alpine-ie11.js 277 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042
  1. (function (factory) {
  2. typeof define === 'function' && define.amd ? define(factory) :
  3. factory();
  4. }((function () { 'use strict';
  5. (function() {
  6. var select = HTMLSelectElement.prototype;
  7. if (select.hasOwnProperty("selectedOptions")) return
  8. Object.defineProperty(select, "selectedOptions", {
  9. get: function() {
  10. return this.querySelectorAll(":checked")
  11. },
  12. enumerable: true,
  13. configurable: true,
  14. });
  15. })();
  16. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17. function createCommonjsModule(fn, module) {
  18. return module = { exports: {} }, fn(module, module.exports), module.exports;
  19. }
  20. (function(){function n(){function v(){return null}function l(a){return a?"object"===typeof a||"function"===typeof a:!1}function p(a){if(null!==a&&!l(a))throw new TypeError("Object prototype may only be an Object or null: "+a);}var q=null,e=Object,w=!!e.create||!({__proto__:null}instanceof e),A=e.create||(w?function(a){p(a);return {__proto__:a}}:function(a){function c(){}p(a);if(null===a)throw new SyntaxError("Native Object.create is required to create objects with null prototype");c.prototype=a;return new c}),
  21. B=e.getPrototypeOf||([].__proto__===Array.prototype?function(a){a=a.__proto__;return l(a)?a:null}:v);var m=function(a,c){function k(){}if(void 0===(this&&this instanceof m?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!l(a)||!l(c))throw new TypeError("Cannot create proxy with a non-object as target or handler");q=function(){a=null;k=function(b){throw new TypeError("Cannot perform '"+b+"' on a proxy that has been revoked");};};setTimeout(function(){q=null;},0);var g=
  22. c;c={get:null,set:null,apply:null,construct:null};for(var h in g){if(!(h in c))throw new TypeError("Proxy polyfill does not support trap '"+h+"'");c[h]=g[h];}"function"===typeof g&&(c.apply=g.apply.bind(g));g=B(a);var r=!1,t=!1;if("function"===typeof a){var f=function(){var b=this&&this.constructor===f,d=Array.prototype.slice.call(arguments);k(b?"construct":"apply");return b&&c.construct?c.construct.call(this,a,d):!b&&c.apply?c.apply(a,this,d):b?(d.unshift(a),new (a.bind.apply(a,d))):a.apply(this,
  23. d)};r=!0;}else a instanceof Array?(f=[],t=!0):f=w||null!==g?A(g):{};var x=c.get?function(b){k("get");return c.get(this,b,f)}:function(b){k("get");return this[b]},C=c.set?function(b,d){k("set");c.set(this,b,d,f);}:function(b,d){k("set");this[b]=d;},y={};e.getOwnPropertyNames(a).forEach(function(b){if(!((r||t)&&b in f)){var d=e.getOwnPropertyDescriptor(a,b);e.defineProperty(f,b,{enumerable:!!d.enumerable,get:x.bind(a,b),set:C.bind(a,b)});y[b]=!0;}});h=!0;if(r||t){var D=e.setPrototypeOf||([].__proto__===
  24. Array.prototype?function(b,d){p(d);b.__proto__=d;return b}:v);g&&D(f,g)||(h=!1);}if(c.get||!h)for(var u in a)y[u]||e.defineProperty(f,u,{get:x.bind(a,u)});e.seal(a);e.seal(f);return f};m.revocable=function(a,c){return {proxy:new m(a,c),revoke:q}};return m}var z="undefined"!==typeof process&&"[object process]"==={}.toString.call(process)||"undefined"!==typeof navigator&&"ReactNative"===navigator.product?commonjsGlobal:self;z.Proxy||(z.Proxy=n(),z.Proxy.revocable=z.Proxy.revocable);})();
  25. !function(e){var t=e.Element.prototype;"function"!=typeof t.matches&&(t.matches=t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),o=0;t[o]&&t[o]!==this;)++o;return Boolean(t[o])}),"function"!=typeof t.closest&&(t.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode;}return null});}(window);
  26. (function (arr) {
  27. arr.forEach(function (item) {
  28. if (item.hasOwnProperty('remove')) {
  29. return;
  30. }
  31. Object.defineProperty(item, 'remove', {
  32. configurable: true,
  33. enumerable: true,
  34. writable: true,
  35. value: function remove() {
  36. this.parentNode && this.parentNode.removeChild(this);
  37. }
  38. });
  39. });
  40. })([Element.prototype, CharacterData.prototype, DocumentType.prototype].filter(Boolean));
  41. /*
  42. * classList.js: Cross-browser full element.classList implementation.
  43. * 1.1.20170427
  44. *
  45. * By Eli Grey, http://eligrey.com
  46. * License: Dedicated to the public domain.
  47. * See https://github.com/eligrey/classList.js/blob/master/LICENSE.md
  48. */
  49. /*global self, document, DOMException */
  50. /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
  51. if ("document" in window.self) {
  52. // Full polyfill for browsers with no classList support
  53. // Including IE < Edge missing SVGElement.classList
  54. if (!("classList" in document.createElement("_"))
  55. || document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg","g"))) {
  56. (function (view) {
  57. if (!('Element' in view)) return;
  58. var
  59. classListProp = "classList"
  60. , protoProp = "prototype"
  61. , elemCtrProto = view.Element[protoProp]
  62. , objCtr = Object
  63. , strTrim = String[protoProp].trim || function () {
  64. return this.replace(/^\s+|\s+$/g, "");
  65. }
  66. , arrIndexOf = Array[protoProp].indexOf || function (item) {
  67. var
  68. i = 0
  69. , len = this.length
  70. ;
  71. for (; i < len; i++) {
  72. if (i in this && this[i] === item) {
  73. return i;
  74. }
  75. }
  76. return -1;
  77. }
  78. // Vendors: please allow content code to instantiate DOMExceptions
  79. , DOMEx = function (type, message) {
  80. this.name = type;
  81. this.code = DOMException[type];
  82. this.message = message;
  83. }
  84. , checkTokenAndGetIndex = function (classList, token) {
  85. if (token === "") {
  86. throw new DOMEx(
  87. "SYNTAX_ERR"
  88. , "An invalid or illegal string was specified"
  89. );
  90. }
  91. if (/\s/.test(token)) {
  92. throw new DOMEx(
  93. "INVALID_CHARACTER_ERR"
  94. , "String contains an invalid character"
  95. );
  96. }
  97. return arrIndexOf.call(classList, token);
  98. }
  99. , ClassList = function (elem) {
  100. var
  101. trimmedClasses = strTrim.call(elem.getAttribute("class") || "")
  102. , classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
  103. , i = 0
  104. , len = classes.length
  105. ;
  106. for (; i < len; i++) {
  107. this.push(classes[i]);
  108. }
  109. this._updateClassName = function () {
  110. elem.setAttribute("class", this.toString());
  111. };
  112. }
  113. , classListProto = ClassList[protoProp] = []
  114. , classListGetter = function () {
  115. return new ClassList(this);
  116. }
  117. ;
  118. // Most DOMException implementations don't allow calling DOMException's toString()
  119. // on non-DOMExceptions. Error's toString() is sufficient here.
  120. DOMEx[protoProp] = Error[protoProp];
  121. classListProto.item = function (i) {
  122. return this[i] || null;
  123. };
  124. classListProto.contains = function (token) {
  125. token += "";
  126. return checkTokenAndGetIndex(this, token) !== -1;
  127. };
  128. classListProto.add = function () {
  129. var
  130. tokens = arguments
  131. , i = 0
  132. , l = tokens.length
  133. , token
  134. , updated = false
  135. ;
  136. do {
  137. token = tokens[i] + "";
  138. if (checkTokenAndGetIndex(this, token) === -1) {
  139. this.push(token);
  140. updated = true;
  141. }
  142. }
  143. while (++i < l);
  144. if (updated) {
  145. this._updateClassName();
  146. }
  147. };
  148. classListProto.remove = function () {
  149. var
  150. tokens = arguments
  151. , i = 0
  152. , l = tokens.length
  153. , token
  154. , updated = false
  155. , index
  156. ;
  157. do {
  158. token = tokens[i] + "";
  159. index = checkTokenAndGetIndex(this, token);
  160. while (index !== -1) {
  161. this.splice(index, 1);
  162. updated = true;
  163. index = checkTokenAndGetIndex(this, token);
  164. }
  165. }
  166. while (++i < l);
  167. if (updated) {
  168. this._updateClassName();
  169. }
  170. };
  171. classListProto.toggle = function (token, force) {
  172. token += "";
  173. var
  174. result = this.contains(token)
  175. , method = result ?
  176. force !== true && "remove"
  177. :
  178. force !== false && "add"
  179. ;
  180. if (method) {
  181. this[method](token);
  182. }
  183. if (force === true || force === false) {
  184. return force;
  185. } else {
  186. return !result;
  187. }
  188. };
  189. classListProto.toString = function () {
  190. return this.join(" ");
  191. };
  192. if (objCtr.defineProperty) {
  193. var classListPropDesc = {
  194. get: classListGetter
  195. , enumerable: true
  196. , configurable: true
  197. };
  198. try {
  199. objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
  200. } catch (ex) { // IE 8 doesn't support enumerable:true
  201. // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36
  202. // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected
  203. if (ex.number === undefined || ex.number === -0x7FF5EC54) {
  204. classListPropDesc.enumerable = false;
  205. objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
  206. }
  207. }
  208. } else if (objCtr[protoProp].__defineGetter__) {
  209. elemCtrProto.__defineGetter__(classListProp, classListGetter);
  210. }
  211. }(window.self));
  212. }
  213. // There is full or partial native classList support, so just check if we need
  214. // to normalize the add/remove and toggle APIs.
  215. (function () {
  216. var testElement = document.createElement("_");
  217. testElement.classList.add("c1", "c2");
  218. // Polyfill for IE 10/11 and Firefox <26, where classList.add and
  219. // classList.remove exist but support only one argument at a time.
  220. if (!testElement.classList.contains("c2")) {
  221. var createMethod = function(method) {
  222. var original = DOMTokenList.prototype[method];
  223. DOMTokenList.prototype[method] = function(token) {
  224. var i, len = arguments.length;
  225. for (i = 0; i < len; i++) {
  226. token = arguments[i];
  227. original.call(this, token);
  228. }
  229. };
  230. };
  231. createMethod('add');
  232. createMethod('remove');
  233. }
  234. testElement.classList.toggle("c3", false);
  235. // Polyfill for IE 10 and Firefox <24, where classList.toggle does not
  236. // support the second argument.
  237. if (testElement.classList.contains("c3")) {
  238. var _toggle = DOMTokenList.prototype.toggle;
  239. DOMTokenList.prototype.toggle = function(token, force) {
  240. if (1 in arguments && !this.contains(token) === !force) {
  241. return force;
  242. } else {
  243. return _toggle.call(this, token);
  244. }
  245. };
  246. }
  247. testElement = null;
  248. }());
  249. }
  250. /**
  251. * @license
  252. * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
  253. * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
  254. * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
  255. * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
  256. * Code distributed by Google as part of the polymer project is also
  257. * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
  258. */
  259. // minimal template polyfill
  260. (function() {
  261. var needsTemplate = (typeof HTMLTemplateElement === 'undefined');
  262. var brokenDocFragment = !(document.createDocumentFragment().cloneNode() instanceof DocumentFragment);
  263. var needsDocFrag = false;
  264. // NOTE: Replace DocumentFragment to work around IE11 bug that
  265. // causes children of a document fragment modified while
  266. // there is a mutation observer to not have a parentNode, or
  267. // have a broken parentNode (!?!)
  268. if (/Trident/.test(navigator.userAgent)) {
  269. (function() {
  270. needsDocFrag = true;
  271. var origCloneNode = Node.prototype.cloneNode;
  272. Node.prototype.cloneNode = function cloneNode(deep) {
  273. var newDom = origCloneNode.call(this, deep);
  274. if (this instanceof DocumentFragment) {
  275. newDom.__proto__ = DocumentFragment.prototype;
  276. }
  277. return newDom;
  278. };
  279. // IE's DocumentFragment querySelector code doesn't work when
  280. // called on an element instance
  281. DocumentFragment.prototype.querySelectorAll = HTMLElement.prototype.querySelectorAll;
  282. DocumentFragment.prototype.querySelector = HTMLElement.prototype.querySelector;
  283. Object.defineProperties(DocumentFragment.prototype, {
  284. 'nodeType': {
  285. get: function () {
  286. return Node.DOCUMENT_FRAGMENT_NODE;
  287. },
  288. configurable: true
  289. },
  290. 'localName': {
  291. get: function () {
  292. return undefined;
  293. },
  294. configurable: true
  295. },
  296. 'nodeName': {
  297. get: function () {
  298. return '#document-fragment';
  299. },
  300. configurable: true
  301. }
  302. });
  303. var origInsertBefore = Node.prototype.insertBefore;
  304. function insertBefore(newNode, refNode) {
  305. if (newNode instanceof DocumentFragment) {
  306. var child;
  307. while ((child = newNode.firstChild)) {
  308. origInsertBefore.call(this, child, refNode);
  309. }
  310. } else {
  311. origInsertBefore.call(this, newNode, refNode);
  312. }
  313. return newNode;
  314. }
  315. Node.prototype.insertBefore = insertBefore;
  316. var origAppendChild = Node.prototype.appendChild;
  317. Node.prototype.appendChild = function appendChild(child) {
  318. if (child instanceof DocumentFragment) {
  319. insertBefore.call(this, child, null);
  320. } else {
  321. origAppendChild.call(this, child);
  322. }
  323. return child;
  324. };
  325. var origRemoveChild = Node.prototype.removeChild;
  326. var origReplaceChild = Node.prototype.replaceChild;
  327. Node.prototype.replaceChild = function replaceChild(newChild, oldChild) {
  328. if (newChild instanceof DocumentFragment) {
  329. insertBefore.call(this, newChild, oldChild);
  330. origRemoveChild.call(this, oldChild);
  331. } else {
  332. origReplaceChild.call(this, newChild, oldChild);
  333. }
  334. return oldChild;
  335. };
  336. Document.prototype.createDocumentFragment = function createDocumentFragment() {
  337. var frag = this.createElement('df');
  338. frag.__proto__ = DocumentFragment.prototype;
  339. return frag;
  340. };
  341. var origImportNode = Document.prototype.importNode;
  342. Document.prototype.importNode = function importNode(impNode, deep) {
  343. deep = deep || false;
  344. var newNode = origImportNode.call(this, impNode, deep);
  345. if (impNode instanceof DocumentFragment) {
  346. newNode.__proto__ = DocumentFragment.prototype;
  347. }
  348. return newNode;
  349. };
  350. })();
  351. }
  352. // NOTE: we rely on this cloneNode not causing element upgrade.
  353. // This means this polyfill must load before the CE polyfill and
  354. // this would need to be re-worked if a browser supports native CE
  355. // but not <template>.
  356. var capturedCloneNode = Node.prototype.cloneNode;
  357. var capturedCreateElement = Document.prototype.createElement;
  358. var capturedImportNode = Document.prototype.importNode;
  359. var capturedRemoveChild = Node.prototype.removeChild;
  360. var capturedAppendChild = Node.prototype.appendChild;
  361. var capturedReplaceChild = Node.prototype.replaceChild;
  362. var capturedParseFromString = DOMParser.prototype.parseFromString;
  363. var capturedHTMLElementInnerHTML = Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'innerHTML') || {
  364. /**
  365. * @this {!HTMLElement}
  366. * @return {string}
  367. */
  368. get: function() {
  369. return this.innerHTML;
  370. },
  371. /**
  372. * @this {!HTMLElement}
  373. * @param {string}
  374. */
  375. set: function(text) {
  376. this.innerHTML = text;
  377. }
  378. };
  379. var capturedChildNodes = Object.getOwnPropertyDescriptor(window.Node.prototype, 'childNodes') || {
  380. /**
  381. * @this {!Node}
  382. * @return {!NodeList}
  383. */
  384. get: function() {
  385. return this.childNodes;
  386. }
  387. };
  388. var elementQuerySelectorAll = Element.prototype.querySelectorAll;
  389. var docQuerySelectorAll = Document.prototype.querySelectorAll;
  390. var fragQuerySelectorAll = DocumentFragment.prototype.querySelectorAll;
  391. var scriptSelector = 'script:not([type]),script[type="application/javascript"],script[type="text/javascript"]';
  392. function QSA(node, selector) {
  393. // IE 11 throws a SyntaxError with `scriptSelector` if the node has no children due to the `:not([type])` syntax
  394. if (!node.childNodes.length) {
  395. return [];
  396. }
  397. switch (node.nodeType) {
  398. case Node.DOCUMENT_NODE:
  399. return docQuerySelectorAll.call(node, selector);
  400. case Node.DOCUMENT_FRAGMENT_NODE:
  401. return fragQuerySelectorAll.call(node, selector);
  402. default:
  403. return elementQuerySelectorAll.call(node, selector);
  404. }
  405. }
  406. // returns true if nested templates cannot be cloned (they cannot be on
  407. // some impl's like Safari 8 and Edge)
  408. // OR if cloning a document fragment does not result in a document fragment
  409. var needsCloning = (function() {
  410. if (!needsTemplate) {
  411. var t = document.createElement('template');
  412. var t2 = document.createElement('template');
  413. t2.content.appendChild(document.createElement('div'));
  414. t.content.appendChild(t2);
  415. var clone = t.cloneNode(true);
  416. return (clone.content.childNodes.length === 0 || clone.content.firstChild.content.childNodes.length === 0
  417. || brokenDocFragment);
  418. }
  419. })();
  420. var TEMPLATE_TAG = 'template';
  421. var PolyfilledHTMLTemplateElement = function() {};
  422. if (needsTemplate) {
  423. var contentDoc = document.implementation.createHTMLDocument('template');
  424. var canDecorate = true;
  425. var templateStyle = document.createElement('style');
  426. templateStyle.textContent = TEMPLATE_TAG + '{display:none;}';
  427. var head = document.head;
  428. head.insertBefore(templateStyle, head.firstElementChild);
  429. /**
  430. Provides a minimal shim for the <template> element.
  431. */
  432. PolyfilledHTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
  433. // if elements do not have `innerHTML` on instances, then
  434. // templates can be patched by swizzling their prototypes.
  435. var canProtoPatch =
  436. !(document.createElement('div').hasOwnProperty('innerHTML'));
  437. /**
  438. The `decorate` method moves element children to the template's `content`.
  439. NOTE: there is no support for dynamically adding elements to templates.
  440. */
  441. PolyfilledHTMLTemplateElement.decorate = function(template) {
  442. // if the template is decorated or not in HTML namespace, return fast
  443. if (template.content ||
  444. template.namespaceURI !== document.documentElement.namespaceURI) {
  445. return;
  446. }
  447. template.content = contentDoc.createDocumentFragment();
  448. var child;
  449. while ((child = template.firstChild)) {
  450. capturedAppendChild.call(template.content, child);
  451. }
  452. // NOTE: prefer prototype patching for performance and
  453. // because on some browsers (IE11), re-defining `innerHTML`
  454. // can result in intermittent errors.
  455. if (canProtoPatch) {
  456. template.__proto__ = PolyfilledHTMLTemplateElement.prototype;
  457. } else {
  458. template.cloneNode = function(deep) {
  459. return PolyfilledHTMLTemplateElement._cloneNode(this, deep);
  460. };
  461. // add innerHTML to template, if possible
  462. // Note: this throws on Safari 7
  463. if (canDecorate) {
  464. try {
  465. defineInnerHTML(template);
  466. defineOuterHTML(template);
  467. } catch (err) {
  468. canDecorate = false;
  469. }
  470. }
  471. }
  472. // bootstrap recursively
  473. PolyfilledHTMLTemplateElement.bootstrap(template.content);
  474. };
  475. // Taken from https://github.com/jquery/jquery/blob/73d7e6259c63ac45f42c6593da8c2796c6ce9281/src/manipulation/wrapMap.js
  476. var topLevelWrappingMap = {
  477. 'option': ['select'],
  478. 'thead': ['table'],
  479. 'col': ['colgroup', 'table'],
  480. 'tr': ['tbody', 'table'],
  481. 'th': ['tr', 'tbody', 'table'],
  482. 'td': ['tr', 'tbody', 'table']
  483. };
  484. var getTagName = function(text) {
  485. // Taken from https://github.com/jquery/jquery/blob/73d7e6259c63ac45f42c6593da8c2796c6ce9281/src/manipulation/var/rtagName.js
  486. return ( /<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
  487. };
  488. var defineInnerHTML = function defineInnerHTML(obj) {
  489. Object.defineProperty(obj, 'innerHTML', {
  490. get: function() {
  491. return getInnerHTML(this);
  492. },
  493. set: function(text) {
  494. // For IE11, wrap the text in the correct (table) context
  495. var wrap = topLevelWrappingMap[getTagName(text)];
  496. if (wrap) {
  497. for (var i = 0; i < wrap.length; i++) {
  498. text = '<' + wrap[i] + '>' + text + '</' + wrap[i] + '>';
  499. }
  500. }
  501. contentDoc.body.innerHTML = text;
  502. PolyfilledHTMLTemplateElement.bootstrap(contentDoc);
  503. while (this.content.firstChild) {
  504. capturedRemoveChild.call(this.content, this.content.firstChild);
  505. }
  506. var body = contentDoc.body;
  507. // If we had wrapped, get back to the original node
  508. if (wrap) {
  509. for (var j = 0; j < wrap.length; j++) {
  510. body = body.lastChild;
  511. }
  512. }
  513. while (body.firstChild) {
  514. capturedAppendChild.call(this.content, body.firstChild);
  515. }
  516. },
  517. configurable: true
  518. });
  519. };
  520. var defineOuterHTML = function defineOuterHTML(obj) {
  521. Object.defineProperty(obj, 'outerHTML', {
  522. get: function() {
  523. return '<' + TEMPLATE_TAG + '>' + this.innerHTML + '</' + TEMPLATE_TAG + '>';
  524. },
  525. set: function(innerHTML) {
  526. if (this.parentNode) {
  527. contentDoc.body.innerHTML = innerHTML;
  528. var docFrag = this.ownerDocument.createDocumentFragment();
  529. while (contentDoc.body.firstChild) {
  530. capturedAppendChild.call(docFrag, contentDoc.body.firstChild);
  531. }
  532. capturedReplaceChild.call(this.parentNode, docFrag, this);
  533. } else {
  534. throw new Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");
  535. }
  536. },
  537. configurable: true
  538. });
  539. };
  540. defineInnerHTML(PolyfilledHTMLTemplateElement.prototype);
  541. defineOuterHTML(PolyfilledHTMLTemplateElement.prototype);
  542. /**
  543. The `bootstrap` method is called automatically and "fixes" all
  544. <template> elements in the document referenced by the `doc` argument.
  545. */
  546. PolyfilledHTMLTemplateElement.bootstrap = function bootstrap(doc) {
  547. var templates = QSA(doc, TEMPLATE_TAG);
  548. for (var i=0, l=templates.length, t; (i<l) && (t=templates[i]); i++) {
  549. PolyfilledHTMLTemplateElement.decorate(t);
  550. }
  551. };
  552. // auto-bootstrapping for main document
  553. document.addEventListener('DOMContentLoaded', function() {
  554. PolyfilledHTMLTemplateElement.bootstrap(document);
  555. });
  556. // Patch document.createElement to ensure newly created templates have content
  557. Document.prototype.createElement = function createElement() {
  558. var el = capturedCreateElement.apply(this, arguments);
  559. if (el.localName === 'template') {
  560. PolyfilledHTMLTemplateElement.decorate(el);
  561. }
  562. return el;
  563. };
  564. DOMParser.prototype.parseFromString = function() {
  565. var el = capturedParseFromString.apply(this, arguments);
  566. PolyfilledHTMLTemplateElement.bootstrap(el);
  567. return el;
  568. };
  569. Object.defineProperty(HTMLElement.prototype, 'innerHTML', {
  570. get: function() {
  571. return getInnerHTML(this);
  572. },
  573. set: function(text) {
  574. capturedHTMLElementInnerHTML.set.call(this, text);
  575. PolyfilledHTMLTemplateElement.bootstrap(this);
  576. },
  577. configurable: true,
  578. enumerable: true
  579. });
  580. // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString
  581. var escapeAttrRegExp = /[&\u00A0"]/g;
  582. var escapeDataRegExp = /[&\u00A0<>]/g;
  583. var escapeReplace = function(c) {
  584. switch (c) {
  585. case '&':
  586. return '&amp;';
  587. case '<':
  588. return '&lt;';
  589. case '>':
  590. return '&gt;';
  591. case '"':
  592. return '&quot;';
  593. case '\u00A0':
  594. return '&nbsp;';
  595. }
  596. };
  597. var escapeAttr = function(s) {
  598. return s.replace(escapeAttrRegExp, escapeReplace);
  599. };
  600. var escapeData = function(s) {
  601. return s.replace(escapeDataRegExp, escapeReplace);
  602. };
  603. var makeSet = function(arr) {
  604. var set = {};
  605. for (var i = 0; i < arr.length; i++) {
  606. set[arr[i]] = true;
  607. }
  608. return set;
  609. };
  610. // http://www.whatwg.org/specs/web-apps/current-work/#void-elements
  611. var voidElements = makeSet([
  612. 'area',
  613. 'base',
  614. 'br',
  615. 'col',
  616. 'command',
  617. 'embed',
  618. 'hr',
  619. 'img',
  620. 'input',
  621. 'keygen',
  622. 'link',
  623. 'meta',
  624. 'param',
  625. 'source',
  626. 'track',
  627. 'wbr'
  628. ]);
  629. var plaintextParents = makeSet([
  630. 'style',
  631. 'script',
  632. 'xmp',
  633. 'iframe',
  634. 'noembed',
  635. 'noframes',
  636. 'plaintext',
  637. 'noscript'
  638. ]);
  639. /**
  640. * @param {Node} node
  641. * @param {Node} parentNode
  642. * @param {Function=} callback
  643. */
  644. var getOuterHTML = function(node, parentNode, callback) {
  645. switch (node.nodeType) {
  646. case Node.ELEMENT_NODE: {
  647. var tagName = node.localName;
  648. var s = '<' + tagName;
  649. var attrs = node.attributes;
  650. for (var i = 0, attr; (attr = attrs[i]); i++) {
  651. s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
  652. }
  653. s += '>';
  654. if (voidElements[tagName]) {
  655. return s;
  656. }
  657. return s + getInnerHTML(node, callback) + '</' + tagName + '>';
  658. }
  659. case Node.TEXT_NODE: {
  660. var data = /** @type {Text} */ (node).data;
  661. if (parentNode && plaintextParents[parentNode.localName]) {
  662. return data;
  663. }
  664. return escapeData(data);
  665. }
  666. case Node.COMMENT_NODE: {
  667. return '<!--' + /** @type {Comment} */ (node).data + '-->';
  668. }
  669. default: {
  670. window.console.error(node);
  671. throw new Error('not implemented');
  672. }
  673. }
  674. };
  675. /**
  676. * @param {Node} node
  677. * @param {Function=} callback
  678. */
  679. var getInnerHTML = function(node, callback) {
  680. if (node.localName === 'template') {
  681. node = /** @type {HTMLTemplateElement} */ (node).content;
  682. }
  683. var s = '';
  684. var c$ = callback ? callback(node) : capturedChildNodes.get.call(node);
  685. for (var i=0, l=c$.length, child; (i<l) && (child=c$[i]); i++) {
  686. s += getOuterHTML(child, node, callback);
  687. }
  688. return s;
  689. };
  690. }
  691. // make cloning/importing work!
  692. if (needsTemplate || needsCloning) {
  693. PolyfilledHTMLTemplateElement._cloneNode = function _cloneNode(template, deep) {
  694. var clone = capturedCloneNode.call(template, false);
  695. // NOTE: decorate doesn't auto-fix children because they are already
  696. // decorated so they need special clone fixup.
  697. if (this.decorate) {
  698. this.decorate(clone);
  699. }
  700. if (deep) {
  701. // NOTE: use native clone node to make sure CE's wrapped
  702. // cloneNode does not cause elements to upgrade.
  703. capturedAppendChild.call(clone.content, capturedCloneNode.call(template.content, true));
  704. // now ensure nested templates are cloned correctly.
  705. fixClonedDom(clone.content, template.content);
  706. }
  707. return clone;
  708. };
  709. // Given a source and cloned subtree, find <template>'s in the cloned
  710. // subtree and replace them with cloned <template>'s from source.
  711. // We must do this because only the source templates have proper .content.
  712. var fixClonedDom = function fixClonedDom(clone, source) {
  713. // do nothing if cloned node is not an element
  714. if (!source.querySelectorAll) return;
  715. // these two lists should be coincident
  716. var s$ = QSA(source, TEMPLATE_TAG);
  717. if (s$.length === 0) {
  718. return;
  719. }
  720. var t$ = QSA(clone, TEMPLATE_TAG);
  721. for (var i=0, l=t$.length, t, s; i<l; i++) {
  722. s = s$[i];
  723. t = t$[i];
  724. if (PolyfilledHTMLTemplateElement && PolyfilledHTMLTemplateElement.decorate) {
  725. PolyfilledHTMLTemplateElement.decorate(s);
  726. }
  727. capturedReplaceChild.call(t.parentNode, cloneNode.call(s, true), t);
  728. }
  729. };
  730. // make sure scripts inside of a cloned template are executable
  731. var fixClonedScripts = function fixClonedScripts(fragment) {
  732. var scripts = QSA(fragment, scriptSelector);
  733. for (var ns, s, i = 0; i < scripts.length; i++) {
  734. s = scripts[i];
  735. ns = capturedCreateElement.call(document, 'script');
  736. ns.textContent = s.textContent;
  737. var attrs = s.attributes;
  738. for (var ai = 0, a; ai < attrs.length; ai++) {
  739. a = attrs[ai];
  740. ns.setAttribute(a.name, a.value);
  741. }
  742. capturedReplaceChild.call(s.parentNode, ns, s);
  743. }
  744. };
  745. // override all cloning to fix the cloned subtree to contain properly
  746. // cloned templates.
  747. var cloneNode = Node.prototype.cloneNode = function cloneNode(deep) {
  748. var dom;
  749. // workaround for Edge bug cloning documentFragments
  750. // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8619646/
  751. if (!needsDocFrag && brokenDocFragment && this instanceof DocumentFragment) {
  752. if (!deep) {
  753. return this.ownerDocument.createDocumentFragment();
  754. } else {
  755. dom = importNode.call(this.ownerDocument, this, true);
  756. }
  757. } else if (this.nodeType === Node.ELEMENT_NODE &&
  758. this.localName === TEMPLATE_TAG &&
  759. this.namespaceURI == document.documentElement.namespaceURI) {
  760. dom = PolyfilledHTMLTemplateElement._cloneNode(this, deep);
  761. } else {
  762. dom = capturedCloneNode.call(this, deep);
  763. }
  764. // template.content is cloned iff `deep`.
  765. if (deep) {
  766. fixClonedDom(dom, this);
  767. }
  768. return dom;
  769. };
  770. // NOTE: we are cloning instead of importing <template>'s.
  771. // However, the ownerDocument of the cloned template will be correct!
  772. // This is because the native import node creates the right document owned
  773. // subtree and `fixClonedDom` inserts cloned templates into this subtree,
  774. // thus updating the owner doc.
  775. var importNode = Document.prototype.importNode = function importNode(element, deep) {
  776. deep = deep || false;
  777. if (element.localName === TEMPLATE_TAG) {
  778. return PolyfilledHTMLTemplateElement._cloneNode(element, deep);
  779. } else {
  780. var dom = capturedImportNode.call(this, element, deep);
  781. if (deep) {
  782. fixClonedDom(dom, element);
  783. fixClonedScripts(dom);
  784. }
  785. return dom;
  786. }
  787. };
  788. }
  789. if (needsTemplate) {
  790. window.HTMLTemplateElement = PolyfilledHTMLTemplateElement;
  791. }
  792. })();
  793. var ApplyThisPrototype = (function() {
  794. return function ApplyThisPrototype(event, target) {
  795. if ((typeof target === 'object') && (target !== null)) {
  796. var proto = Object.getPrototypeOf(target);
  797. var property;
  798. for (property in proto) {
  799. if (!(property in event)) {
  800. var descriptor = Object.getOwnPropertyDescriptor(proto, property);
  801. if (descriptor) {
  802. Object.defineProperty(event, property, descriptor);
  803. }
  804. }
  805. }
  806. for (property in target) {
  807. if (!(property in event)) {
  808. event[property] = target[property];
  809. }
  810. }
  811. }
  812. }
  813. })();
  814. (function(ApplyThisPrototype) {
  815. /**
  816. * Polyfill CustomEvent
  817. */
  818. try {
  819. var event = new window.CustomEvent('event', { bubbles: true, cancelable: true });
  820. } catch (error) {
  821. var CustomEventOriginal = window.CustomEvent || window.Event;
  822. var CustomEvent = function(eventName, params) {
  823. params = params || {};
  824. var event = document.createEvent('CustomEvent');
  825. event.initCustomEvent(
  826. eventName,
  827. (params.bubbles === void 0) ? false : params.bubbles,
  828. (params.cancelable === void 0) ? false : params.cancelable,
  829. (params.detail === void 0) ? {} : params.detail
  830. );
  831. ApplyThisPrototype(event, this);
  832. return event;
  833. };
  834. CustomEvent.prototype = CustomEventOriginal.prototype;
  835. window.CustomEvent = CustomEvent;
  836. }
  837. })(ApplyThisPrototype);
  838. var EventListenerInterceptor = (function() {
  839. if(typeof EventTarget === 'undefined') {
  840. window.EventTarget = Node;
  841. }
  842. /**
  843. * Event listener interceptor
  844. */
  845. var EventListenerInterceptor = {
  846. interceptors: [] // { target: EventTarget, interceptors: [{ add: Function, remove: Function }, ...] }
  847. };
  848. /**
  849. * Returns if exists a previously registered listener from a target and the normalized arguments
  850. * @param target
  851. * @param normalizedArguments
  852. * @return {*}
  853. */
  854. EventListenerInterceptor.getRegisteredEventListener = function(target, normalizedArguments) {
  855. var key = normalizedArguments.type + '-' + (normalizedArguments.options.capture ? '1' : '0');
  856. if(
  857. (target.__eventListeners !== void 0) &&
  858. (target.__eventListeners[key] !== void 0)
  859. ) {
  860. var map = target.__eventListeners[key];
  861. for(var i = 0; i < map.length; i++) {
  862. if(map[i].listener === normalizedArguments.listener) {
  863. return map[i];
  864. }
  865. }
  866. }
  867. return null;
  868. };
  869. /**
  870. * Registers a listener on a target with some options
  871. * @param target
  872. * @param normalizedArguments
  873. */
  874. EventListenerInterceptor.registerEventListener = function(target, normalizedArguments) {
  875. var key = normalizedArguments.type + '-' + (normalizedArguments.options.capture ? '1' : '0');
  876. if(target.__eventListeners === void 0) {
  877. target.__eventListeners = {};
  878. }
  879. if(target.__eventListeners[key] === void 0) {
  880. target.__eventListeners[key] = [];
  881. }
  882. target.__eventListeners[key].push(normalizedArguments);
  883. };
  884. /**
  885. * Unregisters a listener on a target with some options
  886. * @param target
  887. * @param normalizedArguments
  888. */
  889. EventListenerInterceptor.unregisterEventListener = function(target, normalizedArguments) {
  890. var key = normalizedArguments.type + '-' + (normalizedArguments.options.capture ? '1' : '0');
  891. if(
  892. (target.__eventListeners !== void 0) &&
  893. (target.__eventListeners[key] !== void 0)
  894. ) {
  895. var map = target.__eventListeners[key];
  896. for(var i = 0; i < map.length; i++) {
  897. if(map[i].listener === normalizedArguments.listener) {
  898. map.splice(i, 1);
  899. }
  900. }
  901. if(map.length === 0) {
  902. delete target.__eventListeners[key];
  903. }
  904. }
  905. };
  906. EventListenerInterceptor.normalizeListenerCallback = function(listener) {
  907. if((typeof listener === 'function') || (listener === null) || (listener === void 0)) {
  908. return listener;
  909. } else if((typeof listener === 'object') && (typeof listener.handleEvent === 'function')) {
  910. return listener.handleEvent;
  911. } else {
  912. // to support Symbol
  913. return function(event) {
  914. listener(event);
  915. };
  916. }
  917. };
  918. EventListenerInterceptor.normalizeListenerOptions = function(options) {
  919. switch(typeof options) {
  920. case 'boolean':
  921. options = { capture: options };
  922. break;
  923. case 'undefined':
  924. options = { capture: false };
  925. break;
  926. case 'object':
  927. if (options === null) {
  928. options = { capture: false };
  929. }
  930. break;
  931. default:
  932. throw new Error('Unsupported options type for addEventListener');
  933. }
  934. options.once = Boolean(options.once);
  935. options.passive = Boolean(options.passive);
  936. options.capture = Boolean(options.capture);
  937. return options;
  938. };
  939. EventListenerInterceptor.normalizeListenerArguments = function(type, listener, options) {
  940. return {
  941. type: type,
  942. listener: this.normalizeListenerCallback(listener),
  943. options: this.normalizeListenerOptions(options)
  944. };
  945. };
  946. EventListenerInterceptor.intercept = function(target, interceptors) {
  947. // get an interceptor with this target or null
  948. var interceptor = null;
  949. for (var i = 0; i < this.interceptors.length; i++) {
  950. if(this.interceptors[i].target === target) {
  951. interceptor = this.interceptors[i];
  952. }
  953. }
  954. // if no interceptor already set
  955. if (interceptor === null) {
  956. interceptor = { target: target, interceptors: [interceptors] };
  957. this.interceptors.push(interceptor);
  958. this.interceptAddEventListener(target, interceptor);
  959. this.interceptRemoveEventListener(target, interceptor);
  960. } else { // if an interceptor already set, simply add interceptors to the list
  961. interceptor.interceptors.push(interceptors);
  962. }
  963. // var release = function() {
  964. // target.prototype.addEventListener = addEventListener;
  965. // target.prototype.removeEventListener = removeEventListener;
  966. // };
  967. // this.interceptors.push(release);
  968. // return release;
  969. };
  970. EventListenerInterceptor.interceptAddEventListener = function(target, interceptor) {
  971. var _this = this;
  972. var addEventListener = target.prototype.addEventListener;
  973. target.prototype.addEventListener = function(type, listener, options) {
  974. var normalizedArguments = _this.normalizeListenerArguments(type, listener, options);
  975. var registeredEventListener = _this.getRegisteredEventListener(this, normalizedArguments);
  976. if (!registeredEventListener) {
  977. normalizedArguments.polyfilled = {
  978. type: normalizedArguments.type,
  979. listener: normalizedArguments.listener,
  980. options: {
  981. capture: normalizedArguments.options.capture,
  982. once: normalizedArguments.options.once,
  983. passive: normalizedArguments.options.passive
  984. }
  985. };
  986. for (var i = 0; i < interceptor.interceptors.length; i++) {
  987. var interceptors = interceptor.interceptors[i];
  988. if (typeof interceptors.add === 'function') {
  989. interceptors.add(normalizedArguments);
  990. }
  991. }
  992. // console.log('normalizedArguments', normalizedArguments.polyfilled);
  993. _this.registerEventListener(this, normalizedArguments);
  994. addEventListener.call(
  995. this,
  996. normalizedArguments.polyfilled.type,
  997. normalizedArguments.polyfilled.listener,
  998. normalizedArguments.polyfilled.options
  999. );
  1000. }
  1001. };
  1002. return function() {
  1003. target.prototype.addEventListener = addEventListener;
  1004. };
  1005. };
  1006. EventListenerInterceptor.interceptRemoveEventListener = function(target, interceptor) {
  1007. var _this = this;
  1008. var removeEventListener = target.prototype.removeEventListener;
  1009. target.prototype.removeEventListener = function(type, listener, options) {
  1010. var normalizedArguments = _this.normalizeListenerArguments(type, listener, options);
  1011. var registeredEventListener = _this.getRegisteredEventListener(this, normalizedArguments);
  1012. if (registeredEventListener) {
  1013. _this.unregisterEventListener(this, normalizedArguments);
  1014. removeEventListener.call(
  1015. this,
  1016. registeredEventListener.polyfilled.type,
  1017. registeredEventListener.polyfilled.listener,
  1018. registeredEventListener.polyfilled.options
  1019. );
  1020. } else {
  1021. removeEventListener.call(this, type, listener, options);
  1022. }
  1023. };
  1024. return function() {
  1025. target.prototype.removeEventListener = removeEventListener;
  1026. };
  1027. };
  1028. EventListenerInterceptor.interceptAll = function(interceptors) {
  1029. this.intercept(EventTarget, interceptors);
  1030. if(!(window instanceof EventTarget)) {
  1031. this.intercept(Window, interceptors);
  1032. }
  1033. };
  1034. EventListenerInterceptor.releaseAll = function() {
  1035. for(var i = 0, l = this.interceptors.length; i < l; i++) {
  1036. this.interceptors();
  1037. }
  1038. };
  1039. EventListenerInterceptor.error = function(error) {
  1040. // throw error;
  1041. console.error(error);
  1042. };
  1043. return EventListenerInterceptor;
  1044. })();
  1045. (function(EventListenerInterceptor) {
  1046. /**
  1047. * Event listener options support
  1048. */
  1049. EventListenerInterceptor.detectSupportedOptions = function() {
  1050. var _this = this;
  1051. this.supportedOptions = {
  1052. once: false,
  1053. passive: false,
  1054. capture: false,
  1055. all: false,
  1056. some: false
  1057. };
  1058. document.createDocumentFragment().addEventListener('test', function() {}, {
  1059. get once() {
  1060. _this.supportedOptions.once = true;
  1061. return false;
  1062. },
  1063. get passive() {
  1064. _this.supportedOptions.passive = true;
  1065. return false;
  1066. },
  1067. get capture() {
  1068. _this.supportedOptions.capture = true;
  1069. return false;
  1070. }
  1071. });
  1072. // useful shortcuts to detect if options are all/some supported
  1073. this.supportedOptions.all = this.supportedOptions.once && this.supportedOptions.passive && this.supportedOptions.capture;
  1074. this.supportedOptions.some = this.supportedOptions.once || this.supportedOptions.passive || this.supportedOptions.capture;
  1075. };
  1076. EventListenerInterceptor.polyfillListenerOptions = function() {
  1077. this.detectSupportedOptions();
  1078. if (!this.supportedOptions.all) {
  1079. var _this = this;
  1080. this.interceptAll({
  1081. add: function(normalizedArguments) {
  1082. // console.log('intercepted', normalizedArguments);
  1083. var once = normalizedArguments.options.once && !_this.supportedOptions.once;
  1084. var passive = normalizedArguments.options.passive && !_this.supportedOptions.passive;
  1085. if (once || passive) {
  1086. var listener = normalizedArguments.polyfilled.listener;
  1087. normalizedArguments.polyfilled.listener = function(event) {
  1088. if(once) {
  1089. this.removeEventListener(normalizedArguments.type, normalizedArguments.listener, normalizedArguments.options);
  1090. }
  1091. if(passive) {
  1092. event.preventDefault = function() {
  1093. throw new Error('Unable to preventDefault inside passive event listener invocation.');
  1094. };
  1095. }
  1096. return listener.call(this, event);
  1097. };
  1098. }
  1099. if (!_this.supportedOptions.some) {
  1100. normalizedArguments.polyfilled.options = normalizedArguments.options.capture;
  1101. }
  1102. }
  1103. });
  1104. }
  1105. };
  1106. EventListenerInterceptor.polyfillListenerOptions();
  1107. // var onclick = function() {
  1108. // console.log('click');
  1109. // };
  1110. // document.body.addEventListener('click', onclick, false);
  1111. // document.body.addEventListener('click', onclick, { once: true });
  1112. // document.body.addEventListener('click', onclick, { once: true });
  1113. // document.body.addEventListener('click', onclick, false);
  1114. // document.body.addEventListener('click', onclick, false);
  1115. })(EventListenerInterceptor);
  1116. // For the IE11 build.
  1117. SVGElement.prototype.contains = SVGElement.prototype.contains || HTMLElement.prototype.contains // .childElementCount polyfill
  1118. // from https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/childElementCount#Polyfill_for_IE8_IE9_Safari
  1119. ;
  1120. (function (constructor) {
  1121. if (constructor && constructor.prototype && constructor.prototype.childElementCount == null) {
  1122. Object.defineProperty(constructor.prototype, 'childElementCount', {
  1123. get: function get() {
  1124. var i = 0,
  1125. count = 0,
  1126. node,
  1127. nodes = this.childNodes;
  1128. while (node = nodes[i++]) {
  1129. if (node.nodeType === 1) count++;
  1130. }
  1131. return count;
  1132. }
  1133. });
  1134. }
  1135. })(window.Node || window.Element);
  1136. var check = function (it) {
  1137. return it && it.Math == Math && it;
  1138. };
  1139. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  1140. var global_1 =
  1141. // eslint-disable-next-line no-undef
  1142. check(typeof globalThis == 'object' && globalThis) ||
  1143. check(typeof window == 'object' && window) ||
  1144. check(typeof self == 'object' && self) ||
  1145. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  1146. // eslint-disable-next-line no-new-func
  1147. (function () { return this; })() || Function('return this')();
  1148. var fails = function (exec) {
  1149. try {
  1150. return !!exec();
  1151. } catch (error) {
  1152. return true;
  1153. }
  1154. };
  1155. // Detect IE8's incomplete defineProperty implementation
  1156. var descriptors = !fails(function () {
  1157. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  1158. });
  1159. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  1160. var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
  1161. // Nashorn ~ JDK8 bug
  1162. var NASHORN_BUG = getOwnPropertyDescriptor$4 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  1163. // `Object.prototype.propertyIsEnumerable` method implementation
  1164. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  1165. var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  1166. var descriptor = getOwnPropertyDescriptor$4(this, V);
  1167. return !!descriptor && descriptor.enumerable;
  1168. } : nativePropertyIsEnumerable;
  1169. var objectPropertyIsEnumerable = {
  1170. f: f$5
  1171. };
  1172. var createPropertyDescriptor = function (bitmap, value) {
  1173. return {
  1174. enumerable: !(bitmap & 1),
  1175. configurable: !(bitmap & 2),
  1176. writable: !(bitmap & 4),
  1177. value: value
  1178. };
  1179. };
  1180. var toString = {}.toString;
  1181. var classofRaw = function (it) {
  1182. return toString.call(it).slice(8, -1);
  1183. };
  1184. var split = ''.split;
  1185. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  1186. var indexedObject = fails(function () {
  1187. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  1188. // eslint-disable-next-line no-prototype-builtins
  1189. return !Object('z').propertyIsEnumerable(0);
  1190. }) ? function (it) {
  1191. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  1192. } : Object;
  1193. // `RequireObjectCoercible` abstract operation
  1194. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  1195. var requireObjectCoercible = function (it) {
  1196. if (it == undefined) throw TypeError("Can't call method on " + it);
  1197. return it;
  1198. };
  1199. // toObject with fallback for non-array-like ES3 strings
  1200. var toIndexedObject = function (it) {
  1201. return indexedObject(requireObjectCoercible(it));
  1202. };
  1203. var isObject = function (it) {
  1204. return typeof it === 'object' ? it !== null : typeof it === 'function';
  1205. };
  1206. // `ToPrimitive` abstract operation
  1207. // https://tc39.es/ecma262/#sec-toprimitive
  1208. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  1209. // and the second argument - flag - preferred type is a string
  1210. var toPrimitive = function (input, PREFERRED_STRING) {
  1211. if (!isObject(input)) return input;
  1212. var fn, val;
  1213. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  1214. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  1215. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  1216. throw TypeError("Can't convert object to primitive value");
  1217. };
  1218. var hasOwnProperty = {}.hasOwnProperty;
  1219. var has$1 = function (it, key) {
  1220. return hasOwnProperty.call(it, key);
  1221. };
  1222. var document$3 = global_1.document;
  1223. // typeof document.createElement is 'object' in old IE
  1224. var EXISTS = isObject(document$3) && isObject(document$3.createElement);
  1225. var documentCreateElement = function (it) {
  1226. return EXISTS ? document$3.createElement(it) : {};
  1227. };
  1228. // Thank's IE8 for his funny defineProperty
  1229. var ie8DomDefine = !descriptors && !fails(function () {
  1230. return Object.defineProperty(documentCreateElement('div'), 'a', {
  1231. get: function () { return 7; }
  1232. }).a != 7;
  1233. });
  1234. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1235. // `Object.getOwnPropertyDescriptor` method
  1236. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  1237. var f$4 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  1238. O = toIndexedObject(O);
  1239. P = toPrimitive(P, true);
  1240. if (ie8DomDefine) try {
  1241. return nativeGetOwnPropertyDescriptor(O, P);
  1242. } catch (error) { /* empty */ }
  1243. if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  1244. };
  1245. var objectGetOwnPropertyDescriptor = {
  1246. f: f$4
  1247. };
  1248. var anObject = function (it) {
  1249. if (!isObject(it)) {
  1250. throw TypeError(String(it) + ' is not an object');
  1251. } return it;
  1252. };
  1253. var nativeDefineProperty = Object.defineProperty;
  1254. // `Object.defineProperty` method
  1255. // https://tc39.es/ecma262/#sec-object.defineproperty
  1256. var f$3 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  1257. anObject(O);
  1258. P = toPrimitive(P, true);
  1259. anObject(Attributes);
  1260. if (ie8DomDefine) try {
  1261. return nativeDefineProperty(O, P, Attributes);
  1262. } catch (error) { /* empty */ }
  1263. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  1264. if ('value' in Attributes) O[P] = Attributes.value;
  1265. return O;
  1266. };
  1267. var objectDefineProperty = {
  1268. f: f$3
  1269. };
  1270. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  1271. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  1272. } : function (object, key, value) {
  1273. object[key] = value;
  1274. return object;
  1275. };
  1276. var setGlobal = function (key, value) {
  1277. try {
  1278. createNonEnumerableProperty(global_1, key, value);
  1279. } catch (error) {
  1280. global_1[key] = value;
  1281. } return value;
  1282. };
  1283. var SHARED = '__core-js_shared__';
  1284. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  1285. var sharedStore = store$1;
  1286. var functionToString = Function.toString;
  1287. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  1288. if (typeof sharedStore.inspectSource != 'function') {
  1289. sharedStore.inspectSource = function (it) {
  1290. return functionToString.call(it);
  1291. };
  1292. }
  1293. var inspectSource = sharedStore.inspectSource;
  1294. var WeakMap$1 = global_1.WeakMap;
  1295. var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
  1296. var shared = createCommonjsModule(function (module) {
  1297. (module.exports = function (key, value) {
  1298. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  1299. })('versions', []).push({
  1300. version: '3.8.3',
  1301. mode: 'global',
  1302. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  1303. });
  1304. });
  1305. var id = 0;
  1306. var postfix = Math.random();
  1307. var uid = function (key) {
  1308. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  1309. };
  1310. var keys$1 = shared('keys');
  1311. var sharedKey = function (key) {
  1312. return keys$1[key] || (keys$1[key] = uid(key));
  1313. };
  1314. var hiddenKeys$1 = {};
  1315. var WeakMap = global_1.WeakMap;
  1316. var set$2, get, has;
  1317. var enforce = function (it) {
  1318. return has(it) ? get(it) : set$2(it, {});
  1319. };
  1320. var getterFor = function (TYPE) {
  1321. return function (it) {
  1322. var state;
  1323. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  1324. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  1325. } return state;
  1326. };
  1327. };
  1328. if (nativeWeakMap) {
  1329. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  1330. var wmget = store.get;
  1331. var wmhas = store.has;
  1332. var wmset = store.set;
  1333. set$2 = function (it, metadata) {
  1334. metadata.facade = it;
  1335. wmset.call(store, it, metadata);
  1336. return metadata;
  1337. };
  1338. get = function (it) {
  1339. return wmget.call(store, it) || {};
  1340. };
  1341. has = function (it) {
  1342. return wmhas.call(store, it);
  1343. };
  1344. } else {
  1345. var STATE = sharedKey('state');
  1346. hiddenKeys$1[STATE] = true;
  1347. set$2 = function (it, metadata) {
  1348. metadata.facade = it;
  1349. createNonEnumerableProperty(it, STATE, metadata);
  1350. return metadata;
  1351. };
  1352. get = function (it) {
  1353. return has$1(it, STATE) ? it[STATE] : {};
  1354. };
  1355. has = function (it) {
  1356. return has$1(it, STATE);
  1357. };
  1358. }
  1359. var internalState = {
  1360. set: set$2,
  1361. get: get,
  1362. has: has,
  1363. enforce: enforce,
  1364. getterFor: getterFor
  1365. };
  1366. var redefine = createCommonjsModule(function (module) {
  1367. var getInternalState = internalState.get;
  1368. var enforceInternalState = internalState.enforce;
  1369. var TEMPLATE = String(String).split('String');
  1370. (module.exports = function (O, key, value, options) {
  1371. var unsafe = options ? !!options.unsafe : false;
  1372. var simple = options ? !!options.enumerable : false;
  1373. var noTargetGet = options ? !!options.noTargetGet : false;
  1374. var state;
  1375. if (typeof value == 'function') {
  1376. if (typeof key == 'string' && !has$1(value, 'name')) {
  1377. createNonEnumerableProperty(value, 'name', key);
  1378. }
  1379. state = enforceInternalState(value);
  1380. if (!state.source) {
  1381. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  1382. }
  1383. }
  1384. if (O === global_1) {
  1385. if (simple) O[key] = value;
  1386. else setGlobal(key, value);
  1387. return;
  1388. } else if (!unsafe) {
  1389. delete O[key];
  1390. } else if (!noTargetGet && O[key]) {
  1391. simple = true;
  1392. }
  1393. if (simple) O[key] = value;
  1394. else createNonEnumerableProperty(O, key, value);
  1395. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  1396. })(Function.prototype, 'toString', function toString() {
  1397. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  1398. });
  1399. });
  1400. var path = global_1;
  1401. var aFunction$1 = function (variable) {
  1402. return typeof variable == 'function' ? variable : undefined;
  1403. };
  1404. var getBuiltIn = function (namespace, method) {
  1405. return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
  1406. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  1407. };
  1408. var ceil = Math.ceil;
  1409. var floor$1 = Math.floor;
  1410. // `ToInteger` abstract operation
  1411. // https://tc39.es/ecma262/#sec-tointeger
  1412. var toInteger = function (argument) {
  1413. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
  1414. };
  1415. var min$5 = Math.min;
  1416. // `ToLength` abstract operation
  1417. // https://tc39.es/ecma262/#sec-tolength
  1418. var toLength = function (argument) {
  1419. return argument > 0 ? min$5(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  1420. };
  1421. var max$2 = Math.max;
  1422. var min$4 = Math.min;
  1423. // Helper for a popular repeating case of the spec:
  1424. // Let integer be ? ToInteger(index).
  1425. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  1426. var toAbsoluteIndex = function (index, length) {
  1427. var integer = toInteger(index);
  1428. return integer < 0 ? max$2(integer + length, 0) : min$4(integer, length);
  1429. };
  1430. // `Array.prototype.{ indexOf, includes }` methods implementation
  1431. var createMethod$5 = function (IS_INCLUDES) {
  1432. return function ($this, el, fromIndex) {
  1433. var O = toIndexedObject($this);
  1434. var length = toLength(O.length);
  1435. var index = toAbsoluteIndex(fromIndex, length);
  1436. var value;
  1437. // Array#includes uses SameValueZero equality algorithm
  1438. // eslint-disable-next-line no-self-compare
  1439. if (IS_INCLUDES && el != el) while (length > index) {
  1440. value = O[index++];
  1441. // eslint-disable-next-line no-self-compare
  1442. if (value != value) return true;
  1443. // Array#indexOf ignores holes, Array#includes - not
  1444. } else for (;length > index; index++) {
  1445. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  1446. } return !IS_INCLUDES && -1;
  1447. };
  1448. };
  1449. var arrayIncludes = {
  1450. // `Array.prototype.includes` method
  1451. // https://tc39.es/ecma262/#sec-array.prototype.includes
  1452. includes: createMethod$5(true),
  1453. // `Array.prototype.indexOf` method
  1454. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  1455. indexOf: createMethod$5(false)
  1456. };
  1457. var indexOf = arrayIncludes.indexOf;
  1458. var objectKeysInternal = function (object, names) {
  1459. var O = toIndexedObject(object);
  1460. var i = 0;
  1461. var result = [];
  1462. var key;
  1463. for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
  1464. // Don't enum bug & hidden keys
  1465. while (names.length > i) if (has$1(O, key = names[i++])) {
  1466. ~indexOf(result, key) || result.push(key);
  1467. }
  1468. return result;
  1469. };
  1470. // IE8- don't enum bug keys
  1471. var enumBugKeys = [
  1472. 'constructor',
  1473. 'hasOwnProperty',
  1474. 'isPrototypeOf',
  1475. 'propertyIsEnumerable',
  1476. 'toLocaleString',
  1477. 'toString',
  1478. 'valueOf'
  1479. ];
  1480. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  1481. // `Object.getOwnPropertyNames` method
  1482. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  1483. var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  1484. return objectKeysInternal(O, hiddenKeys);
  1485. };
  1486. var objectGetOwnPropertyNames = {
  1487. f: f$2
  1488. };
  1489. var f$1 = Object.getOwnPropertySymbols;
  1490. var objectGetOwnPropertySymbols = {
  1491. f: f$1
  1492. };
  1493. // all object keys, includes non-enumerable and symbols
  1494. var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  1495. var keys = objectGetOwnPropertyNames.f(anObject(it));
  1496. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  1497. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  1498. };
  1499. var copyConstructorProperties = function (target, source) {
  1500. var keys = ownKeys$1(source);
  1501. var defineProperty = objectDefineProperty.f;
  1502. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  1503. for (var i = 0; i < keys.length; i++) {
  1504. var key = keys[i];
  1505. if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  1506. }
  1507. };
  1508. var replacement = /#|\.prototype\./;
  1509. var isForced = function (feature, detection) {
  1510. var value = data[normalize(feature)];
  1511. return value == POLYFILL ? true
  1512. : value == NATIVE ? false
  1513. : typeof detection == 'function' ? fails(detection)
  1514. : !!detection;
  1515. };
  1516. var normalize = isForced.normalize = function (string) {
  1517. return String(string).replace(replacement, '.').toLowerCase();
  1518. };
  1519. var data = isForced.data = {};
  1520. var NATIVE = isForced.NATIVE = 'N';
  1521. var POLYFILL = isForced.POLYFILL = 'P';
  1522. var isForced_1 = isForced;
  1523. var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
  1524. /*
  1525. options.target - name of the target object
  1526. options.global - target is the global object
  1527. options.stat - export as static methods of target
  1528. options.proto - export as prototype methods of target
  1529. options.real - real prototype method for the `pure` version
  1530. options.forced - export even if the native feature is available
  1531. options.bind - bind methods to the target, required for the `pure` version
  1532. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  1533. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  1534. options.sham - add a flag to not completely full polyfills
  1535. options.enumerable - export as enumerable property
  1536. options.noTargetGet - prevent calling a getter on target
  1537. */
  1538. var _export = function (options, source) {
  1539. var TARGET = options.target;
  1540. var GLOBAL = options.global;
  1541. var STATIC = options.stat;
  1542. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1543. if (GLOBAL) {
  1544. target = global_1;
  1545. } else if (STATIC) {
  1546. target = global_1[TARGET] || setGlobal(TARGET, {});
  1547. } else {
  1548. target = (global_1[TARGET] || {}).prototype;
  1549. }
  1550. if (target) for (key in source) {
  1551. sourceProperty = source[key];
  1552. if (options.noTargetGet) {
  1553. descriptor = getOwnPropertyDescriptor$3(target, key);
  1554. targetProperty = descriptor && descriptor.value;
  1555. } else targetProperty = target[key];
  1556. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  1557. // contained in target
  1558. if (!FORCED && targetProperty !== undefined) {
  1559. if (typeof sourceProperty === typeof targetProperty) continue;
  1560. copyConstructorProperties(sourceProperty, targetProperty);
  1561. }
  1562. // add a flag to not completely full polyfills
  1563. if (options.sham || (targetProperty && targetProperty.sham)) {
  1564. createNonEnumerableProperty(sourceProperty, 'sham', true);
  1565. }
  1566. // extend global
  1567. redefine(target, key, sourceProperty, options);
  1568. }
  1569. };
  1570. var aFunction = function (it) {
  1571. if (typeof it != 'function') {
  1572. throw TypeError(String(it) + ' is not a function');
  1573. } return it;
  1574. };
  1575. // optional / simple context binding
  1576. var functionBindContext = function (fn, that, length) {
  1577. aFunction(fn);
  1578. if (that === undefined) return fn;
  1579. switch (length) {
  1580. case 0: return function () {
  1581. return fn.call(that);
  1582. };
  1583. case 1: return function (a) {
  1584. return fn.call(that, a);
  1585. };
  1586. case 2: return function (a, b) {
  1587. return fn.call(that, a, b);
  1588. };
  1589. case 3: return function (a, b, c) {
  1590. return fn.call(that, a, b, c);
  1591. };
  1592. }
  1593. return function (/* ...args */) {
  1594. return fn.apply(that, arguments);
  1595. };
  1596. };
  1597. // `ToObject` abstract operation
  1598. // https://tc39.es/ecma262/#sec-toobject
  1599. var toObject = function (argument) {
  1600. return Object(requireObjectCoercible(argument));
  1601. };
  1602. // `IsArray` abstract operation
  1603. // https://tc39.es/ecma262/#sec-isarray
  1604. var isArray = Array.isArray || function isArray(arg) {
  1605. return classofRaw(arg) == 'Array';
  1606. };
  1607. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  1608. // Chrome 38 Symbol has incorrect toString conversion
  1609. // eslint-disable-next-line no-undef
  1610. return !String(Symbol());
  1611. });
  1612. var useSymbolAsUid = nativeSymbol
  1613. // eslint-disable-next-line no-undef
  1614. && !Symbol.sham
  1615. // eslint-disable-next-line no-undef
  1616. && typeof Symbol.iterator == 'symbol';
  1617. var WellKnownSymbolsStore = shared('wks');
  1618. var Symbol$1 = global_1.Symbol;
  1619. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
  1620. var wellKnownSymbol = function (name) {
  1621. if (!has$1(WellKnownSymbolsStore, name)) {
  1622. if (nativeSymbol && has$1(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
  1623. else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  1624. } return WellKnownSymbolsStore[name];
  1625. };
  1626. var SPECIES$5 = wellKnownSymbol('species');
  1627. // `ArraySpeciesCreate` abstract operation
  1628. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  1629. var arraySpeciesCreate = function (originalArray, length) {
  1630. var C;
  1631. if (isArray(originalArray)) {
  1632. C = originalArray.constructor;
  1633. // cross-realm fallback
  1634. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  1635. else if (isObject(C)) {
  1636. C = C[SPECIES$5];
  1637. if (C === null) C = undefined;
  1638. }
  1639. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  1640. };
  1641. var push = [].push;
  1642. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
  1643. var createMethod$4 = function (TYPE) {
  1644. var IS_MAP = TYPE == 1;
  1645. var IS_FILTER = TYPE == 2;
  1646. var IS_SOME = TYPE == 3;
  1647. var IS_EVERY = TYPE == 4;
  1648. var IS_FIND_INDEX = TYPE == 6;
  1649. var IS_FILTER_OUT = TYPE == 7;
  1650. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  1651. return function ($this, callbackfn, that, specificCreate) {
  1652. var O = toObject($this);
  1653. var self = indexedObject(O);
  1654. var boundFunction = functionBindContext(callbackfn, that, 3);
  1655. var length = toLength(self.length);
  1656. var index = 0;
  1657. var create = specificCreate || arraySpeciesCreate;
  1658. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
  1659. var value, result;
  1660. for (;length > index; index++) if (NO_HOLES || index in self) {
  1661. value = self[index];
  1662. result = boundFunction(value, index, O);
  1663. if (TYPE) {
  1664. if (IS_MAP) target[index] = result; // map
  1665. else if (result) switch (TYPE) {
  1666. case 3: return true; // some
  1667. case 5: return value; // find
  1668. case 6: return index; // findIndex
  1669. case 2: push.call(target, value); // filter
  1670. } else switch (TYPE) {
  1671. case 4: return false; // every
  1672. case 7: push.call(target, value); // filterOut
  1673. }
  1674. }
  1675. }
  1676. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  1677. };
  1678. };
  1679. var arrayIteration = {
  1680. // `Array.prototype.forEach` method
  1681. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1682. forEach: createMethod$4(0),
  1683. // `Array.prototype.map` method
  1684. // https://tc39.es/ecma262/#sec-array.prototype.map
  1685. map: createMethod$4(1),
  1686. // `Array.prototype.filter` method
  1687. // https://tc39.es/ecma262/#sec-array.prototype.filter
  1688. filter: createMethod$4(2),
  1689. // `Array.prototype.some` method
  1690. // https://tc39.es/ecma262/#sec-array.prototype.some
  1691. some: createMethod$4(3),
  1692. // `Array.prototype.every` method
  1693. // https://tc39.es/ecma262/#sec-array.prototype.every
  1694. every: createMethod$4(4),
  1695. // `Array.prototype.find` method
  1696. // https://tc39.es/ecma262/#sec-array.prototype.find
  1697. find: createMethod$4(5),
  1698. // `Array.prototype.findIndex` method
  1699. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  1700. findIndex: createMethod$4(6),
  1701. // `Array.prototype.filterOut` method
  1702. // https://github.com/tc39/proposal-array-filtering
  1703. filterOut: createMethod$4(7)
  1704. };
  1705. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  1706. var process$4 = global_1.process;
  1707. var versions = process$4 && process$4.versions;
  1708. var v8 = versions && versions.v8;
  1709. var match, version;
  1710. if (v8) {
  1711. match = v8.split('.');
  1712. version = match[0] + match[1];
  1713. } else if (engineUserAgent) {
  1714. match = engineUserAgent.match(/Edge\/(\d+)/);
  1715. if (!match || match[1] >= 74) {
  1716. match = engineUserAgent.match(/Chrome\/(\d+)/);
  1717. if (match) version = match[1];
  1718. }
  1719. }
  1720. var engineV8Version = version && +version;
  1721. var SPECIES$4 = wellKnownSymbol('species');
  1722. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  1723. // We can't use this feature detection in V8 since it causes
  1724. // deoptimization and serious performance degradation
  1725. // https://github.com/zloirock/core-js/issues/677
  1726. return engineV8Version >= 51 || !fails(function () {
  1727. var array = [];
  1728. var constructor = array.constructor = {};
  1729. constructor[SPECIES$4] = function () {
  1730. return { foo: 1 };
  1731. };
  1732. return array[METHOD_NAME](Boolean).foo !== 1;
  1733. });
  1734. };
  1735. var defineProperty$5 = Object.defineProperty;
  1736. var cache = {};
  1737. var thrower = function (it) { throw it; };
  1738. var arrayMethodUsesToLength = function (METHOD_NAME, options) {
  1739. if (has$1(cache, METHOD_NAME)) return cache[METHOD_NAME];
  1740. if (!options) options = {};
  1741. var method = [][METHOD_NAME];
  1742. var ACCESSORS = has$1(options, 'ACCESSORS') ? options.ACCESSORS : false;
  1743. var argument0 = has$1(options, 0) ? options[0] : thrower;
  1744. var argument1 = has$1(options, 1) ? options[1] : undefined;
  1745. return cache[METHOD_NAME] = !!method && !fails(function () {
  1746. if (ACCESSORS && !descriptors) return true;
  1747. var O = { length: -1 };
  1748. if (ACCESSORS) defineProperty$5(O, 1, { enumerable: true, get: thrower });
  1749. else O[1] = 1;
  1750. method.call(O, argument0, argument1);
  1751. });
  1752. };
  1753. var $filter = arrayIteration.filter;
  1754. var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('filter');
  1755. // Edge 14- issue
  1756. var USES_TO_LENGTH$8 = arrayMethodUsesToLength('filter');
  1757. // `Array.prototype.filter` method
  1758. // https://tc39.es/ecma262/#sec-array.prototype.filter
  1759. // with adding support of @@species
  1760. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$8 }, {
  1761. filter: function filter(callbackfn /* , thisArg */) {
  1762. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1763. }
  1764. });
  1765. var arrayMethodIsStrict = function (METHOD_NAME, argument) {
  1766. var method = [][METHOD_NAME];
  1767. return !!method && fails(function () {
  1768. // eslint-disable-next-line no-useless-call,no-throw-literal
  1769. method.call(null, argument || function () { throw 1; }, 1);
  1770. });
  1771. };
  1772. var $forEach = arrayIteration.forEach;
  1773. var STRICT_METHOD$4 = arrayMethodIsStrict('forEach');
  1774. var USES_TO_LENGTH$7 = arrayMethodUsesToLength('forEach');
  1775. // `Array.prototype.forEach` method implementation
  1776. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1777. var arrayForEach = (!STRICT_METHOD$4 || !USES_TO_LENGTH$7) ? function forEach(callbackfn /* , thisArg */) {
  1778. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1779. } : [].forEach;
  1780. // `Array.prototype.forEach` method
  1781. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1782. _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {
  1783. forEach: arrayForEach
  1784. });
  1785. var iteratorClose = function (iterator) {
  1786. var returnMethod = iterator['return'];
  1787. if (returnMethod !== undefined) {
  1788. return anObject(returnMethod.call(iterator)).value;
  1789. }
  1790. };
  1791. // call something on iterator step with safe closing on error
  1792. var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
  1793. try {
  1794. return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  1795. // 7.4.6 IteratorClose(iterator, completion)
  1796. } catch (error) {
  1797. iteratorClose(iterator);
  1798. throw error;
  1799. }
  1800. };
  1801. var iterators = {};
  1802. var ITERATOR$5 = wellKnownSymbol('iterator');
  1803. var ArrayPrototype$1 = Array.prototype;
  1804. // check on default Array iterator
  1805. var isArrayIteratorMethod = function (it) {
  1806. return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$5] === it);
  1807. };
  1808. var createProperty = function (object, key, value) {
  1809. var propertyKey = toPrimitive(key);
  1810. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  1811. else object[propertyKey] = value;
  1812. };
  1813. var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
  1814. var test = {};
  1815. test[TO_STRING_TAG$3] = 'z';
  1816. var toStringTagSupport = String(test) === '[object z]';
  1817. var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
  1818. // ES3 wrong here
  1819. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1820. // fallback for IE11 Script Access Denied error
  1821. var tryGet = function (it, key) {
  1822. try {
  1823. return it[key];
  1824. } catch (error) { /* empty */ }
  1825. };
  1826. // getting tag from ES6+ `Object.prototype.toString`
  1827. var classof = toStringTagSupport ? classofRaw : function (it) {
  1828. var O, tag, result;
  1829. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1830. // @@toStringTag case
  1831. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
  1832. // builtinTag case
  1833. : CORRECT_ARGUMENTS ? classofRaw(O)
  1834. // ES3 arguments fallback
  1835. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  1836. };
  1837. var ITERATOR$4 = wellKnownSymbol('iterator');
  1838. var getIteratorMethod = function (it) {
  1839. if (it != undefined) return it[ITERATOR$4]
  1840. || it['@@iterator']
  1841. || iterators[classof(it)];
  1842. };
  1843. // `Array.from` method implementation
  1844. // https://tc39.es/ecma262/#sec-array.from
  1845. var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  1846. var O = toObject(arrayLike);
  1847. var C = typeof this == 'function' ? this : Array;
  1848. var argumentsLength = arguments.length;
  1849. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  1850. var mapping = mapfn !== undefined;
  1851. var iteratorMethod = getIteratorMethod(O);
  1852. var index = 0;
  1853. var length, result, step, iterator, next, value;
  1854. if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
  1855. // if the target is not iterable or it's an array with the default iterator - use a simple case
  1856. if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
  1857. iterator = iteratorMethod.call(O);
  1858. next = iterator.next;
  1859. result = new C();
  1860. for (;!(step = next.call(iterator)).done; index++) {
  1861. value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
  1862. createProperty(result, index, value);
  1863. }
  1864. } else {
  1865. length = toLength(O.length);
  1866. result = new C(length);
  1867. for (;length > index; index++) {
  1868. value = mapping ? mapfn(O[index], index) : O[index];
  1869. createProperty(result, index, value);
  1870. }
  1871. }
  1872. result.length = index;
  1873. return result;
  1874. };
  1875. var ITERATOR$3 = wellKnownSymbol('iterator');
  1876. var SAFE_CLOSING = false;
  1877. try {
  1878. var called = 0;
  1879. var iteratorWithReturn = {
  1880. next: function () {
  1881. return { done: !!called++ };
  1882. },
  1883. 'return': function () {
  1884. SAFE_CLOSING = true;
  1885. }
  1886. };
  1887. iteratorWithReturn[ITERATOR$3] = function () {
  1888. return this;
  1889. };
  1890. // eslint-disable-next-line no-throw-literal
  1891. Array.from(iteratorWithReturn, function () { throw 2; });
  1892. } catch (error) { /* empty */ }
  1893. var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
  1894. if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
  1895. var ITERATION_SUPPORT = false;
  1896. try {
  1897. var object = {};
  1898. object[ITERATOR$3] = function () {
  1899. return {
  1900. next: function () {
  1901. return { done: ITERATION_SUPPORT = true };
  1902. }
  1903. };
  1904. };
  1905. exec(object);
  1906. } catch (error) { /* empty */ }
  1907. return ITERATION_SUPPORT;
  1908. };
  1909. var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration(function (iterable) {
  1910. Array.from(iterable);
  1911. });
  1912. // `Array.from` method
  1913. // https://tc39.es/ecma262/#sec-array.from
  1914. _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION$1 }, {
  1915. from: arrayFrom
  1916. });
  1917. // `String.prototype.{ codePointAt, at }` methods implementation
  1918. var createMethod$3 = function (CONVERT_TO_STRING) {
  1919. return function ($this, pos) {
  1920. var S = String(requireObjectCoercible($this));
  1921. var position = toInteger(pos);
  1922. var size = S.length;
  1923. var first, second;
  1924. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1925. first = S.charCodeAt(position);
  1926. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1927. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  1928. ? CONVERT_TO_STRING ? S.charAt(position) : first
  1929. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1930. };
  1931. };
  1932. var stringMultibyte = {
  1933. // `String.prototype.codePointAt` method
  1934. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  1935. codeAt: createMethod$3(false),
  1936. // `String.prototype.at` method
  1937. // https://github.com/mathiasbynens/String.prototype.at
  1938. charAt: createMethod$3(true)
  1939. };
  1940. var correctPrototypeGetter = !fails(function () {
  1941. function F() { /* empty */ }
  1942. F.prototype.constructor = null;
  1943. return Object.getPrototypeOf(new F()) !== F.prototype;
  1944. });
  1945. var IE_PROTO$1 = sharedKey('IE_PROTO');
  1946. var ObjectPrototype = Object.prototype;
  1947. // `Object.getPrototypeOf` method
  1948. // https://tc39.es/ecma262/#sec-object.getprototypeof
  1949. var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
  1950. O = toObject(O);
  1951. if (has$1(O, IE_PROTO$1)) return O[IE_PROTO$1];
  1952. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  1953. return O.constructor.prototype;
  1954. } return O instanceof Object ? ObjectPrototype : null;
  1955. };
  1956. var ITERATOR$2 = wellKnownSymbol('iterator');
  1957. var BUGGY_SAFARI_ITERATORS$1 = false;
  1958. var returnThis$2 = function () { return this; };
  1959. // `%IteratorPrototype%` object
  1960. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  1961. var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
  1962. if ([].keys) {
  1963. arrayIterator = [].keys();
  1964. // Safari 8 has buggy iterators w/o `next`
  1965. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
  1966. else {
  1967. PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
  1968. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
  1969. }
  1970. }
  1971. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
  1972. var test = {};
  1973. // FF44- legacy iterators case
  1974. return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
  1975. });
  1976. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
  1977. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  1978. if (!has$1(IteratorPrototype$2, ITERATOR$2)) {
  1979. createNonEnumerableProperty(IteratorPrototype$2, ITERATOR$2, returnThis$2);
  1980. }
  1981. var iteratorsCore = {
  1982. IteratorPrototype: IteratorPrototype$2,
  1983. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
  1984. };
  1985. // `Object.keys` method
  1986. // https://tc39.es/ecma262/#sec-object.keys
  1987. var objectKeys = Object.keys || function keys(O) {
  1988. return objectKeysInternal(O, enumBugKeys);
  1989. };
  1990. // `Object.defineProperties` method
  1991. // https://tc39.es/ecma262/#sec-object.defineproperties
  1992. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  1993. anObject(O);
  1994. var keys = objectKeys(Properties);
  1995. var length = keys.length;
  1996. var index = 0;
  1997. var key;
  1998. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  1999. return O;
  2000. };
  2001. var html = getBuiltIn('document', 'documentElement');
  2002. var GT = '>';
  2003. var LT = '<';
  2004. var PROTOTYPE = 'prototype';
  2005. var SCRIPT = 'script';
  2006. var IE_PROTO = sharedKey('IE_PROTO');
  2007. var EmptyConstructor = function () { /* empty */ };
  2008. var scriptTag = function (content) {
  2009. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  2010. };
  2011. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  2012. var NullProtoObjectViaActiveX = function (activeXDocument) {
  2013. activeXDocument.write(scriptTag(''));
  2014. activeXDocument.close();
  2015. var temp = activeXDocument.parentWindow.Object;
  2016. activeXDocument = null; // avoid memory leak
  2017. return temp;
  2018. };
  2019. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  2020. var NullProtoObjectViaIFrame = function () {
  2021. // Thrash, waste and sodomy: IE GC bug
  2022. var iframe = documentCreateElement('iframe');
  2023. var JS = 'java' + SCRIPT + ':';
  2024. var iframeDocument;
  2025. iframe.style.display = 'none';
  2026. html.appendChild(iframe);
  2027. // https://github.com/zloirock/core-js/issues/475
  2028. iframe.src = String(JS);
  2029. iframeDocument = iframe.contentWindow.document;
  2030. iframeDocument.open();
  2031. iframeDocument.write(scriptTag('document.F=Object'));
  2032. iframeDocument.close();
  2033. return iframeDocument.F;
  2034. };
  2035. // Check for document.domain and active x support
  2036. // No need to use active x approach when document.domain is not set
  2037. // see https://github.com/es-shims/es5-shim/issues/150
  2038. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  2039. // avoid IE GC bug
  2040. var activeXDocument;
  2041. var NullProtoObject = function () {
  2042. try {
  2043. /* global ActiveXObject */
  2044. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  2045. } catch (error) { /* ignore */ }
  2046. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  2047. var length = enumBugKeys.length;
  2048. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  2049. return NullProtoObject();
  2050. };
  2051. hiddenKeys$1[IE_PROTO] = true;
  2052. // `Object.create` method
  2053. // https://tc39.es/ecma262/#sec-object.create
  2054. var objectCreate = Object.create || function create(O, Properties) {
  2055. var result;
  2056. if (O !== null) {
  2057. EmptyConstructor[PROTOTYPE] = anObject(O);
  2058. result = new EmptyConstructor();
  2059. EmptyConstructor[PROTOTYPE] = null;
  2060. // add "__proto__" for Object.getPrototypeOf polyfill
  2061. result[IE_PROTO] = O;
  2062. } else result = NullProtoObject();
  2063. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  2064. };
  2065. var defineProperty$4 = objectDefineProperty.f;
  2066. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  2067. var setToStringTag = function (it, TAG, STATIC) {
  2068. if (it && !has$1(it = STATIC ? it : it.prototype, TO_STRING_TAG$1)) {
  2069. defineProperty$4(it, TO_STRING_TAG$1, { configurable: true, value: TAG });
  2070. }
  2071. };
  2072. var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
  2073. var returnThis$1 = function () { return this; };
  2074. var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
  2075. var TO_STRING_TAG = NAME + ' Iterator';
  2076. IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
  2077. setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
  2078. iterators[TO_STRING_TAG] = returnThis$1;
  2079. return IteratorConstructor;
  2080. };
  2081. var aPossiblePrototype = function (it) {
  2082. if (!isObject(it) && it !== null) {
  2083. throw TypeError("Can't set " + String(it) + ' as a prototype');
  2084. } return it;
  2085. };
  2086. // `Object.setPrototypeOf` method
  2087. // https://tc39.es/ecma262/#sec-object.setprototypeof
  2088. // Works with __proto__ only. Old v8 can't work with null proto objects.
  2089. /* eslint-disable no-proto */
  2090. var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  2091. var CORRECT_SETTER = false;
  2092. var test = {};
  2093. var setter;
  2094. try {
  2095. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  2096. setter.call(test, []);
  2097. CORRECT_SETTER = test instanceof Array;
  2098. } catch (error) { /* empty */ }
  2099. return function setPrototypeOf(O, proto) {
  2100. anObject(O);
  2101. aPossiblePrototype(proto);
  2102. if (CORRECT_SETTER) setter.call(O, proto);
  2103. else O.__proto__ = proto;
  2104. return O;
  2105. };
  2106. }() : undefined);
  2107. var IteratorPrototype = iteratorsCore.IteratorPrototype;
  2108. var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
  2109. var ITERATOR$1 = wellKnownSymbol('iterator');
  2110. var KEYS = 'keys';
  2111. var VALUES = 'values';
  2112. var ENTRIES = 'entries';
  2113. var returnThis = function () { return this; };
  2114. var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  2115. createIteratorConstructor(IteratorConstructor, NAME, next);
  2116. var getIterationMethod = function (KIND) {
  2117. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  2118. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  2119. switch (KIND) {
  2120. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  2121. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  2122. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  2123. } return function () { return new IteratorConstructor(this); };
  2124. };
  2125. var TO_STRING_TAG = NAME + ' Iterator';
  2126. var INCORRECT_VALUES_NAME = false;
  2127. var IterablePrototype = Iterable.prototype;
  2128. var nativeIterator = IterablePrototype[ITERATOR$1]
  2129. || IterablePrototype['@@iterator']
  2130. || DEFAULT && IterablePrototype[DEFAULT];
  2131. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  2132. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  2133. var CurrentIteratorPrototype, methods, KEY;
  2134. // fix native
  2135. if (anyNativeIterator) {
  2136. CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
  2137. if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  2138. if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  2139. if (objectSetPrototypeOf) {
  2140. objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  2141. } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
  2142. createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis);
  2143. }
  2144. }
  2145. // Set @@toStringTag to native iterators
  2146. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
  2147. }
  2148. }
  2149. // fix Array#{values, @@iterator}.name in V8 / FF
  2150. if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  2151. INCORRECT_VALUES_NAME = true;
  2152. defaultIterator = function values() { return nativeIterator.call(this); };
  2153. }
  2154. // define iterator
  2155. if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
  2156. createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
  2157. }
  2158. iterators[NAME] = defaultIterator;
  2159. // export additional methods
  2160. if (DEFAULT) {
  2161. methods = {
  2162. values: getIterationMethod(VALUES),
  2163. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  2164. entries: getIterationMethod(ENTRIES)
  2165. };
  2166. if (FORCED) for (KEY in methods) {
  2167. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  2168. redefine(IterablePrototype, KEY, methods[KEY]);
  2169. }
  2170. } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  2171. }
  2172. return methods;
  2173. };
  2174. var charAt$1 = stringMultibyte.charAt;
  2175. var STRING_ITERATOR = 'String Iterator';
  2176. var setInternalState$3 = internalState.set;
  2177. var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
  2178. // `String.prototype[@@iterator]` method
  2179. // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
  2180. defineIterator(String, 'String', function (iterated) {
  2181. setInternalState$3(this, {
  2182. type: STRING_ITERATOR,
  2183. string: String(iterated),
  2184. index: 0
  2185. });
  2186. // `%StringIteratorPrototype%.next` method
  2187. // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
  2188. }, function next() {
  2189. var state = getInternalState$2(this);
  2190. var string = state.string;
  2191. var index = state.index;
  2192. var point;
  2193. if (index >= string.length) return { value: undefined, done: true };
  2194. point = charAt$1(string, index);
  2195. state.index += point.length;
  2196. return { value: point, done: false };
  2197. });
  2198. // iterable DOM collections
  2199. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  2200. var domIterables = {
  2201. CSSRuleList: 0,
  2202. CSSStyleDeclaration: 0,
  2203. CSSValueList: 0,
  2204. ClientRectList: 0,
  2205. DOMRectList: 0,
  2206. DOMStringList: 0,
  2207. DOMTokenList: 1,
  2208. DataTransferItemList: 0,
  2209. FileList: 0,
  2210. HTMLAllCollection: 0,
  2211. HTMLCollection: 0,
  2212. HTMLFormElement: 0,
  2213. HTMLSelectElement: 0,
  2214. MediaList: 0,
  2215. MimeTypeArray: 0,
  2216. NamedNodeMap: 0,
  2217. NodeList: 1,
  2218. PaintRequestList: 0,
  2219. Plugin: 0,
  2220. PluginArray: 0,
  2221. SVGLengthList: 0,
  2222. SVGNumberList: 0,
  2223. SVGPathSegList: 0,
  2224. SVGPointList: 0,
  2225. SVGStringList: 0,
  2226. SVGTransformList: 0,
  2227. SourceBufferList: 0,
  2228. StyleSheetList: 0,
  2229. TextTrackCueList: 0,
  2230. TextTrackList: 0,
  2231. TouchList: 0
  2232. };
  2233. for (var COLLECTION_NAME$1 in domIterables) {
  2234. var Collection$1 = global_1[COLLECTION_NAME$1];
  2235. var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
  2236. // some Chrome versions have non-configurable methods on DOMTokenList
  2237. if (CollectionPrototype$1 && CollectionPrototype$1.forEach !== arrayForEach) try {
  2238. createNonEnumerableProperty(CollectionPrototype$1, 'forEach', arrayForEach);
  2239. } catch (error) {
  2240. CollectionPrototype$1.forEach = arrayForEach;
  2241. }
  2242. }
  2243. function _typeof(obj) {
  2244. "@babel/helpers - typeof";
  2245. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  2246. _typeof = function (obj) {
  2247. return typeof obj;
  2248. };
  2249. } else {
  2250. _typeof = function (obj) {
  2251. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  2252. };
  2253. }
  2254. return _typeof(obj);
  2255. }
  2256. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  2257. try {
  2258. var info = gen[key](arg);
  2259. var value = info.value;
  2260. } catch (error) {
  2261. reject(error);
  2262. return;
  2263. }
  2264. if (info.done) {
  2265. resolve(value);
  2266. } else {
  2267. Promise.resolve(value).then(_next, _throw);
  2268. }
  2269. }
  2270. function _asyncToGenerator(fn) {
  2271. return function () {
  2272. var self = this,
  2273. args = arguments;
  2274. return new Promise(function (resolve, reject) {
  2275. var gen = fn.apply(self, args);
  2276. function _next(value) {
  2277. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  2278. }
  2279. function _throw(err) {
  2280. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  2281. }
  2282. _next(undefined);
  2283. });
  2284. };
  2285. }
  2286. function _classCallCheck(instance, Constructor) {
  2287. if (!(instance instanceof Constructor)) {
  2288. throw new TypeError("Cannot call a class as a function");
  2289. }
  2290. }
  2291. function _defineProperties(target, props) {
  2292. for (var i = 0; i < props.length; i++) {
  2293. var descriptor = props[i];
  2294. descriptor.enumerable = descriptor.enumerable || false;
  2295. descriptor.configurable = true;
  2296. if ("value" in descriptor) descriptor.writable = true;
  2297. Object.defineProperty(target, descriptor.key, descriptor);
  2298. }
  2299. }
  2300. function _createClass(Constructor, protoProps, staticProps) {
  2301. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2302. if (staticProps) _defineProperties(Constructor, staticProps);
  2303. return Constructor;
  2304. }
  2305. function _defineProperty(obj, key, value) {
  2306. if (key in obj) {
  2307. Object.defineProperty(obj, key, {
  2308. value: value,
  2309. enumerable: true,
  2310. configurable: true,
  2311. writable: true
  2312. });
  2313. } else {
  2314. obj[key] = value;
  2315. }
  2316. return obj;
  2317. }
  2318. function ownKeys(object, enumerableOnly) {
  2319. var keys = Object.keys(object);
  2320. if (Object.getOwnPropertySymbols) {
  2321. var symbols = Object.getOwnPropertySymbols(object);
  2322. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2323. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2324. });
  2325. keys.push.apply(keys, symbols);
  2326. }
  2327. return keys;
  2328. }
  2329. function _objectSpread2(target) {
  2330. for (var i = 1; i < arguments.length; i++) {
  2331. var source = arguments[i] != null ? arguments[i] : {};
  2332. if (i % 2) {
  2333. ownKeys(Object(source), true).forEach(function (key) {
  2334. _defineProperty(target, key, source[key]);
  2335. });
  2336. } else if (Object.getOwnPropertyDescriptors) {
  2337. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2338. } else {
  2339. ownKeys(Object(source)).forEach(function (key) {
  2340. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2341. });
  2342. }
  2343. }
  2344. return target;
  2345. }
  2346. function _newArrowCheck(innerThis, boundThis) {
  2347. if (innerThis !== boundThis) {
  2348. throw new TypeError("Cannot instantiate an arrow function");
  2349. }
  2350. }
  2351. function _slicedToArray(arr, i) {
  2352. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  2353. }
  2354. function _toConsumableArray(arr) {
  2355. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  2356. }
  2357. function _arrayWithoutHoles(arr) {
  2358. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  2359. }
  2360. function _arrayWithHoles(arr) {
  2361. if (Array.isArray(arr)) return arr;
  2362. }
  2363. function _iterableToArray(iter) {
  2364. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  2365. }
  2366. function _iterableToArrayLimit(arr, i) {
  2367. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  2368. var _arr = [];
  2369. var _n = true;
  2370. var _d = false;
  2371. var _e = undefined;
  2372. try {
  2373. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  2374. _arr.push(_s.value);
  2375. if (i && _arr.length === i) break;
  2376. }
  2377. } catch (err) {
  2378. _d = true;
  2379. _e = err;
  2380. } finally {
  2381. try {
  2382. if (!_n && _i["return"] != null) _i["return"]();
  2383. } finally {
  2384. if (_d) throw _e;
  2385. }
  2386. }
  2387. return _arr;
  2388. }
  2389. function _unsupportedIterableToArray(o, minLen) {
  2390. if (!o) return;
  2391. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  2392. var n = Object.prototype.toString.call(o).slice(8, -1);
  2393. if (n === "Object" && o.constructor) n = o.constructor.name;
  2394. if (n === "Map" || n === "Set") return Array.from(o);
  2395. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  2396. }
  2397. function _arrayLikeToArray(arr, len) {
  2398. if (len == null || len > arr.length) len = arr.length;
  2399. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  2400. return arr2;
  2401. }
  2402. function _nonIterableSpread() {
  2403. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2404. }
  2405. function _nonIterableRest() {
  2406. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2407. }
  2408. createCommonjsModule(function (module) {
  2409. /**
  2410. * Copyright (c) 2014-present, Facebook, Inc.
  2411. *
  2412. * This source code is licensed under the MIT license found in the
  2413. * LICENSE file in the root directory of this source tree.
  2414. */
  2415. var runtime = (function (exports) {
  2416. var Op = Object.prototype;
  2417. var hasOwn = Op.hasOwnProperty;
  2418. var undefined$1; // More compressible than void 0.
  2419. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  2420. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  2421. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  2422. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  2423. function wrap(innerFn, outerFn, self, tryLocsList) {
  2424. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  2425. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  2426. var generator = Object.create(protoGenerator.prototype);
  2427. var context = new Context(tryLocsList || []);
  2428. // The ._invoke method unifies the implementations of the .next,
  2429. // .throw, and .return methods.
  2430. generator._invoke = makeInvokeMethod(innerFn, self, context);
  2431. return generator;
  2432. }
  2433. exports.wrap = wrap;
  2434. // Try/catch helper to minimize deoptimizations. Returns a completion
  2435. // record like context.tryEntries[i].completion. This interface could
  2436. // have been (and was previously) designed to take a closure to be
  2437. // invoked without arguments, but in all the cases we care about we
  2438. // already have an existing method we want to call, so there's no need
  2439. // to create a new function object. We can even get away with assuming
  2440. // the method takes exactly one argument, since that happens to be true
  2441. // in every case, so we don't have to touch the arguments object. The
  2442. // only additional allocation required is the completion record, which
  2443. // has a stable shape and so hopefully should be cheap to allocate.
  2444. function tryCatch(fn, obj, arg) {
  2445. try {
  2446. return { type: "normal", arg: fn.call(obj, arg) };
  2447. } catch (err) {
  2448. return { type: "throw", arg: err };
  2449. }
  2450. }
  2451. var GenStateSuspendedStart = "suspendedStart";
  2452. var GenStateSuspendedYield = "suspendedYield";
  2453. var GenStateExecuting = "executing";
  2454. var GenStateCompleted = "completed";
  2455. // Returning this object from the innerFn has the same effect as
  2456. // breaking out of the dispatch switch statement.
  2457. var ContinueSentinel = {};
  2458. // Dummy constructor functions that we use as the .constructor and
  2459. // .constructor.prototype properties for functions that return Generator
  2460. // objects. For full spec compliance, you may wish to configure your
  2461. // minifier not to mangle the names of these two functions.
  2462. function Generator() {}
  2463. function GeneratorFunction() {}
  2464. function GeneratorFunctionPrototype() {}
  2465. // This is a polyfill for %IteratorPrototype% for environments that
  2466. // don't natively support it.
  2467. var IteratorPrototype = {};
  2468. IteratorPrototype[iteratorSymbol] = function () {
  2469. return this;
  2470. };
  2471. var getProto = Object.getPrototypeOf;
  2472. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  2473. if (NativeIteratorPrototype &&
  2474. NativeIteratorPrototype !== Op &&
  2475. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  2476. // This environment has a native %IteratorPrototype%; use it instead
  2477. // of the polyfill.
  2478. IteratorPrototype = NativeIteratorPrototype;
  2479. }
  2480. var Gp = GeneratorFunctionPrototype.prototype =
  2481. Generator.prototype = Object.create(IteratorPrototype);
  2482. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  2483. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  2484. GeneratorFunctionPrototype[toStringTagSymbol] =
  2485. GeneratorFunction.displayName = "GeneratorFunction";
  2486. // Helper for defining the .next, .throw, and .return methods of the
  2487. // Iterator interface in terms of a single ._invoke method.
  2488. function defineIteratorMethods(prototype) {
  2489. ["next", "throw", "return"].forEach(function(method) {
  2490. prototype[method] = function(arg) {
  2491. return this._invoke(method, arg);
  2492. };
  2493. });
  2494. }
  2495. exports.isGeneratorFunction = function(genFun) {
  2496. var ctor = typeof genFun === "function" && genFun.constructor;
  2497. return ctor
  2498. ? ctor === GeneratorFunction ||
  2499. // For the native GeneratorFunction constructor, the best we can
  2500. // do is to check its .name property.
  2501. (ctor.displayName || ctor.name) === "GeneratorFunction"
  2502. : false;
  2503. };
  2504. exports.mark = function(genFun) {
  2505. if (Object.setPrototypeOf) {
  2506. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  2507. } else {
  2508. genFun.__proto__ = GeneratorFunctionPrototype;
  2509. if (!(toStringTagSymbol in genFun)) {
  2510. genFun[toStringTagSymbol] = "GeneratorFunction";
  2511. }
  2512. }
  2513. genFun.prototype = Object.create(Gp);
  2514. return genFun;
  2515. };
  2516. // Within the body of any async function, `await x` is transformed to
  2517. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  2518. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  2519. // meant to be awaited.
  2520. exports.awrap = function(arg) {
  2521. return { __await: arg };
  2522. };
  2523. function AsyncIterator(generator, PromiseImpl) {
  2524. function invoke(method, arg, resolve, reject) {
  2525. var record = tryCatch(generator[method], generator, arg);
  2526. if (record.type === "throw") {
  2527. reject(record.arg);
  2528. } else {
  2529. var result = record.arg;
  2530. var value = result.value;
  2531. if (value &&
  2532. typeof value === "object" &&
  2533. hasOwn.call(value, "__await")) {
  2534. return PromiseImpl.resolve(value.__await).then(function(value) {
  2535. invoke("next", value, resolve, reject);
  2536. }, function(err) {
  2537. invoke("throw", err, resolve, reject);
  2538. });
  2539. }
  2540. return PromiseImpl.resolve(value).then(function(unwrapped) {
  2541. // When a yielded Promise is resolved, its final value becomes
  2542. // the .value of the Promise<{value,done}> result for the
  2543. // current iteration.
  2544. result.value = unwrapped;
  2545. resolve(result);
  2546. }, function(error) {
  2547. // If a rejected Promise was yielded, throw the rejection back
  2548. // into the async generator function so it can be handled there.
  2549. return invoke("throw", error, resolve, reject);
  2550. });
  2551. }
  2552. }
  2553. var previousPromise;
  2554. function enqueue(method, arg) {
  2555. function callInvokeWithMethodAndArg() {
  2556. return new PromiseImpl(function(resolve, reject) {
  2557. invoke(method, arg, resolve, reject);
  2558. });
  2559. }
  2560. return previousPromise =
  2561. // If enqueue has been called before, then we want to wait until
  2562. // all previous Promises have been resolved before calling invoke,
  2563. // so that results are always delivered in the correct order. If
  2564. // enqueue has not been called before, then it is important to
  2565. // call invoke immediately, without waiting on a callback to fire,
  2566. // so that the async generator function has the opportunity to do
  2567. // any necessary setup in a predictable way. This predictability
  2568. // is why the Promise constructor synchronously invokes its
  2569. // executor callback, and why async functions synchronously
  2570. // execute code before the first await. Since we implement simple
  2571. // async functions in terms of async generators, it is especially
  2572. // important to get this right, even though it requires care.
  2573. previousPromise ? previousPromise.then(
  2574. callInvokeWithMethodAndArg,
  2575. // Avoid propagating failures to Promises returned by later
  2576. // invocations of the iterator.
  2577. callInvokeWithMethodAndArg
  2578. ) : callInvokeWithMethodAndArg();
  2579. }
  2580. // Define the unified helper method that is used to implement .next,
  2581. // .throw, and .return (see defineIteratorMethods).
  2582. this._invoke = enqueue;
  2583. }
  2584. defineIteratorMethods(AsyncIterator.prototype);
  2585. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  2586. return this;
  2587. };
  2588. exports.AsyncIterator = AsyncIterator;
  2589. // Note that simple async functions are implemented on top of
  2590. // AsyncIterator objects; they just return a Promise for the value of
  2591. // the final result produced by the iterator.
  2592. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  2593. if (PromiseImpl === void 0) PromiseImpl = Promise;
  2594. var iter = new AsyncIterator(
  2595. wrap(innerFn, outerFn, self, tryLocsList),
  2596. PromiseImpl
  2597. );
  2598. return exports.isGeneratorFunction(outerFn)
  2599. ? iter // If outerFn is a generator, return the full iterator.
  2600. : iter.next().then(function(result) {
  2601. return result.done ? result.value : iter.next();
  2602. });
  2603. };
  2604. function makeInvokeMethod(innerFn, self, context) {
  2605. var state = GenStateSuspendedStart;
  2606. return function invoke(method, arg) {
  2607. if (state === GenStateExecuting) {
  2608. throw new Error("Generator is already running");
  2609. }
  2610. if (state === GenStateCompleted) {
  2611. if (method === "throw") {
  2612. throw arg;
  2613. }
  2614. // Be forgiving, per 25.3.3.3.3 of the spec:
  2615. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  2616. return doneResult();
  2617. }
  2618. context.method = method;
  2619. context.arg = arg;
  2620. while (true) {
  2621. var delegate = context.delegate;
  2622. if (delegate) {
  2623. var delegateResult = maybeInvokeDelegate(delegate, context);
  2624. if (delegateResult) {
  2625. if (delegateResult === ContinueSentinel) continue;
  2626. return delegateResult;
  2627. }
  2628. }
  2629. if (context.method === "next") {
  2630. // Setting context._sent for legacy support of Babel's
  2631. // function.sent implementation.
  2632. context.sent = context._sent = context.arg;
  2633. } else if (context.method === "throw") {
  2634. if (state === GenStateSuspendedStart) {
  2635. state = GenStateCompleted;
  2636. throw context.arg;
  2637. }
  2638. context.dispatchException(context.arg);
  2639. } else if (context.method === "return") {
  2640. context.abrupt("return", context.arg);
  2641. }
  2642. state = GenStateExecuting;
  2643. var record = tryCatch(innerFn, self, context);
  2644. if (record.type === "normal") {
  2645. // If an exception is thrown from innerFn, we leave state ===
  2646. // GenStateExecuting and loop back for another invocation.
  2647. state = context.done
  2648. ? GenStateCompleted
  2649. : GenStateSuspendedYield;
  2650. if (record.arg === ContinueSentinel) {
  2651. continue;
  2652. }
  2653. return {
  2654. value: record.arg,
  2655. done: context.done
  2656. };
  2657. } else if (record.type === "throw") {
  2658. state = GenStateCompleted;
  2659. // Dispatch the exception by looping back around to the
  2660. // context.dispatchException(context.arg) call above.
  2661. context.method = "throw";
  2662. context.arg = record.arg;
  2663. }
  2664. }
  2665. };
  2666. }
  2667. // Call delegate.iterator[context.method](context.arg) and handle the
  2668. // result, either by returning a { value, done } result from the
  2669. // delegate iterator, or by modifying context.method and context.arg,
  2670. // setting context.delegate to null, and returning the ContinueSentinel.
  2671. function maybeInvokeDelegate(delegate, context) {
  2672. var method = delegate.iterator[context.method];
  2673. if (method === undefined$1) {
  2674. // A .throw or .return when the delegate iterator has no .throw
  2675. // method always terminates the yield* loop.
  2676. context.delegate = null;
  2677. if (context.method === "throw") {
  2678. // Note: ["return"] must be used for ES3 parsing compatibility.
  2679. if (delegate.iterator["return"]) {
  2680. // If the delegate iterator has a return method, give it a
  2681. // chance to clean up.
  2682. context.method = "return";
  2683. context.arg = undefined$1;
  2684. maybeInvokeDelegate(delegate, context);
  2685. if (context.method === "throw") {
  2686. // If maybeInvokeDelegate(context) changed context.method from
  2687. // "return" to "throw", let that override the TypeError below.
  2688. return ContinueSentinel;
  2689. }
  2690. }
  2691. context.method = "throw";
  2692. context.arg = new TypeError(
  2693. "The iterator does not provide a 'throw' method");
  2694. }
  2695. return ContinueSentinel;
  2696. }
  2697. var record = tryCatch(method, delegate.iterator, context.arg);
  2698. if (record.type === "throw") {
  2699. context.method = "throw";
  2700. context.arg = record.arg;
  2701. context.delegate = null;
  2702. return ContinueSentinel;
  2703. }
  2704. var info = record.arg;
  2705. if (! info) {
  2706. context.method = "throw";
  2707. context.arg = new TypeError("iterator result is not an object");
  2708. context.delegate = null;
  2709. return ContinueSentinel;
  2710. }
  2711. if (info.done) {
  2712. // Assign the result of the finished delegate to the temporary
  2713. // variable specified by delegate.resultName (see delegateYield).
  2714. context[delegate.resultName] = info.value;
  2715. // Resume execution at the desired location (see delegateYield).
  2716. context.next = delegate.nextLoc;
  2717. // If context.method was "throw" but the delegate handled the
  2718. // exception, let the outer generator proceed normally. If
  2719. // context.method was "next", forget context.arg since it has been
  2720. // "consumed" by the delegate iterator. If context.method was
  2721. // "return", allow the original .return call to continue in the
  2722. // outer generator.
  2723. if (context.method !== "return") {
  2724. context.method = "next";
  2725. context.arg = undefined$1;
  2726. }
  2727. } else {
  2728. // Re-yield the result returned by the delegate method.
  2729. return info;
  2730. }
  2731. // The delegate iterator is finished, so forget it and continue with
  2732. // the outer generator.
  2733. context.delegate = null;
  2734. return ContinueSentinel;
  2735. }
  2736. // Define Generator.prototype.{next,throw,return} in terms of the
  2737. // unified ._invoke helper method.
  2738. defineIteratorMethods(Gp);
  2739. Gp[toStringTagSymbol] = "Generator";
  2740. // A Generator should always return itself as the iterator object when the
  2741. // @@iterator function is called on it. Some browsers' implementations of the
  2742. // iterator prototype chain incorrectly implement this, causing the Generator
  2743. // object to not be returned from this call. This ensures that doesn't happen.
  2744. // See https://github.com/facebook/regenerator/issues/274 for more details.
  2745. Gp[iteratorSymbol] = function() {
  2746. return this;
  2747. };
  2748. Gp.toString = function() {
  2749. return "[object Generator]";
  2750. };
  2751. function pushTryEntry(locs) {
  2752. var entry = { tryLoc: locs[0] };
  2753. if (1 in locs) {
  2754. entry.catchLoc = locs[1];
  2755. }
  2756. if (2 in locs) {
  2757. entry.finallyLoc = locs[2];
  2758. entry.afterLoc = locs[3];
  2759. }
  2760. this.tryEntries.push(entry);
  2761. }
  2762. function resetTryEntry(entry) {
  2763. var record = entry.completion || {};
  2764. record.type = "normal";
  2765. delete record.arg;
  2766. entry.completion = record;
  2767. }
  2768. function Context(tryLocsList) {
  2769. // The root entry object (effectively a try statement without a catch
  2770. // or a finally block) gives us a place to store values thrown from
  2771. // locations where there is no enclosing try statement.
  2772. this.tryEntries = [{ tryLoc: "root" }];
  2773. tryLocsList.forEach(pushTryEntry, this);
  2774. this.reset(true);
  2775. }
  2776. exports.keys = function(object) {
  2777. var keys = [];
  2778. for (var key in object) {
  2779. keys.push(key);
  2780. }
  2781. keys.reverse();
  2782. // Rather than returning an object with a next method, we keep
  2783. // things simple and return the next function itself.
  2784. return function next() {
  2785. while (keys.length) {
  2786. var key = keys.pop();
  2787. if (key in object) {
  2788. next.value = key;
  2789. next.done = false;
  2790. return next;
  2791. }
  2792. }
  2793. // To avoid creating an additional object, we just hang the .value
  2794. // and .done properties off the next function object itself. This
  2795. // also ensures that the minifier will not anonymize the function.
  2796. next.done = true;
  2797. return next;
  2798. };
  2799. };
  2800. function values(iterable) {
  2801. if (iterable) {
  2802. var iteratorMethod = iterable[iteratorSymbol];
  2803. if (iteratorMethod) {
  2804. return iteratorMethod.call(iterable);
  2805. }
  2806. if (typeof iterable.next === "function") {
  2807. return iterable;
  2808. }
  2809. if (!isNaN(iterable.length)) {
  2810. var i = -1, next = function next() {
  2811. while (++i < iterable.length) {
  2812. if (hasOwn.call(iterable, i)) {
  2813. next.value = iterable[i];
  2814. next.done = false;
  2815. return next;
  2816. }
  2817. }
  2818. next.value = undefined$1;
  2819. next.done = true;
  2820. return next;
  2821. };
  2822. return next.next = next;
  2823. }
  2824. }
  2825. // Return an iterator with no values.
  2826. return { next: doneResult };
  2827. }
  2828. exports.values = values;
  2829. function doneResult() {
  2830. return { value: undefined$1, done: true };
  2831. }
  2832. Context.prototype = {
  2833. constructor: Context,
  2834. reset: function(skipTempReset) {
  2835. this.prev = 0;
  2836. this.next = 0;
  2837. // Resetting context._sent for legacy support of Babel's
  2838. // function.sent implementation.
  2839. this.sent = this._sent = undefined$1;
  2840. this.done = false;
  2841. this.delegate = null;
  2842. this.method = "next";
  2843. this.arg = undefined$1;
  2844. this.tryEntries.forEach(resetTryEntry);
  2845. if (!skipTempReset) {
  2846. for (var name in this) {
  2847. // Not sure about the optimal order of these conditions:
  2848. if (name.charAt(0) === "t" &&
  2849. hasOwn.call(this, name) &&
  2850. !isNaN(+name.slice(1))) {
  2851. this[name] = undefined$1;
  2852. }
  2853. }
  2854. }
  2855. },
  2856. stop: function() {
  2857. this.done = true;
  2858. var rootEntry = this.tryEntries[0];
  2859. var rootRecord = rootEntry.completion;
  2860. if (rootRecord.type === "throw") {
  2861. throw rootRecord.arg;
  2862. }
  2863. return this.rval;
  2864. },
  2865. dispatchException: function(exception) {
  2866. if (this.done) {
  2867. throw exception;
  2868. }
  2869. var context = this;
  2870. function handle(loc, caught) {
  2871. record.type = "throw";
  2872. record.arg = exception;
  2873. context.next = loc;
  2874. if (caught) {
  2875. // If the dispatched exception was caught by a catch block,
  2876. // then let that catch block handle the exception normally.
  2877. context.method = "next";
  2878. context.arg = undefined$1;
  2879. }
  2880. return !! caught;
  2881. }
  2882. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2883. var entry = this.tryEntries[i];
  2884. var record = entry.completion;
  2885. if (entry.tryLoc === "root") {
  2886. // Exception thrown outside of any try block that could handle
  2887. // it, so set the completion value of the entire function to
  2888. // throw the exception.
  2889. return handle("end");
  2890. }
  2891. if (entry.tryLoc <= this.prev) {
  2892. var hasCatch = hasOwn.call(entry, "catchLoc");
  2893. var hasFinally = hasOwn.call(entry, "finallyLoc");
  2894. if (hasCatch && hasFinally) {
  2895. if (this.prev < entry.catchLoc) {
  2896. return handle(entry.catchLoc, true);
  2897. } else if (this.prev < entry.finallyLoc) {
  2898. return handle(entry.finallyLoc);
  2899. }
  2900. } else if (hasCatch) {
  2901. if (this.prev < entry.catchLoc) {
  2902. return handle(entry.catchLoc, true);
  2903. }
  2904. } else if (hasFinally) {
  2905. if (this.prev < entry.finallyLoc) {
  2906. return handle(entry.finallyLoc);
  2907. }
  2908. } else {
  2909. throw new Error("try statement without catch or finally");
  2910. }
  2911. }
  2912. }
  2913. },
  2914. abrupt: function(type, arg) {
  2915. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2916. var entry = this.tryEntries[i];
  2917. if (entry.tryLoc <= this.prev &&
  2918. hasOwn.call(entry, "finallyLoc") &&
  2919. this.prev < entry.finallyLoc) {
  2920. var finallyEntry = entry;
  2921. break;
  2922. }
  2923. }
  2924. if (finallyEntry &&
  2925. (type === "break" ||
  2926. type === "continue") &&
  2927. finallyEntry.tryLoc <= arg &&
  2928. arg <= finallyEntry.finallyLoc) {
  2929. // Ignore the finally entry if control is not jumping to a
  2930. // location outside the try/catch block.
  2931. finallyEntry = null;
  2932. }
  2933. var record = finallyEntry ? finallyEntry.completion : {};
  2934. record.type = type;
  2935. record.arg = arg;
  2936. if (finallyEntry) {
  2937. this.method = "next";
  2938. this.next = finallyEntry.finallyLoc;
  2939. return ContinueSentinel;
  2940. }
  2941. return this.complete(record);
  2942. },
  2943. complete: function(record, afterLoc) {
  2944. if (record.type === "throw") {
  2945. throw record.arg;
  2946. }
  2947. if (record.type === "break" ||
  2948. record.type === "continue") {
  2949. this.next = record.arg;
  2950. } else if (record.type === "return") {
  2951. this.rval = this.arg = record.arg;
  2952. this.method = "return";
  2953. this.next = "end";
  2954. } else if (record.type === "normal" && afterLoc) {
  2955. this.next = afterLoc;
  2956. }
  2957. return ContinueSentinel;
  2958. },
  2959. finish: function(finallyLoc) {
  2960. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2961. var entry = this.tryEntries[i];
  2962. if (entry.finallyLoc === finallyLoc) {
  2963. this.complete(entry.completion, entry.afterLoc);
  2964. resetTryEntry(entry);
  2965. return ContinueSentinel;
  2966. }
  2967. }
  2968. },
  2969. "catch": function(tryLoc) {
  2970. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  2971. var entry = this.tryEntries[i];
  2972. if (entry.tryLoc === tryLoc) {
  2973. var record = entry.completion;
  2974. if (record.type === "throw") {
  2975. var thrown = record.arg;
  2976. resetTryEntry(entry);
  2977. }
  2978. return thrown;
  2979. }
  2980. }
  2981. // The context.catch method must only be called with a location
  2982. // argument that corresponds to a known catch block.
  2983. throw new Error("illegal catch attempt");
  2984. },
  2985. delegateYield: function(iterable, resultName, nextLoc) {
  2986. this.delegate = {
  2987. iterator: values(iterable),
  2988. resultName: resultName,
  2989. nextLoc: nextLoc
  2990. };
  2991. if (this.method === "next") {
  2992. // Deliberately forget the last sent value so that we don't
  2993. // accidentally pass it on to the delegate.
  2994. this.arg = undefined$1;
  2995. }
  2996. return ContinueSentinel;
  2997. }
  2998. };
  2999. // Regardless of whether this script is executing as a CommonJS module
  3000. // or not, return the runtime object so that we can declare the variable
  3001. // regeneratorRuntime in the outer scope, which allows this module to be
  3002. // injected easily by `bin/regenerator --include-runtime script.js`.
  3003. return exports;
  3004. }(
  3005. // If this script is executing as a CommonJS module, use module.exports
  3006. // as the regeneratorRuntime namespace. Otherwise create a new empty
  3007. // object. Either way, the resulting object will be used to initialize
  3008. // the regeneratorRuntime variable at the top of this file.
  3009. module.exports
  3010. ));
  3011. try {
  3012. regeneratorRuntime = runtime;
  3013. } catch (accidentalStrictMode) {
  3014. // This module should not be running in strict mode, so the above
  3015. // assignment should always work unless something is misconfigured. Just
  3016. // in case runtime.js accidentally runs in strict mode, we can escape
  3017. // strict mode using a global Function call. This could conceivably fail
  3018. // if a Content Security Policy forbids using Function, but in that case
  3019. // the proper solution is to fix the accidental strict mode problem. If
  3020. // you've misconfigured your bundler to force strict mode and applied a
  3021. // CSP to forbid Function, and you're not willing to fix either of those
  3022. // problems, please detail your unique predicament in a GitHub issue.
  3023. Function("r", "regeneratorRuntime = r")(runtime);
  3024. }
  3025. });
  3026. var UNSCOPABLES = wellKnownSymbol('unscopables');
  3027. var ArrayPrototype = Array.prototype;
  3028. // Array.prototype[@@unscopables]
  3029. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  3030. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  3031. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  3032. configurable: true,
  3033. value: objectCreate(null)
  3034. });
  3035. }
  3036. // add a key to Array.prototype[@@unscopables]
  3037. var addToUnscopables = function (key) {
  3038. ArrayPrototype[UNSCOPABLES][key] = true;
  3039. };
  3040. var $includes = arrayIncludes.includes;
  3041. var USES_TO_LENGTH$6 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
  3042. // `Array.prototype.includes` method
  3043. // https://tc39.es/ecma262/#sec-array.prototype.includes
  3044. _export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$6 }, {
  3045. includes: function includes(el /* , fromIndex = 0 */) {
  3046. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  3047. }
  3048. });
  3049. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  3050. addToUnscopables('includes');
  3051. var $map = arrayIteration.map;
  3052. var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map');
  3053. // FF49- issue
  3054. var USES_TO_LENGTH$5 = arrayMethodUsesToLength('map');
  3055. // `Array.prototype.map` method
  3056. // https://tc39.es/ecma262/#sec-array.prototype.map
  3057. // with adding support of @@species
  3058. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$5 }, {
  3059. map: function map(callbackfn /* , thisArg */) {
  3060. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  3061. }
  3062. });
  3063. // `Array.prototype.{ reduce, reduceRight }` methods implementation
  3064. var createMethod$2 = function (IS_RIGHT) {
  3065. return function (that, callbackfn, argumentsLength, memo) {
  3066. aFunction(callbackfn);
  3067. var O = toObject(that);
  3068. var self = indexedObject(O);
  3069. var length = toLength(O.length);
  3070. var index = IS_RIGHT ? length - 1 : 0;
  3071. var i = IS_RIGHT ? -1 : 1;
  3072. if (argumentsLength < 2) while (true) {
  3073. if (index in self) {
  3074. memo = self[index];
  3075. index += i;
  3076. break;
  3077. }
  3078. index += i;
  3079. if (IS_RIGHT ? index < 0 : length <= index) {
  3080. throw TypeError('Reduce of empty array with no initial value');
  3081. }
  3082. }
  3083. for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
  3084. memo = callbackfn(memo, self[index], index, O);
  3085. }
  3086. return memo;
  3087. };
  3088. };
  3089. var arrayReduce = {
  3090. // `Array.prototype.reduce` method
  3091. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  3092. left: createMethod$2(false),
  3093. // `Array.prototype.reduceRight` method
  3094. // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  3095. right: createMethod$2(true)
  3096. };
  3097. var engineIsNode = classofRaw(global_1.process) == 'process';
  3098. var $reduce = arrayReduce.left;
  3099. var STRICT_METHOD$3 = arrayMethodIsStrict('reduce');
  3100. var USES_TO_LENGTH$4 = arrayMethodUsesToLength('reduce', { 1: 0 });
  3101. // Chrome 80-82 has a critical bug
  3102. // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
  3103. var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83;
  3104. // `Array.prototype.reduce` method
  3105. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  3106. _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$3 || !USES_TO_LENGTH$4 || CHROME_BUG }, {
  3107. reduce: function reduce(callbackfn /* , initialValue */) {
  3108. return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
  3109. }
  3110. });
  3111. var $some = arrayIteration.some;
  3112. var STRICT_METHOD$2 = arrayMethodIsStrict('some');
  3113. var USES_TO_LENGTH$3 = arrayMethodUsesToLength('some');
  3114. // `Array.prototype.some` method
  3115. // https://tc39.es/ecma262/#sec-array.prototype.some
  3116. _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$2 || !USES_TO_LENGTH$3 }, {
  3117. some: function some(callbackfn /* , thisArg */) {
  3118. return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  3119. }
  3120. });
  3121. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  3122. // `Object.{ entries, values }` methods implementation
  3123. var createMethod$1 = function (TO_ENTRIES) {
  3124. return function (it) {
  3125. var O = toIndexedObject(it);
  3126. var keys = objectKeys(O);
  3127. var length = keys.length;
  3128. var i = 0;
  3129. var result = [];
  3130. var key;
  3131. while (length > i) {
  3132. key = keys[i++];
  3133. if (!descriptors || propertyIsEnumerable.call(O, key)) {
  3134. result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
  3135. }
  3136. }
  3137. return result;
  3138. };
  3139. };
  3140. var objectToArray = {
  3141. // `Object.entries` method
  3142. // https://tc39.es/ecma262/#sec-object.entries
  3143. entries: createMethod$1(true),
  3144. // `Object.values` method
  3145. // https://tc39.es/ecma262/#sec-object.values
  3146. values: createMethod$1(false)
  3147. };
  3148. var $entries = objectToArray.entries;
  3149. // `Object.entries` method
  3150. // https://tc39.es/ecma262/#sec-object.entries
  3151. _export({ target: 'Object', stat: true }, {
  3152. entries: function entries(O) {
  3153. return $entries(O);
  3154. }
  3155. });
  3156. // `SameValue` abstract operation
  3157. // https://tc39.es/ecma262/#sec-samevalue
  3158. var sameValue = Object.is || function is(x, y) {
  3159. // eslint-disable-next-line no-self-compare
  3160. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  3161. };
  3162. // `Object.is` method
  3163. // https://tc39.es/ecma262/#sec-object.is
  3164. _export({ target: 'Object', stat: true }, {
  3165. is: sameValue
  3166. });
  3167. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  3168. // `Object.keys` method
  3169. // https://tc39.es/ecma262/#sec-object.keys
  3170. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  3171. keys: function keys(it) {
  3172. return objectKeys(toObject(it));
  3173. }
  3174. });
  3175. // `Object.prototype.toString` method implementation
  3176. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  3177. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  3178. return '[object ' + classof(this) + ']';
  3179. };
  3180. // `Object.prototype.toString` method
  3181. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  3182. if (!toStringTagSupport) {
  3183. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  3184. }
  3185. var nativePromiseConstructor = global_1.Promise;
  3186. var redefineAll = function (target, src, options) {
  3187. for (var key in src) redefine(target, key, src[key], options);
  3188. return target;
  3189. };
  3190. var SPECIES$3 = wellKnownSymbol('species');
  3191. var setSpecies = function (CONSTRUCTOR_NAME) {
  3192. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  3193. var defineProperty = objectDefineProperty.f;
  3194. if (descriptors && Constructor && !Constructor[SPECIES$3]) {
  3195. defineProperty(Constructor, SPECIES$3, {
  3196. configurable: true,
  3197. get: function () { return this; }
  3198. });
  3199. }
  3200. };
  3201. var anInstance = function (it, Constructor, name) {
  3202. if (!(it instanceof Constructor)) {
  3203. throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
  3204. } return it;
  3205. };
  3206. var Result = function (stopped, result) {
  3207. this.stopped = stopped;
  3208. this.result = result;
  3209. };
  3210. var iterate = function (iterable, unboundFunction, options) {
  3211. var that = options && options.that;
  3212. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  3213. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  3214. var INTERRUPTED = !!(options && options.INTERRUPTED);
  3215. var fn = functionBindContext(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
  3216. var iterator, iterFn, index, length, result, next, step;
  3217. var stop = function (condition) {
  3218. if (iterator) iteratorClose(iterator);
  3219. return new Result(true, condition);
  3220. };
  3221. var callFn = function (value) {
  3222. if (AS_ENTRIES) {
  3223. anObject(value);
  3224. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  3225. } return INTERRUPTED ? fn(value, stop) : fn(value);
  3226. };
  3227. if (IS_ITERATOR) {
  3228. iterator = iterable;
  3229. } else {
  3230. iterFn = getIteratorMethod(iterable);
  3231. if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
  3232. // optimisation for array iterators
  3233. if (isArrayIteratorMethod(iterFn)) {
  3234. for (index = 0, length = toLength(iterable.length); length > index; index++) {
  3235. result = callFn(iterable[index]);
  3236. if (result && result instanceof Result) return result;
  3237. } return new Result(false);
  3238. }
  3239. iterator = iterFn.call(iterable);
  3240. }
  3241. next = iterator.next;
  3242. while (!(step = next.call(iterator)).done) {
  3243. try {
  3244. result = callFn(step.value);
  3245. } catch (error) {
  3246. iteratorClose(iterator);
  3247. throw error;
  3248. }
  3249. if (typeof result == 'object' && result && result instanceof Result) return result;
  3250. } return new Result(false);
  3251. };
  3252. var SPECIES$2 = wellKnownSymbol('species');
  3253. // `SpeciesConstructor` abstract operation
  3254. // https://tc39.es/ecma262/#sec-speciesconstructor
  3255. var speciesConstructor = function (O, defaultConstructor) {
  3256. var C = anObject(O).constructor;
  3257. var S;
  3258. return C === undefined || (S = anObject(C)[SPECIES$2]) == undefined ? defaultConstructor : aFunction(S);
  3259. };
  3260. var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent);
  3261. var location = global_1.location;
  3262. var set$1 = global_1.setImmediate;
  3263. var clear = global_1.clearImmediate;
  3264. var process$3 = global_1.process;
  3265. var MessageChannel = global_1.MessageChannel;
  3266. var Dispatch = global_1.Dispatch;
  3267. var counter = 0;
  3268. var queue = {};
  3269. var ONREADYSTATECHANGE = 'onreadystatechange';
  3270. var defer, channel, port;
  3271. var run = function (id) {
  3272. // eslint-disable-next-line no-prototype-builtins
  3273. if (queue.hasOwnProperty(id)) {
  3274. var fn = queue[id];
  3275. delete queue[id];
  3276. fn();
  3277. }
  3278. };
  3279. var runner = function (id) {
  3280. return function () {
  3281. run(id);
  3282. };
  3283. };
  3284. var listener = function (event) {
  3285. run(event.data);
  3286. };
  3287. var post = function (id) {
  3288. // old engines have not location.origin
  3289. global_1.postMessage(id + '', location.protocol + '//' + location.host);
  3290. };
  3291. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  3292. if (!set$1 || !clear) {
  3293. set$1 = function setImmediate(fn) {
  3294. var args = [];
  3295. var i = 1;
  3296. while (arguments.length > i) args.push(arguments[i++]);
  3297. queue[++counter] = function () {
  3298. // eslint-disable-next-line no-new-func
  3299. (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
  3300. };
  3301. defer(counter);
  3302. return counter;
  3303. };
  3304. clear = function clearImmediate(id) {
  3305. delete queue[id];
  3306. };
  3307. // Node.js 0.8-
  3308. if (engineIsNode) {
  3309. defer = function (id) {
  3310. process$3.nextTick(runner(id));
  3311. };
  3312. // Sphere (JS game engine) Dispatch API
  3313. } else if (Dispatch && Dispatch.now) {
  3314. defer = function (id) {
  3315. Dispatch.now(runner(id));
  3316. };
  3317. // Browsers with MessageChannel, includes WebWorkers
  3318. // except iOS - https://github.com/zloirock/core-js/issues/624
  3319. } else if (MessageChannel && !engineIsIos) {
  3320. channel = new MessageChannel();
  3321. port = channel.port2;
  3322. channel.port1.onmessage = listener;
  3323. defer = functionBindContext(port.postMessage, port, 1);
  3324. // Browsers with postMessage, skip WebWorkers
  3325. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  3326. } else if (
  3327. global_1.addEventListener &&
  3328. typeof postMessage == 'function' &&
  3329. !global_1.importScripts &&
  3330. location && location.protocol !== 'file:' &&
  3331. !fails(post)
  3332. ) {
  3333. defer = post;
  3334. global_1.addEventListener('message', listener, false);
  3335. // IE8-
  3336. } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
  3337. defer = function (id) {
  3338. html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
  3339. html.removeChild(this);
  3340. run(id);
  3341. };
  3342. };
  3343. // Rest old browsers
  3344. } else {
  3345. defer = function (id) {
  3346. setTimeout(runner(id), 0);
  3347. };
  3348. }
  3349. }
  3350. var task$1 = {
  3351. set: set$1,
  3352. clear: clear
  3353. };
  3354. var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent);
  3355. var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
  3356. var macrotask = task$1.set;
  3357. var MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver;
  3358. var document$2 = global_1.document;
  3359. var process$2 = global_1.process;
  3360. var Promise$1 = global_1.Promise;
  3361. // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
  3362. var queueMicrotaskDescriptor = getOwnPropertyDescriptor$2(global_1, 'queueMicrotask');
  3363. var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
  3364. var flush, head, last, notify$1, toggle, node, promise, then;
  3365. // modern engines have queueMicrotask method
  3366. if (!queueMicrotask) {
  3367. flush = function () {
  3368. var parent, fn;
  3369. if (engineIsNode && (parent = process$2.domain)) parent.exit();
  3370. while (head) {
  3371. fn = head.fn;
  3372. head = head.next;
  3373. try {
  3374. fn();
  3375. } catch (error) {
  3376. if (head) notify$1();
  3377. else last = undefined;
  3378. throw error;
  3379. }
  3380. } last = undefined;
  3381. if (parent) parent.enter();
  3382. };
  3383. // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
  3384. // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
  3385. if (!engineIsIos && !engineIsNode && !engineIsWebosWebkit && MutationObserver$1 && document$2) {
  3386. toggle = true;
  3387. node = document$2.createTextNode('');
  3388. new MutationObserver$1(flush).observe(node, { characterData: true });
  3389. notify$1 = function () {
  3390. node.data = toggle = !toggle;
  3391. };
  3392. // environments with maybe non-completely correct, but existent Promise
  3393. } else if (Promise$1 && Promise$1.resolve) {
  3394. // Promise.resolve without an argument throws an error in LG WebOS 2
  3395. promise = Promise$1.resolve(undefined);
  3396. then = promise.then;
  3397. notify$1 = function () {
  3398. then.call(promise, flush);
  3399. };
  3400. // Node.js without promises
  3401. } else if (engineIsNode) {
  3402. notify$1 = function () {
  3403. process$2.nextTick(flush);
  3404. };
  3405. // for other environments - macrotask based on:
  3406. // - setImmediate
  3407. // - MessageChannel
  3408. // - window.postMessag
  3409. // - onreadystatechange
  3410. // - setTimeout
  3411. } else {
  3412. notify$1 = function () {
  3413. // strange IE + webpack dev server bug - use .call(global)
  3414. macrotask.call(global_1, flush);
  3415. };
  3416. }
  3417. }
  3418. var microtask = queueMicrotask || function (fn) {
  3419. var task = { fn: fn, next: undefined };
  3420. if (last) last.next = task;
  3421. if (!head) {
  3422. head = task;
  3423. notify$1();
  3424. } last = task;
  3425. };
  3426. var PromiseCapability = function (C) {
  3427. var resolve, reject;
  3428. this.promise = new C(function ($$resolve, $$reject) {
  3429. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  3430. resolve = $$resolve;
  3431. reject = $$reject;
  3432. });
  3433. this.resolve = aFunction(resolve);
  3434. this.reject = aFunction(reject);
  3435. };
  3436. // 25.4.1.5 NewPromiseCapability(C)
  3437. var f = function (C) {
  3438. return new PromiseCapability(C);
  3439. };
  3440. var newPromiseCapability$1 = {
  3441. f: f
  3442. };
  3443. var promiseResolve = function (C, x) {
  3444. anObject(C);
  3445. if (isObject(x) && x.constructor === C) return x;
  3446. var promiseCapability = newPromiseCapability$1.f(C);
  3447. var resolve = promiseCapability.resolve;
  3448. resolve(x);
  3449. return promiseCapability.promise;
  3450. };
  3451. var hostReportErrors = function (a, b) {
  3452. var console = global_1.console;
  3453. if (console && console.error) {
  3454. arguments.length === 1 ? console.error(a) : console.error(a, b);
  3455. }
  3456. };
  3457. var perform = function (exec) {
  3458. try {
  3459. return { error: false, value: exec() };
  3460. } catch (error) {
  3461. return { error: true, value: error };
  3462. }
  3463. };
  3464. var task = task$1.set;
  3465. var SPECIES$1 = wellKnownSymbol('species');
  3466. var PROMISE = 'Promise';
  3467. var getInternalState$1 = internalState.get;
  3468. var setInternalState$2 = internalState.set;
  3469. var getInternalPromiseState = internalState.getterFor(PROMISE);
  3470. var PromiseConstructor = nativePromiseConstructor;
  3471. var TypeError$1 = global_1.TypeError;
  3472. var document$1 = global_1.document;
  3473. var process$1 = global_1.process;
  3474. var $fetch = getBuiltIn('fetch');
  3475. var newPromiseCapability = newPromiseCapability$1.f;
  3476. var newGenericPromiseCapability = newPromiseCapability;
  3477. var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent);
  3478. var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function';
  3479. var UNHANDLED_REJECTION = 'unhandledrejection';
  3480. var REJECTION_HANDLED = 'rejectionhandled';
  3481. var PENDING = 0;
  3482. var FULFILLED = 1;
  3483. var REJECTED = 2;
  3484. var HANDLED = 1;
  3485. var UNHANDLED = 2;
  3486. var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
  3487. var FORCED$1 = isForced_1(PROMISE, function () {
  3488. var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
  3489. if (!GLOBAL_CORE_JS_PROMISE) {
  3490. // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  3491. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  3492. // We can't detect it synchronously, so just check versions
  3493. if (engineV8Version === 66) return true;
  3494. // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  3495. if (!engineIsNode && !NATIVE_REJECTION_EVENT) return true;
  3496. }
  3497. // We can't use @@species feature detection in V8 since it causes
  3498. // deoptimization and performance degradation
  3499. // https://github.com/zloirock/core-js/issues/679
  3500. if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;
  3501. // Detect correctness of subclassing with @@species support
  3502. var promise = PromiseConstructor.resolve(1);
  3503. var FakePromise = function (exec) {
  3504. exec(function () { /* empty */ }, function () { /* empty */ });
  3505. };
  3506. var constructor = promise.constructor = {};
  3507. constructor[SPECIES$1] = FakePromise;
  3508. return !(promise.then(function () { /* empty */ }) instanceof FakePromise);
  3509. });
  3510. var INCORRECT_ITERATION = FORCED$1 || !checkCorrectnessOfIteration(function (iterable) {
  3511. PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
  3512. });
  3513. // helpers
  3514. var isThenable = function (it) {
  3515. var then;
  3516. return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  3517. };
  3518. var notify = function (state, isReject) {
  3519. if (state.notified) return;
  3520. state.notified = true;
  3521. var chain = state.reactions;
  3522. microtask(function () {
  3523. var value = state.value;
  3524. var ok = state.state == FULFILLED;
  3525. var index = 0;
  3526. // variable length - can't use forEach
  3527. while (chain.length > index) {
  3528. var reaction = chain[index++];
  3529. var handler = ok ? reaction.ok : reaction.fail;
  3530. var resolve = reaction.resolve;
  3531. var reject = reaction.reject;
  3532. var domain = reaction.domain;
  3533. var result, then, exited;
  3534. try {
  3535. if (handler) {
  3536. if (!ok) {
  3537. if (state.rejection === UNHANDLED) onHandleUnhandled(state);
  3538. state.rejection = HANDLED;
  3539. }
  3540. if (handler === true) result = value;
  3541. else {
  3542. if (domain) domain.enter();
  3543. result = handler(value); // can throw
  3544. if (domain) {
  3545. domain.exit();
  3546. exited = true;
  3547. }
  3548. }
  3549. if (result === reaction.promise) {
  3550. reject(TypeError$1('Promise-chain cycle'));
  3551. } else if (then = isThenable(result)) {
  3552. then.call(result, resolve, reject);
  3553. } else resolve(result);
  3554. } else reject(value);
  3555. } catch (error) {
  3556. if (domain && !exited) domain.exit();
  3557. reject(error);
  3558. }
  3559. }
  3560. state.reactions = [];
  3561. state.notified = false;
  3562. if (isReject && !state.rejection) onUnhandled(state);
  3563. });
  3564. };
  3565. var dispatchEvent = function (name, promise, reason) {
  3566. var event, handler;
  3567. if (DISPATCH_EVENT) {
  3568. event = document$1.createEvent('Event');
  3569. event.promise = promise;
  3570. event.reason = reason;
  3571. event.initEvent(name, false, true);
  3572. global_1.dispatchEvent(event);
  3573. } else event = { promise: promise, reason: reason };
  3574. if (!NATIVE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event);
  3575. else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
  3576. };
  3577. var onUnhandled = function (state) {
  3578. task.call(global_1, function () {
  3579. var promise = state.facade;
  3580. var value = state.value;
  3581. var IS_UNHANDLED = isUnhandled(state);
  3582. var result;
  3583. if (IS_UNHANDLED) {
  3584. result = perform(function () {
  3585. if (engineIsNode) {
  3586. process$1.emit('unhandledRejection', value, promise);
  3587. } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
  3588. });
  3589. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  3590. state.rejection = engineIsNode || isUnhandled(state) ? UNHANDLED : HANDLED;
  3591. if (result.error) throw result.value;
  3592. }
  3593. });
  3594. };
  3595. var isUnhandled = function (state) {
  3596. return state.rejection !== HANDLED && !state.parent;
  3597. };
  3598. var onHandleUnhandled = function (state) {
  3599. task.call(global_1, function () {
  3600. var promise = state.facade;
  3601. if (engineIsNode) {
  3602. process$1.emit('rejectionHandled', promise);
  3603. } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
  3604. });
  3605. };
  3606. var bind = function (fn, state, unwrap) {
  3607. return function (value) {
  3608. fn(state, value, unwrap);
  3609. };
  3610. };
  3611. var internalReject = function (state, value, unwrap) {
  3612. if (state.done) return;
  3613. state.done = true;
  3614. if (unwrap) state = unwrap;
  3615. state.value = value;
  3616. state.state = REJECTED;
  3617. notify(state, true);
  3618. };
  3619. var internalResolve = function (state, value, unwrap) {
  3620. if (state.done) return;
  3621. state.done = true;
  3622. if (unwrap) state = unwrap;
  3623. try {
  3624. if (state.facade === value) throw TypeError$1("Promise can't be resolved itself");
  3625. var then = isThenable(value);
  3626. if (then) {
  3627. microtask(function () {
  3628. var wrapper = { done: false };
  3629. try {
  3630. then.call(value,
  3631. bind(internalResolve, wrapper, state),
  3632. bind(internalReject, wrapper, state)
  3633. );
  3634. } catch (error) {
  3635. internalReject(wrapper, error, state);
  3636. }
  3637. });
  3638. } else {
  3639. state.value = value;
  3640. state.state = FULFILLED;
  3641. notify(state, false);
  3642. }
  3643. } catch (error) {
  3644. internalReject({ done: false }, error, state);
  3645. }
  3646. };
  3647. // constructor polyfill
  3648. if (FORCED$1) {
  3649. // 25.4.3.1 Promise(executor)
  3650. PromiseConstructor = function Promise(executor) {
  3651. anInstance(this, PromiseConstructor, PROMISE);
  3652. aFunction(executor);
  3653. Internal.call(this);
  3654. var state = getInternalState$1(this);
  3655. try {
  3656. executor(bind(internalResolve, state), bind(internalReject, state));
  3657. } catch (error) {
  3658. internalReject(state, error);
  3659. }
  3660. };
  3661. // eslint-disable-next-line no-unused-vars
  3662. Internal = function Promise(executor) {
  3663. setInternalState$2(this, {
  3664. type: PROMISE,
  3665. done: false,
  3666. notified: false,
  3667. parent: false,
  3668. reactions: [],
  3669. rejection: false,
  3670. state: PENDING,
  3671. value: undefined
  3672. });
  3673. };
  3674. Internal.prototype = redefineAll(PromiseConstructor.prototype, {
  3675. // `Promise.prototype.then` method
  3676. // https://tc39.es/ecma262/#sec-promise.prototype.then
  3677. then: function then(onFulfilled, onRejected) {
  3678. var state = getInternalPromiseState(this);
  3679. var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
  3680. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  3681. reaction.fail = typeof onRejected == 'function' && onRejected;
  3682. reaction.domain = engineIsNode ? process$1.domain : undefined;
  3683. state.parent = true;
  3684. state.reactions.push(reaction);
  3685. if (state.state != PENDING) notify(state, false);
  3686. return reaction.promise;
  3687. },
  3688. // `Promise.prototype.catch` method
  3689. // https://tc39.es/ecma262/#sec-promise.prototype.catch
  3690. 'catch': function (onRejected) {
  3691. return this.then(undefined, onRejected);
  3692. }
  3693. });
  3694. OwnPromiseCapability = function () {
  3695. var promise = new Internal();
  3696. var state = getInternalState$1(promise);
  3697. this.promise = promise;
  3698. this.resolve = bind(internalResolve, state);
  3699. this.reject = bind(internalReject, state);
  3700. };
  3701. newPromiseCapability$1.f = newPromiseCapability = function (C) {
  3702. return C === PromiseConstructor || C === PromiseWrapper
  3703. ? new OwnPromiseCapability(C)
  3704. : newGenericPromiseCapability(C);
  3705. };
  3706. if (typeof nativePromiseConstructor == 'function') {
  3707. nativeThen = nativePromiseConstructor.prototype.then;
  3708. // wrap native Promise#then for native async functions
  3709. redefine(nativePromiseConstructor.prototype, 'then', function then(onFulfilled, onRejected) {
  3710. var that = this;
  3711. return new PromiseConstructor(function (resolve, reject) {
  3712. nativeThen.call(that, resolve, reject);
  3713. }).then(onFulfilled, onRejected);
  3714. // https://github.com/zloirock/core-js/issues/640
  3715. }, { unsafe: true });
  3716. // wrap fetch result
  3717. if (typeof $fetch == 'function') _export({ global: true, enumerable: true, forced: true }, {
  3718. // eslint-disable-next-line no-unused-vars
  3719. fetch: function fetch(input /* , init */) {
  3720. return promiseResolve(PromiseConstructor, $fetch.apply(global_1, arguments));
  3721. }
  3722. });
  3723. }
  3724. }
  3725. _export({ global: true, wrap: true, forced: FORCED$1 }, {
  3726. Promise: PromiseConstructor
  3727. });
  3728. setToStringTag(PromiseConstructor, PROMISE, false);
  3729. setSpecies(PROMISE);
  3730. PromiseWrapper = getBuiltIn(PROMISE);
  3731. // statics
  3732. _export({ target: PROMISE, stat: true, forced: FORCED$1 }, {
  3733. // `Promise.reject` method
  3734. // https://tc39.es/ecma262/#sec-promise.reject
  3735. reject: function reject(r) {
  3736. var capability = newPromiseCapability(this);
  3737. capability.reject.call(undefined, r);
  3738. return capability.promise;
  3739. }
  3740. });
  3741. _export({ target: PROMISE, stat: true, forced: FORCED$1 }, {
  3742. // `Promise.resolve` method
  3743. // https://tc39.es/ecma262/#sec-promise.resolve
  3744. resolve: function resolve(x) {
  3745. return promiseResolve(this, x);
  3746. }
  3747. });
  3748. _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
  3749. // `Promise.all` method
  3750. // https://tc39.es/ecma262/#sec-promise.all
  3751. all: function all(iterable) {
  3752. var C = this;
  3753. var capability = newPromiseCapability(C);
  3754. var resolve = capability.resolve;
  3755. var reject = capability.reject;
  3756. var result = perform(function () {
  3757. var $promiseResolve = aFunction(C.resolve);
  3758. var values = [];
  3759. var counter = 0;
  3760. var remaining = 1;
  3761. iterate(iterable, function (promise) {
  3762. var index = counter++;
  3763. var alreadyCalled = false;
  3764. values.push(undefined);
  3765. remaining++;
  3766. $promiseResolve.call(C, promise).then(function (value) {
  3767. if (alreadyCalled) return;
  3768. alreadyCalled = true;
  3769. values[index] = value;
  3770. --remaining || resolve(values);
  3771. }, reject);
  3772. });
  3773. --remaining || resolve(values);
  3774. });
  3775. if (result.error) reject(result.value);
  3776. return capability.promise;
  3777. },
  3778. // `Promise.race` method
  3779. // https://tc39.es/ecma262/#sec-promise.race
  3780. race: function race(iterable) {
  3781. var C = this;
  3782. var capability = newPromiseCapability(C);
  3783. var reject = capability.reject;
  3784. var result = perform(function () {
  3785. var $promiseResolve = aFunction(C.resolve);
  3786. iterate(iterable, function (promise) {
  3787. $promiseResolve.call(C, promise).then(capability.resolve, reject);
  3788. });
  3789. });
  3790. if (result.error) reject(result.value);
  3791. return capability.promise;
  3792. }
  3793. });
  3794. // `RegExp.prototype.flags` getter implementation
  3795. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  3796. var regexpFlags = function () {
  3797. var that = anObject(this);
  3798. var result = '';
  3799. if (that.global) result += 'g';
  3800. if (that.ignoreCase) result += 'i';
  3801. if (that.multiline) result += 'm';
  3802. if (that.dotAll) result += 's';
  3803. if (that.unicode) result += 'u';
  3804. if (that.sticky) result += 'y';
  3805. return result;
  3806. };
  3807. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
  3808. // so we use an intermediate function.
  3809. function RE(s, f) {
  3810. return RegExp(s, f);
  3811. }
  3812. var UNSUPPORTED_Y$1 = fails(function () {
  3813. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  3814. var re = RE('a', 'y');
  3815. re.lastIndex = 2;
  3816. return re.exec('abcd') != null;
  3817. });
  3818. var BROKEN_CARET = fails(function () {
  3819. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  3820. var re = RE('^r', 'gy');
  3821. re.lastIndex = 2;
  3822. return re.exec('str') != null;
  3823. });
  3824. var regexpStickyHelpers = {
  3825. UNSUPPORTED_Y: UNSUPPORTED_Y$1,
  3826. BROKEN_CARET: BROKEN_CARET
  3827. };
  3828. var nativeExec = RegExp.prototype.exec;
  3829. // This always refers to the native implementation, because the
  3830. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  3831. // which loads this file before patching the method.
  3832. var nativeReplace = String.prototype.replace;
  3833. var patchedExec = nativeExec;
  3834. var UPDATES_LAST_INDEX_WRONG = (function () {
  3835. var re1 = /a/;
  3836. var re2 = /b*/g;
  3837. nativeExec.call(re1, 'a');
  3838. nativeExec.call(re2, 'a');
  3839. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  3840. })();
  3841. var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
  3842. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  3843. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  3844. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
  3845. if (PATCH) {
  3846. patchedExec = function exec(str) {
  3847. var re = this;
  3848. var lastIndex, reCopy, match, i;
  3849. var sticky = UNSUPPORTED_Y && re.sticky;
  3850. var flags = regexpFlags.call(re);
  3851. var source = re.source;
  3852. var charsAdded = 0;
  3853. var strCopy = str;
  3854. if (sticky) {
  3855. flags = flags.replace('y', '');
  3856. if (flags.indexOf('g') === -1) {
  3857. flags += 'g';
  3858. }
  3859. strCopy = String(str).slice(re.lastIndex);
  3860. // Support anchored sticky behavior.
  3861. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
  3862. source = '(?: ' + source + ')';
  3863. strCopy = ' ' + strCopy;
  3864. charsAdded++;
  3865. }
  3866. // ^(? + rx + ) is needed, in combination with some str slicing, to
  3867. // simulate the 'y' flag.
  3868. reCopy = new RegExp('^(?:' + source + ')', flags);
  3869. }
  3870. if (NPCG_INCLUDED) {
  3871. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  3872. }
  3873. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  3874. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  3875. if (sticky) {
  3876. if (match) {
  3877. match.input = match.input.slice(charsAdded);
  3878. match[0] = match[0].slice(charsAdded);
  3879. match.index = re.lastIndex;
  3880. re.lastIndex += match[0].length;
  3881. } else re.lastIndex = 0;
  3882. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  3883. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  3884. }
  3885. if (NPCG_INCLUDED && match && match.length > 1) {
  3886. // Fix browsers whose `exec` methods don't consistently return `undefined`
  3887. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  3888. nativeReplace.call(match[0], reCopy, function () {
  3889. for (i = 1; i < arguments.length - 2; i++) {
  3890. if (arguments[i] === undefined) match[i] = undefined;
  3891. }
  3892. });
  3893. }
  3894. return match;
  3895. };
  3896. }
  3897. var regexpExec = patchedExec;
  3898. // `RegExp.prototype.exec` method
  3899. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  3900. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  3901. exec: regexpExec
  3902. });
  3903. var MATCH$1 = wellKnownSymbol('match');
  3904. // `IsRegExp` abstract operation
  3905. // https://tc39.es/ecma262/#sec-isregexp
  3906. var isRegexp = function (it) {
  3907. var isRegExp;
  3908. return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  3909. };
  3910. var notARegexp = function (it) {
  3911. if (isRegexp(it)) {
  3912. throw TypeError("The method doesn't accept regular expressions");
  3913. } return it;
  3914. };
  3915. var MATCH = wellKnownSymbol('match');
  3916. var correctIsRegexpLogic = function (METHOD_NAME) {
  3917. var regexp = /./;
  3918. try {
  3919. '/./'[METHOD_NAME](regexp);
  3920. } catch (error1) {
  3921. try {
  3922. regexp[MATCH] = false;
  3923. return '/./'[METHOD_NAME](regexp);
  3924. } catch (error2) { /* empty */ }
  3925. } return false;
  3926. };
  3927. // `String.prototype.includes` method
  3928. // https://tc39.es/ecma262/#sec-string.prototype.includes
  3929. _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
  3930. includes: function includes(searchString /* , position = 0 */) {
  3931. return !!~String(requireObjectCoercible(this))
  3932. .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
  3933. }
  3934. });
  3935. // TODO: Remove from `core-js@4` since it's moved to entry points
  3936. var SPECIES = wellKnownSymbol('species');
  3937. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  3938. // #replace needs built-in support for named groups.
  3939. // #match works fine because it just return the exec results, even if it has
  3940. // a "grops" property.
  3941. var re = /./;
  3942. re.exec = function () {
  3943. var result = [];
  3944. result.groups = { a: '7' };
  3945. return result;
  3946. };
  3947. return ''.replace(re, '$<a>') !== '7';
  3948. });
  3949. // IE <= 11 replaces $0 with the whole match, as if it was $&
  3950. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  3951. var REPLACE_KEEPS_$0 = (function () {
  3952. return 'a'.replace(/./, '$0') === '$0';
  3953. })();
  3954. var REPLACE = wellKnownSymbol('replace');
  3955. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  3956. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  3957. if (/./[REPLACE]) {
  3958. return /./[REPLACE]('a', '$0') === '';
  3959. }
  3960. return false;
  3961. })();
  3962. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  3963. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  3964. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  3965. var re = /(?:)/;
  3966. var originalExec = re.exec;
  3967. re.exec = function () { return originalExec.apply(this, arguments); };
  3968. var result = 'ab'.split(re);
  3969. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  3970. });
  3971. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  3972. var SYMBOL = wellKnownSymbol(KEY);
  3973. var DELEGATES_TO_SYMBOL = !fails(function () {
  3974. // String methods call symbol-named RegEp methods
  3975. var O = {};
  3976. O[SYMBOL] = function () { return 7; };
  3977. return ''[KEY](O) != 7;
  3978. });
  3979. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  3980. // Symbol-named RegExp methods call .exec
  3981. var execCalled = false;
  3982. var re = /a/;
  3983. if (KEY === 'split') {
  3984. // We can't use real regex here since it causes deoptimization
  3985. // and serious performance degradation in V8
  3986. // https://github.com/zloirock/core-js/issues/306
  3987. re = {};
  3988. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  3989. // a new one. We need to return the patched regex when creating the new one.
  3990. re.constructor = {};
  3991. re.constructor[SPECIES] = function () { return re; };
  3992. re.flags = '';
  3993. re[SYMBOL] = /./[SYMBOL];
  3994. }
  3995. re.exec = function () { execCalled = true; return null; };
  3996. re[SYMBOL]('');
  3997. return !execCalled;
  3998. });
  3999. if (
  4000. !DELEGATES_TO_SYMBOL ||
  4001. !DELEGATES_TO_EXEC ||
  4002. (KEY === 'replace' && !(
  4003. REPLACE_SUPPORTS_NAMED_GROUPS &&
  4004. REPLACE_KEEPS_$0 &&
  4005. !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  4006. )) ||
  4007. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  4008. ) {
  4009. var nativeRegExpMethod = /./[SYMBOL];
  4010. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  4011. if (regexp.exec === regexpExec) {
  4012. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  4013. // The native String method already delegates to @@method (this
  4014. // polyfilled function), leasing to infinite recursion.
  4015. // We avoid it by directly calling the native @@method method.
  4016. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  4017. }
  4018. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  4019. }
  4020. return { done: false };
  4021. }, {
  4022. REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
  4023. REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
  4024. });
  4025. var stringMethod = methods[0];
  4026. var regexMethod = methods[1];
  4027. redefine(String.prototype, KEY, stringMethod);
  4028. redefine(RegExp.prototype, SYMBOL, length == 2
  4029. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  4030. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  4031. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  4032. // 21.2.5.6 RegExp.prototype[@@match](string)
  4033. // 21.2.5.9 RegExp.prototype[@@search](string)
  4034. : function (string) { return regexMethod.call(string, this); }
  4035. );
  4036. }
  4037. if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
  4038. };
  4039. var charAt = stringMultibyte.charAt;
  4040. // `AdvanceStringIndex` abstract operation
  4041. // https://tc39.es/ecma262/#sec-advancestringindex
  4042. var advanceStringIndex = function (S, index, unicode) {
  4043. return index + (unicode ? charAt(S, index).length : 1);
  4044. };
  4045. // `RegExpExec` abstract operation
  4046. // https://tc39.es/ecma262/#sec-regexpexec
  4047. var regexpExecAbstract = function (R, S) {
  4048. var exec = R.exec;
  4049. if (typeof exec === 'function') {
  4050. var result = exec.call(R, S);
  4051. if (typeof result !== 'object') {
  4052. throw TypeError('RegExp exec method returned something other than an Object or null');
  4053. }
  4054. return result;
  4055. }
  4056. if (classofRaw(R) !== 'RegExp') {
  4057. throw TypeError('RegExp#exec called on incompatible receiver');
  4058. }
  4059. return regexpExec.call(R, S);
  4060. };
  4061. var arrayPush = [].push;
  4062. var min$3 = Math.min;
  4063. var MAX_UINT32 = 0xFFFFFFFF;
  4064. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  4065. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  4066. // @@split logic
  4067. fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
  4068. var internalSplit;
  4069. if (
  4070. 'abbc'.split(/(b)*/)[1] == 'c' ||
  4071. 'test'.split(/(?:)/, -1).length != 4 ||
  4072. 'ab'.split(/(?:ab)*/).length != 2 ||
  4073. '.'.split(/(.?)(.?)/).length != 4 ||
  4074. '.'.split(/()()/).length > 1 ||
  4075. ''.split(/.?/).length
  4076. ) {
  4077. // based on es5-shim implementation, need to rework it
  4078. internalSplit = function (separator, limit) {
  4079. var string = String(requireObjectCoercible(this));
  4080. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  4081. if (lim === 0) return [];
  4082. if (separator === undefined) return [string];
  4083. // If `separator` is not a regex, use native split
  4084. if (!isRegexp(separator)) {
  4085. return nativeSplit.call(string, separator, lim);
  4086. }
  4087. var output = [];
  4088. var flags = (separator.ignoreCase ? 'i' : '') +
  4089. (separator.multiline ? 'm' : '') +
  4090. (separator.unicode ? 'u' : '') +
  4091. (separator.sticky ? 'y' : '');
  4092. var lastLastIndex = 0;
  4093. // Make `global` and avoid `lastIndex` issues by working with a copy
  4094. var separatorCopy = new RegExp(separator.source, flags + 'g');
  4095. var match, lastIndex, lastLength;
  4096. while (match = regexpExec.call(separatorCopy, string)) {
  4097. lastIndex = separatorCopy.lastIndex;
  4098. if (lastIndex > lastLastIndex) {
  4099. output.push(string.slice(lastLastIndex, match.index));
  4100. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  4101. lastLength = match[0].length;
  4102. lastLastIndex = lastIndex;
  4103. if (output.length >= lim) break;
  4104. }
  4105. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  4106. }
  4107. if (lastLastIndex === string.length) {
  4108. if (lastLength || !separatorCopy.test('')) output.push('');
  4109. } else output.push(string.slice(lastLastIndex));
  4110. return output.length > lim ? output.slice(0, lim) : output;
  4111. };
  4112. // Chakra, V8
  4113. } else if ('0'.split(undefined, 0).length) {
  4114. internalSplit = function (separator, limit) {
  4115. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  4116. };
  4117. } else internalSplit = nativeSplit;
  4118. return [
  4119. // `String.prototype.split` method
  4120. // https://tc39.es/ecma262/#sec-string.prototype.split
  4121. function split(separator, limit) {
  4122. var O = requireObjectCoercible(this);
  4123. var splitter = separator == undefined ? undefined : separator[SPLIT];
  4124. return splitter !== undefined
  4125. ? splitter.call(separator, O, limit)
  4126. : internalSplit.call(String(O), separator, limit);
  4127. },
  4128. // `RegExp.prototype[@@split]` method
  4129. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  4130. //
  4131. // NOTE: This cannot be properly polyfilled in engines that don't support
  4132. // the 'y' flag.
  4133. function (regexp, limit) {
  4134. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  4135. if (res.done) return res.value;
  4136. var rx = anObject(regexp);
  4137. var S = String(this);
  4138. var C = speciesConstructor(rx, RegExp);
  4139. var unicodeMatching = rx.unicode;
  4140. var flags = (rx.ignoreCase ? 'i' : '') +
  4141. (rx.multiline ? 'm' : '') +
  4142. (rx.unicode ? 'u' : '') +
  4143. (SUPPORTS_Y ? 'y' : 'g');
  4144. // ^(? + rx + ) is needed, in combination with some S slicing, to
  4145. // simulate the 'y' flag.
  4146. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  4147. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  4148. if (lim === 0) return [];
  4149. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  4150. var p = 0;
  4151. var q = 0;
  4152. var A = [];
  4153. while (q < S.length) {
  4154. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  4155. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  4156. var e;
  4157. if (
  4158. z === null ||
  4159. (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  4160. ) {
  4161. q = advanceStringIndex(S, q, unicodeMatching);
  4162. } else {
  4163. A.push(S.slice(p, q));
  4164. if (A.length === lim) return A;
  4165. for (var i = 1; i <= z.length - 1; i++) {
  4166. A.push(z[i]);
  4167. if (A.length === lim) return A;
  4168. }
  4169. q = p = e;
  4170. }
  4171. }
  4172. A.push(S.slice(p));
  4173. return A;
  4174. }
  4175. ];
  4176. }, !SUPPORTS_Y);
  4177. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  4178. var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
  4179. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  4180. // We can't use this feature detection in V8 since it causes
  4181. // deoptimization and serious performance degradation
  4182. // https://github.com/zloirock/core-js/issues/679
  4183. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  4184. var array = [];
  4185. array[IS_CONCAT_SPREADABLE] = false;
  4186. return array.concat()[0] !== array;
  4187. });
  4188. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  4189. var isConcatSpreadable = function (O) {
  4190. if (!isObject(O)) return false;
  4191. var spreadable = O[IS_CONCAT_SPREADABLE];
  4192. return spreadable !== undefined ? !!spreadable : isArray(O);
  4193. };
  4194. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  4195. // `Array.prototype.concat` method
  4196. // https://tc39.es/ecma262/#sec-array.prototype.concat
  4197. // with adding support of @@isConcatSpreadable and @@species
  4198. _export({ target: 'Array', proto: true, forced: FORCED }, {
  4199. concat: function concat(arg) { // eslint-disable-line no-unused-vars
  4200. var O = toObject(this);
  4201. var A = arraySpeciesCreate(O, 0);
  4202. var n = 0;
  4203. var i, k, length, len, E;
  4204. for (i = -1, length = arguments.length; i < length; i++) {
  4205. E = i === -1 ? O : arguments[i];
  4206. if (isConcatSpreadable(E)) {
  4207. len = toLength(E.length);
  4208. if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  4209. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  4210. } else {
  4211. if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  4212. createProperty(A, n++, E);
  4213. }
  4214. }
  4215. A.length = n;
  4216. return A;
  4217. }
  4218. });
  4219. var $find = arrayIteration.find;
  4220. var FIND = 'find';
  4221. var SKIPS_HOLES = true;
  4222. var USES_TO_LENGTH$2 = arrayMethodUsesToLength(FIND);
  4223. // Shouldn't skip holes
  4224. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  4225. // `Array.prototype.find` method
  4226. // https://tc39.es/ecma262/#sec-array.prototype.find
  4227. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$2 }, {
  4228. find: function find(callbackfn /* , that = undefined */) {
  4229. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  4230. }
  4231. });
  4232. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  4233. addToUnscopables(FIND);
  4234. var $indexOf = arrayIncludes.indexOf;
  4235. var nativeIndexOf = [].indexOf;
  4236. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  4237. var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
  4238. var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
  4239. // `Array.prototype.indexOf` method
  4240. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  4241. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 || !USES_TO_LENGTH$1 }, {
  4242. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  4243. return NEGATIVE_ZERO
  4244. // convert -0 to +0
  4245. ? nativeIndexOf.apply(this, arguments) || 0
  4246. : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  4247. }
  4248. });
  4249. var ARRAY_ITERATOR = 'Array Iterator';
  4250. var setInternalState$1 = internalState.set;
  4251. var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
  4252. // `Array.prototype.entries` method
  4253. // https://tc39.es/ecma262/#sec-array.prototype.entries
  4254. // `Array.prototype.keys` method
  4255. // https://tc39.es/ecma262/#sec-array.prototype.keys
  4256. // `Array.prototype.values` method
  4257. // https://tc39.es/ecma262/#sec-array.prototype.values
  4258. // `Array.prototype[@@iterator]` method
  4259. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  4260. // `CreateArrayIterator` internal method
  4261. // https://tc39.es/ecma262/#sec-createarrayiterator
  4262. var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
  4263. setInternalState$1(this, {
  4264. type: ARRAY_ITERATOR,
  4265. target: toIndexedObject(iterated), // target
  4266. index: 0, // next index
  4267. kind: kind // kind
  4268. });
  4269. // `%ArrayIteratorPrototype%.next` method
  4270. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  4271. }, function () {
  4272. var state = getInternalState(this);
  4273. var target = state.target;
  4274. var kind = state.kind;
  4275. var index = state.index++;
  4276. if (!target || index >= target.length) {
  4277. state.target = undefined;
  4278. return { value: undefined, done: true };
  4279. }
  4280. if (kind == 'keys') return { value: index, done: false };
  4281. if (kind == 'values') return { value: target[index], done: false };
  4282. return { value: [index, target[index]], done: false };
  4283. }, 'values');
  4284. // argumentsList[@@iterator] is %ArrayProto_values%
  4285. // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
  4286. // https://tc39.es/ecma262/#sec-createmappedargumentsobject
  4287. iterators.Arguments = iterators.Array;
  4288. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  4289. addToUnscopables('keys');
  4290. addToUnscopables('values');
  4291. addToUnscopables('entries');
  4292. var nativeJoin = [].join;
  4293. var ES3_STRINGS = indexedObject != Object;
  4294. var STRICT_METHOD = arrayMethodIsStrict('join', ',');
  4295. // `Array.prototype.join` method
  4296. // https://tc39.es/ecma262/#sec-array.prototype.join
  4297. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
  4298. join: function join(separator) {
  4299. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  4300. }
  4301. });
  4302. var defineProperty$3 = objectDefineProperty.f;
  4303. var FunctionPrototype = Function.prototype;
  4304. var FunctionPrototypeToString = FunctionPrototype.toString;
  4305. var nameRE = /^\s*function ([^ (]*)/;
  4306. var NAME = 'name';
  4307. // Function instances `.name` property
  4308. // https://tc39.es/ecma262/#sec-function-instances-name
  4309. if (descriptors && !(NAME in FunctionPrototype)) {
  4310. defineProperty$3(FunctionPrototype, NAME, {
  4311. configurable: true,
  4312. get: function () {
  4313. try {
  4314. return FunctionPrototypeToString.call(this).match(nameRE)[1];
  4315. } catch (error) {
  4316. return '';
  4317. }
  4318. }
  4319. });
  4320. }
  4321. // makes subclassing work correct for wrapped built-ins
  4322. var inheritIfRequired = function ($this, dummy, Wrapper) {
  4323. var NewTarget, NewTargetPrototype;
  4324. if (
  4325. // it can work only with native `setPrototypeOf`
  4326. objectSetPrototypeOf &&
  4327. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  4328. typeof (NewTarget = dummy.constructor) == 'function' &&
  4329. NewTarget !== Wrapper &&
  4330. isObject(NewTargetPrototype = NewTarget.prototype) &&
  4331. NewTargetPrototype !== Wrapper.prototype
  4332. ) objectSetPrototypeOf($this, NewTargetPrototype);
  4333. return $this;
  4334. };
  4335. // a string of all valid unicode whitespaces
  4336. // eslint-disable-next-line max-len
  4337. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  4338. var whitespace = '[' + whitespaces + ']';
  4339. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  4340. var rtrim = RegExp(whitespace + whitespace + '*$');
  4341. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  4342. var createMethod = function (TYPE) {
  4343. return function ($this) {
  4344. var string = String(requireObjectCoercible($this));
  4345. if (TYPE & 1) string = string.replace(ltrim, '');
  4346. if (TYPE & 2) string = string.replace(rtrim, '');
  4347. return string;
  4348. };
  4349. };
  4350. var stringTrim = {
  4351. // `String.prototype.{ trimLeft, trimStart }` methods
  4352. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  4353. start: createMethod(1),
  4354. // `String.prototype.{ trimRight, trimEnd }` methods
  4355. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  4356. end: createMethod(2),
  4357. // `String.prototype.trim` method
  4358. // https://tc39.es/ecma262/#sec-string.prototype.trim
  4359. trim: createMethod(3)
  4360. };
  4361. var getOwnPropertyNames = objectGetOwnPropertyNames.f;
  4362. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  4363. var defineProperty$2 = objectDefineProperty.f;
  4364. var trim = stringTrim.trim;
  4365. var NUMBER = 'Number';
  4366. var NativeNumber = global_1[NUMBER];
  4367. var NumberPrototype = NativeNumber.prototype;
  4368. // Opera ~12 has broken Object#toString
  4369. var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
  4370. // `ToNumber` abstract operation
  4371. // https://tc39.es/ecma262/#sec-tonumber
  4372. var toNumber = function (argument) {
  4373. var it = toPrimitive(argument, false);
  4374. var first, third, radix, maxCode, digits, length, index, code;
  4375. if (typeof it == 'string' && it.length > 2) {
  4376. it = trim(it);
  4377. first = it.charCodeAt(0);
  4378. if (first === 43 || first === 45) {
  4379. third = it.charCodeAt(2);
  4380. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  4381. } else if (first === 48) {
  4382. switch (it.charCodeAt(1)) {
  4383. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  4384. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  4385. default: return +it;
  4386. }
  4387. digits = it.slice(2);
  4388. length = digits.length;
  4389. for (index = 0; index < length; index++) {
  4390. code = digits.charCodeAt(index);
  4391. // parseInt parses a string to a first unavailable symbol
  4392. // but ToNumber should return NaN if a string contains unavailable symbols
  4393. if (code < 48 || code > maxCode) return NaN;
  4394. } return parseInt(digits, radix);
  4395. }
  4396. } return +it;
  4397. };
  4398. // `Number` constructor
  4399. // https://tc39.es/ecma262/#sec-number-constructor
  4400. if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  4401. var NumberWrapper = function Number(value) {
  4402. var it = arguments.length < 1 ? 0 : value;
  4403. var dummy = this;
  4404. return dummy instanceof NumberWrapper
  4405. // check on 1..constructor(foo) case
  4406. && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
  4407. ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
  4408. };
  4409. for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : (
  4410. // ES3:
  4411. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  4412. // ES2015 (in case, if modules with ES2015 Number statics required before):
  4413. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
  4414. 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' +
  4415. // ESNext
  4416. 'fromString,range'
  4417. ).split(','), j = 0, key; keys.length > j; j++) {
  4418. if (has$1(NativeNumber, key = keys[j]) && !has$1(NumberWrapper, key)) {
  4419. defineProperty$2(NumberWrapper, key, getOwnPropertyDescriptor$1(NativeNumber, key));
  4420. }
  4421. }
  4422. NumberWrapper.prototype = NumberPrototype;
  4423. NumberPrototype.constructor = NumberWrapper;
  4424. redefine(global_1, NUMBER, NumberWrapper);
  4425. }
  4426. var nativeAssign = Object.assign;
  4427. var defineProperty$1 = Object.defineProperty;
  4428. // `Object.assign` method
  4429. // https://tc39.es/ecma262/#sec-object.assign
  4430. var objectAssign = !nativeAssign || fails(function () {
  4431. // should have correct order of operations (Edge bug)
  4432. if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$1({}, 'a', {
  4433. enumerable: true,
  4434. get: function () {
  4435. defineProperty$1(this, 'b', {
  4436. value: 3,
  4437. enumerable: false
  4438. });
  4439. }
  4440. }), { b: 2 })).b !== 1) return true;
  4441. // should work with symbols and should have deterministic property order (V8 bug)
  4442. var A = {};
  4443. var B = {};
  4444. // eslint-disable-next-line no-undef
  4445. var symbol = Symbol();
  4446. var alphabet = 'abcdefghijklmnopqrst';
  4447. A[symbol] = 7;
  4448. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  4449. return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
  4450. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  4451. var T = toObject(target);
  4452. var argumentsLength = arguments.length;
  4453. var index = 1;
  4454. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  4455. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  4456. while (argumentsLength > index) {
  4457. var S = indexedObject(arguments[index++]);
  4458. var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
  4459. var length = keys.length;
  4460. var j = 0;
  4461. var key;
  4462. while (length > j) {
  4463. key = keys[j++];
  4464. if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
  4465. }
  4466. } return T;
  4467. } : nativeAssign;
  4468. // `Object.assign` method
  4469. // https://tc39.es/ecma262/#sec-object.assign
  4470. _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
  4471. assign: objectAssign
  4472. });
  4473. var $values = objectToArray.values;
  4474. // `Object.values` method
  4475. // https://tc39.es/ecma262/#sec-object.values
  4476. _export({ target: 'Object', stat: true }, {
  4477. values: function values(O) {
  4478. return $values(O);
  4479. }
  4480. });
  4481. var freezing = !fails(function () {
  4482. return Object.isExtensible(Object.preventExtensions({}));
  4483. });
  4484. var internalMetadata = createCommonjsModule(function (module) {
  4485. var defineProperty = objectDefineProperty.f;
  4486. var METADATA = uid('meta');
  4487. var id = 0;
  4488. var isExtensible = Object.isExtensible || function () {
  4489. return true;
  4490. };
  4491. var setMetadata = function (it) {
  4492. defineProperty(it, METADATA, { value: {
  4493. objectID: 'O' + ++id, // object ID
  4494. weakData: {} // weak collections IDs
  4495. } });
  4496. };
  4497. var fastKey = function (it, create) {
  4498. // return a primitive with prefix
  4499. if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  4500. if (!has$1(it, METADATA)) {
  4501. // can't set metadata to uncaught frozen object
  4502. if (!isExtensible(it)) return 'F';
  4503. // not necessary to add metadata
  4504. if (!create) return 'E';
  4505. // add missing metadata
  4506. setMetadata(it);
  4507. // return object ID
  4508. } return it[METADATA].objectID;
  4509. };
  4510. var getWeakData = function (it, create) {
  4511. if (!has$1(it, METADATA)) {
  4512. // can't set metadata to uncaught frozen object
  4513. if (!isExtensible(it)) return true;
  4514. // not necessary to add metadata
  4515. if (!create) return false;
  4516. // add missing metadata
  4517. setMetadata(it);
  4518. // return the store of weak collections IDs
  4519. } return it[METADATA].weakData;
  4520. };
  4521. // add metadata on freeze-family methods calling
  4522. var onFreeze = function (it) {
  4523. if (freezing && meta.REQUIRED && isExtensible(it) && !has$1(it, METADATA)) setMetadata(it);
  4524. return it;
  4525. };
  4526. var meta = module.exports = {
  4527. REQUIRED: false,
  4528. fastKey: fastKey,
  4529. getWeakData: getWeakData,
  4530. onFreeze: onFreeze
  4531. };
  4532. hiddenKeys$1[METADATA] = true;
  4533. });
  4534. internalMetadata.REQUIRED;
  4535. internalMetadata.fastKey;
  4536. internalMetadata.getWeakData;
  4537. internalMetadata.onFreeze;
  4538. var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
  4539. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  4540. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  4541. var ADDER = IS_MAP ? 'set' : 'add';
  4542. var NativeConstructor = global_1[CONSTRUCTOR_NAME];
  4543. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  4544. var Constructor = NativeConstructor;
  4545. var exported = {};
  4546. var fixMethod = function (KEY) {
  4547. var nativeMethod = NativePrototype[KEY];
  4548. redefine(NativePrototype, KEY,
  4549. KEY == 'add' ? function add(value) {
  4550. nativeMethod.call(this, value === 0 ? 0 : value);
  4551. return this;
  4552. } : KEY == 'delete' ? function (key) {
  4553. return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
  4554. } : KEY == 'get' ? function get(key) {
  4555. return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
  4556. } : KEY == 'has' ? function has(key) {
  4557. return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
  4558. } : function set(key, value) {
  4559. nativeMethod.call(this, key === 0 ? 0 : key, value);
  4560. return this;
  4561. }
  4562. );
  4563. };
  4564. // eslint-disable-next-line max-len
  4565. if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  4566. new NativeConstructor().entries().next();
  4567. })))) {
  4568. // create collection constructor
  4569. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  4570. internalMetadata.REQUIRED = true;
  4571. } else if (isForced_1(CONSTRUCTOR_NAME, true)) {
  4572. var instance = new Constructor();
  4573. // early implementations not supports chaining
  4574. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  4575. // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
  4576. var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
  4577. // most early implementations doesn't supports iterables, most modern - not close it correctly
  4578. // eslint-disable-next-line no-new
  4579. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
  4580. // for early implementations -0 and +0 not the same
  4581. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  4582. // V8 ~ Chromium 42- fails only with 5+ elements
  4583. var $instance = new NativeConstructor();
  4584. var index = 5;
  4585. while (index--) $instance[ADDER](index, index);
  4586. return !$instance.has(-0);
  4587. });
  4588. if (!ACCEPT_ITERABLES) {
  4589. Constructor = wrapper(function (dummy, iterable) {
  4590. anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
  4591. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  4592. if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
  4593. return that;
  4594. });
  4595. Constructor.prototype = NativePrototype;
  4596. NativePrototype.constructor = Constructor;
  4597. }
  4598. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  4599. fixMethod('delete');
  4600. fixMethod('has');
  4601. IS_MAP && fixMethod('get');
  4602. }
  4603. if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
  4604. // weak collections should not contains .clear method
  4605. if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
  4606. }
  4607. exported[CONSTRUCTOR_NAME] = Constructor;
  4608. _export({ global: true, forced: Constructor != NativeConstructor }, exported);
  4609. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  4610. if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  4611. return Constructor;
  4612. };
  4613. var defineProperty = objectDefineProperty.f;
  4614. var fastKey = internalMetadata.fastKey;
  4615. var setInternalState = internalState.set;
  4616. var internalStateGetterFor = internalState.getterFor;
  4617. var collectionStrong = {
  4618. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  4619. var C = wrapper(function (that, iterable) {
  4620. anInstance(that, C, CONSTRUCTOR_NAME);
  4621. setInternalState(that, {
  4622. type: CONSTRUCTOR_NAME,
  4623. index: objectCreate(null),
  4624. first: undefined,
  4625. last: undefined,
  4626. size: 0
  4627. });
  4628. if (!descriptors) that.size = 0;
  4629. if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
  4630. });
  4631. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  4632. var define = function (that, key, value) {
  4633. var state = getInternalState(that);
  4634. var entry = getEntry(that, key);
  4635. var previous, index;
  4636. // change existing entry
  4637. if (entry) {
  4638. entry.value = value;
  4639. // create new entry
  4640. } else {
  4641. state.last = entry = {
  4642. index: index = fastKey(key, true),
  4643. key: key,
  4644. value: value,
  4645. previous: previous = state.last,
  4646. next: undefined,
  4647. removed: false
  4648. };
  4649. if (!state.first) state.first = entry;
  4650. if (previous) previous.next = entry;
  4651. if (descriptors) state.size++;
  4652. else that.size++;
  4653. // add to index
  4654. if (index !== 'F') state.index[index] = entry;
  4655. } return that;
  4656. };
  4657. var getEntry = function (that, key) {
  4658. var state = getInternalState(that);
  4659. // fast case
  4660. var index = fastKey(key);
  4661. var entry;
  4662. if (index !== 'F') return state.index[index];
  4663. // frozen object case
  4664. for (entry = state.first; entry; entry = entry.next) {
  4665. if (entry.key == key) return entry;
  4666. }
  4667. };
  4668. redefineAll(C.prototype, {
  4669. // 23.1.3.1 Map.prototype.clear()
  4670. // 23.2.3.2 Set.prototype.clear()
  4671. clear: function clear() {
  4672. var that = this;
  4673. var state = getInternalState(that);
  4674. var data = state.index;
  4675. var entry = state.first;
  4676. while (entry) {
  4677. entry.removed = true;
  4678. if (entry.previous) entry.previous = entry.previous.next = undefined;
  4679. delete data[entry.index];
  4680. entry = entry.next;
  4681. }
  4682. state.first = state.last = undefined;
  4683. if (descriptors) state.size = 0;
  4684. else that.size = 0;
  4685. },
  4686. // 23.1.3.3 Map.prototype.delete(key)
  4687. // 23.2.3.4 Set.prototype.delete(value)
  4688. 'delete': function (key) {
  4689. var that = this;
  4690. var state = getInternalState(that);
  4691. var entry = getEntry(that, key);
  4692. if (entry) {
  4693. var next = entry.next;
  4694. var prev = entry.previous;
  4695. delete state.index[entry.index];
  4696. entry.removed = true;
  4697. if (prev) prev.next = next;
  4698. if (next) next.previous = prev;
  4699. if (state.first == entry) state.first = next;
  4700. if (state.last == entry) state.last = prev;
  4701. if (descriptors) state.size--;
  4702. else that.size--;
  4703. } return !!entry;
  4704. },
  4705. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  4706. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  4707. forEach: function forEach(callbackfn /* , that = undefined */) {
  4708. var state = getInternalState(this);
  4709. var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  4710. var entry;
  4711. while (entry = entry ? entry.next : state.first) {
  4712. boundFunction(entry.value, entry.key, this);
  4713. // revert to the last existing entry
  4714. while (entry && entry.removed) entry = entry.previous;
  4715. }
  4716. },
  4717. // 23.1.3.7 Map.prototype.has(key)
  4718. // 23.2.3.7 Set.prototype.has(value)
  4719. has: function has(key) {
  4720. return !!getEntry(this, key);
  4721. }
  4722. });
  4723. redefineAll(C.prototype, IS_MAP ? {
  4724. // 23.1.3.6 Map.prototype.get(key)
  4725. get: function get(key) {
  4726. var entry = getEntry(this, key);
  4727. return entry && entry.value;
  4728. },
  4729. // 23.1.3.9 Map.prototype.set(key, value)
  4730. set: function set(key, value) {
  4731. return define(this, key === 0 ? 0 : key, value);
  4732. }
  4733. } : {
  4734. // 23.2.3.1 Set.prototype.add(value)
  4735. add: function add(value) {
  4736. return define(this, value = value === 0 ? 0 : value, value);
  4737. }
  4738. });
  4739. if (descriptors) defineProperty(C.prototype, 'size', {
  4740. get: function () {
  4741. return getInternalState(this).size;
  4742. }
  4743. });
  4744. return C;
  4745. },
  4746. setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
  4747. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  4748. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  4749. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  4750. // add .keys, .values, .entries, [@@iterator]
  4751. // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
  4752. defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
  4753. setInternalState(this, {
  4754. type: ITERATOR_NAME,
  4755. target: iterated,
  4756. state: getInternalCollectionState(iterated),
  4757. kind: kind,
  4758. last: undefined
  4759. });
  4760. }, function () {
  4761. var state = getInternalIteratorState(this);
  4762. var kind = state.kind;
  4763. var entry = state.last;
  4764. // revert to the last existing entry
  4765. while (entry && entry.removed) entry = entry.previous;
  4766. // get next entry
  4767. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  4768. // or finish the iteration
  4769. state.target = undefined;
  4770. return { value: undefined, done: true };
  4771. }
  4772. // return step by kind
  4773. if (kind == 'keys') return { value: entry.key, done: false };
  4774. if (kind == 'values') return { value: entry.value, done: false };
  4775. return { value: [entry.key, entry.value], done: false };
  4776. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  4777. // add [@@species], 23.1.2.2, 23.2.2.2
  4778. setSpecies(CONSTRUCTOR_NAME);
  4779. }
  4780. };
  4781. // `Set` constructor
  4782. // https://tc39.es/ecma262/#sec-set-objects
  4783. collection('Set', function (init) {
  4784. return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
  4785. }, collectionStrong);
  4786. // @@match logic
  4787. fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
  4788. return [
  4789. // `String.prototype.match` method
  4790. // https://tc39.es/ecma262/#sec-string.prototype.match
  4791. function match(regexp) {
  4792. var O = requireObjectCoercible(this);
  4793. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  4794. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  4795. },
  4796. // `RegExp.prototype[@@match]` method
  4797. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  4798. function (regexp) {
  4799. var res = maybeCallNative(nativeMatch, regexp, this);
  4800. if (res.done) return res.value;
  4801. var rx = anObject(regexp);
  4802. var S = String(this);
  4803. if (!rx.global) return regexpExecAbstract(rx, S);
  4804. var fullUnicode = rx.unicode;
  4805. rx.lastIndex = 0;
  4806. var A = [];
  4807. var n = 0;
  4808. var result;
  4809. while ((result = regexpExecAbstract(rx, S)) !== null) {
  4810. var matchStr = String(result[0]);
  4811. A[n] = matchStr;
  4812. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  4813. n++;
  4814. }
  4815. return n === 0 ? null : A;
  4816. }
  4817. ];
  4818. });
  4819. var floor = Math.floor;
  4820. var replace = ''.replace;
  4821. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
  4822. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
  4823. // https://tc39.es/ecma262/#sec-getsubstitution
  4824. var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
  4825. var tailPos = position + matched.length;
  4826. var m = captures.length;
  4827. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  4828. if (namedCaptures !== undefined) {
  4829. namedCaptures = toObject(namedCaptures);
  4830. symbols = SUBSTITUTION_SYMBOLS;
  4831. }
  4832. return replace.call(replacement, symbols, function (match, ch) {
  4833. var capture;
  4834. switch (ch.charAt(0)) {
  4835. case '$': return '$';
  4836. case '&': return matched;
  4837. case '`': return str.slice(0, position);
  4838. case "'": return str.slice(tailPos);
  4839. case '<':
  4840. capture = namedCaptures[ch.slice(1, -1)];
  4841. break;
  4842. default: // \d\d?
  4843. var n = +ch;
  4844. if (n === 0) return match;
  4845. if (n > m) {
  4846. var f = floor(n / 10);
  4847. if (f === 0) return match;
  4848. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  4849. return match;
  4850. }
  4851. capture = captures[n - 1];
  4852. }
  4853. return capture === undefined ? '' : capture;
  4854. });
  4855. };
  4856. var max$1 = Math.max;
  4857. var min$2 = Math.min;
  4858. var maybeToString = function (it) {
  4859. return it === undefined ? it : String(it);
  4860. };
  4861. // @@replace logic
  4862. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
  4863. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
  4864. var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
  4865. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  4866. return [
  4867. // `String.prototype.replace` method
  4868. // https://tc39.es/ecma262/#sec-string.prototype.replace
  4869. function replace(searchValue, replaceValue) {
  4870. var O = requireObjectCoercible(this);
  4871. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  4872. return replacer !== undefined
  4873. ? replacer.call(searchValue, O, replaceValue)
  4874. : nativeReplace.call(String(O), searchValue, replaceValue);
  4875. },
  4876. // `RegExp.prototype[@@replace]` method
  4877. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  4878. function (regexp, replaceValue) {
  4879. if (
  4880. (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
  4881. (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
  4882. ) {
  4883. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  4884. if (res.done) return res.value;
  4885. }
  4886. var rx = anObject(regexp);
  4887. var S = String(this);
  4888. var functionalReplace = typeof replaceValue === 'function';
  4889. if (!functionalReplace) replaceValue = String(replaceValue);
  4890. var global = rx.global;
  4891. if (global) {
  4892. var fullUnicode = rx.unicode;
  4893. rx.lastIndex = 0;
  4894. }
  4895. var results = [];
  4896. while (true) {
  4897. var result = regexpExecAbstract(rx, S);
  4898. if (result === null) break;
  4899. results.push(result);
  4900. if (!global) break;
  4901. var matchStr = String(result[0]);
  4902. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  4903. }
  4904. var accumulatedResult = '';
  4905. var nextSourcePosition = 0;
  4906. for (var i = 0; i < results.length; i++) {
  4907. result = results[i];
  4908. var matched = String(result[0]);
  4909. var position = max$1(min$2(toInteger(result.index), S.length), 0);
  4910. var captures = [];
  4911. // NOTE: This is equivalent to
  4912. // captures = result.slice(1).map(maybeToString)
  4913. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  4914. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  4915. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  4916. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  4917. var namedCaptures = result.groups;
  4918. if (functionalReplace) {
  4919. var replacerArgs = [matched].concat(captures, position, S);
  4920. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  4921. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  4922. } else {
  4923. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  4924. }
  4925. if (position >= nextSourcePosition) {
  4926. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  4927. nextSourcePosition = position + matched.length;
  4928. }
  4929. }
  4930. return accumulatedResult + S.slice(nextSourcePosition);
  4931. }
  4932. ];
  4933. });
  4934. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  4935. var nativeStartsWith = ''.startsWith;
  4936. var min$1 = Math.min;
  4937. var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');
  4938. // https://github.com/zloirock/core-js/pull/702
  4939. var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
  4940. var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
  4941. return descriptor && !descriptor.writable;
  4942. }();
  4943. // `String.prototype.startsWith` method
  4944. // https://tc39.es/ecma262/#sec-string.prototype.startswith
  4945. _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
  4946. startsWith: function startsWith(searchString /* , position = 0 */) {
  4947. var that = String(requireObjectCoercible(this));
  4948. notARegexp(searchString);
  4949. var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
  4950. var search = String(searchString);
  4951. return nativeStartsWith
  4952. ? nativeStartsWith.call(that, search, index)
  4953. : that.slice(index, index + search.length) === search;
  4954. }
  4955. });
  4956. var non = '\u200B\u0085\u180E';
  4957. // check that a method works with the correct list
  4958. // of whitespaces and has a correct name
  4959. var stringTrimForced = function (METHOD_NAME) {
  4960. return fails(function () {
  4961. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  4962. });
  4963. };
  4964. var $trim = stringTrim.trim;
  4965. // `String.prototype.trim` method
  4966. // https://tc39.es/ecma262/#sec-string.prototype.trim
  4967. _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
  4968. trim: function trim() {
  4969. return $trim(this);
  4970. }
  4971. });
  4972. var ITERATOR = wellKnownSymbol('iterator');
  4973. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  4974. var ArrayValues = es_array_iterator.values;
  4975. for (var COLLECTION_NAME in domIterables) {
  4976. var Collection = global_1[COLLECTION_NAME];
  4977. var CollectionPrototype = Collection && Collection.prototype;
  4978. if (CollectionPrototype) {
  4979. // some Chrome versions have non-configurable methods on DOMTokenList
  4980. if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
  4981. createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
  4982. } catch (error) {
  4983. CollectionPrototype[ITERATOR] = ArrayValues;
  4984. }
  4985. if (!CollectionPrototype[TO_STRING_TAG]) {
  4986. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  4987. }
  4988. if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
  4989. // some Chrome versions have non-configurable methods on DOMTokenList
  4990. if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
  4991. createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
  4992. } catch (error) {
  4993. CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
  4994. }
  4995. }
  4996. }
  4997. }
  4998. var _this3 = undefined;
  4999. // Thanks @stimulus:
  5000. // https://github.com/stimulusjs/stimulus/blob/master/packages/%40stimulus/core/src/application.ts
  5001. function domReady() {
  5002. var _this = this;
  5003. return new Promise(function (resolve) {
  5004. _newArrowCheck(this, _this);
  5005. if (document.readyState == "loading") {
  5006. document.addEventListener("DOMContentLoaded", resolve);
  5007. } else {
  5008. resolve();
  5009. }
  5010. }.bind(this));
  5011. }
  5012. function arrayUnique(array) {
  5013. return Array.from(new Set(array));
  5014. }
  5015. function isTesting() {
  5016. return navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom");
  5017. }
  5018. function checkedAttrLooseCompare(valueA, valueB) {
  5019. return valueA == valueB;
  5020. }
  5021. function warnIfMalformedTemplate(el, directive) {
  5022. if (el.tagName.toLowerCase() !== 'template') {
  5023. console.warn("Alpine: [".concat(directive, "] directive should only be added to <template> tags. See https://github.com/alpinejs/alpine#").concat(directive));
  5024. } else if (el.content.childElementCount !== 1) {
  5025. console.warn("Alpine: <template> tag with [".concat(directive, "] encountered with an unexpected number of root elements. Make sure <template> has a single root element. "));
  5026. }
  5027. }
  5028. function kebabCase(subject) {
  5029. return subject.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/[_\s]/, '-').toLowerCase();
  5030. }
  5031. function camelCase(subject) {
  5032. var _this2 = this;
  5033. return subject.toLowerCase().replace(/-(\w)/g, function (match, _char) {
  5034. _newArrowCheck(this, _this2);
  5035. return _char.toUpperCase();
  5036. }.bind(this));
  5037. }
  5038. function walk(el, callback) {
  5039. if (callback(el) === false) return;
  5040. var node = el.firstElementChild;
  5041. while (node) {
  5042. walk(node, callback);
  5043. node = node.nextElementSibling;
  5044. }
  5045. }
  5046. function debounce(func, wait) {
  5047. var timeout;
  5048. return function () {
  5049. var context = this,
  5050. args = arguments;
  5051. var later = function later() {
  5052. timeout = null;
  5053. func.apply(context, args);
  5054. };
  5055. clearTimeout(timeout);
  5056. timeout = setTimeout(later, wait);
  5057. };
  5058. }
  5059. var handleError = function handleError(el, expression, error) {
  5060. _newArrowCheck(this, _this3);
  5061. console.warn("Alpine Error: \"".concat(error, "\"\n\nExpression: \"").concat(expression, "\"\nElement:"), el);
  5062. if (!isTesting()) {
  5063. Object.assign(error, {
  5064. el: el,
  5065. expression: expression
  5066. });
  5067. throw error;
  5068. }
  5069. }.bind(undefined);
  5070. function tryCatch(cb, _ref) {
  5071. var _this4 = this;
  5072. var el = _ref.el,
  5073. expression = _ref.expression;
  5074. try {
  5075. var value = cb();
  5076. return value instanceof Promise ? value["catch"](function (e) {
  5077. _newArrowCheck(this, _this4);
  5078. return handleError(el, expression, e);
  5079. }.bind(this)) : value;
  5080. } catch (e) {
  5081. handleError(el, expression, e);
  5082. }
  5083. }
  5084. function saferEval(el, expression, dataContext) {
  5085. var _this5 = this;
  5086. var additionalHelperVariables = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  5087. return tryCatch(function () {
  5088. _newArrowCheck(this, _this5);
  5089. if (typeof expression === 'function') {
  5090. return expression.call(dataContext);
  5091. }
  5092. return new Function(['$data'].concat(_toConsumableArray(Object.keys(additionalHelperVariables))), "var __alpine_result; with($data) { __alpine_result = ".concat(expression, " }; return __alpine_result")).apply(void 0, [dataContext].concat(_toConsumableArray(Object.values(additionalHelperVariables))));
  5093. }.bind(this), {
  5094. el: el,
  5095. expression: expression
  5096. });
  5097. }
  5098. function saferEvalNoReturn(el, expression, dataContext) {
  5099. var _this6 = this;
  5100. var additionalHelperVariables = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  5101. return tryCatch(function () {
  5102. _newArrowCheck(this, _this6);
  5103. if (typeof expression === 'function') {
  5104. return Promise.resolve(expression.call(dataContext, additionalHelperVariables['$event']));
  5105. }
  5106. var AsyncFunction = Function; // For the cases when users pass only a function reference to the caller: `x-on:click="foo"`
  5107. // Where "foo" is a function. Also, we'll pass the function the event instance when we call it.
  5108. if (Object.keys(dataContext).includes(expression)) {
  5109. var methodReference = new Function(['dataContext'].concat(_toConsumableArray(Object.keys(additionalHelperVariables))), "with(dataContext) { return ".concat(expression, " }")).apply(void 0, [dataContext].concat(_toConsumableArray(Object.values(additionalHelperVariables))));
  5110. if (typeof methodReference === 'function') {
  5111. return Promise.resolve(methodReference.call(dataContext, additionalHelperVariables['$event']));
  5112. } else {
  5113. return Promise.resolve();
  5114. }
  5115. }
  5116. return Promise.resolve(new AsyncFunction(['dataContext'].concat(_toConsumableArray(Object.keys(additionalHelperVariables))), "with(dataContext) { ".concat(expression, " }")).apply(void 0, [dataContext].concat(_toConsumableArray(Object.values(additionalHelperVariables)))));
  5117. }.bind(this), {
  5118. el: el,
  5119. expression: expression
  5120. });
  5121. }
  5122. var xAttrRE = /^x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref|spread)\b/;
  5123. function isXAttr(attr) {
  5124. var name = replaceAtAndColonWithStandardSyntax(attr.name);
  5125. return xAttrRE.test(name);
  5126. }
  5127. function getXAttrs(el, component, type) {
  5128. var _this7 = this;
  5129. var directives = Array.from(el.attributes).filter(isXAttr).map(parseHtmlAttribute); // Get an object of directives from x-spread.
  5130. var spreadDirective = directives.filter(function (directive) {
  5131. _newArrowCheck(this, _this7);
  5132. return directive.type === 'spread';
  5133. }.bind(this))[0];
  5134. if (spreadDirective) {
  5135. var spreadObject = saferEval(el, spreadDirective.expression, component.$data); // Add x-spread directives to the pile of existing directives.
  5136. directives = directives.concat(Object.entries(spreadObject).map(function (_ref2) {
  5137. _newArrowCheck(this, _this7);
  5138. var _ref3 = _slicedToArray(_ref2, 2),
  5139. name = _ref3[0],
  5140. value = _ref3[1];
  5141. return parseHtmlAttribute({
  5142. name: name,
  5143. value: value
  5144. });
  5145. }.bind(this)));
  5146. }
  5147. if (type) return directives.filter(function (i) {
  5148. _newArrowCheck(this, _this7);
  5149. return i.type === type;
  5150. }.bind(this));
  5151. return sortDirectives(directives);
  5152. }
  5153. function sortDirectives(directives) {
  5154. var _this8 = this;
  5155. var directiveOrder = ['bind', 'model', 'show', 'catch-all'];
  5156. return directives.sort(function (a, b) {
  5157. _newArrowCheck(this, _this8);
  5158. var typeA = directiveOrder.indexOf(a.type) === -1 ? 'catch-all' : a.type;
  5159. var typeB = directiveOrder.indexOf(b.type) === -1 ? 'catch-all' : b.type;
  5160. return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
  5161. }.bind(this));
  5162. }
  5163. function parseHtmlAttribute(_ref4) {
  5164. var _this9 = this;
  5165. var name = _ref4.name,
  5166. value = _ref4.value;
  5167. var normalizedName = replaceAtAndColonWithStandardSyntax(name);
  5168. var typeMatch = normalizedName.match(xAttrRE);
  5169. var valueMatch = normalizedName.match(/:([a-zA-Z0-9\-:]+)/);
  5170. var modifiers = normalizedName.match(/\.[^.\]]+(?=[^\]]*$)/g) || [];
  5171. return {
  5172. type: typeMatch ? typeMatch[1] : null,
  5173. value: valueMatch ? valueMatch[1] : null,
  5174. modifiers: modifiers.map(function (i) {
  5175. _newArrowCheck(this, _this9);
  5176. return i.replace('.', '');
  5177. }.bind(this)),
  5178. expression: value
  5179. };
  5180. }
  5181. function isBooleanAttr(attrName) {
  5182. // As per HTML spec table https://html.spec.whatwg.org/multipage/indices.html#attributes-3:boolean-attribute
  5183. // Array roughly ordered by estimated usage
  5184. var booleanAttributes = ['disabled', 'checked', 'required', 'readonly', 'hidden', 'open', 'selected', 'autofocus', 'itemscope', 'multiple', 'novalidate', 'allowfullscreen', 'allowpaymentrequest', 'formnovalidate', 'autoplay', 'controls', 'loop', 'muted', 'playsinline', 'default', 'ismap', 'reversed', 'async', 'defer', 'nomodule'];
  5185. return booleanAttributes.includes(attrName);
  5186. }
  5187. function replaceAtAndColonWithStandardSyntax(name) {
  5188. if (name.startsWith('@')) {
  5189. return name.replace('@', 'x-on:');
  5190. } else if (name.startsWith(':')) {
  5191. return name.replace(':', 'x-bind:');
  5192. }
  5193. return name;
  5194. }
  5195. function convertClassStringToArray(classList) {
  5196. var filterFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean;
  5197. return classList.split(' ').filter(filterFn);
  5198. }
  5199. var TRANSITION_TYPE_IN = 'in';
  5200. var TRANSITION_TYPE_OUT = 'out';
  5201. var TRANSITION_CANCELLED = 'cancelled';
  5202. function transitionIn(el, show, reject, component) {
  5203. var _this10 = this;
  5204. var forceSkip = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  5205. // We don't want to transition on the initial page load.
  5206. if (forceSkip) return show();
  5207. if (el.__x_transition && el.__x_transition.type === TRANSITION_TYPE_IN) {
  5208. // there is already a similar transition going on, this was probably triggered by
  5209. // a change in a different property, let's just leave the previous one doing its job
  5210. return;
  5211. }
  5212. var attrs = getXAttrs(el, component, 'transition');
  5213. var showAttr = getXAttrs(el, component, 'show')[0]; // If this is triggered by a x-show.transition.
  5214. if (showAttr && showAttr.modifiers.includes('transition')) {
  5215. var modifiers = showAttr.modifiers; // If x-show.transition.out, we'll skip the "in" transition.
  5216. if (modifiers.includes('out') && !modifiers.includes('in')) return show();
  5217. var settingBothSidesOfTransition = modifiers.includes('in') && modifiers.includes('out'); // If x-show.transition.in...out... only use "in" related modifiers for this transition.
  5218. modifiers = settingBothSidesOfTransition ? modifiers.filter(function (i, index) {
  5219. _newArrowCheck(this, _this10);
  5220. return index < modifiers.indexOf('out');
  5221. }.bind(this)) : modifiers;
  5222. transitionHelperIn(el, modifiers, show, reject); // Otherwise, we can assume x-transition:enter.
  5223. } else if (attrs.some(function (attr) {
  5224. _newArrowCheck(this, _this10);
  5225. return ['enter', 'enter-start', 'enter-end'].includes(attr.value);
  5226. }.bind(this))) {
  5227. transitionClassesIn(el, component, attrs, show, reject);
  5228. } else {
  5229. // If neither, just show that damn thing.
  5230. show();
  5231. }
  5232. }
  5233. function transitionOut(el, hide, reject, component) {
  5234. var _this11 = this;
  5235. var forceSkip = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  5236. // We don't want to transition on the initial page load.
  5237. if (forceSkip) return hide();
  5238. if (el.__x_transition && el.__x_transition.type === TRANSITION_TYPE_OUT) {
  5239. // there is already a similar transition going on, this was probably triggered by
  5240. // a change in a different property, let's just leave the previous one doing its job
  5241. return;
  5242. }
  5243. var attrs = getXAttrs(el, component, 'transition');
  5244. var showAttr = getXAttrs(el, component, 'show')[0];
  5245. if (showAttr && showAttr.modifiers.includes('transition')) {
  5246. var modifiers = showAttr.modifiers;
  5247. if (modifiers.includes('in') && !modifiers.includes('out')) return hide();
  5248. var settingBothSidesOfTransition = modifiers.includes('in') && modifiers.includes('out');
  5249. modifiers = settingBothSidesOfTransition ? modifiers.filter(function (i, index) {
  5250. _newArrowCheck(this, _this11);
  5251. return index > modifiers.indexOf('out');
  5252. }.bind(this)) : modifiers;
  5253. transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hide, reject);
  5254. } else if (attrs.some(function (attr) {
  5255. _newArrowCheck(this, _this11);
  5256. return ['leave', 'leave-start', 'leave-end'].includes(attr.value);
  5257. }.bind(this))) {
  5258. transitionClassesOut(el, component, attrs, hide, reject);
  5259. } else {
  5260. hide();
  5261. }
  5262. }
  5263. function transitionHelperIn(el, modifiers, showCallback, reject) {
  5264. var _this12 = this;
  5265. // Default values inspired by: https://material.io/design/motion/speed.html#duration
  5266. var styleValues = {
  5267. duration: modifierValue(modifiers, 'duration', 150),
  5268. origin: modifierValue(modifiers, 'origin', 'center'),
  5269. first: {
  5270. opacity: 0,
  5271. scale: modifierValue(modifiers, 'scale', 95)
  5272. },
  5273. second: {
  5274. opacity: 1,
  5275. scale: 100
  5276. }
  5277. };
  5278. transitionHelper(el, modifiers, showCallback, function () {
  5279. _newArrowCheck(this, _this12);
  5280. }.bind(this), reject, styleValues, TRANSITION_TYPE_IN);
  5281. }
  5282. function transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hideCallback, reject) {
  5283. var _this13 = this;
  5284. // Make the "out" transition .5x slower than the "in". (Visually better)
  5285. // HOWEVER, if they explicitly set a duration for the "out" transition,
  5286. // use that.
  5287. var duration = settingBothSidesOfTransition ? modifierValue(modifiers, 'duration', 150) : modifierValue(modifiers, 'duration', 150) / 2;
  5288. var styleValues = {
  5289. duration: duration,
  5290. origin: modifierValue(modifiers, 'origin', 'center'),
  5291. first: {
  5292. opacity: 1,
  5293. scale: 100
  5294. },
  5295. second: {
  5296. opacity: 0,
  5297. scale: modifierValue(modifiers, 'scale', 95)
  5298. }
  5299. };
  5300. transitionHelper(el, modifiers, function () {
  5301. _newArrowCheck(this, _this13);
  5302. }.bind(this), hideCallback, reject, styleValues, TRANSITION_TYPE_OUT);
  5303. }
  5304. function modifierValue(modifiers, key, fallback) {
  5305. // If the modifier isn't present, use the default.
  5306. if (modifiers.indexOf(key) === -1) return fallback; // If it IS present, grab the value after it: x-show.transition.duration.500ms
  5307. var rawValue = modifiers[modifiers.indexOf(key) + 1];
  5308. if (!rawValue) return fallback;
  5309. if (key === 'scale') {
  5310. // Check if the very next value is NOT a number and return the fallback.
  5311. // If x-show.transition.scale, we'll use the default scale value.
  5312. // That is how a user opts out of the opacity transition.
  5313. if (!isNumeric(rawValue)) return fallback;
  5314. }
  5315. if (key === 'duration') {
  5316. // Support x-show.transition.duration.500ms && duration.500
  5317. var match = rawValue.match(/([0-9]+)ms/);
  5318. if (match) return match[1];
  5319. }
  5320. if (key === 'origin') {
  5321. // Support chaining origin directions: x-show.transition.top.right
  5322. if (['top', 'right', 'left', 'center', 'bottom'].includes(modifiers[modifiers.indexOf(key) + 2])) {
  5323. return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(' ');
  5324. }
  5325. }
  5326. return rawValue;
  5327. }
  5328. function transitionHelper(el, modifiers, hook1, hook2, reject, styleValues, type) {
  5329. // clear the previous transition if exists to avoid caching the wrong styles
  5330. if (el.__x_transition) {
  5331. el.__x_transition.cancel && el.__x_transition.cancel();
  5332. } // If the user set these style values, we'll put them back when we're done with them.
  5333. var opacityCache = el.style.opacity;
  5334. var transformCache = el.style.transform;
  5335. var transformOriginCache = el.style.transformOrigin; // If no modifiers are present: x-show.transition, we'll default to both opacity and scale.
  5336. var noModifiers = !modifiers.includes('opacity') && !modifiers.includes('scale');
  5337. var transitionOpacity = noModifiers || modifiers.includes('opacity');
  5338. var transitionScale = noModifiers || modifiers.includes('scale'); // These are the explicit stages of a transition (same stages for in and for out).
  5339. // This way you can get a birds eye view of the hooks, and the differences
  5340. // between them.
  5341. var stages = {
  5342. start: function start() {
  5343. if (transitionOpacity) el.style.opacity = styleValues.first.opacity;
  5344. if (transitionScale) el.style.transform = "scale(".concat(styleValues.first.scale / 100, ")");
  5345. },
  5346. during: function during() {
  5347. if (transitionScale) el.style.transformOrigin = styleValues.origin;
  5348. el.style.transitionProperty = [transitionOpacity ? "opacity" : "", transitionScale ? "transform" : ""].join(' ').trim();
  5349. el.style.transitionDuration = "".concat(styleValues.duration / 1000, "s");
  5350. el.style.transitionTimingFunction = "cubic-bezier(0.4, 0.0, 0.2, 1)";
  5351. },
  5352. show: function show() {
  5353. hook1();
  5354. },
  5355. end: function end() {
  5356. if (transitionOpacity) el.style.opacity = styleValues.second.opacity;
  5357. if (transitionScale) el.style.transform = "scale(".concat(styleValues.second.scale / 100, ")");
  5358. },
  5359. hide: function hide() {
  5360. hook2();
  5361. },
  5362. cleanup: function cleanup() {
  5363. if (transitionOpacity) el.style.opacity = opacityCache;
  5364. if (transitionScale) el.style.transform = transformCache;
  5365. if (transitionScale) el.style.transformOrigin = transformOriginCache;
  5366. el.style.transitionProperty = null;
  5367. el.style.transitionDuration = null;
  5368. el.style.transitionTimingFunction = null;
  5369. }
  5370. };
  5371. transition(el, stages, type, reject);
  5372. }
  5373. var ensureStringExpression = function ensureStringExpression(expression, el, component) {
  5374. _newArrowCheck(this, _this3);
  5375. return typeof expression === 'function' ? component.evaluateReturnExpression(el, expression) : expression;
  5376. }.bind(undefined);
  5377. function transitionClassesIn(el, component, directives, showCallback, reject) {
  5378. var _this14 = this;
  5379. var enter = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
  5380. _newArrowCheck(this, _this14);
  5381. return i.value === 'enter';
  5382. }.bind(this)) || {
  5383. expression: ''
  5384. }).expression, el, component));
  5385. var enterStart = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
  5386. _newArrowCheck(this, _this14);
  5387. return i.value === 'enter-start';
  5388. }.bind(this)) || {
  5389. expression: ''
  5390. }).expression, el, component));
  5391. var enterEnd = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
  5392. _newArrowCheck(this, _this14);
  5393. return i.value === 'enter-end';
  5394. }.bind(this)) || {
  5395. expression: ''
  5396. }).expression, el, component));
  5397. transitionClasses(el, enter, enterStart, enterEnd, showCallback, function () {
  5398. _newArrowCheck(this, _this14);
  5399. }.bind(this), TRANSITION_TYPE_IN, reject);
  5400. }
  5401. function transitionClassesOut(el, component, directives, hideCallback, reject) {
  5402. var _this15 = this;
  5403. var leave = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
  5404. _newArrowCheck(this, _this15);
  5405. return i.value === 'leave';
  5406. }.bind(this)) || {
  5407. expression: ''
  5408. }).expression, el, component));
  5409. var leaveStart = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
  5410. _newArrowCheck(this, _this15);
  5411. return i.value === 'leave-start';
  5412. }.bind(this)) || {
  5413. expression: ''
  5414. }).expression, el, component));
  5415. var leaveEnd = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
  5416. _newArrowCheck(this, _this15);
  5417. return i.value === 'leave-end';
  5418. }.bind(this)) || {
  5419. expression: ''
  5420. }).expression, el, component));
  5421. transitionClasses(el, leave, leaveStart, leaveEnd, function () {
  5422. _newArrowCheck(this, _this15);
  5423. }.bind(this), hideCallback, TRANSITION_TYPE_OUT, reject);
  5424. }
  5425. function transitionClasses(el, classesDuring, classesStart, classesEnd, hook1, hook2, type, reject) {
  5426. // clear the previous transition if exists to avoid caching the wrong classes
  5427. if (el.__x_transition) {
  5428. el.__x_transition.cancel && el.__x_transition.cancel();
  5429. }
  5430. var originalClasses = el.__x_original_classes || [];
  5431. var stages = {
  5432. start: function start() {
  5433. var _el$classList;
  5434. (_el$classList = el.classList).add.apply(_el$classList, _toConsumableArray(classesStart));
  5435. },
  5436. during: function during() {
  5437. var _el$classList2;
  5438. (_el$classList2 = el.classList).add.apply(_el$classList2, _toConsumableArray(classesDuring));
  5439. },
  5440. show: function show() {
  5441. hook1();
  5442. },
  5443. end: function end() {
  5444. var _el$classList3,
  5445. _this16 = this,
  5446. _el$classList4;
  5447. // Don't remove classes that were in the original class attribute.
  5448. (_el$classList3 = el.classList).remove.apply(_el$classList3, _toConsumableArray(classesStart.filter(function (i) {
  5449. _newArrowCheck(this, _this16);
  5450. return !originalClasses.includes(i);
  5451. }.bind(this))));
  5452. (_el$classList4 = el.classList).add.apply(_el$classList4, _toConsumableArray(classesEnd));
  5453. },
  5454. hide: function hide() {
  5455. hook2();
  5456. },
  5457. cleanup: function cleanup() {
  5458. var _el$classList5,
  5459. _this17 = this,
  5460. _el$classList6;
  5461. (_el$classList5 = el.classList).remove.apply(_el$classList5, _toConsumableArray(classesDuring.filter(function (i) {
  5462. _newArrowCheck(this, _this17);
  5463. return !originalClasses.includes(i);
  5464. }.bind(this))));
  5465. (_el$classList6 = el.classList).remove.apply(_el$classList6, _toConsumableArray(classesEnd.filter(function (i) {
  5466. _newArrowCheck(this, _this17);
  5467. return !originalClasses.includes(i);
  5468. }.bind(this))));
  5469. }
  5470. };
  5471. transition(el, stages, type, reject);
  5472. }
  5473. function transition(el, stages, type, reject) {
  5474. var _this18 = this;
  5475. var finish = once(function () {
  5476. _newArrowCheck(this, _this18);
  5477. stages.hide(); // Adding an "isConnected" check, in case the callback
  5478. // removed the element from the DOM.
  5479. if (el.isConnected) {
  5480. stages.cleanup();
  5481. }
  5482. delete el.__x_transition;
  5483. }.bind(this));
  5484. el.__x_transition = {
  5485. // Set transition type so we can avoid clearing transition if the direction is the same
  5486. type: type,
  5487. // create a callback for the last stages of the transition so we can call it
  5488. // from different point and early terminate it. Once will ensure that function
  5489. // is only called one time.
  5490. cancel: once(function () {
  5491. _newArrowCheck(this, _this18);
  5492. reject(TRANSITION_CANCELLED);
  5493. finish();
  5494. }.bind(this)),
  5495. finish: finish,
  5496. // This store the next animation frame so we can cancel it
  5497. nextFrame: null
  5498. };
  5499. stages.start();
  5500. stages.during();
  5501. el.__x_transition.nextFrame = requestAnimationFrame(function () {
  5502. var _this19 = this;
  5503. _newArrowCheck(this, _this18);
  5504. // Note: Safari's transitionDuration property will list out comma separated transition durations
  5505. // for every single transition property. Let's grab the first one and call it a day.
  5506. var duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, '').replace('s', '')) * 1000;
  5507. if (duration === 0) {
  5508. duration = Number(getComputedStyle(el).animationDuration.replace('s', '')) * 1000;
  5509. }
  5510. stages.show();
  5511. el.__x_transition.nextFrame = requestAnimationFrame(function () {
  5512. _newArrowCheck(this, _this19);
  5513. stages.end();
  5514. setTimeout(el.__x_transition.finish, duration);
  5515. }.bind(this));
  5516. }.bind(this));
  5517. }
  5518. function isNumeric(subject) {
  5519. return !Array.isArray(subject) && !isNaN(subject);
  5520. } // Thanks @vuejs
  5521. // https://github.com/vuejs/vue/blob/4de4649d9637262a9b007720b59f80ac72a5620c/src/shared/util.js
  5522. function once(callback) {
  5523. var called = false;
  5524. return function () {
  5525. if (!called) {
  5526. called = true;
  5527. callback.apply(this, arguments);
  5528. }
  5529. };
  5530. }
  5531. function handleForDirective(component, templateEl, expression, initialUpdate, extraVars) {
  5532. var _this = this;
  5533. warnIfMalformedTemplate(templateEl, 'x-for');
  5534. var iteratorNames = typeof expression === 'function' ? parseForExpression(component.evaluateReturnExpression(templateEl, expression)) : parseForExpression(expression);
  5535. var items = evaluateItemsAndReturnEmptyIfXIfIsPresentAndFalseOnElement(component, templateEl, iteratorNames, extraVars); // As we walk the array, we'll also walk the DOM (updating/creating as we go).
  5536. var currentEl = templateEl;
  5537. items.forEach(function (item, index) {
  5538. var _this2 = this;
  5539. _newArrowCheck(this, _this);
  5540. var iterationScopeVariables = getIterationScopeVariables(iteratorNames, item, index, items, extraVars());
  5541. var currentKey = generateKeyForIteration(component, templateEl, index, iterationScopeVariables);
  5542. var nextEl = lookAheadForMatchingKeyedElementAndMoveItIfFound(currentEl.nextElementSibling, currentKey); // If we haven't found a matching key, insert the element at the current position.
  5543. if (!nextEl) {
  5544. nextEl = addElementInLoopAfterCurrentEl(templateEl, currentEl); // And transition it in if it's not the first page load.
  5545. transitionIn(nextEl, function () {
  5546. _newArrowCheck(this, _this2);
  5547. }.bind(this), function () {
  5548. _newArrowCheck(this, _this2);
  5549. }.bind(this), component, initialUpdate);
  5550. nextEl.__x_for = iterationScopeVariables;
  5551. component.initializeElements(nextEl, function () {
  5552. _newArrowCheck(this, _this2);
  5553. return nextEl.__x_for;
  5554. }.bind(this)); // Otherwise update the element we found.
  5555. } else {
  5556. // Temporarily remove the key indicator to allow the normal "updateElements" to work.
  5557. delete nextEl.__x_for_key;
  5558. nextEl.__x_for = iterationScopeVariables;
  5559. component.updateElements(nextEl, function () {
  5560. _newArrowCheck(this, _this2);
  5561. return nextEl.__x_for;
  5562. }.bind(this));
  5563. }
  5564. currentEl = nextEl;
  5565. currentEl.__x_for_key = currentKey;
  5566. }.bind(this));
  5567. removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component);
  5568. } // This was taken from VueJS 2.* core. Thanks Vue!
  5569. function parseForExpression(expression) {
  5570. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  5571. var stripParensRE = /^\(|\)$/g;
  5572. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  5573. var inMatch = String(expression).match(forAliasRE);
  5574. if (!inMatch) return;
  5575. var res = {};
  5576. res.items = inMatch[2].trim();
  5577. var item = inMatch[1].trim().replace(stripParensRE, '');
  5578. var iteratorMatch = item.match(forIteratorRE);
  5579. if (iteratorMatch) {
  5580. res.item = item.replace(forIteratorRE, '').trim();
  5581. res.index = iteratorMatch[1].trim();
  5582. if (iteratorMatch[2]) {
  5583. res.collection = iteratorMatch[2].trim();
  5584. }
  5585. } else {
  5586. res.item = item;
  5587. }
  5588. return res;
  5589. }
  5590. function getIterationScopeVariables(iteratorNames, item, index, items, extraVars) {
  5591. // We must create a new object, so each iteration has a new scope
  5592. var scopeVariables = extraVars ? _objectSpread2({}, extraVars) : {};
  5593. scopeVariables[iteratorNames.item] = item;
  5594. if (iteratorNames.index) scopeVariables[iteratorNames.index] = index;
  5595. if (iteratorNames.collection) scopeVariables[iteratorNames.collection] = items;
  5596. return scopeVariables;
  5597. }
  5598. function generateKeyForIteration(component, el, index, iterationScopeVariables) {
  5599. var _this3 = this;
  5600. var bindKeyAttribute = getXAttrs(el, component, 'bind').filter(function (attr) {
  5601. _newArrowCheck(this, _this3);
  5602. return attr.value === 'key';
  5603. }.bind(this))[0]; // If the dev hasn't specified a key, just return the index of the iteration.
  5604. if (!bindKeyAttribute) return index;
  5605. return component.evaluateReturnExpression(el, bindKeyAttribute.expression, function () {
  5606. _newArrowCheck(this, _this3);
  5607. return iterationScopeVariables;
  5608. }.bind(this));
  5609. }
  5610. function evaluateItemsAndReturnEmptyIfXIfIsPresentAndFalseOnElement(component, el, iteratorNames, extraVars) {
  5611. var _this4 = this;
  5612. var ifAttribute = getXAttrs(el, component, 'if')[0];
  5613. if (ifAttribute && !component.evaluateReturnExpression(el, ifAttribute.expression)) {
  5614. return [];
  5615. }
  5616. var items = component.evaluateReturnExpression(el, iteratorNames.items, extraVars); // This adds support for the `i in n` syntax.
  5617. if (isNumeric(items) && items >= 0) {
  5618. items = Array.from(Array(items).keys(), function (i) {
  5619. _newArrowCheck(this, _this4);
  5620. return i + 1;
  5621. }.bind(this));
  5622. }
  5623. return items;
  5624. }
  5625. function addElementInLoopAfterCurrentEl(templateEl, currentEl) {
  5626. var clone = document.importNode(templateEl.content, true);
  5627. currentEl.parentElement.insertBefore(clone, currentEl.nextElementSibling);
  5628. return currentEl.nextElementSibling;
  5629. }
  5630. function lookAheadForMatchingKeyedElementAndMoveItIfFound(nextEl, currentKey) {
  5631. if (!nextEl) return; // If we are already past the x-for generated elements, we don't need to look ahead.
  5632. if (nextEl.__x_for_key === undefined) return; // If the the key's DO match, no need to look ahead.
  5633. if (nextEl.__x_for_key === currentKey) return nextEl; // If they don't, we'll look ahead for a match.
  5634. // If we find it, we'll move it to the current position in the loop.
  5635. var tmpNextEl = nextEl;
  5636. while (tmpNextEl) {
  5637. if (tmpNextEl.__x_for_key === currentKey) {
  5638. return tmpNextEl.parentElement.insertBefore(tmpNextEl, nextEl);
  5639. }
  5640. tmpNextEl = tmpNextEl.nextElementSibling && tmpNextEl.nextElementSibling.__x_for_key !== undefined ? tmpNextEl.nextElementSibling : false;
  5641. }
  5642. }
  5643. function removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component) {
  5644. var nextElementFromOldLoop = currentEl.nextElementSibling && currentEl.nextElementSibling.__x_for_key !== undefined ? currentEl.nextElementSibling : false;
  5645. var _loop = function _loop() {
  5646. var _this5 = this;
  5647. var nextElementFromOldLoopImmutable = nextElementFromOldLoop;
  5648. var nextSibling = nextElementFromOldLoop.nextElementSibling;
  5649. transitionOut(nextElementFromOldLoop, function () {
  5650. _newArrowCheck(this, _this5);
  5651. nextElementFromOldLoopImmutable.remove();
  5652. }.bind(this), function () {
  5653. _newArrowCheck(this, _this5);
  5654. }.bind(this), component);
  5655. nextElementFromOldLoop = nextSibling && nextSibling.__x_for_key !== undefined ? nextSibling : false;
  5656. };
  5657. while (nextElementFromOldLoop) {
  5658. _loop();
  5659. }
  5660. }
  5661. function handleAttributeBindingDirective(component, el, attrName, expression, extraVars, attrType, modifiers) {
  5662. var _this = this;
  5663. var value = component.evaluateReturnExpression(el, expression, extraVars);
  5664. if (attrName === 'value') {
  5665. if (Alpine.ignoreFocusedForValueBinding && document.activeElement.isSameNode(el)) return; // If nested model key is undefined, set the default value to empty string.
  5666. if (value === undefined && String(expression).match(/\./)) {
  5667. value = '';
  5668. }
  5669. if (el.type === 'radio') {
  5670. // Set radio value from x-bind:value, if no "value" attribute exists.
  5671. // If there are any initial state values, radio will have a correct
  5672. // "checked" value since x-bind:value is processed before x-model.
  5673. if (el.attributes.value === undefined && attrType === 'bind') {
  5674. el.value = value;
  5675. } else if (attrType !== 'bind') {
  5676. el.checked = checkedAttrLooseCompare(el.value, value);
  5677. }
  5678. } else if (el.type === 'checkbox') {
  5679. // If we are explicitly binding a string to the :value, set the string,
  5680. // If the value is a boolean, leave it alone, it will be set to "on"
  5681. // automatically.
  5682. if (typeof value !== 'boolean' && ![null, undefined].includes(value) && attrType === 'bind') {
  5683. el.value = String(value);
  5684. } else if (attrType !== 'bind') {
  5685. if (Array.isArray(value)) {
  5686. // I'm purposely not using Array.includes here because it's
  5687. // strict, and because of Numeric/String mis-casting, I
  5688. // want the "includes" to be "fuzzy".
  5689. el.checked = value.some(function (val) {
  5690. _newArrowCheck(this, _this);
  5691. return checkedAttrLooseCompare(val, el.value);
  5692. }.bind(this));
  5693. } else {
  5694. el.checked = !!value;
  5695. }
  5696. }
  5697. } else if (el.tagName === 'SELECT') {
  5698. updateSelect(el, value);
  5699. } else {
  5700. if (el.value === value) return;
  5701. el.value = value;
  5702. }
  5703. } else if (attrName === 'class') {
  5704. if (Array.isArray(value)) {
  5705. var originalClasses = el.__x_original_classes || [];
  5706. el.setAttribute('class', arrayUnique(originalClasses.concat(value)).join(' '));
  5707. } else if (_typeof(value) === 'object') {
  5708. // Sorting the keys / class names by their boolean value will ensure that
  5709. // anything that evaluates to `false` and needs to remove classes is run first.
  5710. var keysSortedByBooleanValue = Object.keys(value).sort(function (a, b) {
  5711. _newArrowCheck(this, _this);
  5712. return value[a] - value[b];
  5713. }.bind(this));
  5714. keysSortedByBooleanValue.forEach(function (classNames) {
  5715. var _this2 = this;
  5716. _newArrowCheck(this, _this);
  5717. if (value[classNames]) {
  5718. convertClassStringToArray(classNames).forEach(function (className) {
  5719. _newArrowCheck(this, _this2);
  5720. return el.classList.add(className);
  5721. }.bind(this));
  5722. } else {
  5723. convertClassStringToArray(classNames).forEach(function (className) {
  5724. _newArrowCheck(this, _this2);
  5725. return el.classList.remove(className);
  5726. }.bind(this));
  5727. }
  5728. }.bind(this));
  5729. } else {
  5730. var _originalClasses = el.__x_original_classes || [];
  5731. var newClasses = value ? convertClassStringToArray(value) : [];
  5732. el.setAttribute('class', arrayUnique(_originalClasses.concat(newClasses)).join(' '));
  5733. }
  5734. } else {
  5735. attrName = modifiers.includes('camel') ? camelCase(attrName) : attrName; // If an attribute's bound value is null, undefined or false, remove the attribute
  5736. if ([null, undefined, false].includes(value)) {
  5737. el.removeAttribute(attrName);
  5738. } else {
  5739. isBooleanAttr(attrName) ? setIfChanged(el, attrName, attrName) : setIfChanged(el, attrName, value);
  5740. }
  5741. }
  5742. }
  5743. function setIfChanged(el, attrName, value) {
  5744. if (el.getAttribute(attrName) != value) {
  5745. el.setAttribute(attrName, value);
  5746. }
  5747. }
  5748. function updateSelect(el, value) {
  5749. var _this3 = this;
  5750. var arrayWrappedValue = [].concat(value).map(function (value) {
  5751. _newArrowCheck(this, _this3);
  5752. return value + '';
  5753. }.bind(this));
  5754. Array.from(el.options).forEach(function (option) {
  5755. _newArrowCheck(this, _this3);
  5756. option.selected = arrayWrappedValue.includes(option.value);
  5757. }.bind(this));
  5758. }
  5759. function handleTextDirective(el, output, expression) {
  5760. // If nested model key is undefined, set the default value to empty string.
  5761. if (output === undefined && String(expression).match(/\./)) {
  5762. output = '';
  5763. }
  5764. el.textContent = output;
  5765. }
  5766. function handleHtmlDirective(component, el, expression, extraVars) {
  5767. el.innerHTML = component.evaluateReturnExpression(el, expression, extraVars);
  5768. }
  5769. function handleShowDirective(component, el, value, modifiers) {
  5770. var _this = this;
  5771. var initialUpdate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  5772. var hide = function hide() {
  5773. _newArrowCheck(this, _this);
  5774. el.style.display = 'none';
  5775. el.__x_is_shown = false;
  5776. }.bind(this);
  5777. var show = function show() {
  5778. _newArrowCheck(this, _this);
  5779. if (el.style.length === 1 && el.style.display === 'none') {
  5780. el.removeAttribute('style');
  5781. } else {
  5782. el.style.removeProperty('display');
  5783. }
  5784. el.__x_is_shown = true;
  5785. }.bind(this);
  5786. if (initialUpdate === true) {
  5787. if (value) {
  5788. show();
  5789. } else {
  5790. hide();
  5791. }
  5792. return;
  5793. }
  5794. var handle = function handle(resolve, reject) {
  5795. var _this2 = this;
  5796. _newArrowCheck(this, _this);
  5797. if (value) {
  5798. if (el.style.display === 'none' || el.__x_transition) {
  5799. transitionIn(el, function () {
  5800. _newArrowCheck(this, _this2);
  5801. show();
  5802. }.bind(this), reject, component);
  5803. }
  5804. resolve(function () {
  5805. _newArrowCheck(this, _this2);
  5806. }.bind(this));
  5807. } else {
  5808. if (el.style.display !== 'none') {
  5809. transitionOut(el, function () {
  5810. var _this3 = this;
  5811. _newArrowCheck(this, _this2);
  5812. resolve(function () {
  5813. _newArrowCheck(this, _this3);
  5814. hide();
  5815. }.bind(this));
  5816. }.bind(this), reject, component);
  5817. } else {
  5818. resolve(function () {
  5819. _newArrowCheck(this, _this2);
  5820. }.bind(this));
  5821. }
  5822. }
  5823. }.bind(this); // The working of x-show is a bit complex because we need to
  5824. // wait for any child transitions to finish before hiding
  5825. // some element. Also, this has to be done recursively.
  5826. // If x-show.immediate, foregoe the waiting.
  5827. if (modifiers.includes('immediate')) {
  5828. handle(function (finish) {
  5829. _newArrowCheck(this, _this);
  5830. return finish();
  5831. }.bind(this), function () {
  5832. _newArrowCheck(this, _this);
  5833. }.bind(this));
  5834. return;
  5835. } // x-show is encountered during a DOM tree walk. If an element
  5836. // we encounter is NOT a child of another x-show element we
  5837. // can execute the previous x-show stack (if one exists).
  5838. if (component.showDirectiveLastElement && !component.showDirectiveLastElement.contains(el)) {
  5839. component.executeAndClearRemainingShowDirectiveStack();
  5840. }
  5841. component.showDirectiveStack.push(handle);
  5842. component.showDirectiveLastElement = el;
  5843. }
  5844. function handleIfDirective(component, el, expressionResult, initialUpdate, extraVars) {
  5845. var _this = this;
  5846. warnIfMalformedTemplate(el, 'x-if');
  5847. var elementHasAlreadyBeenAdded = el.nextElementSibling && el.nextElementSibling.__x_inserted_me === true;
  5848. if (expressionResult && (!elementHasAlreadyBeenAdded || el.__x_transition)) {
  5849. var clone = document.importNode(el.content, true);
  5850. el.parentElement.insertBefore(clone, el.nextElementSibling);
  5851. transitionIn(el.nextElementSibling, function () {
  5852. _newArrowCheck(this, _this);
  5853. }.bind(this), function () {
  5854. _newArrowCheck(this, _this);
  5855. }.bind(this), component, initialUpdate);
  5856. component.initializeElements(el.nextElementSibling, extraVars);
  5857. el.nextElementSibling.__x_inserted_me = true;
  5858. } else if (!expressionResult && elementHasAlreadyBeenAdded) {
  5859. transitionOut(el.nextElementSibling, function () {
  5860. _newArrowCheck(this, _this);
  5861. el.nextElementSibling.remove();
  5862. }.bind(this), function () {
  5863. _newArrowCheck(this, _this);
  5864. }.bind(this), component, initialUpdate);
  5865. }
  5866. }
  5867. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  5868. var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
  5869. var max = Math.max;
  5870. var min = Math.min;
  5871. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  5872. var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
  5873. // `Array.prototype.splice` method
  5874. // https://tc39.es/ecma262/#sec-array.prototype.splice
  5875. // with adding support of @@species
  5876. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
  5877. splice: function splice(start, deleteCount /* , ...items */) {
  5878. var O = toObject(this);
  5879. var len = toLength(O.length);
  5880. var actualStart = toAbsoluteIndex(start, len);
  5881. var argumentsLength = arguments.length;
  5882. var insertCount, actualDeleteCount, A, k, from, to;
  5883. if (argumentsLength === 0) {
  5884. insertCount = actualDeleteCount = 0;
  5885. } else if (argumentsLength === 1) {
  5886. insertCount = 0;
  5887. actualDeleteCount = len - actualStart;
  5888. } else {
  5889. insertCount = argumentsLength - 2;
  5890. actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
  5891. }
  5892. if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
  5893. throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
  5894. }
  5895. A = arraySpeciesCreate(O, actualDeleteCount);
  5896. for (k = 0; k < actualDeleteCount; k++) {
  5897. from = actualStart + k;
  5898. if (from in O) createProperty(A, k, O[from]);
  5899. }
  5900. A.length = actualDeleteCount;
  5901. if (insertCount < actualDeleteCount) {
  5902. for (k = actualStart; k < len - actualDeleteCount; k++) {
  5903. from = k + actualDeleteCount;
  5904. to = k + insertCount;
  5905. if (from in O) O[to] = O[from];
  5906. else delete O[to];
  5907. }
  5908. for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
  5909. } else if (insertCount > actualDeleteCount) {
  5910. for (k = len - actualDeleteCount; k > actualStart; k--) {
  5911. from = k + actualDeleteCount - 1;
  5912. to = k + insertCount - 1;
  5913. if (from in O) O[to] = O[from];
  5914. else delete O[to];
  5915. }
  5916. }
  5917. for (k = 0; k < insertCount; k++) {
  5918. O[k + actualStart] = arguments[k + 2];
  5919. }
  5920. O.length = len - actualDeleteCount + insertCount;
  5921. return A;
  5922. }
  5923. });
  5924. function registerListener(component, el, event, modifiers, expression) {
  5925. var _this = this;
  5926. var extraVars = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
  5927. var options = {
  5928. passive: modifiers.includes('passive')
  5929. };
  5930. if (modifiers.includes('camel')) {
  5931. event = camelCase(event);
  5932. }
  5933. var node_add_count = el.__x_node_add_count;
  5934. var _handler2, listenerTarget;
  5935. if (modifiers.includes('away')) {
  5936. listenerTarget = document;
  5937. _handler2 = function handler(e) {
  5938. _newArrowCheck(this, _this);
  5939. // Don't do anything if the click came from the element or within it.
  5940. if (el.contains(e.target)) return; // Don't do anything if this element isn't currently visible.
  5941. if (el.offsetWidth < 1 && el.offsetHeight < 1) return; // Now that we are sure the element is visible, AND the click
  5942. // is from outside it, let's run the expression.
  5943. runListenerHandler(component, expression, e, extraVars);
  5944. if (modifiers.includes('once')) {
  5945. document.removeEventListener(event, _handler2, options);
  5946. }
  5947. }.bind(this);
  5948. } else {
  5949. listenerTarget = modifiers.includes('window') ? window : modifiers.includes('document') ? document : el;
  5950. _handler2 = function _handler(e) {
  5951. var _this2 = this;
  5952. _newArrowCheck(this, _this);
  5953. // Remove this global event handler if the element that declared it
  5954. // has been removed. It's now stale.
  5955. if (listenerTarget === window || listenerTarget === document) {
  5956. if (!document.body.contains(el)) {
  5957. listenerTarget.removeEventListener(event, _handler2, options);
  5958. return;
  5959. }
  5960. }
  5961. if (el.__x_node_add_count !== node_add_count) {
  5962. listenerTarget.removeEventListener(event, _handler2, options);
  5963. return;
  5964. }
  5965. if (isKeyEvent(event)) {
  5966. if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
  5967. return;
  5968. }
  5969. }
  5970. if (modifiers.includes('prevent')) e.preventDefault();
  5971. if (modifiers.includes('stop')) e.stopPropagation(); // If the .self modifier isn't present, or if it is present and
  5972. // the target element matches the element we are registering the
  5973. // event on, run the handler
  5974. if (!modifiers.includes('self') || e.target === el) {
  5975. var returnValue = runListenerHandler(component, expression, e, extraVars);
  5976. returnValue.then(function (value) {
  5977. _newArrowCheck(this, _this2);
  5978. if (value === false) {
  5979. e.preventDefault();
  5980. } else {
  5981. if (modifiers.includes('once')) {
  5982. listenerTarget.removeEventListener(event, _handler2, options);
  5983. }
  5984. }
  5985. }.bind(this));
  5986. }
  5987. }.bind(this);
  5988. }
  5989. if (modifiers.includes('debounce')) {
  5990. var nextModifier = modifiers[modifiers.indexOf('debounce') + 1] || 'invalid-wait';
  5991. var wait = isNumeric(nextModifier.split('ms')[0]) ? Number(nextModifier.split('ms')[0]) : 250;
  5992. _handler2 = debounce(_handler2, wait);
  5993. }
  5994. listenerTarget.addEventListener(event, _handler2, options);
  5995. }
  5996. function runListenerHandler(component, expression, e, extraVars) {
  5997. var _this3 = this;
  5998. return component.evaluateCommandExpression(e.target, expression, function () {
  5999. _newArrowCheck(this, _this3);
  6000. return _objectSpread2(_objectSpread2({}, extraVars()), {}, {
  6001. '$event': e
  6002. });
  6003. }.bind(this));
  6004. }
  6005. function isKeyEvent(event) {
  6006. return ['keydown', 'keyup'].includes(event);
  6007. }
  6008. function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) {
  6009. var _this4 = this;
  6010. var keyModifiers = modifiers.filter(function (i) {
  6011. _newArrowCheck(this, _this4);
  6012. return !['window', 'document', 'prevent', 'stop'].includes(i);
  6013. }.bind(this));
  6014. if (keyModifiers.includes('debounce')) {
  6015. var debounceIndex = keyModifiers.indexOf('debounce');
  6016. keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || 'invalid-wait').split('ms')[0]) ? 2 : 1);
  6017. } // If no modifier is specified, we'll call it a press.
  6018. if (keyModifiers.length === 0) return false; // If one is passed, AND it matches the key pressed, we'll call it a press.
  6019. if (keyModifiers.length === 1 && keyModifiers[0] === keyToModifier(e.key)) return false; // The user is listening for key combinations.
  6020. var systemKeyModifiers = ['ctrl', 'shift', 'alt', 'meta', 'cmd', 'super'];
  6021. var selectedSystemKeyModifiers = systemKeyModifiers.filter(function (modifier) {
  6022. _newArrowCheck(this, _this4);
  6023. return keyModifiers.includes(modifier);
  6024. }.bind(this));
  6025. keyModifiers = keyModifiers.filter(function (i) {
  6026. _newArrowCheck(this, _this4);
  6027. return !selectedSystemKeyModifiers.includes(i);
  6028. }.bind(this));
  6029. if (selectedSystemKeyModifiers.length > 0) {
  6030. var activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter(function (modifier) {
  6031. _newArrowCheck(this, _this4);
  6032. // Alias "cmd" and "super" to "meta"
  6033. if (modifier === 'cmd' || modifier === 'super') modifier = 'meta';
  6034. return e["".concat(modifier, "Key")];
  6035. }.bind(this)); // If all the modifiers selected are pressed, ...
  6036. if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) {
  6037. // AND the remaining key is pressed as well. It's a press.
  6038. if (keyModifiers[0] === keyToModifier(e.key)) return false;
  6039. }
  6040. } // We'll call it NOT a valid keypress.
  6041. return true;
  6042. }
  6043. function keyToModifier(key) {
  6044. switch (key) {
  6045. case '/':
  6046. return 'slash';
  6047. case ' ':
  6048. case 'Spacebar':
  6049. return 'space';
  6050. default:
  6051. return key && kebabCase(key);
  6052. }
  6053. }
  6054. function registerModelListener(component, el, modifiers, expression, extraVars) {
  6055. var _this = this;
  6056. // If the element we are binding to is a select, a radio, or checkbox
  6057. // we'll listen for the change event instead of the "input" event.
  6058. var event = el.tagName.toLowerCase() === 'select' || ['checkbox', 'radio'].includes(el.type) || modifiers.includes('lazy') ? 'change' : 'input';
  6059. var listenerExpression = "".concat(expression, " = rightSideOfExpression($event, ").concat(expression, ")");
  6060. registerListener(component, el, event, modifiers, listenerExpression, function () {
  6061. _newArrowCheck(this, _this);
  6062. return _objectSpread2(_objectSpread2({}, extraVars()), {}, {
  6063. rightSideOfExpression: generateModelAssignmentFunction(el, modifiers, expression)
  6064. });
  6065. }.bind(this));
  6066. }
  6067. function generateModelAssignmentFunction(el, modifiers, expression) {
  6068. var _this2 = this;
  6069. if (el.type === 'radio') {
  6070. // Radio buttons only work properly when they share a name attribute.
  6071. // People might assume we take care of that for them, because
  6072. // they already set a shared "x-model" attribute.
  6073. if (!el.hasAttribute('name')) el.setAttribute('name', expression);
  6074. }
  6075. return function (event, currentValue) {
  6076. var _this3 = this;
  6077. _newArrowCheck(this, _this2);
  6078. // Check for event.detail due to an issue where IE11 handles other events as a CustomEvent.
  6079. if (event instanceof CustomEvent && event.detail) {
  6080. return event.detail;
  6081. } else if (el.type === 'checkbox') {
  6082. // If the data we are binding to is an array, toggle its value inside the array.
  6083. if (Array.isArray(currentValue)) {
  6084. var newValue = modifiers.includes('number') ? safeParseNumber(event.target.value) : event.target.value;
  6085. return event.target.checked ? currentValue.concat([newValue]) : currentValue.filter(function (el) {
  6086. _newArrowCheck(this, _this3);
  6087. return !checkedAttrLooseCompare(el, newValue);
  6088. }.bind(this));
  6089. } else {
  6090. return event.target.checked;
  6091. }
  6092. } else if (el.tagName.toLowerCase() === 'select' && el.multiple) {
  6093. return modifiers.includes('number') ? Array.from(event.target.selectedOptions).map(function (option) {
  6094. _newArrowCheck(this, _this3);
  6095. var rawValue = option.value || option.text;
  6096. return safeParseNumber(rawValue);
  6097. }.bind(this)) : Array.from(event.target.selectedOptions).map(function (option) {
  6098. _newArrowCheck(this, _this3);
  6099. return option.value || option.text;
  6100. }.bind(this));
  6101. } else {
  6102. var rawValue = event.target.value;
  6103. return modifiers.includes('number') ? safeParseNumber(rawValue) : modifiers.includes('trim') ? rawValue.trim() : rawValue;
  6104. }
  6105. }.bind(this);
  6106. }
  6107. function safeParseNumber(rawValue) {
  6108. var number = rawValue ? parseFloat(rawValue) : null;
  6109. return isNumeric(number) ? number : rawValue;
  6110. }
  6111. // `Reflect.set` method
  6112. // https://tc39.es/ecma262/#sec-reflect.set
  6113. function set(target, propertyKey, V /* , receiver */) {
  6114. var receiver = arguments.length < 4 ? target : arguments[3];
  6115. var ownDescriptor = objectGetOwnPropertyDescriptor.f(anObject(target), propertyKey);
  6116. var existingDescriptor, prototype;
  6117. if (!ownDescriptor) {
  6118. if (isObject(prototype = objectGetPrototypeOf(target))) {
  6119. return set(prototype, propertyKey, V, receiver);
  6120. }
  6121. ownDescriptor = createPropertyDescriptor(0);
  6122. }
  6123. if (has$1(ownDescriptor, 'value')) {
  6124. if (ownDescriptor.writable === false || !isObject(receiver)) return false;
  6125. if (existingDescriptor = objectGetOwnPropertyDescriptor.f(receiver, propertyKey)) {
  6126. if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
  6127. existingDescriptor.value = V;
  6128. objectDefineProperty.f(receiver, propertyKey, existingDescriptor);
  6129. } else objectDefineProperty.f(receiver, propertyKey, createPropertyDescriptor(0, V));
  6130. return true;
  6131. }
  6132. return ownDescriptor.set === undefined ? false : (ownDescriptor.set.call(receiver, V), true);
  6133. }
  6134. // MS Edge 17-18 Reflect.set allows setting the property to object
  6135. // with non-writable property on the prototype
  6136. var MS_EDGE_BUG = fails(function () {
  6137. var Constructor = function () { /* empty */ };
  6138. var object = objectDefineProperty.f(new Constructor(), 'a', { configurable: true });
  6139. // eslint-disable-next-line no-undef
  6140. return Reflect.set(Constructor.prototype, 'a', 1, object) !== false;
  6141. });
  6142. _export({ target: 'Reflect', stat: true, forced: MS_EDGE_BUG }, {
  6143. set: set
  6144. });
  6145. function wrap(data, mutationCallback) {
  6146. /* IE11-ONLY:START */
  6147. return wrapForIe11(data, mutationCallback);
  6148. }
  6149. function unwrap(membrane, observable) {
  6150. var _this = this;
  6151. var unwrappedData = membrane.unwrapProxy(observable);
  6152. var copy = {};
  6153. Object.keys(unwrappedData).forEach(function (key) {
  6154. _newArrowCheck(this, _this);
  6155. if (['$el', '$refs', '$nextTick', '$watch'].includes(key)) return;
  6156. copy[key] = unwrappedData[key];
  6157. }.bind(this));
  6158. return copy;
  6159. }
  6160. function wrapForIe11(data, mutationCallback) {
  6161. var proxyHandler = {
  6162. set: function set(target, key, value) {
  6163. // Set the value converting it to a "Deep Proxy" when required
  6164. // Note that if a project is not a valid object, it won't be converted to a proxy
  6165. var setWasSuccessful = Reflect.set(target, key, deepProxy(value, proxyHandler));
  6166. mutationCallback(target, key);
  6167. return setWasSuccessful;
  6168. },
  6169. get: function get(target, key) {
  6170. // Provide a way to determine if this object is an Alpine proxy or not.
  6171. if (key === "$isAlpineProxy") return true; // Just return the flippin' value. Gawsh.
  6172. return target[key];
  6173. }
  6174. };
  6175. return {
  6176. data: deepProxy(data, proxyHandler),
  6177. membrane: {
  6178. unwrapProxy: function unwrapProxy(proxy) {
  6179. return proxy;
  6180. }
  6181. }
  6182. };
  6183. }
  6184. function deepProxy(target, proxyHandler) {
  6185. // If target is null, return it.
  6186. if (target === null) return target; // If target is not an object, return it.
  6187. if (_typeof(target) !== 'object') return target; // If target is a DOM node (like in the case of this.$el), return it.
  6188. if (target instanceof Node) return target; // If target is already an Alpine proxy, return it.
  6189. if (target['$isAlpineProxy']) return target; // Otherwise proxy the properties recursively.
  6190. // This enables reactivity on setting nested data.
  6191. // Note that if a project is not a valid object, it won't be converted to a proxy
  6192. for (var property in target) {
  6193. target[property] = deepProxy(target[property], proxyHandler);
  6194. }
  6195. return new Proxy(target, proxyHandler);
  6196. }
  6197. var Component = /*#__PURE__*/function () {
  6198. function Component(el) {
  6199. var _this = this;
  6200. var componentForClone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6201. _classCallCheck(this, Component);
  6202. this.$el = el;
  6203. var dataAttr = this.$el.getAttribute('x-data');
  6204. var dataExpression = dataAttr === '' ? '{}' : dataAttr;
  6205. var dataExtras = {
  6206. $el: this.$el
  6207. };
  6208. var canonicalComponentElementReference = componentForClone ? componentForClone.$el : this.$el;
  6209. Object.entries(Alpine.magicProperties).forEach(function (_ref) {
  6210. _newArrowCheck(this, _this);
  6211. var _ref2 = _slicedToArray(_ref, 2),
  6212. name = _ref2[0],
  6213. callback = _ref2[1];
  6214. Object.defineProperty(dataExtras, "$".concat(name), {
  6215. get: function get() {
  6216. return callback(canonicalComponentElementReference);
  6217. }
  6218. });
  6219. }.bind(this));
  6220. this.unobservedData = componentForClone ? componentForClone.getUnobservedData() : saferEval(el, dataExpression, dataExtras);
  6221. /* IE11-ONLY:START */
  6222. // For IE11, add our magic properties to the original data for access.
  6223. // The Proxy polyfill does not allow properties to be added after creation.
  6224. this.unobservedData.$el = null;
  6225. this.unobservedData.$refs = null;
  6226. this.unobservedData.$nextTick = null;
  6227. this.unobservedData.$watch = null; // The IE build uses a proxy polyfill which doesn't allow properties
  6228. // to be defined after the proxy object is created so,
  6229. // for IE only, we need to define our helpers earlier.
  6230. Object.entries(Alpine.magicProperties).forEach(function (_ref3) {
  6231. _newArrowCheck(this, _this);
  6232. var _ref4 = _slicedToArray(_ref3, 2),
  6233. name = _ref4[0],
  6234. callback = _ref4[1];
  6235. Object.defineProperty(this.unobservedData, "$".concat(name), {
  6236. get: function get() {
  6237. return callback(canonicalComponentElementReference, this.$el);
  6238. }
  6239. });
  6240. }.bind(this));
  6241. /* IE11-ONLY:END */
  6242. // Construct a Proxy-based observable. This will be used to handle reactivity.
  6243. var _this$wrapDataInObser = this.wrapDataInObservable(this.unobservedData),
  6244. membrane = _this$wrapDataInObser.membrane,
  6245. data = _this$wrapDataInObser.data;
  6246. this.$data = data;
  6247. this.membrane = membrane; // After making user-supplied data methods reactive, we can now add
  6248. // our magic properties to the original data for access.
  6249. this.unobservedData.$el = this.$el;
  6250. this.unobservedData.$refs = this.getRefsProxy();
  6251. this.nextTickStack = [];
  6252. this.unobservedData.$nextTick = function (callback) {
  6253. _newArrowCheck(this, _this);
  6254. this.nextTickStack.push(callback);
  6255. }.bind(this);
  6256. this.watchers = {};
  6257. this.unobservedData.$watch = function (property, callback) {
  6258. _newArrowCheck(this, _this);
  6259. if (!this.watchers[property]) this.watchers[property] = [];
  6260. this.watchers[property].push(callback);
  6261. }.bind(this);
  6262. this.showDirectiveStack = [];
  6263. this.showDirectiveLastElement;
  6264. componentForClone || Alpine.onBeforeComponentInitializeds.forEach(function (callback) {
  6265. _newArrowCheck(this, _this);
  6266. return callback(this);
  6267. }.bind(this));
  6268. var initExpression = this.$el.getAttribute('x-init');
  6269. var initReturnedCallback; // If x-init is present AND we aren't cloning (skip x-init on clone)
  6270. if (initExpression && !componentForClone) {
  6271. // We want to allow data manipulation, but not trigger DOM updates just yet.
  6272. // We haven't even initialized the elements with their Alpine bindings. I mean c'mon.
  6273. this.pauseReactivity = true;
  6274. initReturnedCallback = this.evaluateReturnExpression(this.$el, initExpression);
  6275. this.pauseReactivity = false;
  6276. } // Register all our listeners and set all our attribute bindings.
  6277. // If we're cloning a component, the third parameter ensures no duplicate
  6278. // event listeners are registered (the mutation observer will take care of them)
  6279. this.initializeElements(this.$el, function () {
  6280. _newArrowCheck(this, _this);
  6281. }.bind(this), componentForClone); // Use mutation observer to detect new elements being added within this component at run-time.
  6282. // Alpine's just so darn flexible amirite?
  6283. this.listenForNewElementsToInitialize();
  6284. if (typeof initReturnedCallback === 'function') {
  6285. // Run the callback returned from the "x-init" hook to allow the user to do stuff after
  6286. // Alpine's got it's grubby little paws all over everything.
  6287. initReturnedCallback.call(this.$data);
  6288. }
  6289. componentForClone || setTimeout(function () {
  6290. var _this2 = this;
  6291. _newArrowCheck(this, _this);
  6292. Alpine.onComponentInitializeds.forEach(function (callback) {
  6293. _newArrowCheck(this, _this2);
  6294. return callback(this);
  6295. }.bind(this));
  6296. }.bind(this), 0);
  6297. }
  6298. _createClass(Component, [{
  6299. key: "getUnobservedData",
  6300. value: function getUnobservedData() {
  6301. return unwrap(this.membrane, this.$data);
  6302. }
  6303. }, {
  6304. key: "wrapDataInObservable",
  6305. value: function wrapDataInObservable(data) {
  6306. var _this3 = this;
  6307. var self = this;
  6308. var updateDom = debounce(function () {
  6309. self.updateElements(self.$el);
  6310. }, 0);
  6311. return wrap(data, function (target, key) {
  6312. var _this4 = this;
  6313. _newArrowCheck(this, _this3);
  6314. if (self.watchers[key]) {
  6315. // If there's a watcher for this specific key, run it.
  6316. self.watchers[key].forEach(function (callback) {
  6317. _newArrowCheck(this, _this4);
  6318. return callback(target[key]);
  6319. }.bind(this));
  6320. } else if (Array.isArray(target)) {
  6321. // Arrays are special cases, if any of the items change, we consider the array as mutated.
  6322. Object.keys(self.watchers).forEach(function (fullDotNotationKey) {
  6323. var _this5 = this;
  6324. _newArrowCheck(this, _this4);
  6325. var dotNotationParts = fullDotNotationKey.split('.'); // Ignore length mutations since they would result in duplicate calls.
  6326. // For example, when calling push, we would get a mutation for the item's key
  6327. // and a second mutation for the length property.
  6328. if (key === 'length') return;
  6329. dotNotationParts.reduce(function (comparisonData, part) {
  6330. var _this6 = this;
  6331. _newArrowCheck(this, _this5);
  6332. if (Object.is(target, comparisonData[part])) {
  6333. self.watchers[fullDotNotationKey].forEach(function (callback) {
  6334. _newArrowCheck(this, _this6);
  6335. return callback(target);
  6336. }.bind(this));
  6337. }
  6338. return comparisonData[part];
  6339. }.bind(this), self.unobservedData);
  6340. }.bind(this));
  6341. } else {
  6342. // Let's walk through the watchers with "dot-notation" (foo.bar) and see
  6343. // if this mutation fits any of them.
  6344. Object.keys(self.watchers).filter(function (i) {
  6345. _newArrowCheck(this, _this4);
  6346. return i.includes('.');
  6347. }.bind(this)).forEach(function (fullDotNotationKey) {
  6348. var _this7 = this;
  6349. _newArrowCheck(this, _this4);
  6350. var dotNotationParts = fullDotNotationKey.split('.'); // If this dot-notation watcher's last "part" doesn't match the current
  6351. // key, then skip it early for performance reasons.
  6352. if (key !== dotNotationParts[dotNotationParts.length - 1]) return; // Now, walk through the dot-notation "parts" recursively to find
  6353. // a match, and call the watcher if one's found.
  6354. dotNotationParts.reduce(function (comparisonData, part) {
  6355. var _this8 = this;
  6356. _newArrowCheck(this, _this7);
  6357. if (Object.is(target, comparisonData)) {
  6358. // Run the watchers.
  6359. self.watchers[fullDotNotationKey].forEach(function (callback) {
  6360. _newArrowCheck(this, _this8);
  6361. return callback(target[key]);
  6362. }.bind(this));
  6363. }
  6364. return comparisonData[part];
  6365. }.bind(this), self.unobservedData);
  6366. }.bind(this));
  6367. } // Don't react to data changes for cases like the `x-created` hook.
  6368. if (self.pauseReactivity) return;
  6369. updateDom();
  6370. }.bind(this));
  6371. }
  6372. }, {
  6373. key: "walkAndSkipNestedComponents",
  6374. value: function walkAndSkipNestedComponents(el, callback) {
  6375. var _this9 = this;
  6376. var initializeComponentCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
  6377. _newArrowCheck(this, _this9);
  6378. }.bind(this);
  6379. walk(el, function (el) {
  6380. _newArrowCheck(this, _this9);
  6381. // We've hit a component.
  6382. if (el.hasAttribute('x-data')) {
  6383. // If it's not the current one.
  6384. if (!el.isSameNode(this.$el)) {
  6385. // Initialize it if it's not.
  6386. if (!el.__x) initializeComponentCallback(el); // Now we'll let that sub-component deal with itself.
  6387. return false;
  6388. }
  6389. }
  6390. return callback(el);
  6391. }.bind(this));
  6392. }
  6393. }, {
  6394. key: "initializeElements",
  6395. value: function initializeElements(rootEl) {
  6396. var _this10 = this;
  6397. var extraVars = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
  6398. _newArrowCheck(this, _this10);
  6399. }.bind(this);
  6400. var componentForClone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6401. this.walkAndSkipNestedComponents(rootEl, function (el) {
  6402. _newArrowCheck(this, _this10);
  6403. // Don't touch spawns from for loop
  6404. if (el.__x_for_key !== undefined) return false; // Don't touch spawns from if directives
  6405. if (el.__x_inserted_me !== undefined) return false;
  6406. this.initializeElement(el, extraVars, componentForClone ? false : true);
  6407. }.bind(this), function (el) {
  6408. _newArrowCheck(this, _this10);
  6409. if (!componentForClone) el.__x = new Component(el);
  6410. }.bind(this));
  6411. this.executeAndClearRemainingShowDirectiveStack();
  6412. this.executeAndClearNextTickStack(rootEl);
  6413. }
  6414. }, {
  6415. key: "initializeElement",
  6416. value: function initializeElement(el, extraVars) {
  6417. var shouldRegisterListeners = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  6418. // To support class attribute merging, we have to know what the element's
  6419. // original class attribute looked like for reference.
  6420. if (el.hasAttribute('class') && getXAttrs(el, this).length > 0) {
  6421. el.__x_original_classes = convertClassStringToArray(el.getAttribute('class'));
  6422. }
  6423. shouldRegisterListeners && this.registerListeners(el, extraVars);
  6424. this.resolveBoundAttributes(el, true, extraVars);
  6425. }
  6426. }, {
  6427. key: "updateElements",
  6428. value: function updateElements(rootEl) {
  6429. var _this11 = this;
  6430. var extraVars = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
  6431. _newArrowCheck(this, _this11);
  6432. }.bind(this);
  6433. this.walkAndSkipNestedComponents(rootEl, function (el) {
  6434. _newArrowCheck(this, _this11);
  6435. // Don't touch spawns from for loop (and check if the root is actually a for loop in a parent, don't skip it.)
  6436. if (el.__x_for_key !== undefined && !el.isSameNode(this.$el)) return false;
  6437. this.updateElement(el, extraVars);
  6438. }.bind(this), function (el) {
  6439. _newArrowCheck(this, _this11);
  6440. el.__x = new Component(el);
  6441. }.bind(this));
  6442. this.executeAndClearRemainingShowDirectiveStack();
  6443. this.executeAndClearNextTickStack(rootEl);
  6444. }
  6445. }, {
  6446. key: "executeAndClearNextTickStack",
  6447. value: function executeAndClearNextTickStack(el) {
  6448. var _this12 = this;
  6449. // Skip spawns from alpine directives
  6450. if (el === this.$el && this.nextTickStack.length > 0) {
  6451. // We run the tick stack after the next frame to allow any
  6452. // running transitions to pass the initial show stage.
  6453. requestAnimationFrame(function () {
  6454. _newArrowCheck(this, _this12);
  6455. while (this.nextTickStack.length > 0) {
  6456. this.nextTickStack.shift()();
  6457. }
  6458. }.bind(this));
  6459. }
  6460. }
  6461. }, {
  6462. key: "executeAndClearRemainingShowDirectiveStack",
  6463. value: function executeAndClearRemainingShowDirectiveStack() {
  6464. var _this13 = this;
  6465. // The goal here is to start all the x-show transitions
  6466. // and build a nested promise chain so that elements
  6467. // only hide when the children are finished hiding.
  6468. this.showDirectiveStack.reverse().map(function (handler) {
  6469. var _this14 = this;
  6470. _newArrowCheck(this, _this13);
  6471. return new Promise(function (resolve, reject) {
  6472. _newArrowCheck(this, _this14);
  6473. handler(resolve, reject);
  6474. }.bind(this));
  6475. }.bind(this)).reduce(function (promiseChain, promise) {
  6476. var _this15 = this;
  6477. _newArrowCheck(this, _this13);
  6478. return promiseChain.then(function () {
  6479. var _this16 = this;
  6480. _newArrowCheck(this, _this15);
  6481. return promise.then(function (finishElement) {
  6482. _newArrowCheck(this, _this16);
  6483. finishElement();
  6484. }.bind(this));
  6485. }.bind(this));
  6486. }.bind(this), Promise.resolve(function () {
  6487. _newArrowCheck(this, _this13);
  6488. }.bind(this)))["catch"](function (e) {
  6489. _newArrowCheck(this, _this13);
  6490. if (e !== TRANSITION_CANCELLED) throw e;
  6491. }.bind(this)); // We've processed the handler stack. let's clear it.
  6492. this.showDirectiveStack = [];
  6493. this.showDirectiveLastElement = undefined;
  6494. }
  6495. }, {
  6496. key: "updateElement",
  6497. value: function updateElement(el, extraVars) {
  6498. this.resolveBoundAttributes(el, false, extraVars);
  6499. }
  6500. }, {
  6501. key: "registerListeners",
  6502. value: function registerListeners(el, extraVars) {
  6503. var _this17 = this;
  6504. getXAttrs(el, this).forEach(function (_ref5) {
  6505. _newArrowCheck(this, _this17);
  6506. var type = _ref5.type,
  6507. value = _ref5.value,
  6508. modifiers = _ref5.modifiers,
  6509. expression = _ref5.expression;
  6510. switch (type) {
  6511. case 'on':
  6512. registerListener(this, el, value, modifiers, expression, extraVars);
  6513. break;
  6514. case 'model':
  6515. registerModelListener(this, el, modifiers, expression, extraVars);
  6516. break;
  6517. }
  6518. }.bind(this));
  6519. }
  6520. }, {
  6521. key: "resolveBoundAttributes",
  6522. value: function resolveBoundAttributes(el) {
  6523. var _this18 = this;
  6524. var initialUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6525. var extraVars = arguments.length > 2 ? arguments[2] : undefined;
  6526. var attrs = getXAttrs(el, this);
  6527. attrs.forEach(function (_ref6) {
  6528. var _this19 = this;
  6529. _newArrowCheck(this, _this18);
  6530. var type = _ref6.type,
  6531. value = _ref6.value,
  6532. modifiers = _ref6.modifiers,
  6533. expression = _ref6.expression;
  6534. switch (type) {
  6535. case 'model':
  6536. handleAttributeBindingDirective(this, el, 'value', expression, extraVars, type, modifiers);
  6537. break;
  6538. case 'bind':
  6539. // The :key binding on an x-for is special, ignore it.
  6540. if (el.tagName.toLowerCase() === 'template' && value === 'key') return;
  6541. handleAttributeBindingDirective(this, el, value, expression, extraVars, type, modifiers);
  6542. break;
  6543. case 'text':
  6544. var output = this.evaluateReturnExpression(el, expression, extraVars);
  6545. handleTextDirective(el, output, expression);
  6546. break;
  6547. case 'html':
  6548. handleHtmlDirective(this, el, expression, extraVars);
  6549. break;
  6550. case 'show':
  6551. var output = this.evaluateReturnExpression(el, expression, extraVars);
  6552. handleShowDirective(this, el, output, modifiers, initialUpdate);
  6553. break;
  6554. case 'if':
  6555. // If this element also has x-for on it, don't process x-if.
  6556. // We will let the "x-for" directive handle the "if"ing.
  6557. if (attrs.some(function (i) {
  6558. _newArrowCheck(this, _this19);
  6559. return i.type === 'for';
  6560. }.bind(this))) return;
  6561. var output = this.evaluateReturnExpression(el, expression, extraVars);
  6562. handleIfDirective(this, el, output, initialUpdate, extraVars);
  6563. break;
  6564. case 'for':
  6565. handleForDirective(this, el, expression, initialUpdate, extraVars);
  6566. break;
  6567. case 'cloak':
  6568. el.removeAttribute('x-cloak');
  6569. break;
  6570. }
  6571. }.bind(this));
  6572. }
  6573. }, {
  6574. key: "evaluateReturnExpression",
  6575. value: function evaluateReturnExpression(el, expression) {
  6576. var _this20 = this;
  6577. var extraVars = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
  6578. _newArrowCheck(this, _this20);
  6579. }.bind(this);
  6580. return saferEval(el, expression, this.$data, _objectSpread2(_objectSpread2({}, extraVars()), {}, {
  6581. $dispatch: this.getDispatchFunction(el)
  6582. }));
  6583. }
  6584. }, {
  6585. key: "evaluateCommandExpression",
  6586. value: function evaluateCommandExpression(el, expression) {
  6587. var _this21 = this;
  6588. var extraVars = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
  6589. _newArrowCheck(this, _this21);
  6590. }.bind(this);
  6591. return saferEvalNoReturn(el, expression, this.$data, _objectSpread2(_objectSpread2({}, extraVars()), {}, {
  6592. $dispatch: this.getDispatchFunction(el)
  6593. }));
  6594. }
  6595. }, {
  6596. key: "getDispatchFunction",
  6597. value: function getDispatchFunction(el) {
  6598. return function (event) {
  6599. var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6600. el.dispatchEvent(new CustomEvent(event, {
  6601. detail: detail,
  6602. bubbles: true
  6603. }));
  6604. };
  6605. }
  6606. }, {
  6607. key: "listenForNewElementsToInitialize",
  6608. value: function listenForNewElementsToInitialize() {
  6609. var _this22 = this;
  6610. var targetNode = this.$el;
  6611. var observerOptions = {
  6612. childList: true,
  6613. attributes: true,
  6614. subtree: true
  6615. };
  6616. var observer = new MutationObserver(function (mutations) {
  6617. var _this23 = this;
  6618. _newArrowCheck(this, _this22);
  6619. for (var i = 0; i < mutations.length; i++) {
  6620. // Filter out mutations triggered from child components.
  6621. var closestParentComponent = mutations[i].target.closest('[x-data]');
  6622. if (!(closestParentComponent && closestParentComponent.isSameNode(this.$el))) continue;
  6623. if (mutations[i].type === 'attributes' && mutations[i].attributeName === 'x-data') {
  6624. (function () {
  6625. var _this24 = this;
  6626. var xAttr = mutations[i].target.getAttribute('x-data') || '{}';
  6627. var rawData = saferEval(_this23.$el, xAttr, {
  6628. $el: _this23.$el
  6629. });
  6630. Object.keys(rawData).forEach(function (key) {
  6631. _newArrowCheck(this, _this24);
  6632. if (_this23.$data[key] !== rawData[key]) {
  6633. _this23.$data[key] = rawData[key];
  6634. }
  6635. }.bind(this));
  6636. })();
  6637. }
  6638. if (mutations[i].addedNodes.length > 0) {
  6639. mutations[i].addedNodes.forEach(function (node) {
  6640. _newArrowCheck(this, _this23);
  6641. if (node.nodeType !== 1 || node.__x_inserted_me) return;
  6642. if (node.matches('[x-data]') && !node.__x) {
  6643. node.__x = new Component(node);
  6644. return;
  6645. }
  6646. node.__x_node_add_count = (node.__x_node_add_count || 0) + 1;
  6647. this.initializeElements(node);
  6648. }.bind(this));
  6649. }
  6650. }
  6651. }.bind(this));
  6652. observer.observe(targetNode, observerOptions);
  6653. }
  6654. }, {
  6655. key: "getRefsProxy",
  6656. value: function getRefsProxy() {
  6657. var _this25 = this;
  6658. var self = this;
  6659. var refObj = {};
  6660. /* IE11-ONLY:START */
  6661. // Add any properties up-front that might be necessary for the Proxy polyfill.
  6662. refObj.$isRefsProxy = false;
  6663. refObj.$isAlpineProxy = false; // If we are in IE, since the polyfill needs all properties to be defined before building the proxy,
  6664. // we just loop on the element, look for any x-ref and create a tmp property on a fake object.
  6665. this.walkAndSkipNestedComponents(self.$el, function (el) {
  6666. _newArrowCheck(this, _this25);
  6667. if (el.hasAttribute('x-ref')) {
  6668. refObj[el.getAttribute('x-ref')] = true;
  6669. }
  6670. }.bind(this));
  6671. /* IE11-ONLY:END */
  6672. // One of the goals of this is to not hold elements in memory, but rather re-evaluate
  6673. // the DOM when the system needs something from it. This way, the framework is flexible and
  6674. // friendly to outside DOM changes from libraries like Vue/Livewire.
  6675. // For this reason, I'm using an "on-demand" proxy to fake a "$refs" object.
  6676. return new Proxy(refObj, {
  6677. get: function get(object, property) {
  6678. var _this26 = this;
  6679. if (property === '$isAlpineProxy') return true;
  6680. var ref; // We can't just query the DOM because it's hard to filter out refs in
  6681. // nested components.
  6682. self.walkAndSkipNestedComponents(self.$el, function (el) {
  6683. _newArrowCheck(this, _this26);
  6684. if (el.hasAttribute('x-ref') && el.getAttribute('x-ref') === property) {
  6685. ref = el;
  6686. }
  6687. }.bind(this));
  6688. return ref;
  6689. }
  6690. });
  6691. }
  6692. }]);
  6693. return Component;
  6694. }();
  6695. var Alpine = {
  6696. version: "2.8.2",
  6697. pauseMutationObserver: false,
  6698. magicProperties: {},
  6699. onComponentInitializeds: [],
  6700. onBeforeComponentInitializeds: [],
  6701. ignoreFocusedForValueBinding: false,
  6702. start: function () {
  6703. var _start = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
  6704. var _this = this;
  6705. return regeneratorRuntime.wrap(function _callee$(_context) {
  6706. while (1) {
  6707. switch (_context.prev = _context.next) {
  6708. case 0:
  6709. if (isTesting()) {
  6710. _context.next = 3;
  6711. break;
  6712. }
  6713. _context.next = 3;
  6714. return domReady();
  6715. case 3:
  6716. this.discoverComponents(function (el) {
  6717. _newArrowCheck(this, _this);
  6718. this.initializeComponent(el);
  6719. }.bind(this)); // It's easier and more performant to just support Turbolinks than listen
  6720. // to MutationObserver mutations at the document level.
  6721. document.addEventListener("turbolinks:load", function () {
  6722. var _this2 = this;
  6723. _newArrowCheck(this, _this);
  6724. this.discoverUninitializedComponents(function (el) {
  6725. _newArrowCheck(this, _this2);
  6726. this.initializeComponent(el);
  6727. }.bind(this));
  6728. }.bind(this));
  6729. this.listenForNewUninitializedComponentsAtRunTime();
  6730. case 6:
  6731. case "end":
  6732. return _context.stop();
  6733. }
  6734. }
  6735. }, _callee, this);
  6736. }));
  6737. function start() {
  6738. return _start.apply(this, arguments);
  6739. }
  6740. return start;
  6741. }(),
  6742. discoverComponents: function discoverComponents(callback) {
  6743. var _this3 = this;
  6744. var rootEls = document.querySelectorAll('[x-data]');
  6745. rootEls.forEach(function (rootEl) {
  6746. _newArrowCheck(this, _this3);
  6747. callback(rootEl);
  6748. }.bind(this));
  6749. },
  6750. discoverUninitializedComponents: function discoverUninitializedComponents(callback) {
  6751. var _this4 = this;
  6752. var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6753. var rootEls = (el || document).querySelectorAll('[x-data]');
  6754. Array.from(rootEls).filter(function (el) {
  6755. _newArrowCheck(this, _this4);
  6756. return el.__x === undefined;
  6757. }.bind(this)).forEach(function (rootEl) {
  6758. _newArrowCheck(this, _this4);
  6759. callback(rootEl);
  6760. }.bind(this));
  6761. },
  6762. listenForNewUninitializedComponentsAtRunTime: function listenForNewUninitializedComponentsAtRunTime() {
  6763. var _this5 = this;
  6764. var targetNode = document.querySelector('body');
  6765. var observerOptions = {
  6766. childList: true,
  6767. attributes: true,
  6768. subtree: true
  6769. };
  6770. var observer = new MutationObserver(function (mutations) {
  6771. var _this6 = this;
  6772. _newArrowCheck(this, _this5);
  6773. if (this.pauseMutationObserver) return;
  6774. for (var i = 0; i < mutations.length; i++) {
  6775. if (mutations[i].addedNodes.length > 0) {
  6776. mutations[i].addedNodes.forEach(function (node) {
  6777. var _this7 = this;
  6778. _newArrowCheck(this, _this6);
  6779. // Discard non-element nodes (like line-breaks)
  6780. if (node.nodeType !== 1) return; // Discard any changes happening within an existing component.
  6781. // They will take care of themselves.
  6782. if (node.parentElement && node.parentElement.closest('[x-data]')) return;
  6783. this.discoverUninitializedComponents(function (el) {
  6784. _newArrowCheck(this, _this7);
  6785. this.initializeComponent(el);
  6786. }.bind(this), node.parentElement);
  6787. }.bind(this));
  6788. }
  6789. }
  6790. }.bind(this));
  6791. observer.observe(targetNode, observerOptions);
  6792. },
  6793. initializeComponent: function initializeComponent(el) {
  6794. var _this8 = this;
  6795. if (!el.__x) {
  6796. // Wrap in a try/catch so that we don't prevent other components
  6797. // from initializing when one component contains an error.
  6798. try {
  6799. el.__x = new Component(el);
  6800. } catch (error) {
  6801. setTimeout(function () {
  6802. _newArrowCheck(this, _this8);
  6803. throw error;
  6804. }.bind(this), 0);
  6805. }
  6806. }
  6807. },
  6808. clone: function clone(component, newEl) {
  6809. if (!newEl.__x) {
  6810. newEl.__x = new Component(newEl, component);
  6811. }
  6812. },
  6813. addMagicProperty: function addMagicProperty(name, callback) {
  6814. this.magicProperties[name] = callback;
  6815. },
  6816. onComponentInitialized: function onComponentInitialized(callback) {
  6817. this.onComponentInitializeds.push(callback);
  6818. },
  6819. onBeforeComponentInitialized: function onBeforeComponentInitialized(callback) {
  6820. this.onBeforeComponentInitializeds.push(callback);
  6821. }
  6822. };
  6823. if (!isTesting()) {
  6824. window.Alpine = Alpine;
  6825. if (window.deferLoadingAlpine) {
  6826. window.deferLoadingAlpine(function () {
  6827. window.Alpine.start();
  6828. });
  6829. } else {
  6830. window.Alpine.start();
  6831. }
  6832. }
  6833. })));