12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042 |
- (function (factory) {
- typeof define === 'function' && define.amd ? define(factory) :
- factory();
- }((function () { 'use strict';
- (function() {
- var select = HTMLSelectElement.prototype;
- if (select.hasOwnProperty("selectedOptions")) return
- Object.defineProperty(select, "selectedOptions", {
- get: function() {
- return this.querySelectorAll(":checked")
- },
- enumerable: true,
- configurable: true,
- });
- })();
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- (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}),
- 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=
- 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,
- 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__===
- 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);})();
- !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);
- (function (arr) {
- arr.forEach(function (item) {
- if (item.hasOwnProperty('remove')) {
- return;
- }
- Object.defineProperty(item, 'remove', {
- configurable: true,
- enumerable: true,
- writable: true,
- value: function remove() {
- this.parentNode && this.parentNode.removeChild(this);
- }
- });
- });
- })([Element.prototype, CharacterData.prototype, DocumentType.prototype].filter(Boolean));
- /*
- * classList.js: Cross-browser full element.classList implementation.
- * 1.1.20170427
- *
- * By Eli Grey, http://eligrey.com
- * License: Dedicated to the public domain.
- * See https://github.com/eligrey/classList.js/blob/master/LICENSE.md
- */
- /*global self, document, DOMException */
- /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */
- if ("document" in window.self) {
- // Full polyfill for browsers with no classList support
- // Including IE < Edge missing SVGElement.classList
- if (!("classList" in document.createElement("_"))
- || document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg","g"))) {
- (function (view) {
- if (!('Element' in view)) return;
- var
- classListProp = "classList"
- , protoProp = "prototype"
- , elemCtrProto = view.Element[protoProp]
- , objCtr = Object
- , strTrim = String[protoProp].trim || function () {
- return this.replace(/^\s+|\s+$/g, "");
- }
- , arrIndexOf = Array[protoProp].indexOf || function (item) {
- var
- i = 0
- , len = this.length
- ;
- for (; i < len; i++) {
- if (i in this && this[i] === item) {
- return i;
- }
- }
- return -1;
- }
- // Vendors: please allow content code to instantiate DOMExceptions
- , DOMEx = function (type, message) {
- this.name = type;
- this.code = DOMException[type];
- this.message = message;
- }
- , checkTokenAndGetIndex = function (classList, token) {
- if (token === "") {
- throw new DOMEx(
- "SYNTAX_ERR"
- , "An invalid or illegal string was specified"
- );
- }
- if (/\s/.test(token)) {
- throw new DOMEx(
- "INVALID_CHARACTER_ERR"
- , "String contains an invalid character"
- );
- }
- return arrIndexOf.call(classList, token);
- }
- , ClassList = function (elem) {
- var
- trimmedClasses = strTrim.call(elem.getAttribute("class") || "")
- , classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
- , i = 0
- , len = classes.length
- ;
- for (; i < len; i++) {
- this.push(classes[i]);
- }
- this._updateClassName = function () {
- elem.setAttribute("class", this.toString());
- };
- }
- , classListProto = ClassList[protoProp] = []
- , classListGetter = function () {
- return new ClassList(this);
- }
- ;
- // Most DOMException implementations don't allow calling DOMException's toString()
- // on non-DOMExceptions. Error's toString() is sufficient here.
- DOMEx[protoProp] = Error[protoProp];
- classListProto.item = function (i) {
- return this[i] || null;
- };
- classListProto.contains = function (token) {
- token += "";
- return checkTokenAndGetIndex(this, token) !== -1;
- };
- classListProto.add = function () {
- var
- tokens = arguments
- , i = 0
- , l = tokens.length
- , token
- , updated = false
- ;
- do {
- token = tokens[i] + "";
- if (checkTokenAndGetIndex(this, token) === -1) {
- this.push(token);
- updated = true;
- }
- }
- while (++i < l);
- if (updated) {
- this._updateClassName();
- }
- };
- classListProto.remove = function () {
- var
- tokens = arguments
- , i = 0
- , l = tokens.length
- , token
- , updated = false
- , index
- ;
- do {
- token = tokens[i] + "";
- index = checkTokenAndGetIndex(this, token);
- while (index !== -1) {
- this.splice(index, 1);
- updated = true;
- index = checkTokenAndGetIndex(this, token);
- }
- }
- while (++i < l);
- if (updated) {
- this._updateClassName();
- }
- };
- classListProto.toggle = function (token, force) {
- token += "";
- var
- result = this.contains(token)
- , method = result ?
- force !== true && "remove"
- :
- force !== false && "add"
- ;
- if (method) {
- this[method](token);
- }
- if (force === true || force === false) {
- return force;
- } else {
- return !result;
- }
- };
- classListProto.toString = function () {
- return this.join(" ");
- };
- if (objCtr.defineProperty) {
- var classListPropDesc = {
- get: classListGetter
- , enumerable: true
- , configurable: true
- };
- try {
- objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
- } catch (ex) { // IE 8 doesn't support enumerable:true
- // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36
- // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected
- if (ex.number === undefined || ex.number === -0x7FF5EC54) {
- classListPropDesc.enumerable = false;
- objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
- }
- }
- } else if (objCtr[protoProp].__defineGetter__) {
- elemCtrProto.__defineGetter__(classListProp, classListGetter);
- }
- }(window.self));
- }
- // There is full or partial native classList support, so just check if we need
- // to normalize the add/remove and toggle APIs.
- (function () {
- var testElement = document.createElement("_");
- testElement.classList.add("c1", "c2");
- // Polyfill for IE 10/11 and Firefox <26, where classList.add and
- // classList.remove exist but support only one argument at a time.
- if (!testElement.classList.contains("c2")) {
- var createMethod = function(method) {
- var original = DOMTokenList.prototype[method];
- DOMTokenList.prototype[method] = function(token) {
- var i, len = arguments.length;
- for (i = 0; i < len; i++) {
- token = arguments[i];
- original.call(this, token);
- }
- };
- };
- createMethod('add');
- createMethod('remove');
- }
- testElement.classList.toggle("c3", false);
- // Polyfill for IE 10 and Firefox <24, where classList.toggle does not
- // support the second argument.
- if (testElement.classList.contains("c3")) {
- var _toggle = DOMTokenList.prototype.toggle;
- DOMTokenList.prototype.toggle = function(token, force) {
- if (1 in arguments && !this.contains(token) === !force) {
- return force;
- } else {
- return _toggle.call(this, token);
- }
- };
- }
- testElement = null;
- }());
- }
- /**
- * @license
- * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
- // minimal template polyfill
- (function() {
- var needsTemplate = (typeof HTMLTemplateElement === 'undefined');
- var brokenDocFragment = !(document.createDocumentFragment().cloneNode() instanceof DocumentFragment);
- var needsDocFrag = false;
- // NOTE: Replace DocumentFragment to work around IE11 bug that
- // causes children of a document fragment modified while
- // there is a mutation observer to not have a parentNode, or
- // have a broken parentNode (!?!)
- if (/Trident/.test(navigator.userAgent)) {
- (function() {
- needsDocFrag = true;
- var origCloneNode = Node.prototype.cloneNode;
- Node.prototype.cloneNode = function cloneNode(deep) {
- var newDom = origCloneNode.call(this, deep);
- if (this instanceof DocumentFragment) {
- newDom.__proto__ = DocumentFragment.prototype;
- }
- return newDom;
- };
- // IE's DocumentFragment querySelector code doesn't work when
- // called on an element instance
- DocumentFragment.prototype.querySelectorAll = HTMLElement.prototype.querySelectorAll;
- DocumentFragment.prototype.querySelector = HTMLElement.prototype.querySelector;
- Object.defineProperties(DocumentFragment.prototype, {
- 'nodeType': {
- get: function () {
- return Node.DOCUMENT_FRAGMENT_NODE;
- },
- configurable: true
- },
- 'localName': {
- get: function () {
- return undefined;
- },
- configurable: true
- },
- 'nodeName': {
- get: function () {
- return '#document-fragment';
- },
- configurable: true
- }
- });
- var origInsertBefore = Node.prototype.insertBefore;
- function insertBefore(newNode, refNode) {
- if (newNode instanceof DocumentFragment) {
- var child;
- while ((child = newNode.firstChild)) {
- origInsertBefore.call(this, child, refNode);
- }
- } else {
- origInsertBefore.call(this, newNode, refNode);
- }
- return newNode;
- }
- Node.prototype.insertBefore = insertBefore;
- var origAppendChild = Node.prototype.appendChild;
- Node.prototype.appendChild = function appendChild(child) {
- if (child instanceof DocumentFragment) {
- insertBefore.call(this, child, null);
- } else {
- origAppendChild.call(this, child);
- }
- return child;
- };
- var origRemoveChild = Node.prototype.removeChild;
- var origReplaceChild = Node.prototype.replaceChild;
- Node.prototype.replaceChild = function replaceChild(newChild, oldChild) {
- if (newChild instanceof DocumentFragment) {
- insertBefore.call(this, newChild, oldChild);
- origRemoveChild.call(this, oldChild);
- } else {
- origReplaceChild.call(this, newChild, oldChild);
- }
- return oldChild;
- };
- Document.prototype.createDocumentFragment = function createDocumentFragment() {
- var frag = this.createElement('df');
- frag.__proto__ = DocumentFragment.prototype;
- return frag;
- };
- var origImportNode = Document.prototype.importNode;
- Document.prototype.importNode = function importNode(impNode, deep) {
- deep = deep || false;
- var newNode = origImportNode.call(this, impNode, deep);
- if (impNode instanceof DocumentFragment) {
- newNode.__proto__ = DocumentFragment.prototype;
- }
- return newNode;
- };
- })();
- }
- // NOTE: we rely on this cloneNode not causing element upgrade.
- // This means this polyfill must load before the CE polyfill and
- // this would need to be re-worked if a browser supports native CE
- // but not <template>.
- var capturedCloneNode = Node.prototype.cloneNode;
- var capturedCreateElement = Document.prototype.createElement;
- var capturedImportNode = Document.prototype.importNode;
- var capturedRemoveChild = Node.prototype.removeChild;
- var capturedAppendChild = Node.prototype.appendChild;
- var capturedReplaceChild = Node.prototype.replaceChild;
- var capturedParseFromString = DOMParser.prototype.parseFromString;
- var capturedHTMLElementInnerHTML = Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'innerHTML') || {
- /**
- * @this {!HTMLElement}
- * @return {string}
- */
- get: function() {
- return this.innerHTML;
- },
- /**
- * @this {!HTMLElement}
- * @param {string}
- */
- set: function(text) {
- this.innerHTML = text;
- }
- };
- var capturedChildNodes = Object.getOwnPropertyDescriptor(window.Node.prototype, 'childNodes') || {
- /**
- * @this {!Node}
- * @return {!NodeList}
- */
- get: function() {
- return this.childNodes;
- }
- };
- var elementQuerySelectorAll = Element.prototype.querySelectorAll;
- var docQuerySelectorAll = Document.prototype.querySelectorAll;
- var fragQuerySelectorAll = DocumentFragment.prototype.querySelectorAll;
- var scriptSelector = 'script:not([type]),script[type="application/javascript"],script[type="text/javascript"]';
- function QSA(node, selector) {
- // IE 11 throws a SyntaxError with `scriptSelector` if the node has no children due to the `:not([type])` syntax
- if (!node.childNodes.length) {
- return [];
- }
- switch (node.nodeType) {
- case Node.DOCUMENT_NODE:
- return docQuerySelectorAll.call(node, selector);
- case Node.DOCUMENT_FRAGMENT_NODE:
- return fragQuerySelectorAll.call(node, selector);
- default:
- return elementQuerySelectorAll.call(node, selector);
- }
- }
- // returns true if nested templates cannot be cloned (they cannot be on
- // some impl's like Safari 8 and Edge)
- // OR if cloning a document fragment does not result in a document fragment
- var needsCloning = (function() {
- if (!needsTemplate) {
- var t = document.createElement('template');
- var t2 = document.createElement('template');
- t2.content.appendChild(document.createElement('div'));
- t.content.appendChild(t2);
- var clone = t.cloneNode(true);
- return (clone.content.childNodes.length === 0 || clone.content.firstChild.content.childNodes.length === 0
- || brokenDocFragment);
- }
- })();
- var TEMPLATE_TAG = 'template';
- var PolyfilledHTMLTemplateElement = function() {};
- if (needsTemplate) {
- var contentDoc = document.implementation.createHTMLDocument('template');
- var canDecorate = true;
- var templateStyle = document.createElement('style');
- templateStyle.textContent = TEMPLATE_TAG + '{display:none;}';
- var head = document.head;
- head.insertBefore(templateStyle, head.firstElementChild);
- /**
- Provides a minimal shim for the <template> element.
- */
- PolyfilledHTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
- // if elements do not have `innerHTML` on instances, then
- // templates can be patched by swizzling their prototypes.
- var canProtoPatch =
- !(document.createElement('div').hasOwnProperty('innerHTML'));
- /**
- The `decorate` method moves element children to the template's `content`.
- NOTE: there is no support for dynamically adding elements to templates.
- */
- PolyfilledHTMLTemplateElement.decorate = function(template) {
- // if the template is decorated or not in HTML namespace, return fast
- if (template.content ||
- template.namespaceURI !== document.documentElement.namespaceURI) {
- return;
- }
- template.content = contentDoc.createDocumentFragment();
- var child;
- while ((child = template.firstChild)) {
- capturedAppendChild.call(template.content, child);
- }
- // NOTE: prefer prototype patching for performance and
- // because on some browsers (IE11), re-defining `innerHTML`
- // can result in intermittent errors.
- if (canProtoPatch) {
- template.__proto__ = PolyfilledHTMLTemplateElement.prototype;
- } else {
- template.cloneNode = function(deep) {
- return PolyfilledHTMLTemplateElement._cloneNode(this, deep);
- };
- // add innerHTML to template, if possible
- // Note: this throws on Safari 7
- if (canDecorate) {
- try {
- defineInnerHTML(template);
- defineOuterHTML(template);
- } catch (err) {
- canDecorate = false;
- }
- }
- }
- // bootstrap recursively
- PolyfilledHTMLTemplateElement.bootstrap(template.content);
- };
- // Taken from https://github.com/jquery/jquery/blob/73d7e6259c63ac45f42c6593da8c2796c6ce9281/src/manipulation/wrapMap.js
- var topLevelWrappingMap = {
- 'option': ['select'],
- 'thead': ['table'],
- 'col': ['colgroup', 'table'],
- 'tr': ['tbody', 'table'],
- 'th': ['tr', 'tbody', 'table'],
- 'td': ['tr', 'tbody', 'table']
- };
- var getTagName = function(text) {
- // Taken from https://github.com/jquery/jquery/blob/73d7e6259c63ac45f42c6593da8c2796c6ce9281/src/manipulation/var/rtagName.js
- return ( /<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
- };
- var defineInnerHTML = function defineInnerHTML(obj) {
- Object.defineProperty(obj, 'innerHTML', {
- get: function() {
- return getInnerHTML(this);
- },
- set: function(text) {
- // For IE11, wrap the text in the correct (table) context
- var wrap = topLevelWrappingMap[getTagName(text)];
- if (wrap) {
- for (var i = 0; i < wrap.length; i++) {
- text = '<' + wrap[i] + '>' + text + '</' + wrap[i] + '>';
- }
- }
- contentDoc.body.innerHTML = text;
- PolyfilledHTMLTemplateElement.bootstrap(contentDoc);
- while (this.content.firstChild) {
- capturedRemoveChild.call(this.content, this.content.firstChild);
- }
- var body = contentDoc.body;
- // If we had wrapped, get back to the original node
- if (wrap) {
- for (var j = 0; j < wrap.length; j++) {
- body = body.lastChild;
- }
- }
- while (body.firstChild) {
- capturedAppendChild.call(this.content, body.firstChild);
- }
- },
- configurable: true
- });
- };
- var defineOuterHTML = function defineOuterHTML(obj) {
- Object.defineProperty(obj, 'outerHTML', {
- get: function() {
- return '<' + TEMPLATE_TAG + '>' + this.innerHTML + '</' + TEMPLATE_TAG + '>';
- },
- set: function(innerHTML) {
- if (this.parentNode) {
- contentDoc.body.innerHTML = innerHTML;
- var docFrag = this.ownerDocument.createDocumentFragment();
- while (contentDoc.body.firstChild) {
- capturedAppendChild.call(docFrag, contentDoc.body.firstChild);
- }
- capturedReplaceChild.call(this.parentNode, docFrag, this);
- } else {
- throw new Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");
- }
- },
- configurable: true
- });
- };
- defineInnerHTML(PolyfilledHTMLTemplateElement.prototype);
- defineOuterHTML(PolyfilledHTMLTemplateElement.prototype);
- /**
- The `bootstrap` method is called automatically and "fixes" all
- <template> elements in the document referenced by the `doc` argument.
- */
- PolyfilledHTMLTemplateElement.bootstrap = function bootstrap(doc) {
- var templates = QSA(doc, TEMPLATE_TAG);
- for (var i=0, l=templates.length, t; (i<l) && (t=templates[i]); i++) {
- PolyfilledHTMLTemplateElement.decorate(t);
- }
- };
- // auto-bootstrapping for main document
- document.addEventListener('DOMContentLoaded', function() {
- PolyfilledHTMLTemplateElement.bootstrap(document);
- });
- // Patch document.createElement to ensure newly created templates have content
- Document.prototype.createElement = function createElement() {
- var el = capturedCreateElement.apply(this, arguments);
- if (el.localName === 'template') {
- PolyfilledHTMLTemplateElement.decorate(el);
- }
- return el;
- };
- DOMParser.prototype.parseFromString = function() {
- var el = capturedParseFromString.apply(this, arguments);
- PolyfilledHTMLTemplateElement.bootstrap(el);
- return el;
- };
- Object.defineProperty(HTMLElement.prototype, 'innerHTML', {
- get: function() {
- return getInnerHTML(this);
- },
- set: function(text) {
- capturedHTMLElementInnerHTML.set.call(this, text);
- PolyfilledHTMLTemplateElement.bootstrap(this);
- },
- configurable: true,
- enumerable: true
- });
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString
- var escapeAttrRegExp = /[&\u00A0"]/g;
- var escapeDataRegExp = /[&\u00A0<>]/g;
- var escapeReplace = function(c) {
- switch (c) {
- case '&':
- return '&';
- case '<':
- return '<';
- case '>':
- return '>';
- case '"':
- return '"';
- case '\u00A0':
- return ' ';
- }
- };
- var escapeAttr = function(s) {
- return s.replace(escapeAttrRegExp, escapeReplace);
- };
- var escapeData = function(s) {
- return s.replace(escapeDataRegExp, escapeReplace);
- };
- var makeSet = function(arr) {
- var set = {};
- for (var i = 0; i < arr.length; i++) {
- set[arr[i]] = true;
- }
- return set;
- };
- // http://www.whatwg.org/specs/web-apps/current-work/#void-elements
- var voidElements = makeSet([
- 'area',
- 'base',
- 'br',
- 'col',
- 'command',
- 'embed',
- 'hr',
- 'img',
- 'input',
- 'keygen',
- 'link',
- 'meta',
- 'param',
- 'source',
- 'track',
- 'wbr'
- ]);
- var plaintextParents = makeSet([
- 'style',
- 'script',
- 'xmp',
- 'iframe',
- 'noembed',
- 'noframes',
- 'plaintext',
- 'noscript'
- ]);
- /**
- * @param {Node} node
- * @param {Node} parentNode
- * @param {Function=} callback
- */
- var getOuterHTML = function(node, parentNode, callback) {
- switch (node.nodeType) {
- case Node.ELEMENT_NODE: {
- var tagName = node.localName;
- var s = '<' + tagName;
- var attrs = node.attributes;
- for (var i = 0, attr; (attr = attrs[i]); i++) {
- s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
- }
- s += '>';
- if (voidElements[tagName]) {
- return s;
- }
- return s + getInnerHTML(node, callback) + '</' + tagName + '>';
- }
- case Node.TEXT_NODE: {
- var data = /** @type {Text} */ (node).data;
- if (parentNode && plaintextParents[parentNode.localName]) {
- return data;
- }
- return escapeData(data);
- }
- case Node.COMMENT_NODE: {
- return '<!--' + /** @type {Comment} */ (node).data + '-->';
- }
- default: {
- window.console.error(node);
- throw new Error('not implemented');
- }
- }
- };
- /**
- * @param {Node} node
- * @param {Function=} callback
- */
- var getInnerHTML = function(node, callback) {
- if (node.localName === 'template') {
- node = /** @type {HTMLTemplateElement} */ (node).content;
- }
- var s = '';
- var c$ = callback ? callback(node) : capturedChildNodes.get.call(node);
- for (var i=0, l=c$.length, child; (i<l) && (child=c$[i]); i++) {
- s += getOuterHTML(child, node, callback);
- }
- return s;
- };
- }
- // make cloning/importing work!
- if (needsTemplate || needsCloning) {
- PolyfilledHTMLTemplateElement._cloneNode = function _cloneNode(template, deep) {
- var clone = capturedCloneNode.call(template, false);
- // NOTE: decorate doesn't auto-fix children because they are already
- // decorated so they need special clone fixup.
- if (this.decorate) {
- this.decorate(clone);
- }
- if (deep) {
- // NOTE: use native clone node to make sure CE's wrapped
- // cloneNode does not cause elements to upgrade.
- capturedAppendChild.call(clone.content, capturedCloneNode.call(template.content, true));
- // now ensure nested templates are cloned correctly.
- fixClonedDom(clone.content, template.content);
- }
- return clone;
- };
- // Given a source and cloned subtree, find <template>'s in the cloned
- // subtree and replace them with cloned <template>'s from source.
- // We must do this because only the source templates have proper .content.
- var fixClonedDom = function fixClonedDom(clone, source) {
- // do nothing if cloned node is not an element
- if (!source.querySelectorAll) return;
- // these two lists should be coincident
- var s$ = QSA(source, TEMPLATE_TAG);
- if (s$.length === 0) {
- return;
- }
- var t$ = QSA(clone, TEMPLATE_TAG);
- for (var i=0, l=t$.length, t, s; i<l; i++) {
- s = s$[i];
- t = t$[i];
- if (PolyfilledHTMLTemplateElement && PolyfilledHTMLTemplateElement.decorate) {
- PolyfilledHTMLTemplateElement.decorate(s);
- }
- capturedReplaceChild.call(t.parentNode, cloneNode.call(s, true), t);
- }
- };
- // make sure scripts inside of a cloned template are executable
- var fixClonedScripts = function fixClonedScripts(fragment) {
- var scripts = QSA(fragment, scriptSelector);
- for (var ns, s, i = 0; i < scripts.length; i++) {
- s = scripts[i];
- ns = capturedCreateElement.call(document, 'script');
- ns.textContent = s.textContent;
- var attrs = s.attributes;
- for (var ai = 0, a; ai < attrs.length; ai++) {
- a = attrs[ai];
- ns.setAttribute(a.name, a.value);
- }
- capturedReplaceChild.call(s.parentNode, ns, s);
- }
- };
- // override all cloning to fix the cloned subtree to contain properly
- // cloned templates.
- var cloneNode = Node.prototype.cloneNode = function cloneNode(deep) {
- var dom;
- // workaround for Edge bug cloning documentFragments
- // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8619646/
- if (!needsDocFrag && brokenDocFragment && this instanceof DocumentFragment) {
- if (!deep) {
- return this.ownerDocument.createDocumentFragment();
- } else {
- dom = importNode.call(this.ownerDocument, this, true);
- }
- } else if (this.nodeType === Node.ELEMENT_NODE &&
- this.localName === TEMPLATE_TAG &&
- this.namespaceURI == document.documentElement.namespaceURI) {
- dom = PolyfilledHTMLTemplateElement._cloneNode(this, deep);
- } else {
- dom = capturedCloneNode.call(this, deep);
- }
- // template.content is cloned iff `deep`.
- if (deep) {
- fixClonedDom(dom, this);
- }
- return dom;
- };
- // NOTE: we are cloning instead of importing <template>'s.
- // However, the ownerDocument of the cloned template will be correct!
- // This is because the native import node creates the right document owned
- // subtree and `fixClonedDom` inserts cloned templates into this subtree,
- // thus updating the owner doc.
- var importNode = Document.prototype.importNode = function importNode(element, deep) {
- deep = deep || false;
- if (element.localName === TEMPLATE_TAG) {
- return PolyfilledHTMLTemplateElement._cloneNode(element, deep);
- } else {
- var dom = capturedImportNode.call(this, element, deep);
- if (deep) {
- fixClonedDom(dom, element);
- fixClonedScripts(dom);
- }
- return dom;
- }
- };
- }
- if (needsTemplate) {
- window.HTMLTemplateElement = PolyfilledHTMLTemplateElement;
- }
- })();
- var ApplyThisPrototype = (function() {
- return function ApplyThisPrototype(event, target) {
- if ((typeof target === 'object') && (target !== null)) {
- var proto = Object.getPrototypeOf(target);
- var property;
- for (property in proto) {
- if (!(property in event)) {
- var descriptor = Object.getOwnPropertyDescriptor(proto, property);
- if (descriptor) {
- Object.defineProperty(event, property, descriptor);
- }
- }
- }
- for (property in target) {
- if (!(property in event)) {
- event[property] = target[property];
- }
- }
- }
- }
- })();
- (function(ApplyThisPrototype) {
- /**
- * Polyfill CustomEvent
- */
- try {
- var event = new window.CustomEvent('event', { bubbles: true, cancelable: true });
- } catch (error) {
- var CustomEventOriginal = window.CustomEvent || window.Event;
- var CustomEvent = function(eventName, params) {
- params = params || {};
- var event = document.createEvent('CustomEvent');
- event.initCustomEvent(
- eventName,
- (params.bubbles === void 0) ? false : params.bubbles,
- (params.cancelable === void 0) ? false : params.cancelable,
- (params.detail === void 0) ? {} : params.detail
- );
- ApplyThisPrototype(event, this);
- return event;
- };
- CustomEvent.prototype = CustomEventOriginal.prototype;
- window.CustomEvent = CustomEvent;
- }
- })(ApplyThisPrototype);
- var EventListenerInterceptor = (function() {
- if(typeof EventTarget === 'undefined') {
- window.EventTarget = Node;
- }
- /**
- * Event listener interceptor
- */
- var EventListenerInterceptor = {
- interceptors: [] // { target: EventTarget, interceptors: [{ add: Function, remove: Function }, ...] }
- };
- /**
- * Returns if exists a previously registered listener from a target and the normalized arguments
- * @param target
- * @param normalizedArguments
- * @return {*}
- */
- EventListenerInterceptor.getRegisteredEventListener = function(target, normalizedArguments) {
- var key = normalizedArguments.type + '-' + (normalizedArguments.options.capture ? '1' : '0');
- if(
- (target.__eventListeners !== void 0) &&
- (target.__eventListeners[key] !== void 0)
- ) {
- var map = target.__eventListeners[key];
- for(var i = 0; i < map.length; i++) {
- if(map[i].listener === normalizedArguments.listener) {
- return map[i];
- }
- }
- }
- return null;
- };
- /**
- * Registers a listener on a target with some options
- * @param target
- * @param normalizedArguments
- */
- EventListenerInterceptor.registerEventListener = function(target, normalizedArguments) {
- var key = normalizedArguments.type + '-' + (normalizedArguments.options.capture ? '1' : '0');
- if(target.__eventListeners === void 0) {
- target.__eventListeners = {};
- }
- if(target.__eventListeners[key] === void 0) {
- target.__eventListeners[key] = [];
- }
- target.__eventListeners[key].push(normalizedArguments);
- };
- /**
- * Unregisters a listener on a target with some options
- * @param target
- * @param normalizedArguments
- */
- EventListenerInterceptor.unregisterEventListener = function(target, normalizedArguments) {
- var key = normalizedArguments.type + '-' + (normalizedArguments.options.capture ? '1' : '0');
- if(
- (target.__eventListeners !== void 0) &&
- (target.__eventListeners[key] !== void 0)
- ) {
- var map = target.__eventListeners[key];
- for(var i = 0; i < map.length; i++) {
- if(map[i].listener === normalizedArguments.listener) {
- map.splice(i, 1);
- }
- }
- if(map.length === 0) {
- delete target.__eventListeners[key];
- }
- }
- };
- EventListenerInterceptor.normalizeListenerCallback = function(listener) {
- if((typeof listener === 'function') || (listener === null) || (listener === void 0)) {
- return listener;
- } else if((typeof listener === 'object') && (typeof listener.handleEvent === 'function')) {
- return listener.handleEvent;
- } else {
- // to support Symbol
- return function(event) {
- listener(event);
- };
- }
- };
- EventListenerInterceptor.normalizeListenerOptions = function(options) {
- switch(typeof options) {
- case 'boolean':
- options = { capture: options };
- break;
- case 'undefined':
- options = { capture: false };
- break;
- case 'object':
- if (options === null) {
- options = { capture: false };
- }
- break;
- default:
- throw new Error('Unsupported options type for addEventListener');
- }
- options.once = Boolean(options.once);
- options.passive = Boolean(options.passive);
- options.capture = Boolean(options.capture);
- return options;
- };
- EventListenerInterceptor.normalizeListenerArguments = function(type, listener, options) {
- return {
- type: type,
- listener: this.normalizeListenerCallback(listener),
- options: this.normalizeListenerOptions(options)
- };
- };
- EventListenerInterceptor.intercept = function(target, interceptors) {
- // get an interceptor with this target or null
- var interceptor = null;
- for (var i = 0; i < this.interceptors.length; i++) {
- if(this.interceptors[i].target === target) {
- interceptor = this.interceptors[i];
- }
- }
- // if no interceptor already set
- if (interceptor === null) {
- interceptor = { target: target, interceptors: [interceptors] };
- this.interceptors.push(interceptor);
- this.interceptAddEventListener(target, interceptor);
- this.interceptRemoveEventListener(target, interceptor);
- } else { // if an interceptor already set, simply add interceptors to the list
- interceptor.interceptors.push(interceptors);
- }
- // var release = function() {
- // target.prototype.addEventListener = addEventListener;
- // target.prototype.removeEventListener = removeEventListener;
- // };
- // this.interceptors.push(release);
- // return release;
- };
- EventListenerInterceptor.interceptAddEventListener = function(target, interceptor) {
- var _this = this;
- var addEventListener = target.prototype.addEventListener;
- target.prototype.addEventListener = function(type, listener, options) {
- var normalizedArguments = _this.normalizeListenerArguments(type, listener, options);
- var registeredEventListener = _this.getRegisteredEventListener(this, normalizedArguments);
- if (!registeredEventListener) {
- normalizedArguments.polyfilled = {
- type: normalizedArguments.type,
- listener: normalizedArguments.listener,
- options: {
- capture: normalizedArguments.options.capture,
- once: normalizedArguments.options.once,
- passive: normalizedArguments.options.passive
- }
- };
- for (var i = 0; i < interceptor.interceptors.length; i++) {
- var interceptors = interceptor.interceptors[i];
- if (typeof interceptors.add === 'function') {
- interceptors.add(normalizedArguments);
- }
- }
- // console.log('normalizedArguments', normalizedArguments.polyfilled);
- _this.registerEventListener(this, normalizedArguments);
- addEventListener.call(
- this,
- normalizedArguments.polyfilled.type,
- normalizedArguments.polyfilled.listener,
- normalizedArguments.polyfilled.options
- );
- }
- };
- return function() {
- target.prototype.addEventListener = addEventListener;
- };
- };
- EventListenerInterceptor.interceptRemoveEventListener = function(target, interceptor) {
- var _this = this;
- var removeEventListener = target.prototype.removeEventListener;
- target.prototype.removeEventListener = function(type, listener, options) {
- var normalizedArguments = _this.normalizeListenerArguments(type, listener, options);
- var registeredEventListener = _this.getRegisteredEventListener(this, normalizedArguments);
- if (registeredEventListener) {
- _this.unregisterEventListener(this, normalizedArguments);
- removeEventListener.call(
- this,
- registeredEventListener.polyfilled.type,
- registeredEventListener.polyfilled.listener,
- registeredEventListener.polyfilled.options
- );
- } else {
- removeEventListener.call(this, type, listener, options);
- }
- };
- return function() {
- target.prototype.removeEventListener = removeEventListener;
- };
- };
- EventListenerInterceptor.interceptAll = function(interceptors) {
- this.intercept(EventTarget, interceptors);
- if(!(window instanceof EventTarget)) {
- this.intercept(Window, interceptors);
- }
- };
- EventListenerInterceptor.releaseAll = function() {
- for(var i = 0, l = this.interceptors.length; i < l; i++) {
- this.interceptors();
- }
- };
- EventListenerInterceptor.error = function(error) {
- // throw error;
- console.error(error);
- };
- return EventListenerInterceptor;
- })();
- (function(EventListenerInterceptor) {
- /**
- * Event listener options support
- */
- EventListenerInterceptor.detectSupportedOptions = function() {
- var _this = this;
- this.supportedOptions = {
- once: false,
- passive: false,
- capture: false,
- all: false,
- some: false
- };
- document.createDocumentFragment().addEventListener('test', function() {}, {
- get once() {
- _this.supportedOptions.once = true;
- return false;
- },
- get passive() {
- _this.supportedOptions.passive = true;
- return false;
- },
- get capture() {
- _this.supportedOptions.capture = true;
- return false;
- }
- });
- // useful shortcuts to detect if options are all/some supported
- this.supportedOptions.all = this.supportedOptions.once && this.supportedOptions.passive && this.supportedOptions.capture;
- this.supportedOptions.some = this.supportedOptions.once || this.supportedOptions.passive || this.supportedOptions.capture;
- };
- EventListenerInterceptor.polyfillListenerOptions = function() {
- this.detectSupportedOptions();
- if (!this.supportedOptions.all) {
- var _this = this;
- this.interceptAll({
- add: function(normalizedArguments) {
- // console.log('intercepted', normalizedArguments);
- var once = normalizedArguments.options.once && !_this.supportedOptions.once;
- var passive = normalizedArguments.options.passive && !_this.supportedOptions.passive;
- if (once || passive) {
- var listener = normalizedArguments.polyfilled.listener;
- normalizedArguments.polyfilled.listener = function(event) {
- if(once) {
- this.removeEventListener(normalizedArguments.type, normalizedArguments.listener, normalizedArguments.options);
- }
- if(passive) {
- event.preventDefault = function() {
- throw new Error('Unable to preventDefault inside passive event listener invocation.');
- };
- }
- return listener.call(this, event);
- };
- }
- if (!_this.supportedOptions.some) {
- normalizedArguments.polyfilled.options = normalizedArguments.options.capture;
- }
- }
- });
- }
- };
- EventListenerInterceptor.polyfillListenerOptions();
- // var onclick = function() {
- // console.log('click');
- // };
- // document.body.addEventListener('click', onclick, false);
- // document.body.addEventListener('click', onclick, { once: true });
- // document.body.addEventListener('click', onclick, { once: true });
- // document.body.addEventListener('click', onclick, false);
- // document.body.addEventListener('click', onclick, false);
- })(EventListenerInterceptor);
- // For the IE11 build.
- SVGElement.prototype.contains = SVGElement.prototype.contains || HTMLElement.prototype.contains // .childElementCount polyfill
- // from https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/childElementCount#Polyfill_for_IE8_IE9_Safari
- ;
- (function (constructor) {
- if (constructor && constructor.prototype && constructor.prototype.childElementCount == null) {
- Object.defineProperty(constructor.prototype, 'childElementCount', {
- get: function get() {
- var i = 0,
- count = 0,
- node,
- nodes = this.childNodes;
- while (node = nodes[i++]) {
- if (node.nodeType === 1) count++;
- }
- return count;
- }
- });
- }
- })(window.Node || window.Element);
- var check = function (it) {
- return it && it.Math == Math && it;
- };
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global_1 =
- // eslint-disable-next-line no-undef
- check(typeof globalThis == 'object' && globalThis) ||
- check(typeof window == 'object' && window) ||
- check(typeof self == 'object' && self) ||
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
- // eslint-disable-next-line no-new-func
- (function () { return this; })() || Function('return this')();
- var fails = function (exec) {
- try {
- return !!exec();
- } catch (error) {
- return true;
- }
- };
- // Detect IE8's incomplete defineProperty implementation
- var descriptors = !fails(function () {
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
- });
- var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
- var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
- // Nashorn ~ JDK8 bug
- var NASHORN_BUG = getOwnPropertyDescriptor$4 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
- // `Object.prototype.propertyIsEnumerable` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
- var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
- var descriptor = getOwnPropertyDescriptor$4(this, V);
- return !!descriptor && descriptor.enumerable;
- } : nativePropertyIsEnumerable;
- var objectPropertyIsEnumerable = {
- f: f$5
- };
- var createPropertyDescriptor = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- var toString = {}.toString;
- var classofRaw = function (it) {
- return toString.call(it).slice(8, -1);
- };
- var split = ''.split;
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- var indexedObject = fails(function () {
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
- // eslint-disable-next-line no-prototype-builtins
- return !Object('z').propertyIsEnumerable(0);
- }) ? function (it) {
- return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
- } : Object;
- // `RequireObjectCoercible` abstract operation
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
- var requireObjectCoercible = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
- };
- // toObject with fallback for non-array-like ES3 strings
- var toIndexedObject = function (it) {
- return indexedObject(requireObjectCoercible(it));
- };
- var isObject = function (it) {
- return typeof it === 'object' ? it !== null : typeof it === 'function';
- };
- // `ToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-toprimitive
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- var toPrimitive = function (input, PREFERRED_STRING) {
- if (!isObject(input)) return input;
- var fn, val;
- if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
- if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
- if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
- throw TypeError("Can't convert object to primitive value");
- };
- var hasOwnProperty = {}.hasOwnProperty;
- var has$1 = function (it, key) {
- return hasOwnProperty.call(it, key);
- };
- var document$3 = global_1.document;
- // typeof document.createElement is 'object' in old IE
- var EXISTS = isObject(document$3) && isObject(document$3.createElement);
- var documentCreateElement = function (it) {
- return EXISTS ? document$3.createElement(it) : {};
- };
- // Thank's IE8 for his funny defineProperty
- var ie8DomDefine = !descriptors && !fails(function () {
- return Object.defineProperty(documentCreateElement('div'), 'a', {
- get: function () { return 7; }
- }).a != 7;
- });
- var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- var f$4 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPrimitive(P, true);
- if (ie8DomDefine) try {
- return nativeGetOwnPropertyDescriptor(O, P);
- } catch (error) { /* empty */ }
- if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
- };
- var objectGetOwnPropertyDescriptor = {
- f: f$4
- };
- var anObject = function (it) {
- if (!isObject(it)) {
- throw TypeError(String(it) + ' is not an object');
- } return it;
- };
- var nativeDefineProperty = Object.defineProperty;
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- var f$3 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (ie8DomDefine) try {
- return nativeDefineProperty(O, P, Attributes);
- } catch (error) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- var objectDefineProperty = {
- f: f$3
- };
- var createNonEnumerableProperty = descriptors ? function (object, key, value) {
- return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- var setGlobal = function (key, value) {
- try {
- createNonEnumerableProperty(global_1, key, value);
- } catch (error) {
- global_1[key] = value;
- } return value;
- };
- var SHARED = '__core-js_shared__';
- var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
- var sharedStore = store$1;
- var functionToString = Function.toString;
- // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
- if (typeof sharedStore.inspectSource != 'function') {
- sharedStore.inspectSource = function (it) {
- return functionToString.call(it);
- };
- }
- var inspectSource = sharedStore.inspectSource;
- var WeakMap$1 = global_1.WeakMap;
- var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
- var shared = createCommonjsModule(function (module) {
- (module.exports = function (key, value) {
- return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: '3.8.3',
- mode: 'global',
- copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
- });
- });
- var id = 0;
- var postfix = Math.random();
- var uid = function (key) {
- return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
- };
- var keys$1 = shared('keys');
- var sharedKey = function (key) {
- return keys$1[key] || (keys$1[key] = uid(key));
- };
- var hiddenKeys$1 = {};
- var WeakMap = global_1.WeakMap;
- var set$2, get, has;
- var enforce = function (it) {
- return has(it) ? get(it) : set$2(it, {});
- };
- var getterFor = function (TYPE) {
- return function (it) {
- var state;
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
- } return state;
- };
- };
- if (nativeWeakMap) {
- var store = sharedStore.state || (sharedStore.state = new WeakMap());
- var wmget = store.get;
- var wmhas = store.has;
- var wmset = store.set;
- set$2 = function (it, metadata) {
- metadata.facade = it;
- wmset.call(store, it, metadata);
- return metadata;
- };
- get = function (it) {
- return wmget.call(store, it) || {};
- };
- has = function (it) {
- return wmhas.call(store, it);
- };
- } else {
- var STATE = sharedKey('state');
- hiddenKeys$1[STATE] = true;
- set$2 = function (it, metadata) {
- metadata.facade = it;
- createNonEnumerableProperty(it, STATE, metadata);
- return metadata;
- };
- get = function (it) {
- return has$1(it, STATE) ? it[STATE] : {};
- };
- has = function (it) {
- return has$1(it, STATE);
- };
- }
- var internalState = {
- set: set$2,
- get: get,
- has: has,
- enforce: enforce,
- getterFor: getterFor
- };
- var redefine = createCommonjsModule(function (module) {
- var getInternalState = internalState.get;
- var enforceInternalState = internalState.enforce;
- var TEMPLATE = String(String).split('String');
- (module.exports = function (O, key, value, options) {
- var unsafe = options ? !!options.unsafe : false;
- var simple = options ? !!options.enumerable : false;
- var noTargetGet = options ? !!options.noTargetGet : false;
- var state;
- if (typeof value == 'function') {
- if (typeof key == 'string' && !has$1(value, 'name')) {
- createNonEnumerableProperty(value, 'name', key);
- }
- state = enforceInternalState(value);
- if (!state.source) {
- state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
- }
- }
- if (O === global_1) {
- if (simple) O[key] = value;
- else setGlobal(key, value);
- return;
- } else if (!unsafe) {
- delete O[key];
- } else if (!noTargetGet && O[key]) {
- simple = true;
- }
- if (simple) O[key] = value;
- else createNonEnumerableProperty(O, key, value);
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
- })(Function.prototype, 'toString', function toString() {
- return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
- });
- });
- var path = global_1;
- var aFunction$1 = function (variable) {
- return typeof variable == 'function' ? variable : undefined;
- };
- var getBuiltIn = function (namespace, method) {
- return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
- : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
- };
- var ceil = Math.ceil;
- var floor$1 = Math.floor;
- // `ToInteger` abstract operation
- // https://tc39.es/ecma262/#sec-tointeger
- var toInteger = function (argument) {
- return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
- };
- var min$5 = Math.min;
- // `ToLength` abstract operation
- // https://tc39.es/ecma262/#sec-tolength
- var toLength = function (argument) {
- return argument > 0 ? min$5(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
- };
- var max$2 = Math.max;
- var min$4 = Math.min;
- // Helper for a popular repeating case of the spec:
- // Let integer be ? ToInteger(index).
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
- var toAbsoluteIndex = function (index, length) {
- var integer = toInteger(index);
- return integer < 0 ? max$2(integer + length, 0) : min$4(integer, length);
- };
- // `Array.prototype.{ indexOf, includes }` methods implementation
- var createMethod$5 = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIndexedObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) {
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- var arrayIncludes = {
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- includes: createMethod$5(true),
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- indexOf: createMethod$5(false)
- };
- var indexOf = arrayIncludes.indexOf;
- var objectKeysInternal = function (object, names) {
- var O = toIndexedObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (has$1(O, key = names[i++])) {
- ~indexOf(result, key) || result.push(key);
- }
- return result;
- };
- // IE8- don't enum bug keys
- var enumBugKeys = [
- 'constructor',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'toLocaleString',
- 'toString',
- 'valueOf'
- ];
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return objectKeysInternal(O, hiddenKeys);
- };
- var objectGetOwnPropertyNames = {
- f: f$2
- };
- var f$1 = Object.getOwnPropertySymbols;
- var objectGetOwnPropertySymbols = {
- f: f$1
- };
- // all object keys, includes non-enumerable and symbols
- var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
- var keys = objectGetOwnPropertyNames.f(anObject(it));
- var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
- return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
- };
- var copyConstructorProperties = function (target, source) {
- var keys = ownKeys$1(source);
- var defineProperty = objectDefineProperty.f;
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!has$1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
- }
- };
- var replacement = /#|\.prototype\./;
- var isForced = function (feature, detection) {
- var value = data[normalize(feature)];
- return value == POLYFILL ? true
- : value == NATIVE ? false
- : typeof detection == 'function' ? fails(detection)
- : !!detection;
- };
- var normalize = isForced.normalize = function (string) {
- return String(string).replace(replacement, '.').toLowerCase();
- };
- var data = isForced.data = {};
- var NATIVE = isForced.NATIVE = 'N';
- var POLYFILL = isForced.POLYFILL = 'P';
- var isForced_1 = isForced;
- var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
- /*
- options.target - name of the target object
- options.global - target is the global object
- options.stat - export as static methods of target
- options.proto - export as prototype methods of target
- options.real - real prototype method for the `pure` version
- options.forced - export even if the native feature is available
- options.bind - bind methods to the target, required for the `pure` version
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
- options.sham - add a flag to not completely full polyfills
- options.enumerable - export as enumerable property
- options.noTargetGet - prevent calling a getter on target
- */
- var _export = function (options, source) {
- var TARGET = options.target;
- var GLOBAL = options.global;
- var STATIC = options.stat;
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
- if (GLOBAL) {
- target = global_1;
- } else if (STATIC) {
- target = global_1[TARGET] || setGlobal(TARGET, {});
- } else {
- target = (global_1[TARGET] || {}).prototype;
- }
- if (target) for (key in source) {
- sourceProperty = source[key];
- if (options.noTargetGet) {
- descriptor = getOwnPropertyDescriptor$3(target, key);
- targetProperty = descriptor && descriptor.value;
- } else targetProperty = target[key];
- FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
- // contained in target
- if (!FORCED && targetProperty !== undefined) {
- if (typeof sourceProperty === typeof targetProperty) continue;
- copyConstructorProperties(sourceProperty, targetProperty);
- }
- // add a flag to not completely full polyfills
- if (options.sham || (targetProperty && targetProperty.sham)) {
- createNonEnumerableProperty(sourceProperty, 'sham', true);
- }
- // extend global
- redefine(target, key, sourceProperty, options);
- }
- };
- var aFunction = function (it) {
- if (typeof it != 'function') {
- throw TypeError(String(it) + ' is not a function');
- } return it;
- };
- // optional / simple context binding
- var functionBindContext = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 0: return function () {
- return fn.call(that);
- };
- case 1: return function (a) {
- return fn.call(that, a);
- };
- case 2: return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3: return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- // `ToObject` abstract operation
- // https://tc39.es/ecma262/#sec-toobject
- var toObject = function (argument) {
- return Object(requireObjectCoercible(argument));
- };
- // `IsArray` abstract operation
- // https://tc39.es/ecma262/#sec-isarray
- var isArray = Array.isArray || function isArray(arg) {
- return classofRaw(arg) == 'Array';
- };
- var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
- // Chrome 38 Symbol has incorrect toString conversion
- // eslint-disable-next-line no-undef
- return !String(Symbol());
- });
- var useSymbolAsUid = nativeSymbol
- // eslint-disable-next-line no-undef
- && !Symbol.sham
- // eslint-disable-next-line no-undef
- && typeof Symbol.iterator == 'symbol';
- var WellKnownSymbolsStore = shared('wks');
- var Symbol$1 = global_1.Symbol;
- var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
- var wellKnownSymbol = function (name) {
- if (!has$1(WellKnownSymbolsStore, name)) {
- if (nativeSymbol && has$1(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
- else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
- } return WellKnownSymbolsStore[name];
- };
- var SPECIES$5 = wellKnownSymbol('species');
- // `ArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
- var arraySpeciesCreate = function (originalArray, length) {
- var C;
- if (isArray(originalArray)) {
- C = originalArray.constructor;
- // cross-realm fallback
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
- else if (isObject(C)) {
- C = C[SPECIES$5];
- if (C === null) C = undefined;
- }
- } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
- };
- var push = [].push;
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
- var createMethod$4 = function (TYPE) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var IS_FILTER_OUT = TYPE == 7;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- return function ($this, callbackfn, that, specificCreate) {
- var O = toObject($this);
- var self = indexedObject(O);
- var boundFunction = functionBindContext(callbackfn, that, 3);
- var length = toLength(self.length);
- var index = 0;
- var create = specificCreate || arraySpeciesCreate;
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
- var value, result;
- for (;length > index; index++) if (NO_HOLES || index in self) {
- value = self[index];
- result = boundFunction(value, index, O);
- if (TYPE) {
- if (IS_MAP) target[index] = result; // map
- else if (result) switch (TYPE) {
- case 3: return true; // some
- case 5: return value; // find
- case 6: return index; // findIndex
- case 2: push.call(target, value); // filter
- } else switch (TYPE) {
- case 4: return false; // every
- case 7: push.call(target, value); // filterOut
- }
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
- };
- };
- var arrayIteration = {
- // `Array.prototype.forEach` method
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- forEach: createMethod$4(0),
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- map: createMethod$4(1),
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- filter: createMethod$4(2),
- // `Array.prototype.some` method
- // https://tc39.es/ecma262/#sec-array.prototype.some
- some: createMethod$4(3),
- // `Array.prototype.every` method
- // https://tc39.es/ecma262/#sec-array.prototype.every
- every: createMethod$4(4),
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- find: createMethod$4(5),
- // `Array.prototype.findIndex` method
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
- findIndex: createMethod$4(6),
- // `Array.prototype.filterOut` method
- // https://github.com/tc39/proposal-array-filtering
- filterOut: createMethod$4(7)
- };
- var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
- var process$4 = global_1.process;
- var versions = process$4 && process$4.versions;
- var v8 = versions && versions.v8;
- var match, version;
- if (v8) {
- match = v8.split('.');
- version = match[0] + match[1];
- } else if (engineUserAgent) {
- match = engineUserAgent.match(/Edge\/(\d+)/);
- if (!match || match[1] >= 74) {
- match = engineUserAgent.match(/Chrome\/(\d+)/);
- if (match) version = match[1];
- }
- }
- var engineV8Version = version && +version;
- var SPECIES$4 = wellKnownSymbol('species');
- var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/677
- return engineV8Version >= 51 || !fails(function () {
- var array = [];
- var constructor = array.constructor = {};
- constructor[SPECIES$4] = function () {
- return { foo: 1 };
- };
- return array[METHOD_NAME](Boolean).foo !== 1;
- });
- };
- var defineProperty$5 = Object.defineProperty;
- var cache = {};
- var thrower = function (it) { throw it; };
- var arrayMethodUsesToLength = function (METHOD_NAME, options) {
- if (has$1(cache, METHOD_NAME)) return cache[METHOD_NAME];
- if (!options) options = {};
- var method = [][METHOD_NAME];
- var ACCESSORS = has$1(options, 'ACCESSORS') ? options.ACCESSORS : false;
- var argument0 = has$1(options, 0) ? options[0] : thrower;
- var argument1 = has$1(options, 1) ? options[1] : undefined;
- return cache[METHOD_NAME] = !!method && !fails(function () {
- if (ACCESSORS && !descriptors) return true;
- var O = { length: -1 };
- if (ACCESSORS) defineProperty$5(O, 1, { enumerable: true, get: thrower });
- else O[1] = 1;
- method.call(O, argument0, argument1);
- });
- };
- var $filter = arrayIteration.filter;
- var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('filter');
- // Edge 14- issue
- var USES_TO_LENGTH$8 = arrayMethodUsesToLength('filter');
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- // with adding support of @@species
- _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$8 }, {
- filter: function filter(callbackfn /* , thisArg */) {
- return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- var arrayMethodIsStrict = function (METHOD_NAME, argument) {
- var method = [][METHOD_NAME];
- return !!method && fails(function () {
- // eslint-disable-next-line no-useless-call,no-throw-literal
- method.call(null, argument || function () { throw 1; }, 1);
- });
- };
- var $forEach = arrayIteration.forEach;
- var STRICT_METHOD$4 = arrayMethodIsStrict('forEach');
- var USES_TO_LENGTH$7 = arrayMethodUsesToLength('forEach');
- // `Array.prototype.forEach` method implementation
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- var arrayForEach = (!STRICT_METHOD$4 || !USES_TO_LENGTH$7) ? function forEach(callbackfn /* , thisArg */) {
- return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- } : [].forEach;
- // `Array.prototype.forEach` method
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {
- forEach: arrayForEach
- });
- var iteratorClose = function (iterator) {
- var returnMethod = iterator['return'];
- if (returnMethod !== undefined) {
- return anObject(returnMethod.call(iterator)).value;
- }
- };
- // call something on iterator step with safe closing on error
- var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
- try {
- return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
- // 7.4.6 IteratorClose(iterator, completion)
- } catch (error) {
- iteratorClose(iterator);
- throw error;
- }
- };
- var iterators = {};
- var ITERATOR$5 = wellKnownSymbol('iterator');
- var ArrayPrototype$1 = Array.prototype;
- // check on default Array iterator
- var isArrayIteratorMethod = function (it) {
- return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$5] === it);
- };
- var createProperty = function (object, key, value) {
- var propertyKey = toPrimitive(key);
- if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
- else object[propertyKey] = value;
- };
- var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
- var test = {};
- test[TO_STRING_TAG$3] = 'z';
- var toStringTagSupport = String(test) === '[object z]';
- var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
- // ES3 wrong here
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
- // fallback for IE11 Script Access Denied error
- var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (error) { /* empty */ }
- };
- // getting tag from ES6+ `Object.prototype.toString`
- var classof = toStringTagSupport ? classofRaw : function (it) {
- var O, tag, result;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
- // builtinTag case
- : CORRECT_ARGUMENTS ? classofRaw(O)
- // ES3 arguments fallback
- : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
- };
- var ITERATOR$4 = wellKnownSymbol('iterator');
- var getIteratorMethod = function (it) {
- if (it != undefined) return it[ITERATOR$4]
- || it['@@iterator']
- || iterators[classof(it)];
- };
- // `Array.from` method implementation
- // https://tc39.es/ecma262/#sec-array.from
- var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = toObject(arrayLike);
- var C = typeof this == 'function' ? this : Array;
- var argumentsLength = arguments.length;
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var iteratorMethod = getIteratorMethod(O);
- var index = 0;
- var length, result, step, iterator, next, value;
- if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
- // if the target is not iterable or it's an array with the default iterator - use a simple case
- if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
- iterator = iteratorMethod.call(O);
- next = iterator.next;
- result = new C();
- for (;!(step = next.call(iterator)).done; index++) {
- value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
- createProperty(result, index, value);
- }
- } else {
- length = toLength(O.length);
- result = new C(length);
- for (;length > index; index++) {
- value = mapping ? mapfn(O[index], index) : O[index];
- createProperty(result, index, value);
- }
- }
- result.length = index;
- return result;
- };
- var ITERATOR$3 = wellKnownSymbol('iterator');
- var SAFE_CLOSING = false;
- try {
- var called = 0;
- var iteratorWithReturn = {
- next: function () {
- return { done: !!called++ };
- },
- 'return': function () {
- SAFE_CLOSING = true;
- }
- };
- iteratorWithReturn[ITERATOR$3] = function () {
- return this;
- };
- // eslint-disable-next-line no-throw-literal
- Array.from(iteratorWithReturn, function () { throw 2; });
- } catch (error) { /* empty */ }
- var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
- var ITERATION_SUPPORT = false;
- try {
- var object = {};
- object[ITERATOR$3] = function () {
- return {
- next: function () {
- return { done: ITERATION_SUPPORT = true };
- }
- };
- };
- exec(object);
- } catch (error) { /* empty */ }
- return ITERATION_SUPPORT;
- };
- var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration(function (iterable) {
- Array.from(iterable);
- });
- // `Array.from` method
- // https://tc39.es/ecma262/#sec-array.from
- _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION$1 }, {
- from: arrayFrom
- });
- // `String.prototype.{ codePointAt, at }` methods implementation
- var createMethod$3 = function (CONVERT_TO_STRING) {
- return function ($this, pos) {
- var S = String(requireObjectCoercible($this));
- var position = toInteger(pos);
- var size = S.length;
- var first, second;
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
- first = S.charCodeAt(position);
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
- || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
- ? CONVERT_TO_STRING ? S.charAt(position) : first
- : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
- };
- };
- var stringMultibyte = {
- // `String.prototype.codePointAt` method
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
- codeAt: createMethod$3(false),
- // `String.prototype.at` method
- // https://github.com/mathiasbynens/String.prototype.at
- charAt: createMethod$3(true)
- };
- var correctPrototypeGetter = !fails(function () {
- function F() { /* empty */ }
- F.prototype.constructor = null;
- return Object.getPrototypeOf(new F()) !== F.prototype;
- });
- var IE_PROTO$1 = sharedKey('IE_PROTO');
- var ObjectPrototype = Object.prototype;
- // `Object.getPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.getprototypeof
- var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
- O = toObject(O);
- if (has$1(O, IE_PROTO$1)) return O[IE_PROTO$1];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- } return O instanceof Object ? ObjectPrototype : null;
- };
- var ITERATOR$2 = wellKnownSymbol('iterator');
- var BUGGY_SAFARI_ITERATORS$1 = false;
- var returnThis$2 = function () { return this; };
- // `%IteratorPrototype%` object
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
- var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
- if ([].keys) {
- arrayIterator = [].keys();
- // Safari 8 has buggy iterators w/o `next`
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
- else {
- PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
- }
- }
- var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
- var test = {};
- // FF44- legacy iterators case
- return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
- });
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
- // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
- if (!has$1(IteratorPrototype$2, ITERATOR$2)) {
- createNonEnumerableProperty(IteratorPrototype$2, ITERATOR$2, returnThis$2);
- }
- var iteratorsCore = {
- IteratorPrototype: IteratorPrototype$2,
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
- };
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- var objectKeys = Object.keys || function keys(O) {
- return objectKeysInternal(O, enumBugKeys);
- };
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var keys = objectKeys(Properties);
- var length = keys.length;
- var index = 0;
- var key;
- while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
- return O;
- };
- var html = getBuiltIn('document', 'documentElement');
- var GT = '>';
- var LT = '<';
- var PROTOTYPE = 'prototype';
- var SCRIPT = 'script';
- var IE_PROTO = sharedKey('IE_PROTO');
- var EmptyConstructor = function () { /* empty */ };
- var scriptTag = function (content) {
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
- };
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
- var NullProtoObjectViaActiveX = function (activeXDocument) {
- activeXDocument.write(scriptTag(''));
- activeXDocument.close();
- var temp = activeXDocument.parentWindow.Object;
- activeXDocument = null; // avoid memory leak
- return temp;
- };
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var NullProtoObjectViaIFrame = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = documentCreateElement('iframe');
- var JS = 'java' + SCRIPT + ':';
- var iframeDocument;
- iframe.style.display = 'none';
- html.appendChild(iframe);
- // https://github.com/zloirock/core-js/issues/475
- iframe.src = String(JS);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(scriptTag('document.F=Object'));
- iframeDocument.close();
- return iframeDocument.F;
- };
- // Check for document.domain and active x support
- // No need to use active x approach when document.domain is not set
- // see https://github.com/es-shims/es5-shim/issues/150
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
- // avoid IE GC bug
- var activeXDocument;
- var NullProtoObject = function () {
- try {
- /* global ActiveXObject */
- activeXDocument = document.domain && new ActiveXObject('htmlfile');
- } catch (error) { /* ignore */ }
- NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
- var length = enumBugKeys.length;
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
- return NullProtoObject();
- };
- hiddenKeys$1[IE_PROTO] = true;
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- var objectCreate = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- EmptyConstructor[PROTOTYPE] = anObject(O);
- result = new EmptyConstructor();
- EmptyConstructor[PROTOTYPE] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO] = O;
- } else result = NullProtoObject();
- return Properties === undefined ? result : objectDefineProperties(result, Properties);
- };
- var defineProperty$4 = objectDefineProperty.f;
- var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
- var setToStringTag = function (it, TAG, STATIC) {
- if (it && !has$1(it = STATIC ? it : it.prototype, TO_STRING_TAG$1)) {
- defineProperty$4(it, TO_STRING_TAG$1, { configurable: true, value: TAG });
- }
- };
- var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
- var returnThis$1 = function () { return this; };
- var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
- var TO_STRING_TAG = NAME + ' Iterator';
- IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
- setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
- iterators[TO_STRING_TAG] = returnThis$1;
- return IteratorConstructor;
- };
- var aPossiblePrototype = function (it) {
- if (!isObject(it) && it !== null) {
- throw TypeError("Can't set " + String(it) + ' as a prototype');
- } return it;
- };
- // `Object.setPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.setprototypeof
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- /* eslint-disable no-proto */
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
- var CORRECT_SETTER = false;
- var test = {};
- var setter;
- try {
- setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
- setter.call(test, []);
- CORRECT_SETTER = test instanceof Array;
- } catch (error) { /* empty */ }
- return function setPrototypeOf(O, proto) {
- anObject(O);
- aPossiblePrototype(proto);
- if (CORRECT_SETTER) setter.call(O, proto);
- else O.__proto__ = proto;
- return O;
- };
- }() : undefined);
- var IteratorPrototype = iteratorsCore.IteratorPrototype;
- var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
- var ITERATOR$1 = wellKnownSymbol('iterator');
- var KEYS = 'keys';
- var VALUES = 'values';
- var ENTRIES = 'entries';
- var returnThis = function () { return this; };
- var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
- createIteratorConstructor(IteratorConstructor, NAME, next);
- var getIterationMethod = function (KIND) {
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
- if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
- switch (KIND) {
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
- } return function () { return new IteratorConstructor(this); };
- };
- var TO_STRING_TAG = NAME + ' Iterator';
- var INCORRECT_VALUES_NAME = false;
- var IterablePrototype = Iterable.prototype;
- var nativeIterator = IterablePrototype[ITERATOR$1]
- || IterablePrototype['@@iterator']
- || DEFAULT && IterablePrototype[DEFAULT];
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
- var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
- var CurrentIteratorPrototype, methods, KEY;
- // fix native
- if (anyNativeIterator) {
- CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
- if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
- if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
- if (objectSetPrototypeOf) {
- objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
- } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
- createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$1, returnThis);
- }
- }
- // Set @@toStringTag to native iterators
- setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
- }
- }
- // fix Array#{values, @@iterator}.name in V8 / FF
- if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
- INCORRECT_VALUES_NAME = true;
- defaultIterator = function values() { return nativeIterator.call(this); };
- }
- // define iterator
- if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
- createNonEnumerableProperty(IterablePrototype, ITERATOR$1, defaultIterator);
- }
- iterators[NAME] = defaultIterator;
- // export additional methods
- if (DEFAULT) {
- methods = {
- values: getIterationMethod(VALUES),
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
- entries: getIterationMethod(ENTRIES)
- };
- if (FORCED) for (KEY in methods) {
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
- redefine(IterablePrototype, KEY, methods[KEY]);
- }
- } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
- }
- return methods;
- };
- var charAt$1 = stringMultibyte.charAt;
- var STRING_ITERATOR = 'String Iterator';
- var setInternalState$3 = internalState.set;
- var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
- // `String.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
- defineIterator(String, 'String', function (iterated) {
- setInternalState$3(this, {
- type: STRING_ITERATOR,
- string: String(iterated),
- index: 0
- });
- // `%StringIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
- }, function next() {
- var state = getInternalState$2(this);
- var string = state.string;
- var index = state.index;
- var point;
- if (index >= string.length) return { value: undefined, done: true };
- point = charAt$1(string, index);
- state.index += point.length;
- return { value: point, done: false };
- });
- // iterable DOM collections
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
- var domIterables = {
- CSSRuleList: 0,
- CSSStyleDeclaration: 0,
- CSSValueList: 0,
- ClientRectList: 0,
- DOMRectList: 0,
- DOMStringList: 0,
- DOMTokenList: 1,
- DataTransferItemList: 0,
- FileList: 0,
- HTMLAllCollection: 0,
- HTMLCollection: 0,
- HTMLFormElement: 0,
- HTMLSelectElement: 0,
- MediaList: 0,
- MimeTypeArray: 0,
- NamedNodeMap: 0,
- NodeList: 1,
- PaintRequestList: 0,
- Plugin: 0,
- PluginArray: 0,
- SVGLengthList: 0,
- SVGNumberList: 0,
- SVGPathSegList: 0,
- SVGPointList: 0,
- SVGStringList: 0,
- SVGTransformList: 0,
- SourceBufferList: 0,
- StyleSheetList: 0,
- TextTrackCueList: 0,
- TextTrackList: 0,
- TouchList: 0
- };
- for (var COLLECTION_NAME$1 in domIterables) {
- var Collection$1 = global_1[COLLECTION_NAME$1];
- var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype$1 && CollectionPrototype$1.forEach !== arrayForEach) try {
- createNonEnumerableProperty(CollectionPrototype$1, 'forEach', arrayForEach);
- } catch (error) {
- CollectionPrototype$1.forEach = arrayForEach;
- }
- }
- function _typeof(obj) {
- "@babel/helpers - typeof";
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- _typeof = function (obj) {
- return typeof obj;
- };
- } else {
- _typeof = function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- }
- return _typeof(obj);
- }
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- Promise.resolve(value).then(_next, _throw);
- }
- }
- function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
- }
- function _throw(err) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
- }
- _next(undefined);
- });
- };
- }
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- function _newArrowCheck(innerThis, boundThis) {
- if (innerThis !== boundThis) {
- throw new TypeError("Cannot instantiate an arrow function");
- }
- }
- function _slicedToArray(arr, i) {
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
- }
- function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
- }
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
- }
- function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
- }
- function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
- }
- function _iterableToArrayLimit(arr, i) {
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
- try {
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
- function _unsupportedIterableToArray(o, minLen) {
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
- }
- function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
- return arr2;
- }
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- createCommonjsModule(function (module) {
- /**
- * Copyright (c) 2014-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var runtime = (function (exports) {
- var Op = Object.prototype;
- var hasOwn = Op.hasOwnProperty;
- var undefined$1; // More compressible than void 0.
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function wrap(innerFn, outerFn, self, tryLocsList) {
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
- var generator = Object.create(protoGenerator.prototype);
- var context = new Context(tryLocsList || []);
- // The ._invoke method unifies the implementations of the .next,
- // .throw, and .return methods.
- generator._invoke = makeInvokeMethod(innerFn, self, context);
- return generator;
- }
- exports.wrap = wrap;
- // Try/catch helper to minimize deoptimizations. Returns a completion
- // record like context.tryEntries[i].completion. This interface could
- // have been (and was previously) designed to take a closure to be
- // invoked without arguments, but in all the cases we care about we
- // already have an existing method we want to call, so there's no need
- // to create a new function object. We can even get away with assuming
- // the method takes exactly one argument, since that happens to be true
- // in every case, so we don't have to touch the arguments object. The
- // only additional allocation required is the completion record, which
- // has a stable shape and so hopefully should be cheap to allocate.
- function tryCatch(fn, obj, arg) {
- try {
- return { type: "normal", arg: fn.call(obj, arg) };
- } catch (err) {
- return { type: "throw", arg: err };
- }
- }
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
- // Returning this object from the innerFn has the same effect as
- // breaking out of the dispatch switch statement.
- var ContinueSentinel = {};
- // Dummy constructor functions that we use as the .constructor and
- // .constructor.prototype properties for functions that return Generator
- // objects. For full spec compliance, you may wish to configure your
- // minifier not to mangle the names of these two functions.
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- // This is a polyfill for %IteratorPrototype% for environments that
- // don't natively support it.
- var IteratorPrototype = {};
- IteratorPrototype[iteratorSymbol] = function () {
- return this;
- };
- var getProto = Object.getPrototypeOf;
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- if (NativeIteratorPrototype &&
- NativeIteratorPrototype !== Op &&
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
- // This environment has a native %IteratorPrototype%; use it instead
- // of the polyfill.
- IteratorPrototype = NativeIteratorPrototype;
- }
- var Gp = GeneratorFunctionPrototype.prototype =
- Generator.prototype = Object.create(IteratorPrototype);
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
- GeneratorFunctionPrototype[toStringTagSymbol] =
- GeneratorFunction.displayName = "GeneratorFunction";
- // Helper for defining the .next, .throw, and .return methods of the
- // Iterator interface in terms of a single ._invoke method.
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function(method) {
- prototype[method] = function(arg) {
- return this._invoke(method, arg);
- };
- });
- }
- exports.isGeneratorFunction = function(genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor
- ? ctor === GeneratorFunction ||
- // For the native GeneratorFunction constructor, the best we can
- // do is to check its .name property.
- (ctor.displayName || ctor.name) === "GeneratorFunction"
- : false;
- };
- exports.mark = function(genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- if (!(toStringTagSymbol in genFun)) {
- genFun[toStringTagSymbol] = "GeneratorFunction";
- }
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
- // Within the body of any async function, `await x` is transformed to
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
- // meant to be awaited.
- exports.awrap = function(arg) {
- return { __await: arg };
- };
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if (record.type === "throw") {
- reject(record.arg);
- } else {
- var result = record.arg;
- var value = result.value;
- if (value &&
- typeof value === "object" &&
- hasOwn.call(value, "__await")) {
- return PromiseImpl.resolve(value.__await).then(function(value) {
- invoke("next", value, resolve, reject);
- }, function(err) {
- invoke("throw", err, resolve, reject);
- });
- }
- return PromiseImpl.resolve(value).then(function(unwrapped) {
- // When a yielded Promise is resolved, its final value becomes
- // the .value of the Promise<{value,done}> result for the
- // current iteration.
- result.value = unwrapped;
- resolve(result);
- }, function(error) {
- // If a rejected Promise was yielded, throw the rejection back
- // into the async generator function so it can be handled there.
- return invoke("throw", error, resolve, reject);
- });
- }
- }
- var previousPromise;
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function(resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise =
- // If enqueue has been called before, then we want to wait until
- // all previous Promises have been resolved before calling invoke,
- // so that results are always delivered in the correct order. If
- // enqueue has not been called before, then it is important to
- // call invoke immediately, without waiting on a callback to fire,
- // so that the async generator function has the opportunity to do
- // any necessary setup in a predictable way. This predictability
- // is why the Promise constructor synchronously invokes its
- // executor callback, and why async functions synchronously
- // execute code before the first await. Since we implement simple
- // async functions in terms of async generators, it is especially
- // important to get this right, even though it requires care.
- previousPromise ? previousPromise.then(
- callInvokeWithMethodAndArg,
- // Avoid propagating failures to Promises returned by later
- // invocations of the iterator.
- callInvokeWithMethodAndArg
- ) : callInvokeWithMethodAndArg();
- }
- // Define the unified helper method that is used to implement .next,
- // .throw, and .return (see defineIteratorMethods).
- this._invoke = enqueue;
- }
- defineIteratorMethods(AsyncIterator.prototype);
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
- return this;
- };
- exports.AsyncIterator = AsyncIterator;
- // Note that simple async functions are implemented on top of
- // AsyncIterator objects; they just return a Promise for the value of
- // the final result produced by the iterator.
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- if (PromiseImpl === void 0) PromiseImpl = Promise;
- var iter = new AsyncIterator(
- wrap(innerFn, outerFn, self, tryLocsList),
- PromiseImpl
- );
- return exports.isGeneratorFunction(outerFn)
- ? iter // If outerFn is a generator, return the full iterator.
- : iter.next().then(function(result) {
- return result.done ? result.value : iter.next();
- });
- };
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
- // Be forgiving, per 25.3.3.3.3 of the spec:
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
- return doneResult();
- }
- context.method = method;
- context.arg = arg;
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if (context.method === "next") {
- // Setting context._sent for legacy support of Babel's
- // function.sent implementation.
- context.sent = context._sent = context.arg;
- } else if (context.method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw context.arg;
- }
- context.dispatchException(context.arg);
- } else if (context.method === "return") {
- context.abrupt("return", context.arg);
- }
- state = GenStateExecuting;
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- // If an exception is thrown from innerFn, we leave state ===
- // GenStateExecuting and loop back for another invocation.
- state = context.done
- ? GenStateCompleted
- : GenStateSuspendedYield;
- if (record.arg === ContinueSentinel) {
- continue;
- }
- return {
- value: record.arg,
- done: context.done
- };
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- // Dispatch the exception by looping back around to the
- // context.dispatchException(context.arg) call above.
- context.method = "throw";
- context.arg = record.arg;
- }
- }
- };
- }
- // Call delegate.iterator[context.method](context.arg) and handle the
- // result, either by returning a { value, done } result from the
- // delegate iterator, or by modifying context.method and context.arg,
- // setting context.delegate to null, and returning the ContinueSentinel.
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (method === undefined$1) {
- // A .throw or .return when the delegate iterator has no .throw
- // method always terminates the yield* loop.
- context.delegate = null;
- if (context.method === "throw") {
- // Note: ["return"] must be used for ES3 parsing compatibility.
- if (delegate.iterator["return"]) {
- // If the delegate iterator has a return method, give it a
- // chance to clean up.
- context.method = "return";
- context.arg = undefined$1;
- maybeInvokeDelegate(delegate, context);
- if (context.method === "throw") {
- // If maybeInvokeDelegate(context) changed context.method from
- // "return" to "throw", let that override the TypeError below.
- return ContinueSentinel;
- }
- }
- context.method = "throw";
- context.arg = new TypeError(
- "The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if (record.type === "throw") {
- context.method = "throw";
- context.arg = record.arg;
- context.delegate = null;
- return ContinueSentinel;
- }
- var info = record.arg;
- if (! info) {
- context.method = "throw";
- context.arg = new TypeError("iterator result is not an object");
- context.delegate = null;
- return ContinueSentinel;
- }
- if (info.done) {
- // Assign the result of the finished delegate to the temporary
- // variable specified by delegate.resultName (see delegateYield).
- context[delegate.resultName] = info.value;
- // Resume execution at the desired location (see delegateYield).
- context.next = delegate.nextLoc;
- // If context.method was "throw" but the delegate handled the
- // exception, let the outer generator proceed normally. If
- // context.method was "next", forget context.arg since it has been
- // "consumed" by the delegate iterator. If context.method was
- // "return", allow the original .return call to continue in the
- // outer generator.
- if (context.method !== "return") {
- context.method = "next";
- context.arg = undefined$1;
- }
- } else {
- // Re-yield the result returned by the delegate method.
- return info;
- }
- // The delegate iterator is finished, so forget it and continue with
- // the outer generator.
- context.delegate = null;
- return ContinueSentinel;
- }
- // Define Generator.prototype.{next,throw,return} in terms of the
- // unified ._invoke helper method.
- defineIteratorMethods(Gp);
- Gp[toStringTagSymbol] = "Generator";
- // A Generator should always return itself as the iterator object when the
- // @@iterator function is called on it. Some browsers' implementations of the
- // iterator prototype chain incorrectly implement this, causing the Generator
- // object to not be returned from this call. This ensures that doesn't happen.
- // See https://github.com/facebook/regenerator/issues/274 for more details.
- Gp[iteratorSymbol] = function() {
- return this;
- };
- Gp.toString = function() {
- return "[object Generator]";
- };
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
- function Context(tryLocsList) {
- // The root entry object (effectively a try statement without a catch
- // or a finally block) gives us a place to store values thrown from
- // locations where there is no enclosing try statement.
- this.tryEntries = [{ tryLoc: "root" }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
- exports.keys = function(object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
- // Rather than returning an object with a next method, we keep
- // things simple and return the next function itself.
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
- // To avoid creating an additional object, we just hang the .value
- // and .done properties off the next function object itself. This
- // also ensures that the minifier will not anonymize the function.
- next.done = true;
- return next;
- };
- };
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
- if (typeof iterable.next === "function") {
- return iterable;
- }
- if (!isNaN(iterable.length)) {
- var i = -1, next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
- next.value = undefined$1;
- next.done = true;
- return next;
- };
- return next.next = next;
- }
- }
- // Return an iterator with no values.
- return { next: doneResult };
- }
- exports.values = values;
- function doneResult() {
- return { value: undefined$1, done: true };
- }
- Context.prototype = {
- constructor: Context,
- reset: function(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- // Resetting context._sent for legacy support of Babel's
- // function.sent implementation.
- this.sent = this._sent = undefined$1;
- this.done = false;
- this.delegate = null;
- this.method = "next";
- this.arg = undefined$1;
- this.tryEntries.forEach(resetTryEntry);
- if (!skipTempReset) {
- for (var name in this) {
- // Not sure about the optimal order of these conditions:
- if (name.charAt(0) === "t" &&
- hasOwn.call(this, name) &&
- !isNaN(+name.slice(1))) {
- this[name] = undefined$1;
- }
- }
- }
- },
- stop: function() {
- this.done = true;
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
- return this.rval;
- },
- dispatchException: function(exception) {
- if (this.done) {
- throw exception;
- }
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- if (caught) {
- // If the dispatched exception was caught by a catch block,
- // then let that catch block handle the exception normally.
- context.method = "next";
- context.arg = undefined$1;
- }
- return !! caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
- if (entry.tryLoc === "root") {
- // Exception thrown outside of any try block that could handle
- // it, so set the completion value of the entire function to
- // throw the exception.
- return handle("end");
- }
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
- abrupt: function(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev &&
- hasOwn.call(entry, "finallyLoc") &&
- this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- if (finallyEntry &&
- (type === "break" ||
- type === "continue") &&
- finallyEntry.tryLoc <= arg &&
- arg <= finallyEntry.finallyLoc) {
- // Ignore the finally entry if control is not jumping to a
- // location outside the try/catch block.
- finallyEntry = null;
- }
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
- if (finallyEntry) {
- this.method = "next";
- this.next = finallyEntry.finallyLoc;
- return ContinueSentinel;
- }
- return this.complete(record);
- },
- complete: function(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
- if (record.type === "break" ||
- record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = this.arg = record.arg;
- this.method = "return";
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- return ContinueSentinel;
- },
- finish: function(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
- "catch": function(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- // The context.catch method must only be called with a location
- // argument that corresponds to a known catch block.
- throw new Error("illegal catch attempt");
- },
- delegateYield: function(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
- if (this.method === "next") {
- // Deliberately forget the last sent value so that we don't
- // accidentally pass it on to the delegate.
- this.arg = undefined$1;
- }
- return ContinueSentinel;
- }
- };
- // Regardless of whether this script is executing as a CommonJS module
- // or not, return the runtime object so that we can declare the variable
- // regeneratorRuntime in the outer scope, which allows this module to be
- // injected easily by `bin/regenerator --include-runtime script.js`.
- return exports;
- }(
- // If this script is executing as a CommonJS module, use module.exports
- // as the regeneratorRuntime namespace. Otherwise create a new empty
- // object. Either way, the resulting object will be used to initialize
- // the regeneratorRuntime variable at the top of this file.
- module.exports
- ));
- try {
- regeneratorRuntime = runtime;
- } catch (accidentalStrictMode) {
- // This module should not be running in strict mode, so the above
- // assignment should always work unless something is misconfigured. Just
- // in case runtime.js accidentally runs in strict mode, we can escape
- // strict mode using a global Function call. This could conceivably fail
- // if a Content Security Policy forbids using Function, but in that case
- // the proper solution is to fix the accidental strict mode problem. If
- // you've misconfigured your bundler to force strict mode and applied a
- // CSP to forbid Function, and you're not willing to fix either of those
- // problems, please detail your unique predicament in a GitHub issue.
- Function("r", "regeneratorRuntime = r")(runtime);
- }
- });
- var UNSCOPABLES = wellKnownSymbol('unscopables');
- var ArrayPrototype = Array.prototype;
- // Array.prototype[@@unscopables]
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
- objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
- configurable: true,
- value: objectCreate(null)
- });
- }
- // add a key to Array.prototype[@@unscopables]
- var addToUnscopables = function (key) {
- ArrayPrototype[UNSCOPABLES][key] = true;
- };
- var $includes = arrayIncludes.includes;
- var USES_TO_LENGTH$6 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- _export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$6 }, {
- includes: function includes(el /* , fromIndex = 0 */) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('includes');
- var $map = arrayIteration.map;
- var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map');
- // FF49- issue
- var USES_TO_LENGTH$5 = arrayMethodUsesToLength('map');
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- // with adding support of @@species
- _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$5 }, {
- map: function map(callbackfn /* , thisArg */) {
- return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
- var createMethod$2 = function (IS_RIGHT) {
- return function (that, callbackfn, argumentsLength, memo) {
- aFunction(callbackfn);
- var O = toObject(that);
- var self = indexedObject(O);
- var length = toLength(O.length);
- var index = IS_RIGHT ? length - 1 : 0;
- var i = IS_RIGHT ? -1 : 1;
- if (argumentsLength < 2) while (true) {
- if (index in self) {
- memo = self[index];
- index += i;
- break;
- }
- index += i;
- if (IS_RIGHT ? index < 0 : length <= index) {
- throw TypeError('Reduce of empty array with no initial value');
- }
- }
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
- memo = callbackfn(memo, self[index], index, O);
- }
- return memo;
- };
- };
- var arrayReduce = {
- // `Array.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
- left: createMethod$2(false),
- // `Array.prototype.reduceRight` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
- right: createMethod$2(true)
- };
- var engineIsNode = classofRaw(global_1.process) == 'process';
- var $reduce = arrayReduce.left;
- var STRICT_METHOD$3 = arrayMethodIsStrict('reduce');
- var USES_TO_LENGTH$4 = arrayMethodUsesToLength('reduce', { 1: 0 });
- // Chrome 80-82 has a critical bug
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
- var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83;
- // `Array.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
- _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$3 || !USES_TO_LENGTH$4 || CHROME_BUG }, {
- reduce: function reduce(callbackfn /* , initialValue */) {
- return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- var $some = arrayIteration.some;
- var STRICT_METHOD$2 = arrayMethodIsStrict('some');
- var USES_TO_LENGTH$3 = arrayMethodUsesToLength('some');
- // `Array.prototype.some` method
- // https://tc39.es/ecma262/#sec-array.prototype.some
- _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$2 || !USES_TO_LENGTH$3 }, {
- some: function some(callbackfn /* , thisArg */) {
- return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- var propertyIsEnumerable = objectPropertyIsEnumerable.f;
- // `Object.{ entries, values }` methods implementation
- var createMethod$1 = function (TO_ENTRIES) {
- return function (it) {
- var O = toIndexedObject(it);
- var keys = objectKeys(O);
- var length = keys.length;
- var i = 0;
- var result = [];
- var key;
- while (length > i) {
- key = keys[i++];
- if (!descriptors || propertyIsEnumerable.call(O, key)) {
- result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
- }
- }
- return result;
- };
- };
- var objectToArray = {
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- entries: createMethod$1(true),
- // `Object.values` method
- // https://tc39.es/ecma262/#sec-object.values
- values: createMethod$1(false)
- };
- var $entries = objectToArray.entries;
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- _export({ target: 'Object', stat: true }, {
- entries: function entries(O) {
- return $entries(O);
- }
- });
- // `SameValue` abstract operation
- // https://tc39.es/ecma262/#sec-samevalue
- var sameValue = Object.is || function is(x, y) {
- // eslint-disable-next-line no-self-compare
- return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
- };
- // `Object.is` method
- // https://tc39.es/ecma262/#sec-object.is
- _export({ target: 'Object', stat: true }, {
- is: sameValue
- });
- var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
- keys: function keys(it) {
- return objectKeys(toObject(it));
- }
- });
- // `Object.prototype.toString` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
- var objectToString = toStringTagSupport ? {}.toString : function toString() {
- return '[object ' + classof(this) + ']';
- };
- // `Object.prototype.toString` method
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
- if (!toStringTagSupport) {
- redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
- }
- var nativePromiseConstructor = global_1.Promise;
- var redefineAll = function (target, src, options) {
- for (var key in src) redefine(target, key, src[key], options);
- return target;
- };
- var SPECIES$3 = wellKnownSymbol('species');
- var setSpecies = function (CONSTRUCTOR_NAME) {
- var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
- var defineProperty = objectDefineProperty.f;
- if (descriptors && Constructor && !Constructor[SPECIES$3]) {
- defineProperty(Constructor, SPECIES$3, {
- configurable: true,
- get: function () { return this; }
- });
- }
- };
- var anInstance = function (it, Constructor, name) {
- if (!(it instanceof Constructor)) {
- throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
- } return it;
- };
- var Result = function (stopped, result) {
- this.stopped = stopped;
- this.result = result;
- };
- var iterate = function (iterable, unboundFunction, options) {
- var that = options && options.that;
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
- var INTERRUPTED = !!(options && options.INTERRUPTED);
- var fn = functionBindContext(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
- var iterator, iterFn, index, length, result, next, step;
- var stop = function (condition) {
- if (iterator) iteratorClose(iterator);
- return new Result(true, condition);
- };
- var callFn = function (value) {
- if (AS_ENTRIES) {
- anObject(value);
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
- } return INTERRUPTED ? fn(value, stop) : fn(value);
- };
- if (IS_ITERATOR) {
- iterator = iterable;
- } else {
- iterFn = getIteratorMethod(iterable);
- if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
- // optimisation for array iterators
- if (isArrayIteratorMethod(iterFn)) {
- for (index = 0, length = toLength(iterable.length); length > index; index++) {
- result = callFn(iterable[index]);
- if (result && result instanceof Result) return result;
- } return new Result(false);
- }
- iterator = iterFn.call(iterable);
- }
- next = iterator.next;
- while (!(step = next.call(iterator)).done) {
- try {
- result = callFn(step.value);
- } catch (error) {
- iteratorClose(iterator);
- throw error;
- }
- if (typeof result == 'object' && result && result instanceof Result) return result;
- } return new Result(false);
- };
- var SPECIES$2 = wellKnownSymbol('species');
- // `SpeciesConstructor` abstract operation
- // https://tc39.es/ecma262/#sec-speciesconstructor
- var speciesConstructor = function (O, defaultConstructor) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES$2]) == undefined ? defaultConstructor : aFunction(S);
- };
- var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent);
- var location = global_1.location;
- var set$1 = global_1.setImmediate;
- var clear = global_1.clearImmediate;
- var process$3 = global_1.process;
- var MessageChannel = global_1.MessageChannel;
- var Dispatch = global_1.Dispatch;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = 'onreadystatechange';
- var defer, channel, port;
- var run = function (id) {
- // eslint-disable-next-line no-prototype-builtins
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var runner = function (id) {
- return function () {
- run(id);
- };
- };
- var listener = function (event) {
- run(event.data);
- };
- var post = function (id) {
- // old engines have not location.origin
- global_1.postMessage(id + '', location.protocol + '//' + location.host);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!set$1 || !clear) {
- set$1 = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) args.push(arguments[i++]);
- queue[++counter] = function () {
- // eslint-disable-next-line no-new-func
- (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
- };
- defer(counter);
- return counter;
- };
- clear = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (engineIsNode) {
- defer = function (id) {
- process$3.nextTick(runner(id));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function (id) {
- Dispatch.now(runner(id));
- };
- // Browsers with MessageChannel, includes WebWorkers
- // except iOS - https://github.com/zloirock/core-js/issues/624
- } else if (MessageChannel && !engineIsIos) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = functionBindContext(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (
- global_1.addEventListener &&
- typeof postMessage == 'function' &&
- !global_1.importScripts &&
- location && location.protocol !== 'file:' &&
- !fails(post)
- ) {
- defer = post;
- global_1.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
- defer = function (id) {
- html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function (id) {
- setTimeout(runner(id), 0);
- };
- }
- }
- var task$1 = {
- set: set$1,
- clear: clear
- };
- var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent);
- var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
- var macrotask = task$1.set;
- var MutationObserver$1 = global_1.MutationObserver || global_1.WebKitMutationObserver;
- var document$2 = global_1.document;
- var process$2 = global_1.process;
- var Promise$1 = global_1.Promise;
- // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
- var queueMicrotaskDescriptor = getOwnPropertyDescriptor$2(global_1, 'queueMicrotask');
- var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
- var flush, head, last, notify$1, toggle, node, promise, then;
- // modern engines have queueMicrotask method
- if (!queueMicrotask) {
- flush = function () {
- var parent, fn;
- if (engineIsNode && (parent = process$2.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (error) {
- if (head) notify$1();
- else last = undefined;
- throw error;
- }
- } last = undefined;
- if (parent) parent.enter();
- };
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
- if (!engineIsIos && !engineIsNode && !engineIsWebosWebkit && MutationObserver$1 && document$2) {
- toggle = true;
- node = document$2.createTextNode('');
- new MutationObserver$1(flush).observe(node, { characterData: true });
- notify$1 = function () {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (Promise$1 && Promise$1.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- promise = Promise$1.resolve(undefined);
- then = promise.then;
- notify$1 = function () {
- then.call(promise, flush);
- };
- // Node.js without promises
- } else if (engineIsNode) {
- notify$1 = function () {
- process$2.nextTick(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessag
- // - onreadystatechange
- // - setTimeout
- } else {
- notify$1 = function () {
- // strange IE + webpack dev server bug - use .call(global)
- macrotask.call(global_1, flush);
- };
- }
- }
- var microtask = queueMicrotask || function (fn) {
- var task = { fn: fn, next: undefined };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify$1();
- } last = task;
- };
- var PromiseCapability = function (C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve);
- this.reject = aFunction(reject);
- };
- // 25.4.1.5 NewPromiseCapability(C)
- var f = function (C) {
- return new PromiseCapability(C);
- };
- var newPromiseCapability$1 = {
- f: f
- };
- var promiseResolve = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability$1.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- var hostReportErrors = function (a, b) {
- var console = global_1.console;
- if (console && console.error) {
- arguments.length === 1 ? console.error(a) : console.error(a, b);
- }
- };
- var perform = function (exec) {
- try {
- return { error: false, value: exec() };
- } catch (error) {
- return { error: true, value: error };
- }
- };
- var task = task$1.set;
- var SPECIES$1 = wellKnownSymbol('species');
- var PROMISE = 'Promise';
- var getInternalState$1 = internalState.get;
- var setInternalState$2 = internalState.set;
- var getInternalPromiseState = internalState.getterFor(PROMISE);
- var PromiseConstructor = nativePromiseConstructor;
- var TypeError$1 = global_1.TypeError;
- var document$1 = global_1.document;
- var process$1 = global_1.process;
- var $fetch = getBuiltIn('fetch');
- var newPromiseCapability = newPromiseCapability$1.f;
- var newGenericPromiseCapability = newPromiseCapability;
- var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent);
- var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function';
- var UNHANDLED_REJECTION = 'unhandledrejection';
- var REJECTION_HANDLED = 'rejectionhandled';
- var PENDING = 0;
- var FULFILLED = 1;
- var REJECTED = 2;
- var HANDLED = 1;
- var UNHANDLED = 2;
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
- var FORCED$1 = isForced_1(PROMISE, function () {
- var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
- if (!GLOBAL_CORE_JS_PROMISE) {
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // We can't detect it synchronously, so just check versions
- if (engineV8Version === 66) return true;
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- if (!engineIsNode && !NATIVE_REJECTION_EVENT) return true;
- }
- // We can't use @@species feature detection in V8 since it causes
- // deoptimization and performance degradation
- // https://github.com/zloirock/core-js/issues/679
- if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;
- // Detect correctness of subclassing with @@species support
- var promise = PromiseConstructor.resolve(1);
- var FakePromise = function (exec) {
- exec(function () { /* empty */ }, function () { /* empty */ });
- };
- var constructor = promise.constructor = {};
- constructor[SPECIES$1] = FakePromise;
- return !(promise.then(function () { /* empty */ }) instanceof FakePromise);
- });
- var INCORRECT_ITERATION = FORCED$1 || !checkCorrectnessOfIteration(function (iterable) {
- PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
- });
- // helpers
- var isThenable = function (it) {
- var then;
- return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
- };
- var notify = function (state, isReject) {
- if (state.notified) return;
- state.notified = true;
- var chain = state.reactions;
- microtask(function () {
- var value = state.value;
- var ok = state.state == FULFILLED;
- var index = 0;
- // variable length - can't use forEach
- while (chain.length > index) {
- var reaction = chain[index++];
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
- state.rejection = HANDLED;
- }
- if (handler === true) result = value;
- else {
- if (domain) domain.enter();
- result = handler(value); // can throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError$1('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (error) {
- if (domain && !exited) domain.exit();
- reject(error);
- }
- }
- state.reactions = [];
- state.notified = false;
- if (isReject && !state.rejection) onUnhandled(state);
- });
- };
- var dispatchEvent = function (name, promise, reason) {
- var event, handler;
- if (DISPATCH_EVENT) {
- event = document$1.createEvent('Event');
- event.promise = promise;
- event.reason = reason;
- event.initEvent(name, false, true);
- global_1.dispatchEvent(event);
- } else event = { promise: promise, reason: reason };
- if (!NATIVE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event);
- else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
- };
- var onUnhandled = function (state) {
- task.call(global_1, function () {
- var promise = state.facade;
- var value = state.value;
- var IS_UNHANDLED = isUnhandled(state);
- var result;
- if (IS_UNHANDLED) {
- result = perform(function () {
- if (engineIsNode) {
- process$1.emit('unhandledRejection', value, promise);
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- state.rejection = engineIsNode || isUnhandled(state) ? UNHANDLED : HANDLED;
- if (result.error) throw result.value;
- }
- });
- };
- var isUnhandled = function (state) {
- return state.rejection !== HANDLED && !state.parent;
- };
- var onHandleUnhandled = function (state) {
- task.call(global_1, function () {
- var promise = state.facade;
- if (engineIsNode) {
- process$1.emit('rejectionHandled', promise);
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
- });
- };
- var bind = function (fn, state, unwrap) {
- return function (value) {
- fn(state, value, unwrap);
- };
- };
- var internalReject = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- state.value = value;
- state.state = REJECTED;
- notify(state, true);
- };
- var internalResolve = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- try {
- if (state.facade === value) throw TypeError$1("Promise can't be resolved itself");
- var then = isThenable(value);
- if (then) {
- microtask(function () {
- var wrapper = { done: false };
- try {
- then.call(value,
- bind(internalResolve, wrapper, state),
- bind(internalReject, wrapper, state)
- );
- } catch (error) {
- internalReject(wrapper, error, state);
- }
- });
- } else {
- state.value = value;
- state.state = FULFILLED;
- notify(state, false);
- }
- } catch (error) {
- internalReject({ done: false }, error, state);
- }
- };
- // constructor polyfill
- if (FORCED$1) {
- // 25.4.3.1 Promise(executor)
- PromiseConstructor = function Promise(executor) {
- anInstance(this, PromiseConstructor, PROMISE);
- aFunction(executor);
- Internal.call(this);
- var state = getInternalState$1(this);
- try {
- executor(bind(internalResolve, state), bind(internalReject, state));
- } catch (error) {
- internalReject(state, error);
- }
- };
- // eslint-disable-next-line no-unused-vars
- Internal = function Promise(executor) {
- setInternalState$2(this, {
- type: PROMISE,
- done: false,
- notified: false,
- parent: false,
- reactions: [],
- rejection: false,
- state: PENDING,
- value: undefined
- });
- };
- Internal.prototype = redefineAll(PromiseConstructor.prototype, {
- // `Promise.prototype.then` method
- // https://tc39.es/ecma262/#sec-promise.prototype.then
- then: function then(onFulfilled, onRejected) {
- var state = getInternalPromiseState(this);
- var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = engineIsNode ? process$1.domain : undefined;
- state.parent = true;
- state.reactions.push(reaction);
- if (state.state != PENDING) notify(state, false);
- return reaction.promise;
- },
- // `Promise.prototype.catch` method
- // https://tc39.es/ecma262/#sec-promise.prototype.catch
- 'catch': function (onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function () {
- var promise = new Internal();
- var state = getInternalState$1(promise);
- this.promise = promise;
- this.resolve = bind(internalResolve, state);
- this.reject = bind(internalReject, state);
- };
- newPromiseCapability$1.f = newPromiseCapability = function (C) {
- return C === PromiseConstructor || C === PromiseWrapper
- ? new OwnPromiseCapability(C)
- : newGenericPromiseCapability(C);
- };
- if (typeof nativePromiseConstructor == 'function') {
- nativeThen = nativePromiseConstructor.prototype.then;
- // wrap native Promise#then for native async functions
- redefine(nativePromiseConstructor.prototype, 'then', function then(onFulfilled, onRejected) {
- var that = this;
- return new PromiseConstructor(function (resolve, reject) {
- nativeThen.call(that, resolve, reject);
- }).then(onFulfilled, onRejected);
- // https://github.com/zloirock/core-js/issues/640
- }, { unsafe: true });
- // wrap fetch result
- if (typeof $fetch == 'function') _export({ global: true, enumerable: true, forced: true }, {
- // eslint-disable-next-line no-unused-vars
- fetch: function fetch(input /* , init */) {
- return promiseResolve(PromiseConstructor, $fetch.apply(global_1, arguments));
- }
- });
- }
- }
- _export({ global: true, wrap: true, forced: FORCED$1 }, {
- Promise: PromiseConstructor
- });
- setToStringTag(PromiseConstructor, PROMISE, false);
- setSpecies(PROMISE);
- PromiseWrapper = getBuiltIn(PROMISE);
- // statics
- _export({ target: PROMISE, stat: true, forced: FORCED$1 }, {
- // `Promise.reject` method
- // https://tc39.es/ecma262/#sec-promise.reject
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- capability.reject.call(undefined, r);
- return capability.promise;
- }
- });
- _export({ target: PROMISE, stat: true, forced: FORCED$1 }, {
- // `Promise.resolve` method
- // https://tc39.es/ecma262/#sec-promise.resolve
- resolve: function resolve(x) {
- return promiseResolve(this, x);
- }
- });
- _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
- // `Promise.all` method
- // https://tc39.es/ecma262/#sec-promise.all
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aFunction(C.resolve);
- var values = [];
- var counter = 0;
- var remaining = 1;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- $promiseResolve.call(C, promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.error) reject(result.value);
- return capability.promise;
- },
- // `Promise.race` method
- // https://tc39.es/ecma262/#sec-promise.race
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aFunction(C.resolve);
- iterate(iterable, function (promise) {
- $promiseResolve.call(C, promise).then(capability.resolve, reject);
- });
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- // `RegExp.prototype.flags` getter implementation
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
- var regexpFlags = function () {
- var that = anObject(this);
- var result = '';
- if (that.global) result += 'g';
- if (that.ignoreCase) result += 'i';
- if (that.multiline) result += 'm';
- if (that.dotAll) result += 's';
- if (that.unicode) result += 'u';
- if (that.sticky) result += 'y';
- return result;
- };
- // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
- // so we use an intermediate function.
- function RE(s, f) {
- return RegExp(s, f);
- }
- var UNSUPPORTED_Y$1 = fails(function () {
- // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
- var re = RE('a', 'y');
- re.lastIndex = 2;
- return re.exec('abcd') != null;
- });
- var BROKEN_CARET = fails(function () {
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
- var re = RE('^r', 'gy');
- re.lastIndex = 2;
- return re.exec('str') != null;
- });
- var regexpStickyHelpers = {
- UNSUPPORTED_Y: UNSUPPORTED_Y$1,
- BROKEN_CARET: BROKEN_CARET
- };
- var nativeExec = RegExp.prototype.exec;
- // This always refers to the native implementation, because the
- // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
- // which loads this file before patching the method.
- var nativeReplace = String.prototype.replace;
- var patchedExec = nativeExec;
- var UPDATES_LAST_INDEX_WRONG = (function () {
- var re1 = /a/;
- var re2 = /b*/g;
- nativeExec.call(re1, 'a');
- nativeExec.call(re2, 'a');
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
- })();
- var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
- if (PATCH) {
- patchedExec = function exec(str) {
- var re = this;
- var lastIndex, reCopy, match, i;
- var sticky = UNSUPPORTED_Y && re.sticky;
- var flags = regexpFlags.call(re);
- var source = re.source;
- var charsAdded = 0;
- var strCopy = str;
- if (sticky) {
- flags = flags.replace('y', '');
- if (flags.indexOf('g') === -1) {
- flags += 'g';
- }
- strCopy = String(str).slice(re.lastIndex);
- // Support anchored sticky behavior.
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
- source = '(?: ' + source + ')';
- strCopy = ' ' + strCopy;
- charsAdded++;
- }
- // ^(? + rx + ) is needed, in combination with some str slicing, to
- // simulate the 'y' flag.
- reCopy = new RegExp('^(?:' + source + ')', flags);
- }
- if (NPCG_INCLUDED) {
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
- }
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
- match = nativeExec.call(sticky ? reCopy : re, strCopy);
- if (sticky) {
- if (match) {
- match.input = match.input.slice(charsAdded);
- match[0] = match[0].slice(charsAdded);
- match.index = re.lastIndex;
- re.lastIndex += match[0].length;
- } else re.lastIndex = 0;
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
- }
- if (NPCG_INCLUDED && match && match.length > 1) {
- // Fix browsers whose `exec` methods don't consistently return `undefined`
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
- nativeReplace.call(match[0], reCopy, function () {
- for (i = 1; i < arguments.length - 2; i++) {
- if (arguments[i] === undefined) match[i] = undefined;
- }
- });
- }
- return match;
- };
- }
- var regexpExec = patchedExec;
- // `RegExp.prototype.exec` method
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
- _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
- exec: regexpExec
- });
- var MATCH$1 = wellKnownSymbol('match');
- // `IsRegExp` abstract operation
- // https://tc39.es/ecma262/#sec-isregexp
- var isRegexp = function (it) {
- var isRegExp;
- return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
- };
- var notARegexp = function (it) {
- if (isRegexp(it)) {
- throw TypeError("The method doesn't accept regular expressions");
- } return it;
- };
- var MATCH = wellKnownSymbol('match');
- var correctIsRegexpLogic = function (METHOD_NAME) {
- var regexp = /./;
- try {
- '/./'[METHOD_NAME](regexp);
- } catch (error1) {
- try {
- regexp[MATCH] = false;
- return '/./'[METHOD_NAME](regexp);
- } catch (error2) { /* empty */ }
- } return false;
- };
- // `String.prototype.includes` method
- // https://tc39.es/ecma262/#sec-string.prototype.includes
- _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
- includes: function includes(searchString /* , position = 0 */) {
- return !!~String(requireObjectCoercible(this))
- .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // TODO: Remove from `core-js@4` since it's moved to entry points
- var SPECIES = wellKnownSymbol('species');
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
- // #replace needs built-in support for named groups.
- // #match works fine because it just return the exec results, even if it has
- // a "grops" property.
- var re = /./;
- re.exec = function () {
- var result = [];
- result.groups = { a: '7' };
- return result;
- };
- return ''.replace(re, '$<a>') !== '7';
- });
- // IE <= 11 replaces $0 with the whole match, as if it was $&
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
- var REPLACE_KEEPS_$0 = (function () {
- return 'a'.replace(/./, '$0') === '$0';
- })();
- var REPLACE = wellKnownSymbol('replace');
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
- if (/./[REPLACE]) {
- return /./[REPLACE]('a', '$0') === '';
- }
- return false;
- })();
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
- // Weex JS has frozen built-in prototypes, so use try / catch wrapper
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
- var re = /(?:)/;
- var originalExec = re.exec;
- re.exec = function () { return originalExec.apply(this, arguments); };
- var result = 'ab'.split(re);
- return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
- });
- var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
- var SYMBOL = wellKnownSymbol(KEY);
- var DELEGATES_TO_SYMBOL = !fails(function () {
- // String methods call symbol-named RegEp methods
- var O = {};
- O[SYMBOL] = function () { return 7; };
- return ''[KEY](O) != 7;
- });
- var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
- // Symbol-named RegExp methods call .exec
- var execCalled = false;
- var re = /a/;
- if (KEY === 'split') {
- // We can't use real regex here since it causes deoptimization
- // and serious performance degradation in V8
- // https://github.com/zloirock/core-js/issues/306
- re = {};
- // RegExp[@@split] doesn't call the regex's exec method, but first creates
- // a new one. We need to return the patched regex when creating the new one.
- re.constructor = {};
- re.constructor[SPECIES] = function () { return re; };
- re.flags = '';
- re[SYMBOL] = /./[SYMBOL];
- }
- re.exec = function () { execCalled = true; return null; };
- re[SYMBOL]('');
- return !execCalled;
- });
- if (
- !DELEGATES_TO_SYMBOL ||
- !DELEGATES_TO_EXEC ||
- (KEY === 'replace' && !(
- REPLACE_SUPPORTS_NAMED_GROUPS &&
- REPLACE_KEEPS_$0 &&
- !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
- )) ||
- (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
- ) {
- var nativeRegExpMethod = /./[SYMBOL];
- var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
- if (regexp.exec === regexpExec) {
- if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
- // The native String method already delegates to @@method (this
- // polyfilled function), leasing to infinite recursion.
- // We avoid it by directly calling the native @@method method.
- return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
- }
- return { done: true, value: nativeMethod.call(str, regexp, arg2) };
- }
- return { done: false };
- }, {
- REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
- REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
- });
- var stringMethod = methods[0];
- var regexMethod = methods[1];
- redefine(String.prototype, KEY, stringMethod);
- redefine(RegExp.prototype, SYMBOL, length == 2
- // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
- // 21.2.5.11 RegExp.prototype[@@split](string, limit)
- ? function (string, arg) { return regexMethod.call(string, this, arg); }
- // 21.2.5.6 RegExp.prototype[@@match](string)
- // 21.2.5.9 RegExp.prototype[@@search](string)
- : function (string) { return regexMethod.call(string, this); }
- );
- }
- if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
- };
- var charAt = stringMultibyte.charAt;
- // `AdvanceStringIndex` abstract operation
- // https://tc39.es/ecma262/#sec-advancestringindex
- var advanceStringIndex = function (S, index, unicode) {
- return index + (unicode ? charAt(S, index).length : 1);
- };
- // `RegExpExec` abstract operation
- // https://tc39.es/ecma262/#sec-regexpexec
- var regexpExecAbstract = function (R, S) {
- var exec = R.exec;
- if (typeof exec === 'function') {
- var result = exec.call(R, S);
- if (typeof result !== 'object') {
- throw TypeError('RegExp exec method returned something other than an Object or null');
- }
- return result;
- }
- if (classofRaw(R) !== 'RegExp') {
- throw TypeError('RegExp#exec called on incompatible receiver');
- }
- return regexpExec.call(R, S);
- };
- var arrayPush = [].push;
- var min$3 = Math.min;
- var MAX_UINT32 = 0xFFFFFFFF;
- // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
- var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
- // @@split logic
- fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
- var internalSplit;
- if (
- 'abbc'.split(/(b)*/)[1] == 'c' ||
- 'test'.split(/(?:)/, -1).length != 4 ||
- 'ab'.split(/(?:ab)*/).length != 2 ||
- '.'.split(/(.?)(.?)/).length != 4 ||
- '.'.split(/()()/).length > 1 ||
- ''.split(/.?/).length
- ) {
- // based on es5-shim implementation, need to rework it
- internalSplit = function (separator, limit) {
- var string = String(requireObjectCoercible(this));
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
- if (lim === 0) return [];
- if (separator === undefined) return [string];
- // If `separator` is not a regex, use native split
- if (!isRegexp(separator)) {
- return nativeSplit.call(string, separator, lim);
- }
- var output = [];
- var flags = (separator.ignoreCase ? 'i' : '') +
- (separator.multiline ? 'm' : '') +
- (separator.unicode ? 'u' : '') +
- (separator.sticky ? 'y' : '');
- var lastLastIndex = 0;
- // Make `global` and avoid `lastIndex` issues by working with a copy
- var separatorCopy = new RegExp(separator.source, flags + 'g');
- var match, lastIndex, lastLength;
- while (match = regexpExec.call(separatorCopy, string)) {
- lastIndex = separatorCopy.lastIndex;
- if (lastIndex > lastLastIndex) {
- output.push(string.slice(lastLastIndex, match.index));
- if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
- lastLength = match[0].length;
- lastLastIndex = lastIndex;
- if (output.length >= lim) break;
- }
- if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
- }
- if (lastLastIndex === string.length) {
- if (lastLength || !separatorCopy.test('')) output.push('');
- } else output.push(string.slice(lastLastIndex));
- return output.length > lim ? output.slice(0, lim) : output;
- };
- // Chakra, V8
- } else if ('0'.split(undefined, 0).length) {
- internalSplit = function (separator, limit) {
- return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
- };
- } else internalSplit = nativeSplit;
- return [
- // `String.prototype.split` method
- // https://tc39.es/ecma262/#sec-string.prototype.split
- function split(separator, limit) {
- var O = requireObjectCoercible(this);
- var splitter = separator == undefined ? undefined : separator[SPLIT];
- return splitter !== undefined
- ? splitter.call(separator, O, limit)
- : internalSplit.call(String(O), separator, limit);
- },
- // `RegExp.prototype[@@split]` method
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
- //
- // NOTE: This cannot be properly polyfilled in engines that don't support
- // the 'y' flag.
- function (regexp, limit) {
- var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
- if (res.done) return res.value;
- var rx = anObject(regexp);
- var S = String(this);
- var C = speciesConstructor(rx, RegExp);
- var unicodeMatching = rx.unicode;
- var flags = (rx.ignoreCase ? 'i' : '') +
- (rx.multiline ? 'm' : '') +
- (rx.unicode ? 'u' : '') +
- (SUPPORTS_Y ? 'y' : 'g');
- // ^(? + rx + ) is needed, in combination with some S slicing, to
- // simulate the 'y' flag.
- var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
- if (lim === 0) return [];
- if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
- var p = 0;
- var q = 0;
- var A = [];
- while (q < S.length) {
- splitter.lastIndex = SUPPORTS_Y ? q : 0;
- var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
- var e;
- if (
- z === null ||
- (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
- ) {
- q = advanceStringIndex(S, q, unicodeMatching);
- } else {
- A.push(S.slice(p, q));
- if (A.length === lim) return A;
- for (var i = 1; i <= z.length - 1; i++) {
- A.push(z[i]);
- if (A.length === lim) return A;
- }
- q = p = e;
- }
- }
- A.push(S.slice(p));
- return A;
- }
- ];
- }, !SUPPORTS_Y);
- var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
- var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
- var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/679
- var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
- var array = [];
- array[IS_CONCAT_SPREADABLE] = false;
- return array.concat()[0] !== array;
- });
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
- var isConcatSpreadable = function (O) {
- if (!isObject(O)) return false;
- var spreadable = O[IS_CONCAT_SPREADABLE];
- return spreadable !== undefined ? !!spreadable : isArray(O);
- };
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
- // `Array.prototype.concat` method
- // https://tc39.es/ecma262/#sec-array.prototype.concat
- // with adding support of @@isConcatSpreadable and @@species
- _export({ target: 'Array', proto: true, forced: FORCED }, {
- concat: function concat(arg) { // eslint-disable-line no-unused-vars
- var O = toObject(this);
- var A = arraySpeciesCreate(O, 0);
- var n = 0;
- var i, k, length, len, E;
- for (i = -1, length = arguments.length; i < length; i++) {
- E = i === -1 ? O : arguments[i];
- if (isConcatSpreadable(E)) {
- len = toLength(E.length);
- if (n + len > MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
- for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
- } else {
- if (n >= MAX_SAFE_INTEGER$1) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
- createProperty(A, n++, E);
- }
- }
- A.length = n;
- return A;
- }
- });
- var $find = arrayIteration.find;
- var FIND = 'find';
- var SKIPS_HOLES = true;
- var USES_TO_LENGTH$2 = arrayMethodUsesToLength(FIND);
- // Shouldn't skip holes
- if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- _export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH$2 }, {
- find: function find(callbackfn /* , that = undefined */) {
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables(FIND);
- var $indexOf = arrayIncludes.indexOf;
- var nativeIndexOf = [].indexOf;
- var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
- var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
- var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 || !USES_TO_LENGTH$1 }, {
- indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
- return NEGATIVE_ZERO
- // convert -0 to +0
- ? nativeIndexOf.apply(this, arguments) || 0
- : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- var ARRAY_ITERATOR = 'Array Iterator';
- var setInternalState$1 = internalState.set;
- var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
- // `Array.prototype.entries` method
- // https://tc39.es/ecma262/#sec-array.prototype.entries
- // `Array.prototype.keys` method
- // https://tc39.es/ecma262/#sec-array.prototype.keys
- // `Array.prototype.values` method
- // https://tc39.es/ecma262/#sec-array.prototype.values
- // `Array.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
- // `CreateArrayIterator` internal method
- // https://tc39.es/ecma262/#sec-createarrayiterator
- var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
- setInternalState$1(this, {
- type: ARRAY_ITERATOR,
- target: toIndexedObject(iterated), // target
- index: 0, // next index
- kind: kind // kind
- });
- // `%ArrayIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
- }, function () {
- var state = getInternalState(this);
- var target = state.target;
- var kind = state.kind;
- var index = state.index++;
- if (!target || index >= target.length) {
- state.target = undefined;
- return { value: undefined, done: true };
- }
- if (kind == 'keys') return { value: index, done: false };
- if (kind == 'values') return { value: target[index], done: false };
- return { value: [index, target[index]], done: false };
- }, 'values');
- // argumentsList[@@iterator] is %ArrayProto_values%
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
- iterators.Arguments = iterators.Array;
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('keys');
- addToUnscopables('values');
- addToUnscopables('entries');
- var nativeJoin = [].join;
- var ES3_STRINGS = indexedObject != Object;
- var STRICT_METHOD = arrayMethodIsStrict('join', ',');
- // `Array.prototype.join` method
- // https://tc39.es/ecma262/#sec-array.prototype.join
- _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
- join: function join(separator) {
- return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
- }
- });
- var defineProperty$3 = objectDefineProperty.f;
- var FunctionPrototype = Function.prototype;
- var FunctionPrototypeToString = FunctionPrototype.toString;
- var nameRE = /^\s*function ([^ (]*)/;
- var NAME = 'name';
- // Function instances `.name` property
- // https://tc39.es/ecma262/#sec-function-instances-name
- if (descriptors && !(NAME in FunctionPrototype)) {
- defineProperty$3(FunctionPrototype, NAME, {
- configurable: true,
- get: function () {
- try {
- return FunctionPrototypeToString.call(this).match(nameRE)[1];
- } catch (error) {
- return '';
- }
- }
- });
- }
- // makes subclassing work correct for wrapped built-ins
- var inheritIfRequired = function ($this, dummy, Wrapper) {
- var NewTarget, NewTargetPrototype;
- if (
- // it can work only with native `setPrototypeOf`
- objectSetPrototypeOf &&
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
- typeof (NewTarget = dummy.constructor) == 'function' &&
- NewTarget !== Wrapper &&
- isObject(NewTargetPrototype = NewTarget.prototype) &&
- NewTargetPrototype !== Wrapper.prototype
- ) objectSetPrototypeOf($this, NewTargetPrototype);
- return $this;
- };
- // a string of all valid unicode whitespaces
- // eslint-disable-next-line max-len
- 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';
- var whitespace = '[' + whitespaces + ']';
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
- var rtrim = RegExp(whitespace + whitespace + '*$');
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
- var createMethod = function (TYPE) {
- return function ($this) {
- var string = String(requireObjectCoercible($this));
- if (TYPE & 1) string = string.replace(ltrim, '');
- if (TYPE & 2) string = string.replace(rtrim, '');
- return string;
- };
- };
- var stringTrim = {
- // `String.prototype.{ trimLeft, trimStart }` methods
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
- start: createMethod(1),
- // `String.prototype.{ trimRight, trimEnd }` methods
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
- end: createMethod(2),
- // `String.prototype.trim` method
- // https://tc39.es/ecma262/#sec-string.prototype.trim
- trim: createMethod(3)
- };
- var getOwnPropertyNames = objectGetOwnPropertyNames.f;
- var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
- var defineProperty$2 = objectDefineProperty.f;
- var trim = stringTrim.trim;
- var NUMBER = 'Number';
- var NativeNumber = global_1[NUMBER];
- var NumberPrototype = NativeNumber.prototype;
- // Opera ~12 has broken Object#toString
- var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
- // `ToNumber` abstract operation
- // https://tc39.es/ecma262/#sec-tonumber
- var toNumber = function (argument) {
- var it = toPrimitive(argument, false);
- var first, third, radix, maxCode, digits, length, index, code;
- if (typeof it == 'string' && it.length > 2) {
- it = trim(it);
- first = it.charCodeAt(0);
- if (first === 43 || first === 45) {
- third = it.charCodeAt(2);
- if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
- } else if (first === 48) {
- switch (it.charCodeAt(1)) {
- case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
- case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
- default: return +it;
- }
- digits = it.slice(2);
- length = digits.length;
- for (index = 0; index < length; index++) {
- code = digits.charCodeAt(index);
- // parseInt parses a string to a first unavailable symbol
- // but ToNumber should return NaN if a string contains unavailable symbols
- if (code < 48 || code > maxCode) return NaN;
- } return parseInt(digits, radix);
- }
- } return +it;
- };
- // `Number` constructor
- // https://tc39.es/ecma262/#sec-number-constructor
- if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
- var NumberWrapper = function Number(value) {
- var it = arguments.length < 1 ? 0 : value;
- var dummy = this;
- return dummy instanceof NumberWrapper
- // check on 1..constructor(foo) case
- && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classofRaw(dummy) != NUMBER)
- ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
- };
- for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : (
- // ES3:
- 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
- // ES2015 (in case, if modules with ES2015 Number statics required before):
- 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
- 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' +
- // ESNext
- 'fromString,range'
- ).split(','), j = 0, key; keys.length > j; j++) {
- if (has$1(NativeNumber, key = keys[j]) && !has$1(NumberWrapper, key)) {
- defineProperty$2(NumberWrapper, key, getOwnPropertyDescriptor$1(NativeNumber, key));
- }
- }
- NumberWrapper.prototype = NumberPrototype;
- NumberPrototype.constructor = NumberWrapper;
- redefine(global_1, NUMBER, NumberWrapper);
- }
- var nativeAssign = Object.assign;
- var defineProperty$1 = Object.defineProperty;
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- var objectAssign = !nativeAssign || fails(function () {
- // should have correct order of operations (Edge bug)
- if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$1({}, 'a', {
- enumerable: true,
- get: function () {
- defineProperty$1(this, 'b', {
- value: 3,
- enumerable: false
- });
- }
- }), { b: 2 })).b !== 1) return true;
- // should work with symbols and should have deterministic property order (V8 bug)
- var A = {};
- var B = {};
- // eslint-disable-next-line no-undef
- var symbol = Symbol();
- var alphabet = 'abcdefghijklmnopqrst';
- A[symbol] = 7;
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
- return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
- var T = toObject(target);
- var argumentsLength = arguments.length;
- var index = 1;
- var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
- var propertyIsEnumerable = objectPropertyIsEnumerable.f;
- while (argumentsLength > index) {
- var S = indexedObject(arguments[index++]);
- var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) {
- key = keys[j++];
- if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
- }
- } return T;
- } : nativeAssign;
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
- assign: objectAssign
- });
- var $values = objectToArray.values;
- // `Object.values` method
- // https://tc39.es/ecma262/#sec-object.values
- _export({ target: 'Object', stat: true }, {
- values: function values(O) {
- return $values(O);
- }
- });
- var freezing = !fails(function () {
- return Object.isExtensible(Object.preventExtensions({}));
- });
- var internalMetadata = createCommonjsModule(function (module) {
- var defineProperty = objectDefineProperty.f;
- var METADATA = uid('meta');
- var id = 0;
- var isExtensible = Object.isExtensible || function () {
- return true;
- };
- var setMetadata = function (it) {
- defineProperty(it, METADATA, { value: {
- objectID: 'O' + ++id, // object ID
- weakData: {} // weak collections IDs
- } });
- };
- var fastKey = function (it, create) {
- // return a primitive with prefix
- if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!has$1(it, METADATA)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return 'F';
- // not necessary to add metadata
- if (!create) return 'E';
- // add missing metadata
- setMetadata(it);
- // return object ID
- } return it[METADATA].objectID;
- };
- var getWeakData = function (it, create) {
- if (!has$1(it, METADATA)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return true;
- // not necessary to add metadata
- if (!create) return false;
- // add missing metadata
- setMetadata(it);
- // return the store of weak collections IDs
- } return it[METADATA].weakData;
- };
- // add metadata on freeze-family methods calling
- var onFreeze = function (it) {
- if (freezing && meta.REQUIRED && isExtensible(it) && !has$1(it, METADATA)) setMetadata(it);
- return it;
- };
- var meta = module.exports = {
- REQUIRED: false,
- fastKey: fastKey,
- getWeakData: getWeakData,
- onFreeze: onFreeze
- };
- hiddenKeys$1[METADATA] = true;
- });
- internalMetadata.REQUIRED;
- internalMetadata.fastKey;
- internalMetadata.getWeakData;
- internalMetadata.onFreeze;
- var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
- var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
- var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
- var ADDER = IS_MAP ? 'set' : 'add';
- var NativeConstructor = global_1[CONSTRUCTOR_NAME];
- var NativePrototype = NativeConstructor && NativeConstructor.prototype;
- var Constructor = NativeConstructor;
- var exported = {};
- var fixMethod = function (KEY) {
- var nativeMethod = NativePrototype[KEY];
- redefine(NativePrototype, KEY,
- KEY == 'add' ? function add(value) {
- nativeMethod.call(this, value === 0 ? 0 : value);
- return this;
- } : KEY == 'delete' ? function (key) {
- return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
- } : KEY == 'get' ? function get(key) {
- return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
- } : KEY == 'has' ? function has(key) {
- return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
- } : function set(key, value) {
- nativeMethod.call(this, key === 0 ? 0 : key, value);
- return this;
- }
- );
- };
- // eslint-disable-next-line max-len
- if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
- new NativeConstructor().entries().next();
- })))) {
- // create collection constructor
- Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
- internalMetadata.REQUIRED = true;
- } else if (isForced_1(CONSTRUCTOR_NAME, true)) {
- var instance = new Constructor();
- // early implementations not supports chaining
- var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
- // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
- var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
- // most early implementations doesn't supports iterables, most modern - not close it correctly
- // eslint-disable-next-line no-new
- var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
- // for early implementations -0 and +0 not the same
- var BUGGY_ZERO = !IS_WEAK && fails(function () {
- // V8 ~ Chromium 42- fails only with 5+ elements
- var $instance = new NativeConstructor();
- var index = 5;
- while (index--) $instance[ADDER](index, index);
- return !$instance.has(-0);
- });
- if (!ACCEPT_ITERABLES) {
- Constructor = wrapper(function (dummy, iterable) {
- anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
- var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
- if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
- return that;
- });
- Constructor.prototype = NativePrototype;
- NativePrototype.constructor = Constructor;
- }
- if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
- fixMethod('delete');
- fixMethod('has');
- IS_MAP && fixMethod('get');
- }
- if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
- // weak collections should not contains .clear method
- if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
- }
- exported[CONSTRUCTOR_NAME] = Constructor;
- _export({ global: true, forced: Constructor != NativeConstructor }, exported);
- setToStringTag(Constructor, CONSTRUCTOR_NAME);
- if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
- return Constructor;
- };
- var defineProperty = objectDefineProperty.f;
- var fastKey = internalMetadata.fastKey;
- var setInternalState = internalState.set;
- var internalStateGetterFor = internalState.getterFor;
- var collectionStrong = {
- getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
- var C = wrapper(function (that, iterable) {
- anInstance(that, C, CONSTRUCTOR_NAME);
- setInternalState(that, {
- type: CONSTRUCTOR_NAME,
- index: objectCreate(null),
- first: undefined,
- last: undefined,
- size: 0
- });
- if (!descriptors) that.size = 0;
- if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
- });
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var define = function (that, key, value) {
- var state = getInternalState(that);
- var entry = getEntry(that, key);
- var previous, index;
- // change existing entry
- if (entry) {
- entry.value = value;
- // create new entry
- } else {
- state.last = entry = {
- index: index = fastKey(key, true),
- key: key,
- value: value,
- previous: previous = state.last,
- next: undefined,
- removed: false
- };
- if (!state.first) state.first = entry;
- if (previous) previous.next = entry;
- if (descriptors) state.size++;
- else that.size++;
- // add to index
- if (index !== 'F') state.index[index] = entry;
- } return that;
- };
- var getEntry = function (that, key) {
- var state = getInternalState(that);
- // fast case
- var index = fastKey(key);
- var entry;
- if (index !== 'F') return state.index[index];
- // frozen object case
- for (entry = state.first; entry; entry = entry.next) {
- if (entry.key == key) return entry;
- }
- };
- redefineAll(C.prototype, {
- // 23.1.3.1 Map.prototype.clear()
- // 23.2.3.2 Set.prototype.clear()
- clear: function clear() {
- var that = this;
- var state = getInternalState(that);
- var data = state.index;
- var entry = state.first;
- while (entry) {
- entry.removed = true;
- if (entry.previous) entry.previous = entry.previous.next = undefined;
- delete data[entry.index];
- entry = entry.next;
- }
- state.first = state.last = undefined;
- if (descriptors) state.size = 0;
- else that.size = 0;
- },
- // 23.1.3.3 Map.prototype.delete(key)
- // 23.2.3.4 Set.prototype.delete(value)
- 'delete': function (key) {
- var that = this;
- var state = getInternalState(that);
- var entry = getEntry(that, key);
- if (entry) {
- var next = entry.next;
- var prev = entry.previous;
- delete state.index[entry.index];
- entry.removed = true;
- if (prev) prev.next = next;
- if (next) next.previous = prev;
- if (state.first == entry) state.first = next;
- if (state.last == entry) state.last = prev;
- if (descriptors) state.size--;
- else that.size--;
- } return !!entry;
- },
- // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
- // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
- forEach: function forEach(callbackfn /* , that = undefined */) {
- var state = getInternalState(this);
- var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
- var entry;
- while (entry = entry ? entry.next : state.first) {
- boundFunction(entry.value, entry.key, this);
- // revert to the last existing entry
- while (entry && entry.removed) entry = entry.previous;
- }
- },
- // 23.1.3.7 Map.prototype.has(key)
- // 23.2.3.7 Set.prototype.has(value)
- has: function has(key) {
- return !!getEntry(this, key);
- }
- });
- redefineAll(C.prototype, IS_MAP ? {
- // 23.1.3.6 Map.prototype.get(key)
- get: function get(key) {
- var entry = getEntry(this, key);
- return entry && entry.value;
- },
- // 23.1.3.9 Map.prototype.set(key, value)
- set: function set(key, value) {
- return define(this, key === 0 ? 0 : key, value);
- }
- } : {
- // 23.2.3.1 Set.prototype.add(value)
- add: function add(value) {
- return define(this, value = value === 0 ? 0 : value, value);
- }
- });
- if (descriptors) defineProperty(C.prototype, 'size', {
- get: function () {
- return getInternalState(this).size;
- }
- });
- return C;
- },
- setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
- var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
- var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
- // add .keys, .values, .entries, [@@iterator]
- // 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
- defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
- setInternalState(this, {
- type: ITERATOR_NAME,
- target: iterated,
- state: getInternalCollectionState(iterated),
- kind: kind,
- last: undefined
- });
- }, function () {
- var state = getInternalIteratorState(this);
- var kind = state.kind;
- var entry = state.last;
- // revert to the last existing entry
- while (entry && entry.removed) entry = entry.previous;
- // get next entry
- if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
- // or finish the iteration
- state.target = undefined;
- return { value: undefined, done: true };
- }
- // return step by kind
- if (kind == 'keys') return { value: entry.key, done: false };
- if (kind == 'values') return { value: entry.value, done: false };
- return { value: [entry.key, entry.value], done: false };
- }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
- // add [@@species], 23.1.2.2, 23.2.2.2
- setSpecies(CONSTRUCTOR_NAME);
- }
- };
- // `Set` constructor
- // https://tc39.es/ecma262/#sec-set-objects
- collection('Set', function (init) {
- return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
- }, collectionStrong);
- // @@match logic
- fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
- return [
- // `String.prototype.match` method
- // https://tc39.es/ecma262/#sec-string.prototype.match
- function match(regexp) {
- var O = requireObjectCoercible(this);
- var matcher = regexp == undefined ? undefined : regexp[MATCH];
- return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
- },
- // `RegExp.prototype[@@match]` method
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
- function (regexp) {
- var res = maybeCallNative(nativeMatch, regexp, this);
- if (res.done) return res.value;
- var rx = anObject(regexp);
- var S = String(this);
- if (!rx.global) return regexpExecAbstract(rx, S);
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- var A = [];
- var n = 0;
- var result;
- while ((result = regexpExecAbstract(rx, S)) !== null) {
- var matchStr = String(result[0]);
- A[n] = matchStr;
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- n++;
- }
- return n === 0 ? null : A;
- }
- ];
- });
- var floor = Math.floor;
- var replace = ''.replace;
- var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
- // https://tc39.es/ecma262/#sec-getsubstitution
- var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
- var tailPos = position + matched.length;
- var m = captures.length;
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
- if (namedCaptures !== undefined) {
- namedCaptures = toObject(namedCaptures);
- symbols = SUBSTITUTION_SYMBOLS;
- }
- return replace.call(replacement, symbols, function (match, ch) {
- var capture;
- switch (ch.charAt(0)) {
- case '$': return '$';
- case '&': return matched;
- case '`': return str.slice(0, position);
- case "'": return str.slice(tailPos);
- case '<':
- capture = namedCaptures[ch.slice(1, -1)];
- break;
- default: // \d\d?
- var n = +ch;
- if (n === 0) return match;
- if (n > m) {
- var f = floor(n / 10);
- if (f === 0) return match;
- if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
- return match;
- }
- capture = captures[n - 1];
- }
- return capture === undefined ? '' : capture;
- });
- };
- var max$1 = Math.max;
- var min$2 = Math.min;
- var maybeToString = function (it) {
- return it === undefined ? it : String(it);
- };
- // @@replace logic
- fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
- var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
- var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
- return [
- // `String.prototype.replace` method
- // https://tc39.es/ecma262/#sec-string.prototype.replace
- function replace(searchValue, replaceValue) {
- var O = requireObjectCoercible(this);
- var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
- return replacer !== undefined
- ? replacer.call(searchValue, O, replaceValue)
- : nativeReplace.call(String(O), searchValue, replaceValue);
- },
- // `RegExp.prototype[@@replace]` method
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
- function (regexp, replaceValue) {
- if (
- (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
- (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
- ) {
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
- if (res.done) return res.value;
- }
- var rx = anObject(regexp);
- var S = String(this);
- var functionalReplace = typeof replaceValue === 'function';
- if (!functionalReplace) replaceValue = String(replaceValue);
- var global = rx.global;
- if (global) {
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- }
- var results = [];
- while (true) {
- var result = regexpExecAbstract(rx, S);
- if (result === null) break;
- results.push(result);
- if (!global) break;
- var matchStr = String(result[0]);
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- }
- var accumulatedResult = '';
- var nextSourcePosition = 0;
- for (var i = 0; i < results.length; i++) {
- result = results[i];
- var matched = String(result[0]);
- var position = max$1(min$2(toInteger(result.index), S.length), 0);
- var captures = [];
- // NOTE: This is equivalent to
- // captures = result.slice(1).map(maybeToString)
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
- var namedCaptures = result.groups;
- if (functionalReplace) {
- var replacerArgs = [matched].concat(captures, position, S);
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
- var replacement = String(replaceValue.apply(undefined, replacerArgs));
- } else {
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
- }
- if (position >= nextSourcePosition) {
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
- nextSourcePosition = position + matched.length;
- }
- }
- return accumulatedResult + S.slice(nextSourcePosition);
- }
- ];
- });
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
- var nativeStartsWith = ''.startsWith;
- var min$1 = Math.min;
- var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');
- // https://github.com/zloirock/core-js/pull/702
- var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
- var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
- return descriptor && !descriptor.writable;
- }();
- // `String.prototype.startsWith` method
- // https://tc39.es/ecma262/#sec-string.prototype.startswith
- _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
- startsWith: function startsWith(searchString /* , position = 0 */) {
- var that = String(requireObjectCoercible(this));
- notARegexp(searchString);
- var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
- var search = String(searchString);
- return nativeStartsWith
- ? nativeStartsWith.call(that, search, index)
- : that.slice(index, index + search.length) === search;
- }
- });
- var non = '\u200B\u0085\u180E';
- // check that a method works with the correct list
- // of whitespaces and has a correct name
- var stringTrimForced = function (METHOD_NAME) {
- return fails(function () {
- return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
- });
- };
- var $trim = stringTrim.trim;
- // `String.prototype.trim` method
- // https://tc39.es/ecma262/#sec-string.prototype.trim
- _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
- trim: function trim() {
- return $trim(this);
- }
- });
- var ITERATOR = wellKnownSymbol('iterator');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var ArrayValues = es_array_iterator.values;
- for (var COLLECTION_NAME in domIterables) {
- var Collection = global_1[COLLECTION_NAME];
- var CollectionPrototype = Collection && Collection.prototype;
- if (CollectionPrototype) {
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
- createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
- } catch (error) {
- CollectionPrototype[ITERATOR] = ArrayValues;
- }
- if (!CollectionPrototype[TO_STRING_TAG]) {
- createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
- }
- if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
- createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
- } catch (error) {
- CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
- }
- }
- }
- }
- var _this3 = undefined;
- // Thanks @stimulus:
- // https://github.com/stimulusjs/stimulus/blob/master/packages/%40stimulus/core/src/application.ts
- function domReady() {
- var _this = this;
- return new Promise(function (resolve) {
- _newArrowCheck(this, _this);
- if (document.readyState == "loading") {
- document.addEventListener("DOMContentLoaded", resolve);
- } else {
- resolve();
- }
- }.bind(this));
- }
- function arrayUnique(array) {
- return Array.from(new Set(array));
- }
- function isTesting() {
- return navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom");
- }
- function checkedAttrLooseCompare(valueA, valueB) {
- return valueA == valueB;
- }
- function warnIfMalformedTemplate(el, directive) {
- if (el.tagName.toLowerCase() !== 'template') {
- console.warn("Alpine: [".concat(directive, "] directive should only be added to <template> tags. See https://github.com/alpinejs/alpine#").concat(directive));
- } else if (el.content.childElementCount !== 1) {
- console.warn("Alpine: <template> tag with [".concat(directive, "] encountered with an unexpected number of root elements. Make sure <template> has a single root element. "));
- }
- }
- function kebabCase(subject) {
- return subject.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/[_\s]/, '-').toLowerCase();
- }
- function camelCase(subject) {
- var _this2 = this;
- return subject.toLowerCase().replace(/-(\w)/g, function (match, _char) {
- _newArrowCheck(this, _this2);
- return _char.toUpperCase();
- }.bind(this));
- }
- function walk(el, callback) {
- if (callback(el) === false) return;
- var node = el.firstElementChild;
- while (node) {
- walk(node, callback);
- node = node.nextElementSibling;
- }
- }
- function debounce(func, wait) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
- func.apply(context, args);
- };
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- };
- }
- var handleError = function handleError(el, expression, error) {
- _newArrowCheck(this, _this3);
- console.warn("Alpine Error: \"".concat(error, "\"\n\nExpression: \"").concat(expression, "\"\nElement:"), el);
- if (!isTesting()) {
- Object.assign(error, {
- el: el,
- expression: expression
- });
- throw error;
- }
- }.bind(undefined);
- function tryCatch(cb, _ref) {
- var _this4 = this;
- var el = _ref.el,
- expression = _ref.expression;
- try {
- var value = cb();
- return value instanceof Promise ? value["catch"](function (e) {
- _newArrowCheck(this, _this4);
- return handleError(el, expression, e);
- }.bind(this)) : value;
- } catch (e) {
- handleError(el, expression, e);
- }
- }
- function saferEval(el, expression, dataContext) {
- var _this5 = this;
- var additionalHelperVariables = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- return tryCatch(function () {
- _newArrowCheck(this, _this5);
- if (typeof expression === 'function') {
- return expression.call(dataContext);
- }
- 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))));
- }.bind(this), {
- el: el,
- expression: expression
- });
- }
- function saferEvalNoReturn(el, expression, dataContext) {
- var _this6 = this;
- var additionalHelperVariables = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- return tryCatch(function () {
- _newArrowCheck(this, _this6);
- if (typeof expression === 'function') {
- return Promise.resolve(expression.call(dataContext, additionalHelperVariables['$event']));
- }
- var AsyncFunction = Function; // For the cases when users pass only a function reference to the caller: `x-on:click="foo"`
- // Where "foo" is a function. Also, we'll pass the function the event instance when we call it.
- if (Object.keys(dataContext).includes(expression)) {
- var methodReference = new Function(['dataContext'].concat(_toConsumableArray(Object.keys(additionalHelperVariables))), "with(dataContext) { return ".concat(expression, " }")).apply(void 0, [dataContext].concat(_toConsumableArray(Object.values(additionalHelperVariables))));
- if (typeof methodReference === 'function') {
- return Promise.resolve(methodReference.call(dataContext, additionalHelperVariables['$event']));
- } else {
- return Promise.resolve();
- }
- }
- return Promise.resolve(new AsyncFunction(['dataContext'].concat(_toConsumableArray(Object.keys(additionalHelperVariables))), "with(dataContext) { ".concat(expression, " }")).apply(void 0, [dataContext].concat(_toConsumableArray(Object.values(additionalHelperVariables)))));
- }.bind(this), {
- el: el,
- expression: expression
- });
- }
- var xAttrRE = /^x-(on|bind|data|text|html|model|if|for|show|cloak|transition|ref|spread)\b/;
- function isXAttr(attr) {
- var name = replaceAtAndColonWithStandardSyntax(attr.name);
- return xAttrRE.test(name);
- }
- function getXAttrs(el, component, type) {
- var _this7 = this;
- var directives = Array.from(el.attributes).filter(isXAttr).map(parseHtmlAttribute); // Get an object of directives from x-spread.
- var spreadDirective = directives.filter(function (directive) {
- _newArrowCheck(this, _this7);
- return directive.type === 'spread';
- }.bind(this))[0];
- if (spreadDirective) {
- var spreadObject = saferEval(el, spreadDirective.expression, component.$data); // Add x-spread directives to the pile of existing directives.
- directives = directives.concat(Object.entries(spreadObject).map(function (_ref2) {
- _newArrowCheck(this, _this7);
- var _ref3 = _slicedToArray(_ref2, 2),
- name = _ref3[0],
- value = _ref3[1];
- return parseHtmlAttribute({
- name: name,
- value: value
- });
- }.bind(this)));
- }
- if (type) return directives.filter(function (i) {
- _newArrowCheck(this, _this7);
- return i.type === type;
- }.bind(this));
- return sortDirectives(directives);
- }
- function sortDirectives(directives) {
- var _this8 = this;
- var directiveOrder = ['bind', 'model', 'show', 'catch-all'];
- return directives.sort(function (a, b) {
- _newArrowCheck(this, _this8);
- var typeA = directiveOrder.indexOf(a.type) === -1 ? 'catch-all' : a.type;
- var typeB = directiveOrder.indexOf(b.type) === -1 ? 'catch-all' : b.type;
- return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
- }.bind(this));
- }
- function parseHtmlAttribute(_ref4) {
- var _this9 = this;
- var name = _ref4.name,
- value = _ref4.value;
- var normalizedName = replaceAtAndColonWithStandardSyntax(name);
- var typeMatch = normalizedName.match(xAttrRE);
- var valueMatch = normalizedName.match(/:([a-zA-Z0-9\-:]+)/);
- var modifiers = normalizedName.match(/\.[^.\]]+(?=[^\]]*$)/g) || [];
- return {
- type: typeMatch ? typeMatch[1] : null,
- value: valueMatch ? valueMatch[1] : null,
- modifiers: modifiers.map(function (i) {
- _newArrowCheck(this, _this9);
- return i.replace('.', '');
- }.bind(this)),
- expression: value
- };
- }
- function isBooleanAttr(attrName) {
- // As per HTML spec table https://html.spec.whatwg.org/multipage/indices.html#attributes-3:boolean-attribute
- // Array roughly ordered by estimated usage
- 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'];
- return booleanAttributes.includes(attrName);
- }
- function replaceAtAndColonWithStandardSyntax(name) {
- if (name.startsWith('@')) {
- return name.replace('@', 'x-on:');
- } else if (name.startsWith(':')) {
- return name.replace(':', 'x-bind:');
- }
- return name;
- }
- function convertClassStringToArray(classList) {
- var filterFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Boolean;
- return classList.split(' ').filter(filterFn);
- }
- var TRANSITION_TYPE_IN = 'in';
- var TRANSITION_TYPE_OUT = 'out';
- var TRANSITION_CANCELLED = 'cancelled';
- function transitionIn(el, show, reject, component) {
- var _this10 = this;
- var forceSkip = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- // We don't want to transition on the initial page load.
- if (forceSkip) return show();
- if (el.__x_transition && el.__x_transition.type === TRANSITION_TYPE_IN) {
- // there is already a similar transition going on, this was probably triggered by
- // a change in a different property, let's just leave the previous one doing its job
- return;
- }
- var attrs = getXAttrs(el, component, 'transition');
- var showAttr = getXAttrs(el, component, 'show')[0]; // If this is triggered by a x-show.transition.
- if (showAttr && showAttr.modifiers.includes('transition')) {
- var modifiers = showAttr.modifiers; // If x-show.transition.out, we'll skip the "in" transition.
- if (modifiers.includes('out') && !modifiers.includes('in')) return show();
- var settingBothSidesOfTransition = modifiers.includes('in') && modifiers.includes('out'); // If x-show.transition.in...out... only use "in" related modifiers for this transition.
- modifiers = settingBothSidesOfTransition ? modifiers.filter(function (i, index) {
- _newArrowCheck(this, _this10);
- return index < modifiers.indexOf('out');
- }.bind(this)) : modifiers;
- transitionHelperIn(el, modifiers, show, reject); // Otherwise, we can assume x-transition:enter.
- } else if (attrs.some(function (attr) {
- _newArrowCheck(this, _this10);
- return ['enter', 'enter-start', 'enter-end'].includes(attr.value);
- }.bind(this))) {
- transitionClassesIn(el, component, attrs, show, reject);
- } else {
- // If neither, just show that damn thing.
- show();
- }
- }
- function transitionOut(el, hide, reject, component) {
- var _this11 = this;
- var forceSkip = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- // We don't want to transition on the initial page load.
- if (forceSkip) return hide();
- if (el.__x_transition && el.__x_transition.type === TRANSITION_TYPE_OUT) {
- // there is already a similar transition going on, this was probably triggered by
- // a change in a different property, let's just leave the previous one doing its job
- return;
- }
- var attrs = getXAttrs(el, component, 'transition');
- var showAttr = getXAttrs(el, component, 'show')[0];
- if (showAttr && showAttr.modifiers.includes('transition')) {
- var modifiers = showAttr.modifiers;
- if (modifiers.includes('in') && !modifiers.includes('out')) return hide();
- var settingBothSidesOfTransition = modifiers.includes('in') && modifiers.includes('out');
- modifiers = settingBothSidesOfTransition ? modifiers.filter(function (i, index) {
- _newArrowCheck(this, _this11);
- return index > modifiers.indexOf('out');
- }.bind(this)) : modifiers;
- transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hide, reject);
- } else if (attrs.some(function (attr) {
- _newArrowCheck(this, _this11);
- return ['leave', 'leave-start', 'leave-end'].includes(attr.value);
- }.bind(this))) {
- transitionClassesOut(el, component, attrs, hide, reject);
- } else {
- hide();
- }
- }
- function transitionHelperIn(el, modifiers, showCallback, reject) {
- var _this12 = this;
- // Default values inspired by: https://material.io/design/motion/speed.html#duration
- var styleValues = {
- duration: modifierValue(modifiers, 'duration', 150),
- origin: modifierValue(modifiers, 'origin', 'center'),
- first: {
- opacity: 0,
- scale: modifierValue(modifiers, 'scale', 95)
- },
- second: {
- opacity: 1,
- scale: 100
- }
- };
- transitionHelper(el, modifiers, showCallback, function () {
- _newArrowCheck(this, _this12);
- }.bind(this), reject, styleValues, TRANSITION_TYPE_IN);
- }
- function transitionHelperOut(el, modifiers, settingBothSidesOfTransition, hideCallback, reject) {
- var _this13 = this;
- // Make the "out" transition .5x slower than the "in". (Visually better)
- // HOWEVER, if they explicitly set a duration for the "out" transition,
- // use that.
- var duration = settingBothSidesOfTransition ? modifierValue(modifiers, 'duration', 150) : modifierValue(modifiers, 'duration', 150) / 2;
- var styleValues = {
- duration: duration,
- origin: modifierValue(modifiers, 'origin', 'center'),
- first: {
- opacity: 1,
- scale: 100
- },
- second: {
- opacity: 0,
- scale: modifierValue(modifiers, 'scale', 95)
- }
- };
- transitionHelper(el, modifiers, function () {
- _newArrowCheck(this, _this13);
- }.bind(this), hideCallback, reject, styleValues, TRANSITION_TYPE_OUT);
- }
- function modifierValue(modifiers, key, fallback) {
- // If the modifier isn't present, use the default.
- if (modifiers.indexOf(key) === -1) return fallback; // If it IS present, grab the value after it: x-show.transition.duration.500ms
- var rawValue = modifiers[modifiers.indexOf(key) + 1];
- if (!rawValue) return fallback;
- if (key === 'scale') {
- // Check if the very next value is NOT a number and return the fallback.
- // If x-show.transition.scale, we'll use the default scale value.
- // That is how a user opts out of the opacity transition.
- if (!isNumeric(rawValue)) return fallback;
- }
- if (key === 'duration') {
- // Support x-show.transition.duration.500ms && duration.500
- var match = rawValue.match(/([0-9]+)ms/);
- if (match) return match[1];
- }
- if (key === 'origin') {
- // Support chaining origin directions: x-show.transition.top.right
- if (['top', 'right', 'left', 'center', 'bottom'].includes(modifiers[modifiers.indexOf(key) + 2])) {
- return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(' ');
- }
- }
- return rawValue;
- }
- function transitionHelper(el, modifiers, hook1, hook2, reject, styleValues, type) {
- // clear the previous transition if exists to avoid caching the wrong styles
- if (el.__x_transition) {
- el.__x_transition.cancel && el.__x_transition.cancel();
- } // If the user set these style values, we'll put them back when we're done with them.
- var opacityCache = el.style.opacity;
- var transformCache = el.style.transform;
- var transformOriginCache = el.style.transformOrigin; // If no modifiers are present: x-show.transition, we'll default to both opacity and scale.
- var noModifiers = !modifiers.includes('opacity') && !modifiers.includes('scale');
- var transitionOpacity = noModifiers || modifiers.includes('opacity');
- var transitionScale = noModifiers || modifiers.includes('scale'); // These are the explicit stages of a transition (same stages for in and for out).
- // This way you can get a birds eye view of the hooks, and the differences
- // between them.
- var stages = {
- start: function start() {
- if (transitionOpacity) el.style.opacity = styleValues.first.opacity;
- if (transitionScale) el.style.transform = "scale(".concat(styleValues.first.scale / 100, ")");
- },
- during: function during() {
- if (transitionScale) el.style.transformOrigin = styleValues.origin;
- el.style.transitionProperty = [transitionOpacity ? "opacity" : "", transitionScale ? "transform" : ""].join(' ').trim();
- el.style.transitionDuration = "".concat(styleValues.duration / 1000, "s");
- el.style.transitionTimingFunction = "cubic-bezier(0.4, 0.0, 0.2, 1)";
- },
- show: function show() {
- hook1();
- },
- end: function end() {
- if (transitionOpacity) el.style.opacity = styleValues.second.opacity;
- if (transitionScale) el.style.transform = "scale(".concat(styleValues.second.scale / 100, ")");
- },
- hide: function hide() {
- hook2();
- },
- cleanup: function cleanup() {
- if (transitionOpacity) el.style.opacity = opacityCache;
- if (transitionScale) el.style.transform = transformCache;
- if (transitionScale) el.style.transformOrigin = transformOriginCache;
- el.style.transitionProperty = null;
- el.style.transitionDuration = null;
- el.style.transitionTimingFunction = null;
- }
- };
- transition(el, stages, type, reject);
- }
- var ensureStringExpression = function ensureStringExpression(expression, el, component) {
- _newArrowCheck(this, _this3);
- return typeof expression === 'function' ? component.evaluateReturnExpression(el, expression) : expression;
- }.bind(undefined);
- function transitionClassesIn(el, component, directives, showCallback, reject) {
- var _this14 = this;
- var enter = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
- _newArrowCheck(this, _this14);
- return i.value === 'enter';
- }.bind(this)) || {
- expression: ''
- }).expression, el, component));
- var enterStart = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
- _newArrowCheck(this, _this14);
- return i.value === 'enter-start';
- }.bind(this)) || {
- expression: ''
- }).expression, el, component));
- var enterEnd = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
- _newArrowCheck(this, _this14);
- return i.value === 'enter-end';
- }.bind(this)) || {
- expression: ''
- }).expression, el, component));
- transitionClasses(el, enter, enterStart, enterEnd, showCallback, function () {
- _newArrowCheck(this, _this14);
- }.bind(this), TRANSITION_TYPE_IN, reject);
- }
- function transitionClassesOut(el, component, directives, hideCallback, reject) {
- var _this15 = this;
- var leave = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
- _newArrowCheck(this, _this15);
- return i.value === 'leave';
- }.bind(this)) || {
- expression: ''
- }).expression, el, component));
- var leaveStart = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
- _newArrowCheck(this, _this15);
- return i.value === 'leave-start';
- }.bind(this)) || {
- expression: ''
- }).expression, el, component));
- var leaveEnd = convertClassStringToArray(ensureStringExpression((directives.find(function (i) {
- _newArrowCheck(this, _this15);
- return i.value === 'leave-end';
- }.bind(this)) || {
- expression: ''
- }).expression, el, component));
- transitionClasses(el, leave, leaveStart, leaveEnd, function () {
- _newArrowCheck(this, _this15);
- }.bind(this), hideCallback, TRANSITION_TYPE_OUT, reject);
- }
- function transitionClasses(el, classesDuring, classesStart, classesEnd, hook1, hook2, type, reject) {
- // clear the previous transition if exists to avoid caching the wrong classes
- if (el.__x_transition) {
- el.__x_transition.cancel && el.__x_transition.cancel();
- }
- var originalClasses = el.__x_original_classes || [];
- var stages = {
- start: function start() {
- var _el$classList;
- (_el$classList = el.classList).add.apply(_el$classList, _toConsumableArray(classesStart));
- },
- during: function during() {
- var _el$classList2;
- (_el$classList2 = el.classList).add.apply(_el$classList2, _toConsumableArray(classesDuring));
- },
- show: function show() {
- hook1();
- },
- end: function end() {
- var _el$classList3,
- _this16 = this,
- _el$classList4;
- // Don't remove classes that were in the original class attribute.
- (_el$classList3 = el.classList).remove.apply(_el$classList3, _toConsumableArray(classesStart.filter(function (i) {
- _newArrowCheck(this, _this16);
- return !originalClasses.includes(i);
- }.bind(this))));
- (_el$classList4 = el.classList).add.apply(_el$classList4, _toConsumableArray(classesEnd));
- },
- hide: function hide() {
- hook2();
- },
- cleanup: function cleanup() {
- var _el$classList5,
- _this17 = this,
- _el$classList6;
- (_el$classList5 = el.classList).remove.apply(_el$classList5, _toConsumableArray(classesDuring.filter(function (i) {
- _newArrowCheck(this, _this17);
- return !originalClasses.includes(i);
- }.bind(this))));
- (_el$classList6 = el.classList).remove.apply(_el$classList6, _toConsumableArray(classesEnd.filter(function (i) {
- _newArrowCheck(this, _this17);
- return !originalClasses.includes(i);
- }.bind(this))));
- }
- };
- transition(el, stages, type, reject);
- }
- function transition(el, stages, type, reject) {
- var _this18 = this;
- var finish = once(function () {
- _newArrowCheck(this, _this18);
- stages.hide(); // Adding an "isConnected" check, in case the callback
- // removed the element from the DOM.
- if (el.isConnected) {
- stages.cleanup();
- }
- delete el.__x_transition;
- }.bind(this));
- el.__x_transition = {
- // Set transition type so we can avoid clearing transition if the direction is the same
- type: type,
- // create a callback for the last stages of the transition so we can call it
- // from different point and early terminate it. Once will ensure that function
- // is only called one time.
- cancel: once(function () {
- _newArrowCheck(this, _this18);
- reject(TRANSITION_CANCELLED);
- finish();
- }.bind(this)),
- finish: finish,
- // This store the next animation frame so we can cancel it
- nextFrame: null
- };
- stages.start();
- stages.during();
- el.__x_transition.nextFrame = requestAnimationFrame(function () {
- var _this19 = this;
- _newArrowCheck(this, _this18);
- // Note: Safari's transitionDuration property will list out comma separated transition durations
- // for every single transition property. Let's grab the first one and call it a day.
- var duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, '').replace('s', '')) * 1000;
- if (duration === 0) {
- duration = Number(getComputedStyle(el).animationDuration.replace('s', '')) * 1000;
- }
- stages.show();
- el.__x_transition.nextFrame = requestAnimationFrame(function () {
- _newArrowCheck(this, _this19);
- stages.end();
- setTimeout(el.__x_transition.finish, duration);
- }.bind(this));
- }.bind(this));
- }
- function isNumeric(subject) {
- return !Array.isArray(subject) && !isNaN(subject);
- } // Thanks @vuejs
- // https://github.com/vuejs/vue/blob/4de4649d9637262a9b007720b59f80ac72a5620c/src/shared/util.js
- function once(callback) {
- var called = false;
- return function () {
- if (!called) {
- called = true;
- callback.apply(this, arguments);
- }
- };
- }
- function handleForDirective(component, templateEl, expression, initialUpdate, extraVars) {
- var _this = this;
- warnIfMalformedTemplate(templateEl, 'x-for');
- var iteratorNames = typeof expression === 'function' ? parseForExpression(component.evaluateReturnExpression(templateEl, expression)) : parseForExpression(expression);
- var items = evaluateItemsAndReturnEmptyIfXIfIsPresentAndFalseOnElement(component, templateEl, iteratorNames, extraVars); // As we walk the array, we'll also walk the DOM (updating/creating as we go).
- var currentEl = templateEl;
- items.forEach(function (item, index) {
- var _this2 = this;
- _newArrowCheck(this, _this);
- var iterationScopeVariables = getIterationScopeVariables(iteratorNames, item, index, items, extraVars());
- var currentKey = generateKeyForIteration(component, templateEl, index, iterationScopeVariables);
- var nextEl = lookAheadForMatchingKeyedElementAndMoveItIfFound(currentEl.nextElementSibling, currentKey); // If we haven't found a matching key, insert the element at the current position.
- if (!nextEl) {
- nextEl = addElementInLoopAfterCurrentEl(templateEl, currentEl); // And transition it in if it's not the first page load.
- transitionIn(nextEl, function () {
- _newArrowCheck(this, _this2);
- }.bind(this), function () {
- _newArrowCheck(this, _this2);
- }.bind(this), component, initialUpdate);
- nextEl.__x_for = iterationScopeVariables;
- component.initializeElements(nextEl, function () {
- _newArrowCheck(this, _this2);
- return nextEl.__x_for;
- }.bind(this)); // Otherwise update the element we found.
- } else {
- // Temporarily remove the key indicator to allow the normal "updateElements" to work.
- delete nextEl.__x_for_key;
- nextEl.__x_for = iterationScopeVariables;
- component.updateElements(nextEl, function () {
- _newArrowCheck(this, _this2);
- return nextEl.__x_for;
- }.bind(this));
- }
- currentEl = nextEl;
- currentEl.__x_for_key = currentKey;
- }.bind(this));
- removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component);
- } // This was taken from VueJS 2.* core. Thanks Vue!
- function parseForExpression(expression) {
- var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
- var stripParensRE = /^\(|\)$/g;
- var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
- var inMatch = String(expression).match(forAliasRE);
- if (!inMatch) return;
- var res = {};
- res.items = inMatch[2].trim();
- var item = inMatch[1].trim().replace(stripParensRE, '');
- var iteratorMatch = item.match(forIteratorRE);
- if (iteratorMatch) {
- res.item = item.replace(forIteratorRE, '').trim();
- res.index = iteratorMatch[1].trim();
- if (iteratorMatch[2]) {
- res.collection = iteratorMatch[2].trim();
- }
- } else {
- res.item = item;
- }
- return res;
- }
- function getIterationScopeVariables(iteratorNames, item, index, items, extraVars) {
- // We must create a new object, so each iteration has a new scope
- var scopeVariables = extraVars ? _objectSpread2({}, extraVars) : {};
- scopeVariables[iteratorNames.item] = item;
- if (iteratorNames.index) scopeVariables[iteratorNames.index] = index;
- if (iteratorNames.collection) scopeVariables[iteratorNames.collection] = items;
- return scopeVariables;
- }
- function generateKeyForIteration(component, el, index, iterationScopeVariables) {
- var _this3 = this;
- var bindKeyAttribute = getXAttrs(el, component, 'bind').filter(function (attr) {
- _newArrowCheck(this, _this3);
- return attr.value === 'key';
- }.bind(this))[0]; // If the dev hasn't specified a key, just return the index of the iteration.
- if (!bindKeyAttribute) return index;
- return component.evaluateReturnExpression(el, bindKeyAttribute.expression, function () {
- _newArrowCheck(this, _this3);
- return iterationScopeVariables;
- }.bind(this));
- }
- function evaluateItemsAndReturnEmptyIfXIfIsPresentAndFalseOnElement(component, el, iteratorNames, extraVars) {
- var _this4 = this;
- var ifAttribute = getXAttrs(el, component, 'if')[0];
- if (ifAttribute && !component.evaluateReturnExpression(el, ifAttribute.expression)) {
- return [];
- }
- var items = component.evaluateReturnExpression(el, iteratorNames.items, extraVars); // This adds support for the `i in n` syntax.
- if (isNumeric(items) && items >= 0) {
- items = Array.from(Array(items).keys(), function (i) {
- _newArrowCheck(this, _this4);
- return i + 1;
- }.bind(this));
- }
- return items;
- }
- function addElementInLoopAfterCurrentEl(templateEl, currentEl) {
- var clone = document.importNode(templateEl.content, true);
- currentEl.parentElement.insertBefore(clone, currentEl.nextElementSibling);
- return currentEl.nextElementSibling;
- }
- function lookAheadForMatchingKeyedElementAndMoveItIfFound(nextEl, currentKey) {
- if (!nextEl) return; // If we are already past the x-for generated elements, we don't need to look ahead.
- if (nextEl.__x_for_key === undefined) return; // If the the key's DO match, no need to look ahead.
- if (nextEl.__x_for_key === currentKey) return nextEl; // If they don't, we'll look ahead for a match.
- // If we find it, we'll move it to the current position in the loop.
- var tmpNextEl = nextEl;
- while (tmpNextEl) {
- if (tmpNextEl.__x_for_key === currentKey) {
- return tmpNextEl.parentElement.insertBefore(tmpNextEl, nextEl);
- }
- tmpNextEl = tmpNextEl.nextElementSibling && tmpNextEl.nextElementSibling.__x_for_key !== undefined ? tmpNextEl.nextElementSibling : false;
- }
- }
- function removeAnyLeftOverElementsFromPreviousUpdate(currentEl, component) {
- var nextElementFromOldLoop = currentEl.nextElementSibling && currentEl.nextElementSibling.__x_for_key !== undefined ? currentEl.nextElementSibling : false;
- var _loop = function _loop() {
- var _this5 = this;
- var nextElementFromOldLoopImmutable = nextElementFromOldLoop;
- var nextSibling = nextElementFromOldLoop.nextElementSibling;
- transitionOut(nextElementFromOldLoop, function () {
- _newArrowCheck(this, _this5);
- nextElementFromOldLoopImmutable.remove();
- }.bind(this), function () {
- _newArrowCheck(this, _this5);
- }.bind(this), component);
- nextElementFromOldLoop = nextSibling && nextSibling.__x_for_key !== undefined ? nextSibling : false;
- };
- while (nextElementFromOldLoop) {
- _loop();
- }
- }
- function handleAttributeBindingDirective(component, el, attrName, expression, extraVars, attrType, modifiers) {
- var _this = this;
- var value = component.evaluateReturnExpression(el, expression, extraVars);
- if (attrName === 'value') {
- if (Alpine.ignoreFocusedForValueBinding && document.activeElement.isSameNode(el)) return; // If nested model key is undefined, set the default value to empty string.
- if (value === undefined && String(expression).match(/\./)) {
- value = '';
- }
- if (el.type === 'radio') {
- // Set radio value from x-bind:value, if no "value" attribute exists.
- // If there are any initial state values, radio will have a correct
- // "checked" value since x-bind:value is processed before x-model.
- if (el.attributes.value === undefined && attrType === 'bind') {
- el.value = value;
- } else if (attrType !== 'bind') {
- el.checked = checkedAttrLooseCompare(el.value, value);
- }
- } else if (el.type === 'checkbox') {
- // If we are explicitly binding a string to the :value, set the string,
- // If the value is a boolean, leave it alone, it will be set to "on"
- // automatically.
- if (typeof value !== 'boolean' && ![null, undefined].includes(value) && attrType === 'bind') {
- el.value = String(value);
- } else if (attrType !== 'bind') {
- if (Array.isArray(value)) {
- // I'm purposely not using Array.includes here because it's
- // strict, and because of Numeric/String mis-casting, I
- // want the "includes" to be "fuzzy".
- el.checked = value.some(function (val) {
- _newArrowCheck(this, _this);
- return checkedAttrLooseCompare(val, el.value);
- }.bind(this));
- } else {
- el.checked = !!value;
- }
- }
- } else if (el.tagName === 'SELECT') {
- updateSelect(el, value);
- } else {
- if (el.value === value) return;
- el.value = value;
- }
- } else if (attrName === 'class') {
- if (Array.isArray(value)) {
- var originalClasses = el.__x_original_classes || [];
- el.setAttribute('class', arrayUnique(originalClasses.concat(value)).join(' '));
- } else if (_typeof(value) === 'object') {
- // Sorting the keys / class names by their boolean value will ensure that
- // anything that evaluates to `false` and needs to remove classes is run first.
- var keysSortedByBooleanValue = Object.keys(value).sort(function (a, b) {
- _newArrowCheck(this, _this);
- return value[a] - value[b];
- }.bind(this));
- keysSortedByBooleanValue.forEach(function (classNames) {
- var _this2 = this;
- _newArrowCheck(this, _this);
- if (value[classNames]) {
- convertClassStringToArray(classNames).forEach(function (className) {
- _newArrowCheck(this, _this2);
- return el.classList.add(className);
- }.bind(this));
- } else {
- convertClassStringToArray(classNames).forEach(function (className) {
- _newArrowCheck(this, _this2);
- return el.classList.remove(className);
- }.bind(this));
- }
- }.bind(this));
- } else {
- var _originalClasses = el.__x_original_classes || [];
- var newClasses = value ? convertClassStringToArray(value) : [];
- el.setAttribute('class', arrayUnique(_originalClasses.concat(newClasses)).join(' '));
- }
- } else {
- attrName = modifiers.includes('camel') ? camelCase(attrName) : attrName; // If an attribute's bound value is null, undefined or false, remove the attribute
- if ([null, undefined, false].includes(value)) {
- el.removeAttribute(attrName);
- } else {
- isBooleanAttr(attrName) ? setIfChanged(el, attrName, attrName) : setIfChanged(el, attrName, value);
- }
- }
- }
- function setIfChanged(el, attrName, value) {
- if (el.getAttribute(attrName) != value) {
- el.setAttribute(attrName, value);
- }
- }
- function updateSelect(el, value) {
- var _this3 = this;
- var arrayWrappedValue = [].concat(value).map(function (value) {
- _newArrowCheck(this, _this3);
- return value + '';
- }.bind(this));
- Array.from(el.options).forEach(function (option) {
- _newArrowCheck(this, _this3);
- option.selected = arrayWrappedValue.includes(option.value);
- }.bind(this));
- }
- function handleTextDirective(el, output, expression) {
- // If nested model key is undefined, set the default value to empty string.
- if (output === undefined && String(expression).match(/\./)) {
- output = '';
- }
- el.textContent = output;
- }
- function handleHtmlDirective(component, el, expression, extraVars) {
- el.innerHTML = component.evaluateReturnExpression(el, expression, extraVars);
- }
- function handleShowDirective(component, el, value, modifiers) {
- var _this = this;
- var initialUpdate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- var hide = function hide() {
- _newArrowCheck(this, _this);
- el.style.display = 'none';
- el.__x_is_shown = false;
- }.bind(this);
- var show = function show() {
- _newArrowCheck(this, _this);
- if (el.style.length === 1 && el.style.display === 'none') {
- el.removeAttribute('style');
- } else {
- el.style.removeProperty('display');
- }
- el.__x_is_shown = true;
- }.bind(this);
- if (initialUpdate === true) {
- if (value) {
- show();
- } else {
- hide();
- }
- return;
- }
- var handle = function handle(resolve, reject) {
- var _this2 = this;
- _newArrowCheck(this, _this);
- if (value) {
- if (el.style.display === 'none' || el.__x_transition) {
- transitionIn(el, function () {
- _newArrowCheck(this, _this2);
- show();
- }.bind(this), reject, component);
- }
- resolve(function () {
- _newArrowCheck(this, _this2);
- }.bind(this));
- } else {
- if (el.style.display !== 'none') {
- transitionOut(el, function () {
- var _this3 = this;
- _newArrowCheck(this, _this2);
- resolve(function () {
- _newArrowCheck(this, _this3);
- hide();
- }.bind(this));
- }.bind(this), reject, component);
- } else {
- resolve(function () {
- _newArrowCheck(this, _this2);
- }.bind(this));
- }
- }
- }.bind(this); // The working of x-show is a bit complex because we need to
- // wait for any child transitions to finish before hiding
- // some element. Also, this has to be done recursively.
- // If x-show.immediate, foregoe the waiting.
- if (modifiers.includes('immediate')) {
- handle(function (finish) {
- _newArrowCheck(this, _this);
- return finish();
- }.bind(this), function () {
- _newArrowCheck(this, _this);
- }.bind(this));
- return;
- } // x-show is encountered during a DOM tree walk. If an element
- // we encounter is NOT a child of another x-show element we
- // can execute the previous x-show stack (if one exists).
- if (component.showDirectiveLastElement && !component.showDirectiveLastElement.contains(el)) {
- component.executeAndClearRemainingShowDirectiveStack();
- }
- component.showDirectiveStack.push(handle);
- component.showDirectiveLastElement = el;
- }
- function handleIfDirective(component, el, expressionResult, initialUpdate, extraVars) {
- var _this = this;
- warnIfMalformedTemplate(el, 'x-if');
- var elementHasAlreadyBeenAdded = el.nextElementSibling && el.nextElementSibling.__x_inserted_me === true;
- if (expressionResult && (!elementHasAlreadyBeenAdded || el.__x_transition)) {
- var clone = document.importNode(el.content, true);
- el.parentElement.insertBefore(clone, el.nextElementSibling);
- transitionIn(el.nextElementSibling, function () {
- _newArrowCheck(this, _this);
- }.bind(this), function () {
- _newArrowCheck(this, _this);
- }.bind(this), component, initialUpdate);
- component.initializeElements(el.nextElementSibling, extraVars);
- el.nextElementSibling.__x_inserted_me = true;
- } else if (!expressionResult && elementHasAlreadyBeenAdded) {
- transitionOut(el.nextElementSibling, function () {
- _newArrowCheck(this, _this);
- el.nextElementSibling.remove();
- }.bind(this), function () {
- _newArrowCheck(this, _this);
- }.bind(this), component, initialUpdate);
- }
- }
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
- var USES_TO_LENGTH = arrayMethodUsesToLength('splice', { ACCESSORS: true, 0: 0, 1: 2 });
- var max = Math.max;
- var min = Math.min;
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
- var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
- // `Array.prototype.splice` method
- // https://tc39.es/ecma262/#sec-array.prototype.splice
- // with adding support of @@species
- _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
- splice: function splice(start, deleteCount /* , ...items */) {
- var O = toObject(this);
- var len = toLength(O.length);
- var actualStart = toAbsoluteIndex(start, len);
- var argumentsLength = arguments.length;
- var insertCount, actualDeleteCount, A, k, from, to;
- if (argumentsLength === 0) {
- insertCount = actualDeleteCount = 0;
- } else if (argumentsLength === 1) {
- insertCount = 0;
- actualDeleteCount = len - actualStart;
- } else {
- insertCount = argumentsLength - 2;
- actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
- }
- if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
- throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
- }
- A = arraySpeciesCreate(O, actualDeleteCount);
- for (k = 0; k < actualDeleteCount; k++) {
- from = actualStart + k;
- if (from in O) createProperty(A, k, O[from]);
- }
- A.length = actualDeleteCount;
- if (insertCount < actualDeleteCount) {
- for (k = actualStart; k < len - actualDeleteCount; k++) {
- from = k + actualDeleteCount;
- to = k + insertCount;
- if (from in O) O[to] = O[from];
- else delete O[to];
- }
- for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
- } else if (insertCount > actualDeleteCount) {
- for (k = len - actualDeleteCount; k > actualStart; k--) {
- from = k + actualDeleteCount - 1;
- to = k + insertCount - 1;
- if (from in O) O[to] = O[from];
- else delete O[to];
- }
- }
- for (k = 0; k < insertCount; k++) {
- O[k + actualStart] = arguments[k + 2];
- }
- O.length = len - actualDeleteCount + insertCount;
- return A;
- }
- });
- function registerListener(component, el, event, modifiers, expression) {
- var _this = this;
- var extraVars = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
- var options = {
- passive: modifiers.includes('passive')
- };
- if (modifiers.includes('camel')) {
- event = camelCase(event);
- }
- var node_add_count = el.__x_node_add_count;
- var _handler2, listenerTarget;
- if (modifiers.includes('away')) {
- listenerTarget = document;
- _handler2 = function handler(e) {
- _newArrowCheck(this, _this);
- // Don't do anything if the click came from the element or within it.
- if (el.contains(e.target)) return; // Don't do anything if this element isn't currently visible.
- if (el.offsetWidth < 1 && el.offsetHeight < 1) return; // Now that we are sure the element is visible, AND the click
- // is from outside it, let's run the expression.
- runListenerHandler(component, expression, e, extraVars);
- if (modifiers.includes('once')) {
- document.removeEventListener(event, _handler2, options);
- }
- }.bind(this);
- } else {
- listenerTarget = modifiers.includes('window') ? window : modifiers.includes('document') ? document : el;
- _handler2 = function _handler(e) {
- var _this2 = this;
- _newArrowCheck(this, _this);
- // Remove this global event handler if the element that declared it
- // has been removed. It's now stale.
- if (listenerTarget === window || listenerTarget === document) {
- if (!document.body.contains(el)) {
- listenerTarget.removeEventListener(event, _handler2, options);
- return;
- }
- }
- if (el.__x_node_add_count !== node_add_count) {
- listenerTarget.removeEventListener(event, _handler2, options);
- return;
- }
- if (isKeyEvent(event)) {
- if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
- return;
- }
- }
- if (modifiers.includes('prevent')) e.preventDefault();
- if (modifiers.includes('stop')) e.stopPropagation(); // If the .self modifier isn't present, or if it is present and
- // the target element matches the element we are registering the
- // event on, run the handler
- if (!modifiers.includes('self') || e.target === el) {
- var returnValue = runListenerHandler(component, expression, e, extraVars);
- returnValue.then(function (value) {
- _newArrowCheck(this, _this2);
- if (value === false) {
- e.preventDefault();
- } else {
- if (modifiers.includes('once')) {
- listenerTarget.removeEventListener(event, _handler2, options);
- }
- }
- }.bind(this));
- }
- }.bind(this);
- }
- if (modifiers.includes('debounce')) {
- var nextModifier = modifiers[modifiers.indexOf('debounce') + 1] || 'invalid-wait';
- var wait = isNumeric(nextModifier.split('ms')[0]) ? Number(nextModifier.split('ms')[0]) : 250;
- _handler2 = debounce(_handler2, wait);
- }
- listenerTarget.addEventListener(event, _handler2, options);
- }
- function runListenerHandler(component, expression, e, extraVars) {
- var _this3 = this;
- return component.evaluateCommandExpression(e.target, expression, function () {
- _newArrowCheck(this, _this3);
- return _objectSpread2(_objectSpread2({}, extraVars()), {}, {
- '$event': e
- });
- }.bind(this));
- }
- function isKeyEvent(event) {
- return ['keydown', 'keyup'].includes(event);
- }
- function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) {
- var _this4 = this;
- var keyModifiers = modifiers.filter(function (i) {
- _newArrowCheck(this, _this4);
- return !['window', 'document', 'prevent', 'stop'].includes(i);
- }.bind(this));
- if (keyModifiers.includes('debounce')) {
- var debounceIndex = keyModifiers.indexOf('debounce');
- keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || 'invalid-wait').split('ms')[0]) ? 2 : 1);
- } // If no modifier is specified, we'll call it a press.
- if (keyModifiers.length === 0) return false; // If one is passed, AND it matches the key pressed, we'll call it a press.
- if (keyModifiers.length === 1 && keyModifiers[0] === keyToModifier(e.key)) return false; // The user is listening for key combinations.
- var systemKeyModifiers = ['ctrl', 'shift', 'alt', 'meta', 'cmd', 'super'];
- var selectedSystemKeyModifiers = systemKeyModifiers.filter(function (modifier) {
- _newArrowCheck(this, _this4);
- return keyModifiers.includes(modifier);
- }.bind(this));
- keyModifiers = keyModifiers.filter(function (i) {
- _newArrowCheck(this, _this4);
- return !selectedSystemKeyModifiers.includes(i);
- }.bind(this));
- if (selectedSystemKeyModifiers.length > 0) {
- var activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter(function (modifier) {
- _newArrowCheck(this, _this4);
- // Alias "cmd" and "super" to "meta"
- if (modifier === 'cmd' || modifier === 'super') modifier = 'meta';
- return e["".concat(modifier, "Key")];
- }.bind(this)); // If all the modifiers selected are pressed, ...
- if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) {
- // AND the remaining key is pressed as well. It's a press.
- if (keyModifiers[0] === keyToModifier(e.key)) return false;
- }
- } // We'll call it NOT a valid keypress.
- return true;
- }
- function keyToModifier(key) {
- switch (key) {
- case '/':
- return 'slash';
- case ' ':
- case 'Spacebar':
- return 'space';
- default:
- return key && kebabCase(key);
- }
- }
- function registerModelListener(component, el, modifiers, expression, extraVars) {
- var _this = this;
- // If the element we are binding to is a select, a radio, or checkbox
- // we'll listen for the change event instead of the "input" event.
- var event = el.tagName.toLowerCase() === 'select' || ['checkbox', 'radio'].includes(el.type) || modifiers.includes('lazy') ? 'change' : 'input';
- var listenerExpression = "".concat(expression, " = rightSideOfExpression($event, ").concat(expression, ")");
- registerListener(component, el, event, modifiers, listenerExpression, function () {
- _newArrowCheck(this, _this);
- return _objectSpread2(_objectSpread2({}, extraVars()), {}, {
- rightSideOfExpression: generateModelAssignmentFunction(el, modifiers, expression)
- });
- }.bind(this));
- }
- function generateModelAssignmentFunction(el, modifiers, expression) {
- var _this2 = this;
- if (el.type === 'radio') {
- // Radio buttons only work properly when they share a name attribute.
- // People might assume we take care of that for them, because
- // they already set a shared "x-model" attribute.
- if (!el.hasAttribute('name')) el.setAttribute('name', expression);
- }
- return function (event, currentValue) {
- var _this3 = this;
- _newArrowCheck(this, _this2);
- // Check for event.detail due to an issue where IE11 handles other events as a CustomEvent.
- if (event instanceof CustomEvent && event.detail) {
- return event.detail;
- } else if (el.type === 'checkbox') {
- // If the data we are binding to is an array, toggle its value inside the array.
- if (Array.isArray(currentValue)) {
- var newValue = modifiers.includes('number') ? safeParseNumber(event.target.value) : event.target.value;
- return event.target.checked ? currentValue.concat([newValue]) : currentValue.filter(function (el) {
- _newArrowCheck(this, _this3);
- return !checkedAttrLooseCompare(el, newValue);
- }.bind(this));
- } else {
- return event.target.checked;
- }
- } else if (el.tagName.toLowerCase() === 'select' && el.multiple) {
- return modifiers.includes('number') ? Array.from(event.target.selectedOptions).map(function (option) {
- _newArrowCheck(this, _this3);
- var rawValue = option.value || option.text;
- return safeParseNumber(rawValue);
- }.bind(this)) : Array.from(event.target.selectedOptions).map(function (option) {
- _newArrowCheck(this, _this3);
- return option.value || option.text;
- }.bind(this));
- } else {
- var rawValue = event.target.value;
- return modifiers.includes('number') ? safeParseNumber(rawValue) : modifiers.includes('trim') ? rawValue.trim() : rawValue;
- }
- }.bind(this);
- }
- function safeParseNumber(rawValue) {
- var number = rawValue ? parseFloat(rawValue) : null;
- return isNumeric(number) ? number : rawValue;
- }
- // `Reflect.set` method
- // https://tc39.es/ecma262/#sec-reflect.set
- function set(target, propertyKey, V /* , receiver */) {
- var receiver = arguments.length < 4 ? target : arguments[3];
- var ownDescriptor = objectGetOwnPropertyDescriptor.f(anObject(target), propertyKey);
- var existingDescriptor, prototype;
- if (!ownDescriptor) {
- if (isObject(prototype = objectGetPrototypeOf(target))) {
- return set(prototype, propertyKey, V, receiver);
- }
- ownDescriptor = createPropertyDescriptor(0);
- }
- if (has$1(ownDescriptor, 'value')) {
- if (ownDescriptor.writable === false || !isObject(receiver)) return false;
- if (existingDescriptor = objectGetOwnPropertyDescriptor.f(receiver, propertyKey)) {
- if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
- existingDescriptor.value = V;
- objectDefineProperty.f(receiver, propertyKey, existingDescriptor);
- } else objectDefineProperty.f(receiver, propertyKey, createPropertyDescriptor(0, V));
- return true;
- }
- return ownDescriptor.set === undefined ? false : (ownDescriptor.set.call(receiver, V), true);
- }
- // MS Edge 17-18 Reflect.set allows setting the property to object
- // with non-writable property on the prototype
- var MS_EDGE_BUG = fails(function () {
- var Constructor = function () { /* empty */ };
- var object = objectDefineProperty.f(new Constructor(), 'a', { configurable: true });
- // eslint-disable-next-line no-undef
- return Reflect.set(Constructor.prototype, 'a', 1, object) !== false;
- });
- _export({ target: 'Reflect', stat: true, forced: MS_EDGE_BUG }, {
- set: set
- });
- function wrap(data, mutationCallback) {
- /* IE11-ONLY:START */
- return wrapForIe11(data, mutationCallback);
- }
- function unwrap(membrane, observable) {
- var _this = this;
- var unwrappedData = membrane.unwrapProxy(observable);
- var copy = {};
- Object.keys(unwrappedData).forEach(function (key) {
- _newArrowCheck(this, _this);
- if (['$el', '$refs', '$nextTick', '$watch'].includes(key)) return;
- copy[key] = unwrappedData[key];
- }.bind(this));
- return copy;
- }
- function wrapForIe11(data, mutationCallback) {
- var proxyHandler = {
- set: function set(target, key, value) {
- // Set the value converting it to a "Deep Proxy" when required
- // Note that if a project is not a valid object, it won't be converted to a proxy
- var setWasSuccessful = Reflect.set(target, key, deepProxy(value, proxyHandler));
- mutationCallback(target, key);
- return setWasSuccessful;
- },
- get: function get(target, key) {
- // Provide a way to determine if this object is an Alpine proxy or not.
- if (key === "$isAlpineProxy") return true; // Just return the flippin' value. Gawsh.
- return target[key];
- }
- };
- return {
- data: deepProxy(data, proxyHandler),
- membrane: {
- unwrapProxy: function unwrapProxy(proxy) {
- return proxy;
- }
- }
- };
- }
- function deepProxy(target, proxyHandler) {
- // If target is null, return it.
- if (target === null) return target; // If target is not an object, return it.
- if (_typeof(target) !== 'object') return target; // If target is a DOM node (like in the case of this.$el), return it.
- if (target instanceof Node) return target; // If target is already an Alpine proxy, return it.
- if (target['$isAlpineProxy']) return target; // Otherwise proxy the properties recursively.
- // This enables reactivity on setting nested data.
- // Note that if a project is not a valid object, it won't be converted to a proxy
- for (var property in target) {
- target[property] = deepProxy(target[property], proxyHandler);
- }
- return new Proxy(target, proxyHandler);
- }
- var Component = /*#__PURE__*/function () {
- function Component(el) {
- var _this = this;
- var componentForClone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
- _classCallCheck(this, Component);
- this.$el = el;
- var dataAttr = this.$el.getAttribute('x-data');
- var dataExpression = dataAttr === '' ? '{}' : dataAttr;
- var dataExtras = {
- $el: this.$el
- };
- var canonicalComponentElementReference = componentForClone ? componentForClone.$el : this.$el;
- Object.entries(Alpine.magicProperties).forEach(function (_ref) {
- _newArrowCheck(this, _this);
- var _ref2 = _slicedToArray(_ref, 2),
- name = _ref2[0],
- callback = _ref2[1];
- Object.defineProperty(dataExtras, "$".concat(name), {
- get: function get() {
- return callback(canonicalComponentElementReference);
- }
- });
- }.bind(this));
- this.unobservedData = componentForClone ? componentForClone.getUnobservedData() : saferEval(el, dataExpression, dataExtras);
- /* IE11-ONLY:START */
- // For IE11, add our magic properties to the original data for access.
- // The Proxy polyfill does not allow properties to be added after creation.
- this.unobservedData.$el = null;
- this.unobservedData.$refs = null;
- this.unobservedData.$nextTick = null;
- this.unobservedData.$watch = null; // The IE build uses a proxy polyfill which doesn't allow properties
- // to be defined after the proxy object is created so,
- // for IE only, we need to define our helpers earlier.
- Object.entries(Alpine.magicProperties).forEach(function (_ref3) {
- _newArrowCheck(this, _this);
- var _ref4 = _slicedToArray(_ref3, 2),
- name = _ref4[0],
- callback = _ref4[1];
- Object.defineProperty(this.unobservedData, "$".concat(name), {
- get: function get() {
- return callback(canonicalComponentElementReference, this.$el);
- }
- });
- }.bind(this));
- /* IE11-ONLY:END */
- // Construct a Proxy-based observable. This will be used to handle reactivity.
- var _this$wrapDataInObser = this.wrapDataInObservable(this.unobservedData),
- membrane = _this$wrapDataInObser.membrane,
- data = _this$wrapDataInObser.data;
- this.$data = data;
- this.membrane = membrane; // After making user-supplied data methods reactive, we can now add
- // our magic properties to the original data for access.
- this.unobservedData.$el = this.$el;
- this.unobservedData.$refs = this.getRefsProxy();
- this.nextTickStack = [];
- this.unobservedData.$nextTick = function (callback) {
- _newArrowCheck(this, _this);
- this.nextTickStack.push(callback);
- }.bind(this);
- this.watchers = {};
- this.unobservedData.$watch = function (property, callback) {
- _newArrowCheck(this, _this);
- if (!this.watchers[property]) this.watchers[property] = [];
- this.watchers[property].push(callback);
- }.bind(this);
- this.showDirectiveStack = [];
- this.showDirectiveLastElement;
- componentForClone || Alpine.onBeforeComponentInitializeds.forEach(function (callback) {
- _newArrowCheck(this, _this);
- return callback(this);
- }.bind(this));
- var initExpression = this.$el.getAttribute('x-init');
- var initReturnedCallback; // If x-init is present AND we aren't cloning (skip x-init on clone)
- if (initExpression && !componentForClone) {
- // We want to allow data manipulation, but not trigger DOM updates just yet.
- // We haven't even initialized the elements with their Alpine bindings. I mean c'mon.
- this.pauseReactivity = true;
- initReturnedCallback = this.evaluateReturnExpression(this.$el, initExpression);
- this.pauseReactivity = false;
- } // Register all our listeners and set all our attribute bindings.
- // If we're cloning a component, the third parameter ensures no duplicate
- // event listeners are registered (the mutation observer will take care of them)
- this.initializeElements(this.$el, function () {
- _newArrowCheck(this, _this);
- }.bind(this), componentForClone); // Use mutation observer to detect new elements being added within this component at run-time.
- // Alpine's just so darn flexible amirite?
- this.listenForNewElementsToInitialize();
- if (typeof initReturnedCallback === 'function') {
- // Run the callback returned from the "x-init" hook to allow the user to do stuff after
- // Alpine's got it's grubby little paws all over everything.
- initReturnedCallback.call(this.$data);
- }
- componentForClone || setTimeout(function () {
- var _this2 = this;
- _newArrowCheck(this, _this);
- Alpine.onComponentInitializeds.forEach(function (callback) {
- _newArrowCheck(this, _this2);
- return callback(this);
- }.bind(this));
- }.bind(this), 0);
- }
- _createClass(Component, [{
- key: "getUnobservedData",
- value: function getUnobservedData() {
- return unwrap(this.membrane, this.$data);
- }
- }, {
- key: "wrapDataInObservable",
- value: function wrapDataInObservable(data) {
- var _this3 = this;
- var self = this;
- var updateDom = debounce(function () {
- self.updateElements(self.$el);
- }, 0);
- return wrap(data, function (target, key) {
- var _this4 = this;
- _newArrowCheck(this, _this3);
- if (self.watchers[key]) {
- // If there's a watcher for this specific key, run it.
- self.watchers[key].forEach(function (callback) {
- _newArrowCheck(this, _this4);
- return callback(target[key]);
- }.bind(this));
- } else if (Array.isArray(target)) {
- // Arrays are special cases, if any of the items change, we consider the array as mutated.
- Object.keys(self.watchers).forEach(function (fullDotNotationKey) {
- var _this5 = this;
- _newArrowCheck(this, _this4);
- var dotNotationParts = fullDotNotationKey.split('.'); // Ignore length mutations since they would result in duplicate calls.
- // For example, when calling push, we would get a mutation for the item's key
- // and a second mutation for the length property.
- if (key === 'length') return;
- dotNotationParts.reduce(function (comparisonData, part) {
- var _this6 = this;
- _newArrowCheck(this, _this5);
- if (Object.is(target, comparisonData[part])) {
- self.watchers[fullDotNotationKey].forEach(function (callback) {
- _newArrowCheck(this, _this6);
- return callback(target);
- }.bind(this));
- }
- return comparisonData[part];
- }.bind(this), self.unobservedData);
- }.bind(this));
- } else {
- // Let's walk through the watchers with "dot-notation" (foo.bar) and see
- // if this mutation fits any of them.
- Object.keys(self.watchers).filter(function (i) {
- _newArrowCheck(this, _this4);
- return i.includes('.');
- }.bind(this)).forEach(function (fullDotNotationKey) {
- var _this7 = this;
- _newArrowCheck(this, _this4);
- var dotNotationParts = fullDotNotationKey.split('.'); // If this dot-notation watcher's last "part" doesn't match the current
- // key, then skip it early for performance reasons.
- if (key !== dotNotationParts[dotNotationParts.length - 1]) return; // Now, walk through the dot-notation "parts" recursively to find
- // a match, and call the watcher if one's found.
- dotNotationParts.reduce(function (comparisonData, part) {
- var _this8 = this;
- _newArrowCheck(this, _this7);
- if (Object.is(target, comparisonData)) {
- // Run the watchers.
- self.watchers[fullDotNotationKey].forEach(function (callback) {
- _newArrowCheck(this, _this8);
- return callback(target[key]);
- }.bind(this));
- }
- return comparisonData[part];
- }.bind(this), self.unobservedData);
- }.bind(this));
- } // Don't react to data changes for cases like the `x-created` hook.
- if (self.pauseReactivity) return;
- updateDom();
- }.bind(this));
- }
- }, {
- key: "walkAndSkipNestedComponents",
- value: function walkAndSkipNestedComponents(el, callback) {
- var _this9 = this;
- var initializeComponentCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
- _newArrowCheck(this, _this9);
- }.bind(this);
- walk(el, function (el) {
- _newArrowCheck(this, _this9);
- // We've hit a component.
- if (el.hasAttribute('x-data')) {
- // If it's not the current one.
- if (!el.isSameNode(this.$el)) {
- // Initialize it if it's not.
- if (!el.__x) initializeComponentCallback(el); // Now we'll let that sub-component deal with itself.
- return false;
- }
- }
- return callback(el);
- }.bind(this));
- }
- }, {
- key: "initializeElements",
- value: function initializeElements(rootEl) {
- var _this10 = this;
- var extraVars = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
- _newArrowCheck(this, _this10);
- }.bind(this);
- var componentForClone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- this.walkAndSkipNestedComponents(rootEl, function (el) {
- _newArrowCheck(this, _this10);
- // Don't touch spawns from for loop
- if (el.__x_for_key !== undefined) return false; // Don't touch spawns from if directives
- if (el.__x_inserted_me !== undefined) return false;
- this.initializeElement(el, extraVars, componentForClone ? false : true);
- }.bind(this), function (el) {
- _newArrowCheck(this, _this10);
- if (!componentForClone) el.__x = new Component(el);
- }.bind(this));
- this.executeAndClearRemainingShowDirectiveStack();
- this.executeAndClearNextTickStack(rootEl);
- }
- }, {
- key: "initializeElement",
- value: function initializeElement(el, extraVars) {
- var shouldRegisterListeners = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
- // To support class attribute merging, we have to know what the element's
- // original class attribute looked like for reference.
- if (el.hasAttribute('class') && getXAttrs(el, this).length > 0) {
- el.__x_original_classes = convertClassStringToArray(el.getAttribute('class'));
- }
- shouldRegisterListeners && this.registerListeners(el, extraVars);
- this.resolveBoundAttributes(el, true, extraVars);
- }
- }, {
- key: "updateElements",
- value: function updateElements(rootEl) {
- var _this11 = this;
- var extraVars = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
- _newArrowCheck(this, _this11);
- }.bind(this);
- this.walkAndSkipNestedComponents(rootEl, function (el) {
- _newArrowCheck(this, _this11);
- // Don't touch spawns from for loop (and check if the root is actually a for loop in a parent, don't skip it.)
- if (el.__x_for_key !== undefined && !el.isSameNode(this.$el)) return false;
- this.updateElement(el, extraVars);
- }.bind(this), function (el) {
- _newArrowCheck(this, _this11);
- el.__x = new Component(el);
- }.bind(this));
- this.executeAndClearRemainingShowDirectiveStack();
- this.executeAndClearNextTickStack(rootEl);
- }
- }, {
- key: "executeAndClearNextTickStack",
- value: function executeAndClearNextTickStack(el) {
- var _this12 = this;
- // Skip spawns from alpine directives
- if (el === this.$el && this.nextTickStack.length > 0) {
- // We run the tick stack after the next frame to allow any
- // running transitions to pass the initial show stage.
- requestAnimationFrame(function () {
- _newArrowCheck(this, _this12);
- while (this.nextTickStack.length > 0) {
- this.nextTickStack.shift()();
- }
- }.bind(this));
- }
- }
- }, {
- key: "executeAndClearRemainingShowDirectiveStack",
- value: function executeAndClearRemainingShowDirectiveStack() {
- var _this13 = this;
- // The goal here is to start all the x-show transitions
- // and build a nested promise chain so that elements
- // only hide when the children are finished hiding.
- this.showDirectiveStack.reverse().map(function (handler) {
- var _this14 = this;
- _newArrowCheck(this, _this13);
- return new Promise(function (resolve, reject) {
- _newArrowCheck(this, _this14);
- handler(resolve, reject);
- }.bind(this));
- }.bind(this)).reduce(function (promiseChain, promise) {
- var _this15 = this;
- _newArrowCheck(this, _this13);
- return promiseChain.then(function () {
- var _this16 = this;
- _newArrowCheck(this, _this15);
- return promise.then(function (finishElement) {
- _newArrowCheck(this, _this16);
- finishElement();
- }.bind(this));
- }.bind(this));
- }.bind(this), Promise.resolve(function () {
- _newArrowCheck(this, _this13);
- }.bind(this)))["catch"](function (e) {
- _newArrowCheck(this, _this13);
- if (e !== TRANSITION_CANCELLED) throw e;
- }.bind(this)); // We've processed the handler stack. let's clear it.
- this.showDirectiveStack = [];
- this.showDirectiveLastElement = undefined;
- }
- }, {
- key: "updateElement",
- value: function updateElement(el, extraVars) {
- this.resolveBoundAttributes(el, false, extraVars);
- }
- }, {
- key: "registerListeners",
- value: function registerListeners(el, extraVars) {
- var _this17 = this;
- getXAttrs(el, this).forEach(function (_ref5) {
- _newArrowCheck(this, _this17);
- var type = _ref5.type,
- value = _ref5.value,
- modifiers = _ref5.modifiers,
- expression = _ref5.expression;
- switch (type) {
- case 'on':
- registerListener(this, el, value, modifiers, expression, extraVars);
- break;
- case 'model':
- registerModelListener(this, el, modifiers, expression, extraVars);
- break;
- }
- }.bind(this));
- }
- }, {
- key: "resolveBoundAttributes",
- value: function resolveBoundAttributes(el) {
- var _this18 = this;
- var initialUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var extraVars = arguments.length > 2 ? arguments[2] : undefined;
- var attrs = getXAttrs(el, this);
- attrs.forEach(function (_ref6) {
- var _this19 = this;
- _newArrowCheck(this, _this18);
- var type = _ref6.type,
- value = _ref6.value,
- modifiers = _ref6.modifiers,
- expression = _ref6.expression;
- switch (type) {
- case 'model':
- handleAttributeBindingDirective(this, el, 'value', expression, extraVars, type, modifiers);
- break;
- case 'bind':
- // The :key binding on an x-for is special, ignore it.
- if (el.tagName.toLowerCase() === 'template' && value === 'key') return;
- handleAttributeBindingDirective(this, el, value, expression, extraVars, type, modifiers);
- break;
- case 'text':
- var output = this.evaluateReturnExpression(el, expression, extraVars);
- handleTextDirective(el, output, expression);
- break;
- case 'html':
- handleHtmlDirective(this, el, expression, extraVars);
- break;
- case 'show':
- var output = this.evaluateReturnExpression(el, expression, extraVars);
- handleShowDirective(this, el, output, modifiers, initialUpdate);
- break;
- case 'if':
- // If this element also has x-for on it, don't process x-if.
- // We will let the "x-for" directive handle the "if"ing.
- if (attrs.some(function (i) {
- _newArrowCheck(this, _this19);
- return i.type === 'for';
- }.bind(this))) return;
- var output = this.evaluateReturnExpression(el, expression, extraVars);
- handleIfDirective(this, el, output, initialUpdate, extraVars);
- break;
- case 'for':
- handleForDirective(this, el, expression, initialUpdate, extraVars);
- break;
- case 'cloak':
- el.removeAttribute('x-cloak');
- break;
- }
- }.bind(this));
- }
- }, {
- key: "evaluateReturnExpression",
- value: function evaluateReturnExpression(el, expression) {
- var _this20 = this;
- var extraVars = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
- _newArrowCheck(this, _this20);
- }.bind(this);
- return saferEval(el, expression, this.$data, _objectSpread2(_objectSpread2({}, extraVars()), {}, {
- $dispatch: this.getDispatchFunction(el)
- }));
- }
- }, {
- key: "evaluateCommandExpression",
- value: function evaluateCommandExpression(el, expression) {
- var _this21 = this;
- var extraVars = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
- _newArrowCheck(this, _this21);
- }.bind(this);
- return saferEvalNoReturn(el, expression, this.$data, _objectSpread2(_objectSpread2({}, extraVars()), {}, {
- $dispatch: this.getDispatchFunction(el)
- }));
- }
- }, {
- key: "getDispatchFunction",
- value: function getDispatchFunction(el) {
- return function (event) {
- var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- el.dispatchEvent(new CustomEvent(event, {
- detail: detail,
- bubbles: true
- }));
- };
- }
- }, {
- key: "listenForNewElementsToInitialize",
- value: function listenForNewElementsToInitialize() {
- var _this22 = this;
- var targetNode = this.$el;
- var observerOptions = {
- childList: true,
- attributes: true,
- subtree: true
- };
- var observer = new MutationObserver(function (mutations) {
- var _this23 = this;
- _newArrowCheck(this, _this22);
- for (var i = 0; i < mutations.length; i++) {
- // Filter out mutations triggered from child components.
- var closestParentComponent = mutations[i].target.closest('[x-data]');
- if (!(closestParentComponent && closestParentComponent.isSameNode(this.$el))) continue;
- if (mutations[i].type === 'attributes' && mutations[i].attributeName === 'x-data') {
- (function () {
- var _this24 = this;
- var xAttr = mutations[i].target.getAttribute('x-data') || '{}';
- var rawData = saferEval(_this23.$el, xAttr, {
- $el: _this23.$el
- });
- Object.keys(rawData).forEach(function (key) {
- _newArrowCheck(this, _this24);
- if (_this23.$data[key] !== rawData[key]) {
- _this23.$data[key] = rawData[key];
- }
- }.bind(this));
- })();
- }
- if (mutations[i].addedNodes.length > 0) {
- mutations[i].addedNodes.forEach(function (node) {
- _newArrowCheck(this, _this23);
- if (node.nodeType !== 1 || node.__x_inserted_me) return;
- if (node.matches('[x-data]') && !node.__x) {
- node.__x = new Component(node);
- return;
- }
- node.__x_node_add_count = (node.__x_node_add_count || 0) + 1;
- this.initializeElements(node);
- }.bind(this));
- }
- }
- }.bind(this));
- observer.observe(targetNode, observerOptions);
- }
- }, {
- key: "getRefsProxy",
- value: function getRefsProxy() {
- var _this25 = this;
- var self = this;
- var refObj = {};
- /* IE11-ONLY:START */
- // Add any properties up-front that might be necessary for the Proxy polyfill.
- refObj.$isRefsProxy = false;
- refObj.$isAlpineProxy = false; // If we are in IE, since the polyfill needs all properties to be defined before building the proxy,
- // we just loop on the element, look for any x-ref and create a tmp property on a fake object.
- this.walkAndSkipNestedComponents(self.$el, function (el) {
- _newArrowCheck(this, _this25);
- if (el.hasAttribute('x-ref')) {
- refObj[el.getAttribute('x-ref')] = true;
- }
- }.bind(this));
- /* IE11-ONLY:END */
- // One of the goals of this is to not hold elements in memory, but rather re-evaluate
- // the DOM when the system needs something from it. This way, the framework is flexible and
- // friendly to outside DOM changes from libraries like Vue/Livewire.
- // For this reason, I'm using an "on-demand" proxy to fake a "$refs" object.
- return new Proxy(refObj, {
- get: function get(object, property) {
- var _this26 = this;
- if (property === '$isAlpineProxy') return true;
- var ref; // We can't just query the DOM because it's hard to filter out refs in
- // nested components.
- self.walkAndSkipNestedComponents(self.$el, function (el) {
- _newArrowCheck(this, _this26);
- if (el.hasAttribute('x-ref') && el.getAttribute('x-ref') === property) {
- ref = el;
- }
- }.bind(this));
- return ref;
- }
- });
- }
- }]);
- return Component;
- }();
- var Alpine = {
- version: "2.8.2",
- pauseMutationObserver: false,
- magicProperties: {},
- onComponentInitializeds: [],
- onBeforeComponentInitializeds: [],
- ignoreFocusedForValueBinding: false,
- start: function () {
- var _start = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
- var _this = this;
- return regeneratorRuntime.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (isTesting()) {
- _context.next = 3;
- break;
- }
- _context.next = 3;
- return domReady();
- case 3:
- this.discoverComponents(function (el) {
- _newArrowCheck(this, _this);
- this.initializeComponent(el);
- }.bind(this)); // It's easier and more performant to just support Turbolinks than listen
- // to MutationObserver mutations at the document level.
- document.addEventListener("turbolinks:load", function () {
- var _this2 = this;
- _newArrowCheck(this, _this);
- this.discoverUninitializedComponents(function (el) {
- _newArrowCheck(this, _this2);
- this.initializeComponent(el);
- }.bind(this));
- }.bind(this));
- this.listenForNewUninitializedComponentsAtRunTime();
- case 6:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function start() {
- return _start.apply(this, arguments);
- }
- return start;
- }(),
- discoverComponents: function discoverComponents(callback) {
- var _this3 = this;
- var rootEls = document.querySelectorAll('[x-data]');
- rootEls.forEach(function (rootEl) {
- _newArrowCheck(this, _this3);
- callback(rootEl);
- }.bind(this));
- },
- discoverUninitializedComponents: function discoverUninitializedComponents(callback) {
- var _this4 = this;
- var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
- var rootEls = (el || document).querySelectorAll('[x-data]');
- Array.from(rootEls).filter(function (el) {
- _newArrowCheck(this, _this4);
- return el.__x === undefined;
- }.bind(this)).forEach(function (rootEl) {
- _newArrowCheck(this, _this4);
- callback(rootEl);
- }.bind(this));
- },
- listenForNewUninitializedComponentsAtRunTime: function listenForNewUninitializedComponentsAtRunTime() {
- var _this5 = this;
- var targetNode = document.querySelector('body');
- var observerOptions = {
- childList: true,
- attributes: true,
- subtree: true
- };
- var observer = new MutationObserver(function (mutations) {
- var _this6 = this;
- _newArrowCheck(this, _this5);
- if (this.pauseMutationObserver) return;
- for (var i = 0; i < mutations.length; i++) {
- if (mutations[i].addedNodes.length > 0) {
- mutations[i].addedNodes.forEach(function (node) {
- var _this7 = this;
- _newArrowCheck(this, _this6);
- // Discard non-element nodes (like line-breaks)
- if (node.nodeType !== 1) return; // Discard any changes happening within an existing component.
- // They will take care of themselves.
- if (node.parentElement && node.parentElement.closest('[x-data]')) return;
- this.discoverUninitializedComponents(function (el) {
- _newArrowCheck(this, _this7);
- this.initializeComponent(el);
- }.bind(this), node.parentElement);
- }.bind(this));
- }
- }
- }.bind(this));
- observer.observe(targetNode, observerOptions);
- },
- initializeComponent: function initializeComponent(el) {
- var _this8 = this;
- if (!el.__x) {
- // Wrap in a try/catch so that we don't prevent other components
- // from initializing when one component contains an error.
- try {
- el.__x = new Component(el);
- } catch (error) {
- setTimeout(function () {
- _newArrowCheck(this, _this8);
- throw error;
- }.bind(this), 0);
- }
- }
- },
- clone: function clone(component, newEl) {
- if (!newEl.__x) {
- newEl.__x = new Component(newEl, component);
- }
- },
- addMagicProperty: function addMagicProperty(name, callback) {
- this.magicProperties[name] = callback;
- },
- onComponentInitialized: function onComponentInitialized(callback) {
- this.onComponentInitializeds.push(callback);
- },
- onBeforeComponentInitialized: function onBeforeComponentInitialized(callback) {
- this.onBeforeComponentInitializeds.push(callback);
- }
- };
- if (!isTesting()) {
- window.Alpine = Alpine;
- if (window.deferLoadingAlpine) {
- window.deferLoadingAlpine(function () {
- window.Alpine.start();
- });
- } else {
- window.Alpine.start();
- }
- }
- })));
|