You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bootstrap.bundle.js 212KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822
  1. /*!
  2. * Bootstrap v4.2.1 (https://getbootstrap.com/)
  3. * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
  8. typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
  9. (factory((global.bootstrap = {}),global.jQuery));
  10. }(this, (function (exports,$) { 'use strict';
  11. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  12. function _defineProperties(target, props) {
  13. for (var i = 0; i < props.length; i++) {
  14. var descriptor = props[i];
  15. descriptor.enumerable = descriptor.enumerable || false;
  16. descriptor.configurable = true;
  17. if ("value" in descriptor) descriptor.writable = true;
  18. Object.defineProperty(target, descriptor.key, descriptor);
  19. }
  20. }
  21. function _createClass(Constructor, protoProps, staticProps) {
  22. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  23. if (staticProps) _defineProperties(Constructor, staticProps);
  24. return Constructor;
  25. }
  26. function _defineProperty(obj, key, value) {
  27. if (key in obj) {
  28. Object.defineProperty(obj, key, {
  29. value: value,
  30. enumerable: true,
  31. configurable: true,
  32. writable: true
  33. });
  34. } else {
  35. obj[key] = value;
  36. }
  37. return obj;
  38. }
  39. function _objectSpread(target) {
  40. for (var i = 1; i < arguments.length; i++) {
  41. var source = arguments[i] != null ? arguments[i] : {};
  42. var ownKeys = Object.keys(source);
  43. if (typeof Object.getOwnPropertySymbols === 'function') {
  44. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  45. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  46. }));
  47. }
  48. ownKeys.forEach(function (key) {
  49. _defineProperty(target, key, source[key]);
  50. });
  51. }
  52. return target;
  53. }
  54. function _inheritsLoose(subClass, superClass) {
  55. subClass.prototype = Object.create(superClass.prototype);
  56. subClass.prototype.constructor = subClass;
  57. subClass.__proto__ = superClass;
  58. }
  59. /**
  60. * --------------------------------------------------------------------------
  61. * Bootstrap (v4.2.1): util.js
  62. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  63. * --------------------------------------------------------------------------
  64. */
  65. /**
  66. * ------------------------------------------------------------------------
  67. * Private TransitionEnd Helpers
  68. * ------------------------------------------------------------------------
  69. */
  70. var TRANSITION_END = 'transitionend';
  71. var MAX_UID = 1000000;
  72. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  73. function toType(obj) {
  74. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  75. }
  76. function getSpecialTransitionEndEvent() {
  77. return {
  78. bindType: TRANSITION_END,
  79. delegateType: TRANSITION_END,
  80. handle: function handle(event) {
  81. if ($(event.target).is(this)) {
  82. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  83. }
  84. return undefined; // eslint-disable-line no-undefined
  85. }
  86. };
  87. }
  88. function transitionEndEmulator(duration) {
  89. var _this = this;
  90. var called = false;
  91. $(this).one(Util.TRANSITION_END, function () {
  92. called = true;
  93. });
  94. setTimeout(function () {
  95. if (!called) {
  96. Util.triggerTransitionEnd(_this);
  97. }
  98. }, duration);
  99. return this;
  100. }
  101. function setTransitionEndSupport() {
  102. $.fn.emulateTransitionEnd = transitionEndEmulator;
  103. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  104. }
  105. /**
  106. * --------------------------------------------------------------------------
  107. * Public Util Api
  108. * --------------------------------------------------------------------------
  109. */
  110. var Util = {
  111. TRANSITION_END: 'bsTransitionEnd',
  112. getUID: function getUID(prefix) {
  113. do {
  114. // eslint-disable-next-line no-bitwise
  115. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  116. } while (document.getElementById(prefix));
  117. return prefix;
  118. },
  119. getSelectorFromElement: function getSelectorFromElement(element) {
  120. var selector = element.getAttribute('data-target');
  121. if (!selector || selector === '#') {
  122. var hrefAttr = element.getAttribute('href');
  123. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  124. }
  125. try {
  126. return document.querySelector(selector) ? selector : null
  127. } catch (err) {
  128. return null
  129. }
  130. },
  131. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  132. if (!element) {
  133. return 0;
  134. } // Get transition-duration of the element
  135. var transitionDuration = $(element).css('transition-duration');
  136. var transitionDelay = $(element).css('transition-delay');
  137. var floatTransitionDuration = parseFloat(transitionDuration);
  138. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  139. if (!floatTransitionDuration && !floatTransitionDelay) {
  140. return 0;
  141. } // If multiple durations are defined, take the first
  142. transitionDuration = transitionDuration.split(',')[0];
  143. transitionDelay = transitionDelay.split(',')[0];
  144. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  145. },
  146. reflow: function reflow(element) {
  147. return element.offsetHeight;
  148. },
  149. triggerTransitionEnd: function triggerTransitionEnd(element) {
  150. $(element).trigger(TRANSITION_END);
  151. },
  152. // TODO: Remove in v5
  153. supportsTransitionEnd: function supportsTransitionEnd() {
  154. return Boolean(TRANSITION_END);
  155. },
  156. isElement: function isElement(obj) {
  157. return (obj[0] || obj).nodeType;
  158. },
  159. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  160. for (var property in configTypes) {
  161. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  162. var expectedTypes = configTypes[property];
  163. var value = config[property];
  164. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  165. if (!new RegExp(expectedTypes).test(valueType)) {
  166. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  167. }
  168. }
  169. }
  170. },
  171. findShadowRoot: function findShadowRoot(element) {
  172. if (!document.documentElement.attachShadow) {
  173. return null;
  174. } // Can find the shadow root otherwise it'll return the document
  175. if (typeof element.getRootNode === 'function') {
  176. var root = element.getRootNode();
  177. return root instanceof ShadowRoot ? root : null;
  178. }
  179. if (element instanceof ShadowRoot) {
  180. return element;
  181. } // when we don't find a shadow root
  182. if (!element.parentNode) {
  183. return null;
  184. }
  185. return Util.findShadowRoot(element.parentNode);
  186. }
  187. };
  188. setTransitionEndSupport();
  189. /**
  190. * ------------------------------------------------------------------------
  191. * Constants
  192. * ------------------------------------------------------------------------
  193. */
  194. var NAME = 'alert';
  195. var VERSION = '4.2.1';
  196. var DATA_KEY = 'bs.alert';
  197. var EVENT_KEY = "." + DATA_KEY;
  198. var DATA_API_KEY = '.data-api';
  199. var JQUERY_NO_CONFLICT = $.fn[NAME];
  200. var Selector = {
  201. DISMISS: '[data-dismiss="alert"]'
  202. };
  203. var Event = {
  204. CLOSE: "close" + EVENT_KEY,
  205. CLOSED: "closed" + EVENT_KEY,
  206. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  207. };
  208. var ClassName = {
  209. ALERT: 'alert',
  210. FADE: 'fade',
  211. SHOW: 'show'
  212. /**
  213. * ------------------------------------------------------------------------
  214. * Class Definition
  215. * ------------------------------------------------------------------------
  216. */
  217. };
  218. var Alert =
  219. /*#__PURE__*/
  220. function () {
  221. function Alert(element) {
  222. this._element = element;
  223. } // Getters
  224. var _proto = Alert.prototype;
  225. // Public
  226. _proto.close = function close(element) {
  227. var rootElement = this._element;
  228. if (element) {
  229. rootElement = this._getRootElement(element);
  230. }
  231. var customEvent = this._triggerCloseEvent(rootElement);
  232. if (customEvent.isDefaultPrevented()) {
  233. return;
  234. }
  235. this._removeElement(rootElement);
  236. };
  237. _proto.dispose = function dispose() {
  238. $.removeData(this._element, DATA_KEY);
  239. this._element = null;
  240. }; // Private
  241. _proto._getRootElement = function _getRootElement(element) {
  242. var selector = Util.getSelectorFromElement(element);
  243. var parent = false;
  244. if (selector) {
  245. parent = document.querySelector(selector);
  246. }
  247. if (!parent) {
  248. parent = $(element).closest("." + ClassName.ALERT)[0];
  249. }
  250. return parent;
  251. };
  252. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  253. var closeEvent = $.Event(Event.CLOSE);
  254. $(element).trigger(closeEvent);
  255. return closeEvent;
  256. };
  257. _proto._removeElement = function _removeElement(element) {
  258. var _this = this;
  259. $(element).removeClass(ClassName.SHOW);
  260. if (!$(element).hasClass(ClassName.FADE)) {
  261. this._destroyElement(element);
  262. return;
  263. }
  264. var transitionDuration = Util.getTransitionDurationFromElement(element);
  265. $(element).one(Util.TRANSITION_END, function (event) {
  266. return _this._destroyElement(element, event);
  267. }).emulateTransitionEnd(transitionDuration);
  268. };
  269. _proto._destroyElement = function _destroyElement(element) {
  270. $(element).detach().trigger(Event.CLOSED).remove();
  271. }; // Static
  272. Alert._jQueryInterface = function _jQueryInterface(config) {
  273. return this.each(function () {
  274. var $element = $(this);
  275. var data = $element.data(DATA_KEY);
  276. if (!data) {
  277. data = new Alert(this);
  278. $element.data(DATA_KEY, data);
  279. }
  280. if (config === 'close') {
  281. data[config](this);
  282. }
  283. });
  284. };
  285. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  286. return function (event) {
  287. if (event) {
  288. event.preventDefault();
  289. }
  290. alertInstance.close(this);
  291. };
  292. };
  293. _createClass(Alert, null, [{
  294. key: "VERSION",
  295. get: function get() {
  296. return VERSION;
  297. }
  298. }]);
  299. return Alert;
  300. }();
  301. /**
  302. * ------------------------------------------------------------------------
  303. * Data Api implementation
  304. * ------------------------------------------------------------------------
  305. */
  306. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  307. /**
  308. * ------------------------------------------------------------------------
  309. * jQuery
  310. * ------------------------------------------------------------------------
  311. */
  312. $.fn[NAME] = Alert._jQueryInterface;
  313. $.fn[NAME].Constructor = Alert;
  314. $.fn[NAME].noConflict = function () {
  315. $.fn[NAME] = JQUERY_NO_CONFLICT;
  316. return Alert._jQueryInterface;
  317. };
  318. /**
  319. * ------------------------------------------------------------------------
  320. * Constants
  321. * ------------------------------------------------------------------------
  322. */
  323. var NAME$1 = 'button';
  324. var VERSION$1 = '4.2.1';
  325. var DATA_KEY$1 = 'bs.button';
  326. var EVENT_KEY$1 = "." + DATA_KEY$1;
  327. var DATA_API_KEY$1 = '.data-api';
  328. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  329. var ClassName$1 = {
  330. ACTIVE: 'active',
  331. BUTTON: 'btn',
  332. FOCUS: 'focus'
  333. };
  334. var Selector$1 = {
  335. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  336. DATA_TOGGLE: '[data-toggle="buttons"]',
  337. INPUT: 'input:not([type="hidden"])',
  338. ACTIVE: '.active',
  339. BUTTON: '.btn'
  340. };
  341. var Event$1 = {
  342. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  343. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1)
  344. /**
  345. * ------------------------------------------------------------------------
  346. * Class Definition
  347. * ------------------------------------------------------------------------
  348. */
  349. };
  350. var Button =
  351. /*#__PURE__*/
  352. function () {
  353. function Button(element) {
  354. this._element = element;
  355. } // Getters
  356. var _proto = Button.prototype;
  357. // Public
  358. _proto.toggle = function toggle() {
  359. var triggerChangeEvent = true;
  360. var addAriaPressed = true;
  361. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0];
  362. if (rootElement) {
  363. var input = this._element.querySelector(Selector$1.INPUT);
  364. if (input) {
  365. if (input.type === 'radio') {
  366. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  367. triggerChangeEvent = false;
  368. } else {
  369. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  370. if (activeElement) {
  371. $(activeElement).removeClass(ClassName$1.ACTIVE);
  372. }
  373. }
  374. }
  375. if (triggerChangeEvent) {
  376. if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
  377. return;
  378. }
  379. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  380. $(input).trigger('change');
  381. }
  382. input.focus();
  383. addAriaPressed = false;
  384. }
  385. }
  386. if (addAriaPressed) {
  387. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  388. }
  389. if (triggerChangeEvent) {
  390. $(this._element).toggleClass(ClassName$1.ACTIVE);
  391. }
  392. };
  393. _proto.dispose = function dispose() {
  394. $.removeData(this._element, DATA_KEY$1);
  395. this._element = null;
  396. }; // Static
  397. Button._jQueryInterface = function _jQueryInterface(config) {
  398. return this.each(function () {
  399. var data = $(this).data(DATA_KEY$1);
  400. if (!data) {
  401. data = new Button(this);
  402. $(this).data(DATA_KEY$1, data);
  403. }
  404. if (config === 'toggle') {
  405. data[config]();
  406. }
  407. });
  408. };
  409. _createClass(Button, null, [{
  410. key: "VERSION",
  411. get: function get() {
  412. return VERSION$1;
  413. }
  414. }]);
  415. return Button;
  416. }();
  417. /**
  418. * ------------------------------------------------------------------------
  419. * Data Api implementation
  420. * ------------------------------------------------------------------------
  421. */
  422. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  423. event.preventDefault();
  424. var button = event.target;
  425. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  426. button = $(button).closest(Selector$1.BUTTON);
  427. }
  428. Button._jQueryInterface.call($(button), 'toggle');
  429. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  430. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  431. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  432. });
  433. /**
  434. * ------------------------------------------------------------------------
  435. * jQuery
  436. * ------------------------------------------------------------------------
  437. */
  438. $.fn[NAME$1] = Button._jQueryInterface;
  439. $.fn[NAME$1].Constructor = Button;
  440. $.fn[NAME$1].noConflict = function () {
  441. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  442. return Button._jQueryInterface;
  443. };
  444. /**
  445. * ------------------------------------------------------------------------
  446. * Constants
  447. * ------------------------------------------------------------------------
  448. */
  449. var NAME$2 = 'carousel';
  450. var VERSION$2 = '4.2.1';
  451. var DATA_KEY$2 = 'bs.carousel';
  452. var EVENT_KEY$2 = "." + DATA_KEY$2;
  453. var DATA_API_KEY$2 = '.data-api';
  454. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  455. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  456. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  457. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  458. var SWIPE_THRESHOLD = 40;
  459. var Default = {
  460. interval: 5000,
  461. keyboard: true,
  462. slide: false,
  463. pause: 'hover',
  464. wrap: true,
  465. touch: true
  466. };
  467. var DefaultType = {
  468. interval: '(number|boolean)',
  469. keyboard: 'boolean',
  470. slide: '(boolean|string)',
  471. pause: '(string|boolean)',
  472. wrap: 'boolean',
  473. touch: 'boolean'
  474. };
  475. var Direction = {
  476. NEXT: 'next',
  477. PREV: 'prev',
  478. LEFT: 'left',
  479. RIGHT: 'right'
  480. };
  481. var Event$2 = {
  482. SLIDE: "slide" + EVENT_KEY$2,
  483. SLID: "slid" + EVENT_KEY$2,
  484. KEYDOWN: "keydown" + EVENT_KEY$2,
  485. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  486. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  487. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  488. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  489. TOUCHEND: "touchend" + EVENT_KEY$2,
  490. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  491. POINTERUP: "pointerup" + EVENT_KEY$2,
  492. DRAG_START: "dragstart" + EVENT_KEY$2,
  493. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  494. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  495. };
  496. var ClassName$2 = {
  497. CAROUSEL: 'carousel',
  498. ACTIVE: 'active',
  499. SLIDE: 'slide',
  500. RIGHT: 'carousel-item-right',
  501. LEFT: 'carousel-item-left',
  502. NEXT: 'carousel-item-next',
  503. PREV: 'carousel-item-prev',
  504. ITEM: 'carousel-item',
  505. POINTER_EVENT: 'pointer-event'
  506. };
  507. var Selector$2 = {
  508. ACTIVE: '.active',
  509. ACTIVE_ITEM: '.active.carousel-item',
  510. ITEM: '.carousel-item',
  511. ITEM_IMG: '.carousel-item img',
  512. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  513. INDICATORS: '.carousel-indicators',
  514. DATA_SLIDE: '[data-slide], [data-slide-to]',
  515. DATA_RIDE: '[data-ride="carousel"]'
  516. };
  517. var PointerType = {
  518. TOUCH: 'touch',
  519. PEN: 'pen'
  520. /**
  521. * ------------------------------------------------------------------------
  522. * Class Definition
  523. * ------------------------------------------------------------------------
  524. */
  525. };
  526. var Carousel =
  527. /*#__PURE__*/
  528. function () {
  529. function Carousel(element, config) {
  530. this._items = null;
  531. this._interval = null;
  532. this._activeElement = null;
  533. this._isPaused = false;
  534. this._isSliding = false;
  535. this.touchTimeout = null;
  536. this.touchStartX = 0;
  537. this.touchDeltaX = 0;
  538. this._config = this._getConfig(config);
  539. this._element = element;
  540. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  541. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  542. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  543. this._addEventListeners();
  544. } // Getters
  545. var _proto = Carousel.prototype;
  546. // Public
  547. _proto.next = function next() {
  548. if (!this._isSliding) {
  549. this._slide(Direction.NEXT);
  550. }
  551. };
  552. _proto.nextWhenVisible = function nextWhenVisible() {
  553. // Don't call next when the page isn't visible
  554. // or the carousel or its parent isn't visible
  555. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  556. this.next();
  557. }
  558. };
  559. _proto.prev = function prev() {
  560. if (!this._isSliding) {
  561. this._slide(Direction.PREV);
  562. }
  563. };
  564. _proto.pause = function pause(event) {
  565. if (!event) {
  566. this._isPaused = true;
  567. }
  568. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  569. Util.triggerTransitionEnd(this._element);
  570. this.cycle(true);
  571. }
  572. clearInterval(this._interval);
  573. this._interval = null;
  574. };
  575. _proto.cycle = function cycle(event) {
  576. if (!event) {
  577. this._isPaused = false;
  578. }
  579. if (this._interval) {
  580. clearInterval(this._interval);
  581. this._interval = null;
  582. }
  583. if (this._config.interval && !this._isPaused) {
  584. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  585. }
  586. };
  587. _proto.to = function to(index) {
  588. var _this = this;
  589. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  590. var activeIndex = this._getItemIndex(this._activeElement);
  591. if (index > this._items.length - 1 || index < 0) {
  592. return;
  593. }
  594. if (this._isSliding) {
  595. $(this._element).one(Event$2.SLID, function () {
  596. return _this.to(index);
  597. });
  598. return;
  599. }
  600. if (activeIndex === index) {
  601. this.pause();
  602. this.cycle();
  603. return;
  604. }
  605. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  606. this._slide(direction, this._items[index]);
  607. };
  608. _proto.dispose = function dispose() {
  609. $(this._element).off(EVENT_KEY$2);
  610. $.removeData(this._element, DATA_KEY$2);
  611. this._items = null;
  612. this._config = null;
  613. this._element = null;
  614. this._interval = null;
  615. this._isPaused = null;
  616. this._isSliding = null;
  617. this._activeElement = null;
  618. this._indicatorsElement = null;
  619. }; // Private
  620. _proto._getConfig = function _getConfig(config) {
  621. config = _objectSpread({}, Default, config);
  622. Util.typeCheckConfig(NAME$2, config, DefaultType);
  623. return config;
  624. };
  625. _proto._handleSwipe = function _handleSwipe() {
  626. var absDeltax = Math.abs(this.touchDeltaX);
  627. if (absDeltax <= SWIPE_THRESHOLD) {
  628. return;
  629. }
  630. var direction = absDeltax / this.touchDeltaX; // swipe left
  631. if (direction > 0) {
  632. this.prev();
  633. } // swipe right
  634. if (direction < 0) {
  635. this.next();
  636. }
  637. };
  638. _proto._addEventListeners = function _addEventListeners() {
  639. var _this2 = this;
  640. if (this._config.keyboard) {
  641. $(this._element).on(Event$2.KEYDOWN, function (event) {
  642. return _this2._keydown(event);
  643. });
  644. }
  645. if (this._config.pause === 'hover') {
  646. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  647. return _this2.pause(event);
  648. }).on(Event$2.MOUSELEAVE, function (event) {
  649. return _this2.cycle(event);
  650. });
  651. }
  652. this._addTouchEventListeners();
  653. };
  654. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  655. var _this3 = this;
  656. if (!this._touchSupported) {
  657. return;
  658. }
  659. var start = function start(event) {
  660. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  661. _this3.touchStartX = event.originalEvent.clientX;
  662. } else if (!_this3._pointerEvent) {
  663. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  664. }
  665. };
  666. var move = function move(event) {
  667. // ensure swiping with one touch and not pinching
  668. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  669. _this3.touchDeltaX = 0;
  670. } else {
  671. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  672. }
  673. };
  674. var end = function end(event) {
  675. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  676. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  677. }
  678. _this3._handleSwipe();
  679. if (_this3._config.pause === 'hover') {
  680. // If it's a touch-enabled device, mouseenter/leave are fired as
  681. // part of the mouse compatibility events on first tap - the carousel
  682. // would stop cycling until user tapped out of it;
  683. // here, we listen for touchend, explicitly pause the carousel
  684. // (as if it's the second time we tap on it, mouseenter compat event
  685. // is NOT fired) and after a timeout (to allow for mouse compatibility
  686. // events to fire) we explicitly restart cycling
  687. _this3.pause();
  688. if (_this3.touchTimeout) {
  689. clearTimeout(_this3.touchTimeout);
  690. }
  691. _this3.touchTimeout = setTimeout(function (event) {
  692. return _this3.cycle(event);
  693. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  694. }
  695. };
  696. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  697. return e.preventDefault();
  698. });
  699. if (this._pointerEvent) {
  700. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  701. return start(event);
  702. });
  703. $(this._element).on(Event$2.POINTERUP, function (event) {
  704. return end(event);
  705. });
  706. this._element.classList.add(ClassName$2.POINTER_EVENT);
  707. } else {
  708. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  709. return start(event);
  710. });
  711. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  712. return move(event);
  713. });
  714. $(this._element).on(Event$2.TOUCHEND, function (event) {
  715. return end(event);
  716. });
  717. }
  718. };
  719. _proto._keydown = function _keydown(event) {
  720. if (/input|textarea/i.test(event.target.tagName)) {
  721. return;
  722. }
  723. switch (event.which) {
  724. case ARROW_LEFT_KEYCODE:
  725. event.preventDefault();
  726. this.prev();
  727. break;
  728. case ARROW_RIGHT_KEYCODE:
  729. event.preventDefault();
  730. this.next();
  731. break;
  732. default:
  733. }
  734. };
  735. _proto._getItemIndex = function _getItemIndex(element) {
  736. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  737. return this._items.indexOf(element);
  738. };
  739. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  740. var isNextDirection = direction === Direction.NEXT;
  741. var isPrevDirection = direction === Direction.PREV;
  742. var activeIndex = this._getItemIndex(activeElement);
  743. var lastItemIndex = this._items.length - 1;
  744. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  745. if (isGoingToWrap && !this._config.wrap) {
  746. return activeElement;
  747. }
  748. var delta = direction === Direction.PREV ? -1 : 1;
  749. var itemIndex = (activeIndex + delta) % this._items.length;
  750. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  751. };
  752. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  753. var targetIndex = this._getItemIndex(relatedTarget);
  754. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  755. var slideEvent = $.Event(Event$2.SLIDE, {
  756. relatedTarget: relatedTarget,
  757. direction: eventDirectionName,
  758. from: fromIndex,
  759. to: targetIndex
  760. });
  761. $(this._element).trigger(slideEvent);
  762. return slideEvent;
  763. };
  764. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  765. if (this._indicatorsElement) {
  766. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  767. $(indicators).removeClass(ClassName$2.ACTIVE);
  768. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  769. if (nextIndicator) {
  770. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  771. }
  772. }
  773. };
  774. _proto._slide = function _slide(direction, element) {
  775. var _this4 = this;
  776. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  777. var activeElementIndex = this._getItemIndex(activeElement);
  778. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  779. var nextElementIndex = this._getItemIndex(nextElement);
  780. var isCycling = Boolean(this._interval);
  781. var directionalClassName;
  782. var orderClassName;
  783. var eventDirectionName;
  784. if (direction === Direction.NEXT) {
  785. directionalClassName = ClassName$2.LEFT;
  786. orderClassName = ClassName$2.NEXT;
  787. eventDirectionName = Direction.LEFT;
  788. } else {
  789. directionalClassName = ClassName$2.RIGHT;
  790. orderClassName = ClassName$2.PREV;
  791. eventDirectionName = Direction.RIGHT;
  792. }
  793. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  794. this._isSliding = false;
  795. return;
  796. }
  797. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  798. if (slideEvent.isDefaultPrevented()) {
  799. return;
  800. }
  801. if (!activeElement || !nextElement) {
  802. // Some weirdness is happening, so we bail
  803. return;
  804. }
  805. this._isSliding = true;
  806. if (isCycling) {
  807. this.pause();
  808. }
  809. this._setActiveIndicatorElement(nextElement);
  810. var slidEvent = $.Event(Event$2.SLID, {
  811. relatedTarget: nextElement,
  812. direction: eventDirectionName,
  813. from: activeElementIndex,
  814. to: nextElementIndex
  815. });
  816. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  817. $(nextElement).addClass(orderClassName);
  818. Util.reflow(nextElement);
  819. $(activeElement).addClass(directionalClassName);
  820. $(nextElement).addClass(directionalClassName);
  821. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  822. if (nextElementInterval) {
  823. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  824. this._config.interval = nextElementInterval;
  825. } else {
  826. this._config.interval = this._config.defaultInterval || this._config.interval;
  827. }
  828. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  829. $(activeElement).one(Util.TRANSITION_END, function () {
  830. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  831. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  832. _this4._isSliding = false;
  833. setTimeout(function () {
  834. return $(_this4._element).trigger(slidEvent);
  835. }, 0);
  836. }).emulateTransitionEnd(transitionDuration);
  837. } else {
  838. $(activeElement).removeClass(ClassName$2.ACTIVE);
  839. $(nextElement).addClass(ClassName$2.ACTIVE);
  840. this._isSliding = false;
  841. $(this._element).trigger(slidEvent);
  842. }
  843. if (isCycling) {
  844. this.cycle();
  845. }
  846. }; // Static
  847. Carousel._jQueryInterface = function _jQueryInterface(config) {
  848. return this.each(function () {
  849. var data = $(this).data(DATA_KEY$2);
  850. var _config = _objectSpread({}, Default, $(this).data());
  851. if (typeof config === 'object') {
  852. _config = _objectSpread({}, _config, config);
  853. }
  854. var action = typeof config === 'string' ? config : _config.slide;
  855. if (!data) {
  856. data = new Carousel(this, _config);
  857. $(this).data(DATA_KEY$2, data);
  858. }
  859. if (typeof config === 'number') {
  860. data.to(config);
  861. } else if (typeof action === 'string') {
  862. if (typeof data[action] === 'undefined') {
  863. throw new TypeError("No method named \"" + action + "\"");
  864. }
  865. data[action]();
  866. } else if (_config.interval) {
  867. data.pause();
  868. data.cycle();
  869. }
  870. });
  871. };
  872. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  873. var selector = Util.getSelectorFromElement(this);
  874. if (!selector) {
  875. return;
  876. }
  877. var target = $(selector)[0];
  878. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  879. return;
  880. }
  881. var config = _objectSpread({}, $(target).data(), $(this).data());
  882. var slideIndex = this.getAttribute('data-slide-to');
  883. if (slideIndex) {
  884. config.interval = false;
  885. }
  886. Carousel._jQueryInterface.call($(target), config);
  887. if (slideIndex) {
  888. $(target).data(DATA_KEY$2).to(slideIndex);
  889. }
  890. event.preventDefault();
  891. };
  892. _createClass(Carousel, null, [{
  893. key: "VERSION",
  894. get: function get() {
  895. return VERSION$2;
  896. }
  897. }, {
  898. key: "Default",
  899. get: function get() {
  900. return Default;
  901. }
  902. }]);
  903. return Carousel;
  904. }();
  905. /**
  906. * ------------------------------------------------------------------------
  907. * Data Api implementation
  908. * ------------------------------------------------------------------------
  909. */
  910. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  911. $(window).on(Event$2.LOAD_DATA_API, function () {
  912. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  913. for (var i = 0, len = carousels.length; i < len; i++) {
  914. var $carousel = $(carousels[i]);
  915. Carousel._jQueryInterface.call($carousel, $carousel.data());
  916. }
  917. });
  918. /**
  919. * ------------------------------------------------------------------------
  920. * jQuery
  921. * ------------------------------------------------------------------------
  922. */
  923. $.fn[NAME$2] = Carousel._jQueryInterface;
  924. $.fn[NAME$2].Constructor = Carousel;
  925. $.fn[NAME$2].noConflict = function () {
  926. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  927. return Carousel._jQueryInterface;
  928. };
  929. /**
  930. * ------------------------------------------------------------------------
  931. * Constants
  932. * ------------------------------------------------------------------------
  933. */
  934. var NAME$3 = 'collapse';
  935. var VERSION$3 = '4.2.1';
  936. var DATA_KEY$3 = 'bs.collapse';
  937. var EVENT_KEY$3 = "." + DATA_KEY$3;
  938. var DATA_API_KEY$3 = '.data-api';
  939. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  940. var Default$1 = {
  941. toggle: true,
  942. parent: ''
  943. };
  944. var DefaultType$1 = {
  945. toggle: 'boolean',
  946. parent: '(string|element)'
  947. };
  948. var Event$3 = {
  949. SHOW: "show" + EVENT_KEY$3,
  950. SHOWN: "shown" + EVENT_KEY$3,
  951. HIDE: "hide" + EVENT_KEY$3,
  952. HIDDEN: "hidden" + EVENT_KEY$3,
  953. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  954. };
  955. var ClassName$3 = {
  956. SHOW: 'show',
  957. COLLAPSE: 'collapse',
  958. COLLAPSING: 'collapsing',
  959. COLLAPSED: 'collapsed'
  960. };
  961. var Dimension = {
  962. WIDTH: 'width',
  963. HEIGHT: 'height'
  964. };
  965. var Selector$3 = {
  966. ACTIVES: '.show, .collapsing',
  967. DATA_TOGGLE: '[data-toggle="collapse"]'
  968. /**
  969. * ------------------------------------------------------------------------
  970. * Class Definition
  971. * ------------------------------------------------------------------------
  972. */
  973. };
  974. var Collapse =
  975. /*#__PURE__*/
  976. function () {
  977. function Collapse(element, config) {
  978. this._isTransitioning = false;
  979. this._element = element;
  980. this._config = this._getConfig(config);
  981. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  982. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  983. for (var i = 0, len = toggleList.length; i < len; i++) {
  984. var elem = toggleList[i];
  985. var selector = Util.getSelectorFromElement(elem);
  986. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  987. return foundElem === element;
  988. });
  989. if (selector !== null && filterElement.length > 0) {
  990. this._selector = selector;
  991. this._triggerArray.push(elem);
  992. }
  993. }
  994. this._parent = this._config.parent ? this._getParent() : null;
  995. if (!this._config.parent) {
  996. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  997. }
  998. if (this._config.toggle) {
  999. this.toggle();
  1000. }
  1001. } // Getters
  1002. var _proto = Collapse.prototype;
  1003. // Public
  1004. _proto.toggle = function toggle() {
  1005. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  1006. this.hide();
  1007. } else {
  1008. this.show();
  1009. }
  1010. };
  1011. _proto.show = function show() {
  1012. var _this = this;
  1013. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  1014. return;
  1015. }
  1016. var actives;
  1017. var activesData;
  1018. if (this._parent) {
  1019. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  1020. if (typeof _this._config.parent === 'string') {
  1021. return elem.getAttribute('data-parent') === _this._config.parent;
  1022. }
  1023. return elem.classList.contains(ClassName$3.COLLAPSE);
  1024. });
  1025. if (actives.length === 0) {
  1026. actives = null;
  1027. }
  1028. }
  1029. if (actives) {
  1030. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  1031. if (activesData && activesData._isTransitioning) {
  1032. return;
  1033. }
  1034. }
  1035. var startEvent = $.Event(Event$3.SHOW);
  1036. $(this._element).trigger(startEvent);
  1037. if (startEvent.isDefaultPrevented()) {
  1038. return;
  1039. }
  1040. if (actives) {
  1041. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  1042. if (!activesData) {
  1043. $(actives).data(DATA_KEY$3, null);
  1044. }
  1045. }
  1046. var dimension = this._getDimension();
  1047. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  1048. this._element.style[dimension] = 0;
  1049. if (this._triggerArray.length) {
  1050. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  1051. }
  1052. this.setTransitioning(true);
  1053. var complete = function complete() {
  1054. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  1055. _this._element.style[dimension] = '';
  1056. _this.setTransitioning(false);
  1057. $(_this._element).trigger(Event$3.SHOWN);
  1058. };
  1059. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1060. var scrollSize = "scroll" + capitalizedDimension;
  1061. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1062. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1063. this._element.style[dimension] = this._element[scrollSize] + "px";
  1064. };
  1065. _proto.hide = function hide() {
  1066. var _this2 = this;
  1067. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  1068. return;
  1069. }
  1070. var startEvent = $.Event(Event$3.HIDE);
  1071. $(this._element).trigger(startEvent);
  1072. if (startEvent.isDefaultPrevented()) {
  1073. return;
  1074. }
  1075. var dimension = this._getDimension();
  1076. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  1077. Util.reflow(this._element);
  1078. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  1079. var triggerArrayLength = this._triggerArray.length;
  1080. if (triggerArrayLength > 0) {
  1081. for (var i = 0; i < triggerArrayLength; i++) {
  1082. var trigger = this._triggerArray[i];
  1083. var selector = Util.getSelectorFromElement(trigger);
  1084. if (selector !== null) {
  1085. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  1086. if (!$elem.hasClass(ClassName$3.SHOW)) {
  1087. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  1088. }
  1089. }
  1090. }
  1091. }
  1092. this.setTransitioning(true);
  1093. var complete = function complete() {
  1094. _this2.setTransitioning(false);
  1095. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  1096. };
  1097. this._element.style[dimension] = '';
  1098. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  1099. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  1100. };
  1101. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  1102. this._isTransitioning = isTransitioning;
  1103. };
  1104. _proto.dispose = function dispose() {
  1105. $.removeData(this._element, DATA_KEY$3);
  1106. this._config = null;
  1107. this._parent = null;
  1108. this._element = null;
  1109. this._triggerArray = null;
  1110. this._isTransitioning = null;
  1111. }; // Private
  1112. _proto._getConfig = function _getConfig(config) {
  1113. config = _objectSpread({}, Default$1, config);
  1114. config.toggle = Boolean(config.toggle); // Coerce string values
  1115. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  1116. return config;
  1117. };
  1118. _proto._getDimension = function _getDimension() {
  1119. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  1120. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  1121. };
  1122. _proto._getParent = function _getParent() {
  1123. var _this3 = this;
  1124. var parent;
  1125. if (Util.isElement(this._config.parent)) {
  1126. parent = this._config.parent; // It's a jQuery object
  1127. if (typeof this._config.parent.jquery !== 'undefined') {
  1128. parent = this._config.parent[0];
  1129. }
  1130. } else {
  1131. parent = document.querySelector(this._config.parent);
  1132. }
  1133. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  1134. var children = [].slice.call(parent.querySelectorAll(selector));
  1135. $(children).each(function (i, element) {
  1136. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  1137. });
  1138. return parent;
  1139. };
  1140. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  1141. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  1142. if (triggerArray.length) {
  1143. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  1144. }
  1145. }; // Static
  1146. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  1147. var selector = Util.getSelectorFromElement(element);
  1148. return selector ? document.querySelector(selector) : null;
  1149. };
  1150. Collapse._jQueryInterface = function _jQueryInterface(config) {
  1151. return this.each(function () {
  1152. var $this = $(this);
  1153. var data = $this.data(DATA_KEY$3);
  1154. var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
  1155. if (!data && _config.toggle && /show|hide/.test(config)) {
  1156. _config.toggle = false;
  1157. }
  1158. if (!data) {
  1159. data = new Collapse(this, _config);
  1160. $this.data(DATA_KEY$3, data);
  1161. }
  1162. if (typeof config === 'string') {
  1163. if (typeof data[config] === 'undefined') {
  1164. throw new TypeError("No method named \"" + config + "\"");
  1165. }
  1166. data[config]();
  1167. }
  1168. });
  1169. };
  1170. _createClass(Collapse, null, [{
  1171. key: "VERSION",
  1172. get: function get() {
  1173. return VERSION$3;
  1174. }
  1175. }, {
  1176. key: "Default",
  1177. get: function get() {
  1178. return Default$1;
  1179. }
  1180. }]);
  1181. return Collapse;
  1182. }();
  1183. /**
  1184. * ------------------------------------------------------------------------
  1185. * Data Api implementation
  1186. * ------------------------------------------------------------------------
  1187. */
  1188. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  1189. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1190. if (event.currentTarget.tagName === 'A') {
  1191. event.preventDefault();
  1192. }
  1193. var $trigger = $(this);
  1194. var selector = Util.getSelectorFromElement(this);
  1195. var selectors = [].slice.call(document.querySelectorAll(selector));
  1196. $(selectors).each(function () {
  1197. var $target = $(this);
  1198. var data = $target.data(DATA_KEY$3);
  1199. var config = data ? 'toggle' : $trigger.data();
  1200. Collapse._jQueryInterface.call($target, config);
  1201. });
  1202. });
  1203. /**
  1204. * ------------------------------------------------------------------------
  1205. * jQuery
  1206. * ------------------------------------------------------------------------
  1207. */
  1208. $.fn[NAME$3] = Collapse._jQueryInterface;
  1209. $.fn[NAME$3].Constructor = Collapse;
  1210. $.fn[NAME$3].noConflict = function () {
  1211. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  1212. return Collapse._jQueryInterface;
  1213. };
  1214. /**!
  1215. * @fileOverview Kickass library to create and place poppers near their reference elements.
  1216. * @version 1.14.6
  1217. * @license
  1218. * Copyright (c) 2016 Federico Zivolo and contributors
  1219. *
  1220. * Permission is hereby granted, free of charge, to any person obtaining a copy
  1221. * of this software and associated documentation files (the "Software"), to deal
  1222. * in the Software without restriction, including without limitation the rights
  1223. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  1224. * copies of the Software, and to permit persons to whom the Software is
  1225. * furnished to do so, subject to the following conditions:
  1226. *
  1227. * The above copyright notice and this permission notice shall be included in all
  1228. * copies or substantial portions of the Software.
  1229. *
  1230. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  1231. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  1232. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  1233. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  1234. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  1235. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  1236. * SOFTWARE.
  1237. */
  1238. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
  1239. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  1240. var timeoutDuration = 0;
  1241. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  1242. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  1243. timeoutDuration = 1;
  1244. break;
  1245. }
  1246. }
  1247. function microtaskDebounce(fn) {
  1248. var called = false;
  1249. return function () {
  1250. if (called) {
  1251. return;
  1252. }
  1253. called = true;
  1254. window.Promise.resolve().then(function () {
  1255. called = false;
  1256. fn();
  1257. });
  1258. };
  1259. }
  1260. function taskDebounce(fn) {
  1261. var scheduled = false;
  1262. return function () {
  1263. if (!scheduled) {
  1264. scheduled = true;
  1265. setTimeout(function () {
  1266. scheduled = false;
  1267. fn();
  1268. }, timeoutDuration);
  1269. }
  1270. };
  1271. }
  1272. var supportsMicroTasks = isBrowser && window.Promise;
  1273. /**
  1274. * Create a debounced version of a method, that's asynchronously deferred
  1275. * but called in the minimum time possible.
  1276. *
  1277. * @method
  1278. * @memberof Popper.Utils
  1279. * @argument {Function} fn
  1280. * @returns {Function}
  1281. */
  1282. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  1283. /**
  1284. * Check if the given variable is a function
  1285. * @method
  1286. * @memberof Popper.Utils
  1287. * @argument {Any} functionToCheck - variable to check
  1288. * @returns {Boolean} answer to: is a function?
  1289. */
  1290. function isFunction(functionToCheck) {
  1291. var getType = {};
  1292. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  1293. }
  1294. /**
  1295. * Get CSS computed property of the given element
  1296. * @method
  1297. * @memberof Popper.Utils
  1298. * @argument {Eement} element
  1299. * @argument {String} property
  1300. */
  1301. function getStyleComputedProperty(element, property) {
  1302. if (element.nodeType !== 1) {
  1303. return [];
  1304. }
  1305. // NOTE: 1 DOM access here
  1306. var window = element.ownerDocument.defaultView;
  1307. var css = window.getComputedStyle(element, null);
  1308. return property ? css[property] : css;
  1309. }
  1310. /**
  1311. * Returns the parentNode or the host of the element
  1312. * @method
  1313. * @memberof Popper.Utils
  1314. * @argument {Element} element
  1315. * @returns {Element} parent
  1316. */
  1317. function getParentNode(element) {
  1318. if (element.nodeName === 'HTML') {
  1319. return element;
  1320. }
  1321. return element.parentNode || element.host;
  1322. }
  1323. /**
  1324. * Returns the scrolling parent of the given element
  1325. * @method
  1326. * @memberof Popper.Utils
  1327. * @argument {Element} element
  1328. * @returns {Element} scroll parent
  1329. */
  1330. function getScrollParent(element) {
  1331. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  1332. if (!element) {
  1333. return document.body;
  1334. }
  1335. switch (element.nodeName) {
  1336. case 'HTML':
  1337. case 'BODY':
  1338. return element.ownerDocument.body;
  1339. case '#document':
  1340. return element.body;
  1341. }
  1342. // Firefox want us to check `-x` and `-y` variations as well
  1343. var _getStyleComputedProp = getStyleComputedProperty(element),
  1344. overflow = _getStyleComputedProp.overflow,
  1345. overflowX = _getStyleComputedProp.overflowX,
  1346. overflowY = _getStyleComputedProp.overflowY;
  1347. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  1348. return element;
  1349. }
  1350. return getScrollParent(getParentNode(element));
  1351. }
  1352. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  1353. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  1354. /**
  1355. * Determines if the browser is Internet Explorer
  1356. * @method
  1357. * @memberof Popper.Utils
  1358. * @param {Number} version to check
  1359. * @returns {Boolean} isIE
  1360. */
  1361. function isIE(version) {
  1362. if (version === 11) {
  1363. return isIE11;
  1364. }
  1365. if (version === 10) {
  1366. return isIE10;
  1367. }
  1368. return isIE11 || isIE10;
  1369. }
  1370. /**
  1371. * Returns the offset parent of the given element
  1372. * @method
  1373. * @memberof Popper.Utils
  1374. * @argument {Element} element
  1375. * @returns {Element} offset parent
  1376. */
  1377. function getOffsetParent(element) {
  1378. if (!element) {
  1379. return document.documentElement;
  1380. }
  1381. var noOffsetParent = isIE(10) ? document.body : null;
  1382. // NOTE: 1 DOM access here
  1383. var offsetParent = element.offsetParent || null;
  1384. // Skip hidden elements which don't have an offsetParent
  1385. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  1386. offsetParent = (element = element.nextElementSibling).offsetParent;
  1387. }
  1388. var nodeName = offsetParent && offsetParent.nodeName;
  1389. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  1390. return element ? element.ownerDocument.documentElement : document.documentElement;
  1391. }
  1392. // .offsetParent will return the closest TH, TD or TABLE in case
  1393. // no offsetParent is present, I hate this job...
  1394. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  1395. return getOffsetParent(offsetParent);
  1396. }
  1397. return offsetParent;
  1398. }
  1399. function isOffsetContainer(element) {
  1400. var nodeName = element.nodeName;
  1401. if (nodeName === 'BODY') {
  1402. return false;
  1403. }
  1404. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  1405. }
  1406. /**
  1407. * Finds the root node (document, shadowDOM root) of the given element
  1408. * @method
  1409. * @memberof Popper.Utils
  1410. * @argument {Element} node
  1411. * @returns {Element} root node
  1412. */
  1413. function getRoot(node) {
  1414. if (node.parentNode !== null) {
  1415. return getRoot(node.parentNode);
  1416. }
  1417. return node;
  1418. }
  1419. /**
  1420. * Finds the offset parent common to the two provided nodes
  1421. * @method
  1422. * @memberof Popper.Utils
  1423. * @argument {Element} element1
  1424. * @argument {Element} element2
  1425. * @returns {Element} common offset parent
  1426. */
  1427. function findCommonOffsetParent(element1, element2) {
  1428. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  1429. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  1430. return document.documentElement;
  1431. }
  1432. // Here we make sure to give as "start" the element that comes first in the DOM
  1433. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  1434. var start = order ? element1 : element2;
  1435. var end = order ? element2 : element1;
  1436. // Get common ancestor container
  1437. var range = document.createRange();
  1438. range.setStart(start, 0);
  1439. range.setEnd(end, 0);
  1440. var commonAncestorContainer = range.commonAncestorContainer;
  1441. // Both nodes are inside #document
  1442. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  1443. if (isOffsetContainer(commonAncestorContainer)) {
  1444. return commonAncestorContainer;
  1445. }
  1446. return getOffsetParent(commonAncestorContainer);
  1447. }
  1448. // one of the nodes is inside shadowDOM, find which one
  1449. var element1root = getRoot(element1);
  1450. if (element1root.host) {
  1451. return findCommonOffsetParent(element1root.host, element2);
  1452. } else {
  1453. return findCommonOffsetParent(element1, getRoot(element2).host);
  1454. }
  1455. }
  1456. /**
  1457. * Gets the scroll value of the given element in the given side (top and left)
  1458. * @method
  1459. * @memberof Popper.Utils
  1460. * @argument {Element} element
  1461. * @argument {String} side `top` or `left`
  1462. * @returns {number} amount of scrolled pixels
  1463. */
  1464. function getScroll(element) {
  1465. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  1466. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  1467. var nodeName = element.nodeName;
  1468. if (nodeName === 'BODY' || nodeName === 'HTML') {
  1469. var html = element.ownerDocument.documentElement;
  1470. var scrollingElement = element.ownerDocument.scrollingElement || html;
  1471. return scrollingElement[upperSide];
  1472. }
  1473. return element[upperSide];
  1474. }
  1475. /*
  1476. * Sum or subtract the element scroll values (left and top) from a given rect object
  1477. * @method
  1478. * @memberof Popper.Utils
  1479. * @param {Object} rect - Rect object you want to change
  1480. * @param {HTMLElement} element - The element from the function reads the scroll values
  1481. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  1482. * @return {Object} rect - The modifier rect object
  1483. */
  1484. function includeScroll(rect, element) {
  1485. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1486. var scrollTop = getScroll(element, 'top');
  1487. var scrollLeft = getScroll(element, 'left');
  1488. var modifier = subtract ? -1 : 1;
  1489. rect.top += scrollTop * modifier;
  1490. rect.bottom += scrollTop * modifier;
  1491. rect.left += scrollLeft * modifier;
  1492. rect.right += scrollLeft * modifier;
  1493. return rect;
  1494. }
  1495. /*
  1496. * Helper to detect borders of a given element
  1497. * @method
  1498. * @memberof Popper.Utils
  1499. * @param {CSSStyleDeclaration} styles
  1500. * Result of `getStyleComputedProperty` on the given element
  1501. * @param {String} axis - `x` or `y`
  1502. * @return {number} borders - The borders size of the given axis
  1503. */
  1504. function getBordersSize(styles, axis) {
  1505. var sideA = axis === 'x' ? 'Left' : 'Top';
  1506. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  1507. return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
  1508. }
  1509. function getSize(axis, body, html, computedStyle) {
  1510. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  1511. }
  1512. function getWindowSizes(document) {
  1513. var body = document.body;
  1514. var html = document.documentElement;
  1515. var computedStyle = isIE(10) && getComputedStyle(html);
  1516. return {
  1517. height: getSize('Height', body, html, computedStyle),
  1518. width: getSize('Width', body, html, computedStyle)
  1519. };
  1520. }
  1521. var classCallCheck = function (instance, Constructor) {
  1522. if (!(instance instanceof Constructor)) {
  1523. throw new TypeError("Cannot call a class as a function");
  1524. }
  1525. };
  1526. var createClass = function () {
  1527. function defineProperties(target, props) {
  1528. for (var i = 0; i < props.length; i++) {
  1529. var descriptor = props[i];
  1530. descriptor.enumerable = descriptor.enumerable || false;
  1531. descriptor.configurable = true;
  1532. if ("value" in descriptor) descriptor.writable = true;
  1533. Object.defineProperty(target, descriptor.key, descriptor);
  1534. }
  1535. }
  1536. return function (Constructor, protoProps, staticProps) {
  1537. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  1538. if (staticProps) defineProperties(Constructor, staticProps);
  1539. return Constructor;
  1540. };
  1541. }();
  1542. var defineProperty = function (obj, key, value) {
  1543. if (key in obj) {
  1544. Object.defineProperty(obj, key, {
  1545. value: value,
  1546. enumerable: true,
  1547. configurable: true,
  1548. writable: true
  1549. });
  1550. } else {
  1551. obj[key] = value;
  1552. }
  1553. return obj;
  1554. };
  1555. var _extends = Object.assign || function (target) {
  1556. for (var i = 1; i < arguments.length; i++) {
  1557. var source = arguments[i];
  1558. for (var key in source) {
  1559. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1560. target[key] = source[key];
  1561. }
  1562. }
  1563. }
  1564. return target;
  1565. };
  1566. /**
  1567. * Given element offsets, generate an output similar to getBoundingClientRect
  1568. * @method
  1569. * @memberof Popper.Utils
  1570. * @argument {Object} offsets
  1571. * @returns {Object} ClientRect like output
  1572. */
  1573. function getClientRect(offsets) {
  1574. return _extends({}, offsets, {
  1575. right: offsets.left + offsets.width,
  1576. bottom: offsets.top + offsets.height
  1577. });
  1578. }
  1579. /**
  1580. * Get bounding client rect of given element
  1581. * @method
  1582. * @memberof Popper.Utils
  1583. * @param {HTMLElement} element
  1584. * @return {Object} client rect
  1585. */
  1586. function getBoundingClientRect(element) {
  1587. var rect = {};
  1588. // IE10 10 FIX: Please, don't ask, the element isn't
  1589. // considered in DOM in some circumstances...
  1590. // This isn't reproducible in IE10 compatibility mode of IE11
  1591. try {
  1592. if (isIE(10)) {
  1593. rect = element.getBoundingClientRect();
  1594. var scrollTop = getScroll(element, 'top');
  1595. var scrollLeft = getScroll(element, 'left');
  1596. rect.top += scrollTop;
  1597. rect.left += scrollLeft;
  1598. rect.bottom += scrollTop;
  1599. rect.right += scrollLeft;
  1600. } else {
  1601. rect = element.getBoundingClientRect();
  1602. }
  1603. } catch (e) {}
  1604. var result = {
  1605. left: rect.left,
  1606. top: rect.top,
  1607. width: rect.right - rect.left,
  1608. height: rect.bottom - rect.top
  1609. };
  1610. // subtract scrollbar size from sizes
  1611. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  1612. var width = sizes.width || element.clientWidth || result.right - result.left;
  1613. var height = sizes.height || element.clientHeight || result.bottom - result.top;
  1614. var horizScrollbar = element.offsetWidth - width;
  1615. var vertScrollbar = element.offsetHeight - height;
  1616. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  1617. // we make this check conditional for performance reasons
  1618. if (horizScrollbar || vertScrollbar) {
  1619. var styles = getStyleComputedProperty(element);
  1620. horizScrollbar -= getBordersSize(styles, 'x');
  1621. vertScrollbar -= getBordersSize(styles, 'y');
  1622. result.width -= horizScrollbar;
  1623. result.height -= vertScrollbar;
  1624. }
  1625. return getClientRect(result);
  1626. }
  1627. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  1628. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1629. var isIE10 = isIE(10);
  1630. var isHTML = parent.nodeName === 'HTML';
  1631. var childrenRect = getBoundingClientRect(children);
  1632. var parentRect = getBoundingClientRect(parent);
  1633. var scrollParent = getScrollParent(children);
  1634. var styles = getStyleComputedProperty(parent);
  1635. var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
  1636. var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
  1637. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  1638. if (fixedPosition && isHTML) {
  1639. parentRect.top = Math.max(parentRect.top, 0);
  1640. parentRect.left = Math.max(parentRect.left, 0);
  1641. }
  1642. var offsets = getClientRect({
  1643. top: childrenRect.top - parentRect.top - borderTopWidth,
  1644. left: childrenRect.left - parentRect.left - borderLeftWidth,
  1645. width: childrenRect.width,
  1646. height: childrenRect.height
  1647. });
  1648. offsets.marginTop = 0;
  1649. offsets.marginLeft = 0;
  1650. // Subtract margins of documentElement in case it's being used as parent
  1651. // we do this only on HTML because it's the only element that behaves
  1652. // differently when margins are applied to it. The margins are included in
  1653. // the box of the documentElement, in the other cases not.
  1654. if (!isIE10 && isHTML) {
  1655. var marginTop = parseFloat(styles.marginTop, 10);
  1656. var marginLeft = parseFloat(styles.marginLeft, 10);
  1657. offsets.top -= borderTopWidth - marginTop;
  1658. offsets.bottom -= borderTopWidth - marginTop;
  1659. offsets.left -= borderLeftWidth - marginLeft;
  1660. offsets.right -= borderLeftWidth - marginLeft;
  1661. // Attach marginTop and marginLeft because in some circumstances we may need them
  1662. offsets.marginTop = marginTop;
  1663. offsets.marginLeft = marginLeft;
  1664. }
  1665. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  1666. offsets = includeScroll(offsets, parent);
  1667. }
  1668. return offsets;
  1669. }
  1670. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  1671. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1672. var html = element.ownerDocument.documentElement;
  1673. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  1674. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  1675. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  1676. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  1677. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  1678. var offset = {
  1679. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  1680. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  1681. width: width,
  1682. height: height
  1683. };
  1684. return getClientRect(offset);
  1685. }
  1686. /**
  1687. * Check if the given element is fixed or is inside a fixed parent
  1688. * @method
  1689. * @memberof Popper.Utils
  1690. * @argument {Element} element
  1691. * @argument {Element} customContainer
  1692. * @returns {Boolean} answer to "isFixed?"
  1693. */
  1694. function isFixed(element) {
  1695. var nodeName = element.nodeName;
  1696. if (nodeName === 'BODY' || nodeName === 'HTML') {
  1697. return false;
  1698. }
  1699. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  1700. return true;
  1701. }
  1702. return isFixed(getParentNode(element));
  1703. }
  1704. /**
  1705. * Finds the first parent of an element that has a transformed property defined
  1706. * @method
  1707. * @memberof Popper.Utils
  1708. * @argument {Element} element
  1709. * @returns {Element} first transformed parent or documentElement
  1710. */
  1711. function getFixedPositionOffsetParent(element) {
  1712. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  1713. if (!element || !element.parentElement || isIE()) {
  1714. return document.documentElement;
  1715. }
  1716. var el = element.parentElement;
  1717. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  1718. el = el.parentElement;
  1719. }
  1720. return el || document.documentElement;
  1721. }
  1722. /**
  1723. * Computed the boundaries limits and return them
  1724. * @method
  1725. * @memberof Popper.Utils
  1726. * @param {HTMLElement} popper
  1727. * @param {HTMLElement} reference
  1728. * @param {number} padding
  1729. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  1730. * @param {Boolean} fixedPosition - Is in fixed position mode
  1731. * @returns {Object} Coordinates of the boundaries
  1732. */
  1733. function getBoundaries(popper, reference, padding, boundariesElement) {
  1734. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  1735. // NOTE: 1 DOM access here
  1736. var boundaries = { top: 0, left: 0 };
  1737. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  1738. // Handle viewport case
  1739. if (boundariesElement === 'viewport') {
  1740. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  1741. } else {
  1742. // Handle other cases based on DOM element used as boundaries
  1743. var boundariesNode = void 0;
  1744. if (boundariesElement === 'scrollParent') {
  1745. boundariesNode = getScrollParent(getParentNode(reference));
  1746. if (boundariesNode.nodeName === 'BODY') {
  1747. boundariesNode = popper.ownerDocument.documentElement;
  1748. }
  1749. } else if (boundariesElement === 'window') {
  1750. boundariesNode = popper.ownerDocument.documentElement;
  1751. } else {
  1752. boundariesNode = boundariesElement;
  1753. }
  1754. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  1755. // In case of HTML, we need a different computation
  1756. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  1757. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  1758. height = _getWindowSizes.height,
  1759. width = _getWindowSizes.width;
  1760. boundaries.top += offsets.top - offsets.marginTop;
  1761. boundaries.bottom = height + offsets.top;
  1762. boundaries.left += offsets.left - offsets.marginLeft;
  1763. boundaries.right = width + offsets.left;
  1764. } else {
  1765. // for all the other DOM elements, this one is good
  1766. boundaries = offsets;
  1767. }
  1768. }
  1769. // Add paddings
  1770. padding = padding || 0;
  1771. var isPaddingNumber = typeof padding === 'number';
  1772. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  1773. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  1774. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  1775. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  1776. return boundaries;
  1777. }
  1778. function getArea(_ref) {
  1779. var width = _ref.width,
  1780. height = _ref.height;
  1781. return width * height;
  1782. }
  1783. /**
  1784. * Utility used to transform the `auto` placement to the placement with more
  1785. * available space.
  1786. * @method
  1787. * @memberof Popper.Utils
  1788. * @argument {Object} data - The data object generated by update method
  1789. * @argument {Object} options - Modifiers configuration and options
  1790. * @returns {Object} The data object, properly modified
  1791. */
  1792. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  1793. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  1794. if (placement.indexOf('auto') === -1) {
  1795. return placement;
  1796. }
  1797. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  1798. var rects = {
  1799. top: {
  1800. width: boundaries.width,
  1801. height: refRect.top - boundaries.top
  1802. },
  1803. right: {
  1804. width: boundaries.right - refRect.right,
  1805. height: boundaries.height
  1806. },
  1807. bottom: {
  1808. width: boundaries.width,
  1809. height: boundaries.bottom - refRect.bottom
  1810. },
  1811. left: {
  1812. width: refRect.left - boundaries.left,
  1813. height: boundaries.height
  1814. }
  1815. };
  1816. var sortedAreas = Object.keys(rects).map(function (key) {
  1817. return _extends({
  1818. key: key
  1819. }, rects[key], {
  1820. area: getArea(rects[key])
  1821. });
  1822. }).sort(function (a, b) {
  1823. return b.area - a.area;
  1824. });
  1825. var filteredAreas = sortedAreas.filter(function (_ref2) {
  1826. var width = _ref2.width,
  1827. height = _ref2.height;
  1828. return width >= popper.clientWidth && height >= popper.clientHeight;
  1829. });
  1830. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  1831. var variation = placement.split('-')[1];
  1832. return computedPlacement + (variation ? '-' + variation : '');
  1833. }
  1834. /**
  1835. * Get offsets to the reference element
  1836. * @method
  1837. * @memberof Popper.Utils
  1838. * @param {Object} state
  1839. * @param {Element} popper - the popper element
  1840. * @param {Element} reference - the reference element (the popper will be relative to this)
  1841. * @param {Element} fixedPosition - is in fixed position mode
  1842. * @returns {Object} An object containing the offsets which will be applied to the popper
  1843. */
  1844. function getReferenceOffsets(state, popper, reference) {
  1845. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  1846. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  1847. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  1848. }
  1849. /**
  1850. * Get the outer sizes of the given element (offset size + margins)
  1851. * @method
  1852. * @memberof Popper.Utils
  1853. * @argument {Element} element
  1854. * @returns {Object} object containing width and height properties
  1855. */
  1856. function getOuterSizes(element) {
  1857. var window = element.ownerDocument.defaultView;
  1858. var styles = window.getComputedStyle(element);
  1859. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  1860. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  1861. var result = {
  1862. width: element.offsetWidth + y,
  1863. height: element.offsetHeight + x
  1864. };
  1865. return result;
  1866. }
  1867. /**
  1868. * Get the opposite placement of the given one
  1869. * @method
  1870. * @memberof Popper.Utils
  1871. * @argument {String} placement
  1872. * @returns {String} flipped placement
  1873. */
  1874. function getOppositePlacement(placement) {
  1875. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  1876. return placement.replace(/left|right|bottom|top/g, function (matched) {
  1877. return hash[matched];
  1878. });
  1879. }
  1880. /**
  1881. * Get offsets to the popper
  1882. * @method
  1883. * @memberof Popper.Utils
  1884. * @param {Object} position - CSS position the Popper will get applied
  1885. * @param {HTMLElement} popper - the popper element
  1886. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  1887. * @param {String} placement - one of the valid placement options
  1888. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  1889. */
  1890. function getPopperOffsets(popper, referenceOffsets, placement) {
  1891. placement = placement.split('-')[0];
  1892. // Get popper node sizes
  1893. var popperRect = getOuterSizes(popper);
  1894. // Add position, width and height to our offsets object
  1895. var popperOffsets = {
  1896. width: popperRect.width,
  1897. height: popperRect.height
  1898. };
  1899. // depending by the popper placement we have to compute its offsets slightly differently
  1900. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  1901. var mainSide = isHoriz ? 'top' : 'left';
  1902. var secondarySide = isHoriz ? 'left' : 'top';
  1903. var measurement = isHoriz ? 'height' : 'width';
  1904. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  1905. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  1906. if (placement === secondarySide) {
  1907. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  1908. } else {
  1909. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  1910. }
  1911. return popperOffsets;
  1912. }
  1913. /**
  1914. * Mimics the `find` method of Array
  1915. * @method
  1916. * @memberof Popper.Utils
  1917. * @argument {Array} arr
  1918. * @argument prop
  1919. * @argument value
  1920. * @returns index or -1
  1921. */
  1922. function find(arr, check) {
  1923. // use native find if supported
  1924. if (Array.prototype.find) {
  1925. return arr.find(check);
  1926. }
  1927. // use `filter` to obtain the same behavior of `find`
  1928. return arr.filter(check)[0];
  1929. }
  1930. /**
  1931. * Return the index of the matching object
  1932. * @method
  1933. * @memberof Popper.Utils
  1934. * @argument {Array} arr
  1935. * @argument prop
  1936. * @argument value
  1937. * @returns index or -1
  1938. */
  1939. function findIndex(arr, prop, value) {
  1940. // use native findIndex if supported
  1941. if (Array.prototype.findIndex) {
  1942. return arr.findIndex(function (cur) {
  1943. return cur[prop] === value;
  1944. });
  1945. }
  1946. // use `find` + `indexOf` if `findIndex` isn't supported
  1947. var match = find(arr, function (obj) {
  1948. return obj[prop] === value;
  1949. });
  1950. return arr.indexOf(match);
  1951. }
  1952. /**
  1953. * Loop trough the list of modifiers and run them in order,
  1954. * each of them will then edit the data object.
  1955. * @method
  1956. * @memberof Popper.Utils
  1957. * @param {dataObject} data
  1958. * @param {Array} modifiers
  1959. * @param {String} ends - Optional modifier name used as stopper
  1960. * @returns {dataObject}
  1961. */
  1962. function runModifiers(modifiers, data, ends) {
  1963. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  1964. modifiersToRun.forEach(function (modifier) {
  1965. if (modifier['function']) {
  1966. // eslint-disable-line dot-notation
  1967. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  1968. }
  1969. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  1970. if (modifier.enabled && isFunction(fn)) {
  1971. // Add properties to offsets to make them a complete clientRect object
  1972. // we do this before each modifier to make sure the previous one doesn't
  1973. // mess with these values
  1974. data.offsets.popper = getClientRect(data.offsets.popper);
  1975. data.offsets.reference = getClientRect(data.offsets.reference);
  1976. data = fn(data, modifier);
  1977. }
  1978. });
  1979. return data;
  1980. }
  1981. /**
  1982. * Updates the position of the popper, computing the new offsets and applying
  1983. * the new style.<br />
  1984. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  1985. * @method
  1986. * @memberof Popper
  1987. */
  1988. function update() {
  1989. // if popper is destroyed, don't perform any further update
  1990. if (this.state.isDestroyed) {
  1991. return;
  1992. }
  1993. var data = {
  1994. instance: this,
  1995. styles: {},
  1996. arrowStyles: {},
  1997. attributes: {},
  1998. flipped: false,
  1999. offsets: {}
  2000. };
  2001. // compute reference element offsets
  2002. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  2003. // compute auto placement, store placement inside the data object,
  2004. // modifiers will be able to edit `placement` if needed
  2005. // and refer to originalPlacement to know the original value
  2006. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  2007. // store the computed placement inside `originalPlacement`
  2008. data.originalPlacement = data.placement;
  2009. data.positionFixed = this.options.positionFixed;
  2010. // compute the popper offsets
  2011. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  2012. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  2013. // run the modifiers
  2014. data = runModifiers(this.modifiers, data);
  2015. // the first `update` will call `onCreate` callback
  2016. // the other ones will call `onUpdate` callback
  2017. if (!this.state.isCreated) {
  2018. this.state.isCreated = true;
  2019. this.options.onCreate(data);
  2020. } else {
  2021. this.options.onUpdate(data);
  2022. }
  2023. }
  2024. /**
  2025. * Helper used to know if the given modifier is enabled.
  2026. * @method
  2027. * @memberof Popper.Utils
  2028. * @returns {Boolean}
  2029. */
  2030. function isModifierEnabled(modifiers, modifierName) {
  2031. return modifiers.some(function (_ref) {
  2032. var name = _ref.name,
  2033. enabled = _ref.enabled;
  2034. return enabled && name === modifierName;
  2035. });
  2036. }
  2037. /**
  2038. * Get the prefixed supported property name
  2039. * @method
  2040. * @memberof Popper.Utils
  2041. * @argument {String} property (camelCase)
  2042. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  2043. */
  2044. function getSupportedPropertyName(property) {
  2045. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  2046. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  2047. for (var i = 0; i < prefixes.length; i++) {
  2048. var prefix = prefixes[i];
  2049. var toCheck = prefix ? '' + prefix + upperProp : property;
  2050. if (typeof document.body.style[toCheck] !== 'undefined') {
  2051. return toCheck;
  2052. }
  2053. }
  2054. return null;
  2055. }
  2056. /**
  2057. * Destroys the popper.
  2058. * @method
  2059. * @memberof Popper
  2060. */
  2061. function destroy() {
  2062. this.state.isDestroyed = true;
  2063. // touch DOM only if `applyStyle` modifier is enabled
  2064. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  2065. this.popper.removeAttribute('x-placement');
  2066. this.popper.style.position = '';
  2067. this.popper.style.top = '';
  2068. this.popper.style.left = '';
  2069. this.popper.style.right = '';
  2070. this.popper.style.bottom = '';
  2071. this.popper.style.willChange = '';
  2072. this.popper.style[getSupportedPropertyName('transform')] = '';
  2073. }
  2074. this.disableEventListeners();
  2075. // remove the popper if user explicity asked for the deletion on destroy
  2076. // do not use `remove` because IE11 doesn't support it
  2077. if (this.options.removeOnDestroy) {
  2078. this.popper.parentNode.removeChild(this.popper);
  2079. }
  2080. return this;
  2081. }
  2082. /**
  2083. * Get the window associated with the element
  2084. * @argument {Element} element
  2085. * @returns {Window}
  2086. */
  2087. function getWindow(element) {
  2088. var ownerDocument = element.ownerDocument;
  2089. return ownerDocument ? ownerDocument.defaultView : window;
  2090. }
  2091. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  2092. var isBody = scrollParent.nodeName === 'BODY';
  2093. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  2094. target.addEventListener(event, callback, { passive: true });
  2095. if (!isBody) {
  2096. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  2097. }
  2098. scrollParents.push(target);
  2099. }
  2100. /**
  2101. * Setup needed event listeners used to update the popper position
  2102. * @method
  2103. * @memberof Popper.Utils
  2104. * @private
  2105. */
  2106. function setupEventListeners(reference, options, state, updateBound) {
  2107. // Resize event listener on window
  2108. state.updateBound = updateBound;
  2109. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  2110. // Scroll event listener on scroll parents
  2111. var scrollElement = getScrollParent(reference);
  2112. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  2113. state.scrollElement = scrollElement;
  2114. state.eventsEnabled = true;
  2115. return state;
  2116. }
  2117. /**
  2118. * It will add resize/scroll events and start recalculating
  2119. * position of the popper element when they are triggered.
  2120. * @method
  2121. * @memberof Popper
  2122. */
  2123. function enableEventListeners() {
  2124. if (!this.state.eventsEnabled) {
  2125. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  2126. }
  2127. }
  2128. /**
  2129. * Remove event listeners used to update the popper position
  2130. * @method
  2131. * @memberof Popper.Utils
  2132. * @private
  2133. */
  2134. function removeEventListeners(reference, state) {
  2135. // Remove resize event listener on window
  2136. getWindow(reference).removeEventListener('resize', state.updateBound);
  2137. // Remove scroll event listener on scroll parents
  2138. state.scrollParents.forEach(function (target) {
  2139. target.removeEventListener('scroll', state.updateBound);
  2140. });
  2141. // Reset state
  2142. state.updateBound = null;
  2143. state.scrollParents = [];
  2144. state.scrollElement = null;
  2145. state.eventsEnabled = false;
  2146. return state;
  2147. }
  2148. /**
  2149. * It will remove resize/scroll events and won't recalculate popper position
  2150. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  2151. * unless you call `update` method manually.
  2152. * @method
  2153. * @memberof Popper
  2154. */
  2155. function disableEventListeners() {
  2156. if (this.state.eventsEnabled) {
  2157. cancelAnimationFrame(this.scheduleUpdate);
  2158. this.state = removeEventListeners(this.reference, this.state);
  2159. }
  2160. }
  2161. /**
  2162. * Tells if a given input is a number
  2163. * @method
  2164. * @memberof Popper.Utils
  2165. * @param {*} input to check
  2166. * @return {Boolean}
  2167. */
  2168. function isNumeric(n) {
  2169. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  2170. }
  2171. /**
  2172. * Set the style to the given popper
  2173. * @method
  2174. * @memberof Popper.Utils
  2175. * @argument {Element} element - Element to apply the style to
  2176. * @argument {Object} styles
  2177. * Object with a list of properties and values which will be applied to the element
  2178. */
  2179. function setStyles(element, styles) {
  2180. Object.keys(styles).forEach(function (prop) {
  2181. var unit = '';
  2182. // add unit if the value is numeric and is one of the following
  2183. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  2184. unit = 'px';
  2185. }
  2186. element.style[prop] = styles[prop] + unit;
  2187. });
  2188. }
  2189. /**
  2190. * Set the attributes to the given popper
  2191. * @method
  2192. * @memberof Popper.Utils
  2193. * @argument {Element} element - Element to apply the attributes to
  2194. * @argument {Object} styles
  2195. * Object with a list of properties and values which will be applied to the element
  2196. */
  2197. function setAttributes(element, attributes) {
  2198. Object.keys(attributes).forEach(function (prop) {
  2199. var value = attributes[prop];
  2200. if (value !== false) {
  2201. element.setAttribute(prop, attributes[prop]);
  2202. } else {
  2203. element.removeAttribute(prop);
  2204. }
  2205. });
  2206. }
  2207. /**
  2208. * @function
  2209. * @memberof Modifiers
  2210. * @argument {Object} data - The data object generated by `update` method
  2211. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  2212. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  2213. * @argument {Object} options - Modifiers configuration and options
  2214. * @returns {Object} The same data object
  2215. */
  2216. function applyStyle(data) {
  2217. // any property present in `data.styles` will be applied to the popper,
  2218. // in this way we can make the 3rd party modifiers add custom styles to it
  2219. // Be aware, modifiers could override the properties defined in the previous
  2220. // lines of this modifier!
  2221. setStyles(data.instance.popper, data.styles);
  2222. // any property present in `data.attributes` will be applied to the popper,
  2223. // they will be set as HTML attributes of the element
  2224. setAttributes(data.instance.popper, data.attributes);
  2225. // if arrowElement is defined and arrowStyles has some properties
  2226. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  2227. setStyles(data.arrowElement, data.arrowStyles);
  2228. }
  2229. return data;
  2230. }
  2231. /**
  2232. * Set the x-placement attribute before everything else because it could be used
  2233. * to add margins to the popper margins needs to be calculated to get the
  2234. * correct popper offsets.
  2235. * @method
  2236. * @memberof Popper.modifiers
  2237. * @param {HTMLElement} reference - The reference element used to position the popper
  2238. * @param {HTMLElement} popper - The HTML element used as popper
  2239. * @param {Object} options - Popper.js options
  2240. */
  2241. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  2242. // compute reference element offsets
  2243. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  2244. // compute auto placement, store placement inside the data object,
  2245. // modifiers will be able to edit `placement` if needed
  2246. // and refer to originalPlacement to know the original value
  2247. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  2248. popper.setAttribute('x-placement', placement);
  2249. // Apply `position` to popper before anything else because
  2250. // without the position applied we can't guarantee correct computations
  2251. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  2252. return options;
  2253. }
  2254. /**
  2255. * @function
  2256. * @memberof Popper.Utils
  2257. * @argument {Object} data - The data object generated by `update` method
  2258. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  2259. * @returns {Object} The popper's position offsets rounded
  2260. *
  2261. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  2262. * good as it can be within reason.
  2263. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  2264. *
  2265. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  2266. * as well on High DPI screens).
  2267. *
  2268. * Firefox prefers no rounding for positioning and does not have blurriness on
  2269. * high DPI screens.
  2270. *
  2271. * Only horizontal placement and left/right values need to be considered.
  2272. */
  2273. function getRoundedOffsets(data, shouldRound) {
  2274. var _data$offsets = data.offsets,
  2275. popper = _data$offsets.popper,
  2276. reference = _data$offsets.reference;
  2277. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  2278. var isVariation = data.placement.indexOf('-') !== -1;
  2279. var sameWidthOddness = reference.width % 2 === popper.width % 2;
  2280. var bothOddWidth = reference.width % 2 === 1 && popper.width % 2 === 1;
  2281. var noRound = function noRound(v) {
  2282. return v;
  2283. };
  2284. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthOddness ? Math.round : Math.floor;
  2285. var verticalToInteger = !shouldRound ? noRound : Math.round;
  2286. return {
  2287. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  2288. top: verticalToInteger(popper.top),
  2289. bottom: verticalToInteger(popper.bottom),
  2290. right: horizontalToInteger(popper.right)
  2291. };
  2292. }
  2293. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  2294. /**
  2295. * @function
  2296. * @memberof Modifiers
  2297. * @argument {Object} data - The data object generated by `update` method
  2298. * @argument {Object} options - Modifiers configuration and options
  2299. * @returns {Object} The data object, properly modified
  2300. */
  2301. function computeStyle(data, options) {
  2302. var x = options.x,
  2303. y = options.y;
  2304. var popper = data.offsets.popper;
  2305. // Remove this legacy support in Popper.js v2
  2306. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  2307. return modifier.name === 'applyStyle';
  2308. }).gpuAcceleration;
  2309. if (legacyGpuAccelerationOption !== undefined) {
  2310. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  2311. }
  2312. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  2313. var offsetParent = getOffsetParent(data.instance.popper);
  2314. var offsetParentRect = getBoundingClientRect(offsetParent);
  2315. // Styles
  2316. var styles = {
  2317. position: popper.position
  2318. };
  2319. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  2320. var sideA = x === 'bottom' ? 'top' : 'bottom';
  2321. var sideB = y === 'right' ? 'left' : 'right';
  2322. // if gpuAcceleration is set to `true` and transform is supported,
  2323. // we use `translate3d` to apply the position to the popper we
  2324. // automatically use the supported prefixed version if needed
  2325. var prefixedProperty = getSupportedPropertyName('transform');
  2326. // now, let's make a step back and look at this code closely (wtf?)
  2327. // If the content of the popper grows once it's been positioned, it
  2328. // may happen that the popper gets misplaced because of the new content
  2329. // overflowing its reference element
  2330. // To avoid this problem, we provide two options (x and y), which allow
  2331. // the consumer to define the offset origin.
  2332. // If we position a popper on top of a reference element, we can set
  2333. // `x` to `top` to make the popper grow towards its top instead of
  2334. // its bottom.
  2335. var left = void 0,
  2336. top = void 0;
  2337. if (sideA === 'bottom') {
  2338. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  2339. // and not the bottom of the html element
  2340. if (offsetParent.nodeName === 'HTML') {
  2341. top = -offsetParent.clientHeight + offsets.bottom;
  2342. } else {
  2343. top = -offsetParentRect.height + offsets.bottom;
  2344. }
  2345. } else {
  2346. top = offsets.top;
  2347. }
  2348. if (sideB === 'right') {
  2349. if (offsetParent.nodeName === 'HTML') {
  2350. left = -offsetParent.clientWidth + offsets.right;
  2351. } else {
  2352. left = -offsetParentRect.width + offsets.right;
  2353. }
  2354. } else {
  2355. left = offsets.left;
  2356. }
  2357. if (gpuAcceleration && prefixedProperty) {
  2358. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  2359. styles[sideA] = 0;
  2360. styles[sideB] = 0;
  2361. styles.willChange = 'transform';
  2362. } else {
  2363. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  2364. var invertTop = sideA === 'bottom' ? -1 : 1;
  2365. var invertLeft = sideB === 'right' ? -1 : 1;
  2366. styles[sideA] = top * invertTop;
  2367. styles[sideB] = left * invertLeft;
  2368. styles.willChange = sideA + ', ' + sideB;
  2369. }
  2370. // Attributes
  2371. var attributes = {
  2372. 'x-placement': data.placement
  2373. };
  2374. // Update `data` attributes, styles and arrowStyles
  2375. data.attributes = _extends({}, attributes, data.attributes);
  2376. data.styles = _extends({}, styles, data.styles);
  2377. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  2378. return data;
  2379. }
  2380. /**
  2381. * Helper used to know if the given modifier depends from another one.<br />
  2382. * It checks if the needed modifier is listed and enabled.
  2383. * @method
  2384. * @memberof Popper.Utils
  2385. * @param {Array} modifiers - list of modifiers
  2386. * @param {String} requestingName - name of requesting modifier
  2387. * @param {String} requestedName - name of requested modifier
  2388. * @returns {Boolean}
  2389. */
  2390. function isModifierRequired(modifiers, requestingName, requestedName) {
  2391. var requesting = find(modifiers, function (_ref) {
  2392. var name = _ref.name;
  2393. return name === requestingName;
  2394. });
  2395. var isRequired = !!requesting && modifiers.some(function (modifier) {
  2396. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  2397. });
  2398. if (!isRequired) {
  2399. var _requesting = '`' + requestingName + '`';
  2400. var requested = '`' + requestedName + '`';
  2401. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  2402. }
  2403. return isRequired;
  2404. }
  2405. /**
  2406. * @function
  2407. * @memberof Modifiers
  2408. * @argument {Object} data - The data object generated by update method
  2409. * @argument {Object} options - Modifiers configuration and options
  2410. * @returns {Object} The data object, properly modified
  2411. */
  2412. function arrow(data, options) {
  2413. var _data$offsets$arrow;
  2414. // arrow depends on keepTogether in order to work
  2415. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  2416. return data;
  2417. }
  2418. var arrowElement = options.element;
  2419. // if arrowElement is a string, suppose it's a CSS selector
  2420. if (typeof arrowElement === 'string') {
  2421. arrowElement = data.instance.popper.querySelector(arrowElement);
  2422. // if arrowElement is not found, don't run the modifier
  2423. if (!arrowElement) {
  2424. return data;
  2425. }
  2426. } else {
  2427. // if the arrowElement isn't a query selector we must check that the
  2428. // provided DOM node is child of its popper node
  2429. if (!data.instance.popper.contains(arrowElement)) {
  2430. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  2431. return data;
  2432. }
  2433. }
  2434. var placement = data.placement.split('-')[0];
  2435. var _data$offsets = data.offsets,
  2436. popper = _data$offsets.popper,
  2437. reference = _data$offsets.reference;
  2438. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  2439. var len = isVertical ? 'height' : 'width';
  2440. var sideCapitalized = isVertical ? 'Top' : 'Left';
  2441. var side = sideCapitalized.toLowerCase();
  2442. var altSide = isVertical ? 'left' : 'top';
  2443. var opSide = isVertical ? 'bottom' : 'right';
  2444. var arrowElementSize = getOuterSizes(arrowElement)[len];
  2445. //
  2446. // extends keepTogether behavior making sure the popper and its
  2447. // reference have enough pixels in conjunction
  2448. //
  2449. // top/left side
  2450. if (reference[opSide] - arrowElementSize < popper[side]) {
  2451. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  2452. }
  2453. // bottom/right side
  2454. if (reference[side] + arrowElementSize > popper[opSide]) {
  2455. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  2456. }
  2457. data.offsets.popper = getClientRect(data.offsets.popper);
  2458. // compute center of the popper
  2459. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  2460. // Compute the sideValue using the updated popper offsets
  2461. // take popper margin in account because we don't have this info available
  2462. var css = getStyleComputedProperty(data.instance.popper);
  2463. var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
  2464. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
  2465. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  2466. // prevent arrowElement from being placed not contiguously to its popper
  2467. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  2468. data.arrowElement = arrowElement;
  2469. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  2470. return data;
  2471. }
  2472. /**
  2473. * Get the opposite placement variation of the given one
  2474. * @method
  2475. * @memberof Popper.Utils
  2476. * @argument {String} placement variation
  2477. * @returns {String} flipped placement variation
  2478. */
  2479. function getOppositeVariation(variation) {
  2480. if (variation === 'end') {
  2481. return 'start';
  2482. } else if (variation === 'start') {
  2483. return 'end';
  2484. }
  2485. return variation;
  2486. }
  2487. /**
  2488. * List of accepted placements to use as values of the `placement` option.<br />
  2489. * Valid placements are:
  2490. * - `auto`
  2491. * - `top`
  2492. * - `right`
  2493. * - `bottom`
  2494. * - `left`
  2495. *
  2496. * Each placement can have a variation from this list:
  2497. * - `-start`
  2498. * - `-end`
  2499. *
  2500. * Variations are interpreted easily if you think of them as the left to right
  2501. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  2502. * is right.<br />
  2503. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  2504. *
  2505. * Some valid examples are:
  2506. * - `top-end` (on top of reference, right aligned)
  2507. * - `right-start` (on right of reference, top aligned)
  2508. * - `bottom` (on bottom, centered)
  2509. * - `auto-end` (on the side with more space available, alignment depends by placement)
  2510. *
  2511. * @static
  2512. * @type {Array}
  2513. * @enum {String}
  2514. * @readonly
  2515. * @method placements
  2516. * @memberof Popper
  2517. */
  2518. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  2519. // Get rid of `auto` `auto-start` and `auto-end`
  2520. var validPlacements = placements.slice(3);
  2521. /**
  2522. * Given an initial placement, returns all the subsequent placements
  2523. * clockwise (or counter-clockwise).
  2524. *
  2525. * @method
  2526. * @memberof Popper.Utils
  2527. * @argument {String} placement - A valid placement (it accepts variations)
  2528. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  2529. * @returns {Array} placements including their variations
  2530. */
  2531. function clockwise(placement) {
  2532. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2533. var index = validPlacements.indexOf(placement);
  2534. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  2535. return counter ? arr.reverse() : arr;
  2536. }
  2537. var BEHAVIORS = {
  2538. FLIP: 'flip',
  2539. CLOCKWISE: 'clockwise',
  2540. COUNTERCLOCKWISE: 'counterclockwise'
  2541. };
  2542. /**
  2543. * @function
  2544. * @memberof Modifiers
  2545. * @argument {Object} data - The data object generated by update method
  2546. * @argument {Object} options - Modifiers configuration and options
  2547. * @returns {Object} The data object, properly modified
  2548. */
  2549. function flip(data, options) {
  2550. // if `inner` modifier is enabled, we can't use the `flip` modifier
  2551. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  2552. return data;
  2553. }
  2554. if (data.flipped && data.placement === data.originalPlacement) {
  2555. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  2556. return data;
  2557. }
  2558. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  2559. var placement = data.placement.split('-')[0];
  2560. var placementOpposite = getOppositePlacement(placement);
  2561. var variation = data.placement.split('-')[1] || '';
  2562. var flipOrder = [];
  2563. switch (options.behavior) {
  2564. case BEHAVIORS.FLIP:
  2565. flipOrder = [placement, placementOpposite];
  2566. break;
  2567. case BEHAVIORS.CLOCKWISE:
  2568. flipOrder = clockwise(placement);
  2569. break;
  2570. case BEHAVIORS.COUNTERCLOCKWISE:
  2571. flipOrder = clockwise(placement, true);
  2572. break;
  2573. default:
  2574. flipOrder = options.behavior;
  2575. }
  2576. flipOrder.forEach(function (step, index) {
  2577. if (placement !== step || flipOrder.length === index + 1) {
  2578. return data;
  2579. }
  2580. placement = data.placement.split('-')[0];
  2581. placementOpposite = getOppositePlacement(placement);
  2582. var popperOffsets = data.offsets.popper;
  2583. var refOffsets = data.offsets.reference;
  2584. // using floor because the reference offsets may contain decimals we are not going to consider here
  2585. var floor = Math.floor;
  2586. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  2587. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  2588. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  2589. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  2590. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  2591. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  2592. // flip the variation if required
  2593. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  2594. var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  2595. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  2596. // this boolean to detect any flip loop
  2597. data.flipped = true;
  2598. if (overlapsRef || overflowsBoundaries) {
  2599. placement = flipOrder[index + 1];
  2600. }
  2601. if (flippedVariation) {
  2602. variation = getOppositeVariation(variation);
  2603. }
  2604. data.placement = placement + (variation ? '-' + variation : '');
  2605. // this object contains `position`, we want to preserve it along with
  2606. // any additional property we may add in the future
  2607. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  2608. data = runModifiers(data.instance.modifiers, data, 'flip');
  2609. }
  2610. });
  2611. return data;
  2612. }
  2613. /**
  2614. * @function
  2615. * @memberof Modifiers
  2616. * @argument {Object} data - The data object generated by update method
  2617. * @argument {Object} options - Modifiers configuration and options
  2618. * @returns {Object} The data object, properly modified
  2619. */
  2620. function keepTogether(data) {
  2621. var _data$offsets = data.offsets,
  2622. popper = _data$offsets.popper,
  2623. reference = _data$offsets.reference;
  2624. var placement = data.placement.split('-')[0];
  2625. var floor = Math.floor;
  2626. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  2627. var side = isVertical ? 'right' : 'bottom';
  2628. var opSide = isVertical ? 'left' : 'top';
  2629. var measurement = isVertical ? 'width' : 'height';
  2630. if (popper[side] < floor(reference[opSide])) {
  2631. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  2632. }
  2633. if (popper[opSide] > floor(reference[side])) {
  2634. data.offsets.popper[opSide] = floor(reference[side]);
  2635. }
  2636. return data;
  2637. }
  2638. /**
  2639. * Converts a string containing value + unit into a px value number
  2640. * @function
  2641. * @memberof {modifiers~offset}
  2642. * @private
  2643. * @argument {String} str - Value + unit string
  2644. * @argument {String} measurement - `height` or `width`
  2645. * @argument {Object} popperOffsets
  2646. * @argument {Object} referenceOffsets
  2647. * @returns {Number|String}
  2648. * Value in pixels, or original string if no values were extracted
  2649. */
  2650. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  2651. // separate value from unit
  2652. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  2653. var value = +split[1];
  2654. var unit = split[2];
  2655. // If it's not a number it's an operator, I guess
  2656. if (!value) {
  2657. return str;
  2658. }
  2659. if (unit.indexOf('%') === 0) {
  2660. var element = void 0;
  2661. switch (unit) {
  2662. case '%p':
  2663. element = popperOffsets;
  2664. break;
  2665. case '%':
  2666. case '%r':
  2667. default:
  2668. element = referenceOffsets;
  2669. }
  2670. var rect = getClientRect(element);
  2671. return rect[measurement] / 100 * value;
  2672. } else if (unit === 'vh' || unit === 'vw') {
  2673. // if is a vh or vw, we calculate the size based on the viewport
  2674. var size = void 0;
  2675. if (unit === 'vh') {
  2676. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  2677. } else {
  2678. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  2679. }
  2680. return size / 100 * value;
  2681. } else {
  2682. // if is an explicit pixel unit, we get rid of the unit and keep the value
  2683. // if is an implicit unit, it's px, and we return just the value
  2684. return value;
  2685. }
  2686. }
  2687. /**
  2688. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  2689. * @function
  2690. * @memberof {modifiers~offset}
  2691. * @private
  2692. * @argument {String} offset
  2693. * @argument {Object} popperOffsets
  2694. * @argument {Object} referenceOffsets
  2695. * @argument {String} basePlacement
  2696. * @returns {Array} a two cells array with x and y offsets in numbers
  2697. */
  2698. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  2699. var offsets = [0, 0];
  2700. // Use height if placement is left or right and index is 0 otherwise use width
  2701. // in this way the first offset will use an axis and the second one
  2702. // will use the other one
  2703. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  2704. // Split the offset string to obtain a list of values and operands
  2705. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  2706. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  2707. return frag.trim();
  2708. });
  2709. // Detect if the offset string contains a pair of values or a single one
  2710. // they could be separated by comma or space
  2711. var divider = fragments.indexOf(find(fragments, function (frag) {
  2712. return frag.search(/,|\s/) !== -1;
  2713. }));
  2714. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  2715. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  2716. }
  2717. // If divider is found, we divide the list of values and operands to divide
  2718. // them by ofset X and Y.
  2719. var splitRegex = /\s*,\s*|\s+/;
  2720. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  2721. // Convert the values with units to absolute pixels to allow our computations
  2722. ops = ops.map(function (op, index) {
  2723. // Most of the units rely on the orientation of the popper
  2724. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  2725. var mergeWithPrevious = false;
  2726. return op
  2727. // This aggregates any `+` or `-` sign that aren't considered operators
  2728. // e.g.: 10 + +5 => [10, +, +5]
  2729. .reduce(function (a, b) {
  2730. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  2731. a[a.length - 1] = b;
  2732. mergeWithPrevious = true;
  2733. return a;
  2734. } else if (mergeWithPrevious) {
  2735. a[a.length - 1] += b;
  2736. mergeWithPrevious = false;
  2737. return a;
  2738. } else {
  2739. return a.concat(b);
  2740. }
  2741. }, [])
  2742. // Here we convert the string values into number values (in px)
  2743. .map(function (str) {
  2744. return toValue(str, measurement, popperOffsets, referenceOffsets);
  2745. });
  2746. });
  2747. // Loop trough the offsets arrays and execute the operations
  2748. ops.forEach(function (op, index) {
  2749. op.forEach(function (frag, index2) {
  2750. if (isNumeric(frag)) {
  2751. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  2752. }
  2753. });
  2754. });
  2755. return offsets;
  2756. }
  2757. /**
  2758. * @function
  2759. * @memberof Modifiers
  2760. * @argument {Object} data - The data object generated by update method
  2761. * @argument {Object} options - Modifiers configuration and options
  2762. * @argument {Number|String} options.offset=0
  2763. * The offset value as described in the modifier description
  2764. * @returns {Object} The data object, properly modified
  2765. */
  2766. function offset(data, _ref) {
  2767. var offset = _ref.offset;
  2768. var placement = data.placement,
  2769. _data$offsets = data.offsets,
  2770. popper = _data$offsets.popper,
  2771. reference = _data$offsets.reference;
  2772. var basePlacement = placement.split('-')[0];
  2773. var offsets = void 0;
  2774. if (isNumeric(+offset)) {
  2775. offsets = [+offset, 0];
  2776. } else {
  2777. offsets = parseOffset(offset, popper, reference, basePlacement);
  2778. }
  2779. if (basePlacement === 'left') {
  2780. popper.top += offsets[0];
  2781. popper.left -= offsets[1];
  2782. } else if (basePlacement === 'right') {
  2783. popper.top += offsets[0];
  2784. popper.left += offsets[1];
  2785. } else if (basePlacement === 'top') {
  2786. popper.left += offsets[0];
  2787. popper.top -= offsets[1];
  2788. } else if (basePlacement === 'bottom') {
  2789. popper.left += offsets[0];
  2790. popper.top += offsets[1];
  2791. }
  2792. data.popper = popper;
  2793. return data;
  2794. }
  2795. /**
  2796. * @function
  2797. * @memberof Modifiers
  2798. * @argument {Object} data - The data object generated by `update` method
  2799. * @argument {Object} options - Modifiers configuration and options
  2800. * @returns {Object} The data object, properly modified
  2801. */
  2802. function preventOverflow(data, options) {
  2803. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  2804. // If offsetParent is the reference element, we really want to
  2805. // go one step up and use the next offsetParent as reference to
  2806. // avoid to make this modifier completely useless and look like broken
  2807. if (data.instance.reference === boundariesElement) {
  2808. boundariesElement = getOffsetParent(boundariesElement);
  2809. }
  2810. // NOTE: DOM access here
  2811. // resets the popper's position so that the document size can be calculated excluding
  2812. // the size of the popper element itself
  2813. var transformProp = getSupportedPropertyName('transform');
  2814. var popperStyles = data.instance.popper.style; // assignment to help minification
  2815. var top = popperStyles.top,
  2816. left = popperStyles.left,
  2817. transform = popperStyles[transformProp];
  2818. popperStyles.top = '';
  2819. popperStyles.left = '';
  2820. popperStyles[transformProp] = '';
  2821. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  2822. // NOTE: DOM access here
  2823. // restores the original style properties after the offsets have been computed
  2824. popperStyles.top = top;
  2825. popperStyles.left = left;
  2826. popperStyles[transformProp] = transform;
  2827. options.boundaries = boundaries;
  2828. var order = options.priority;
  2829. var popper = data.offsets.popper;
  2830. var check = {
  2831. primary: function primary(placement) {
  2832. var value = popper[placement];
  2833. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  2834. value = Math.max(popper[placement], boundaries[placement]);
  2835. }
  2836. return defineProperty({}, placement, value);
  2837. },
  2838. secondary: function secondary(placement) {
  2839. var mainSide = placement === 'right' ? 'left' : 'top';
  2840. var value = popper[mainSide];
  2841. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  2842. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  2843. }
  2844. return defineProperty({}, mainSide, value);
  2845. }
  2846. };
  2847. order.forEach(function (placement) {
  2848. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  2849. popper = _extends({}, popper, check[side](placement));
  2850. });
  2851. data.offsets.popper = popper;
  2852. return data;
  2853. }
  2854. /**
  2855. * @function
  2856. * @memberof Modifiers
  2857. * @argument {Object} data - The data object generated by `update` method
  2858. * @argument {Object} options - Modifiers configuration and options
  2859. * @returns {Object} The data object, properly modified
  2860. */
  2861. function shift(data) {
  2862. var placement = data.placement;
  2863. var basePlacement = placement.split('-')[0];
  2864. var shiftvariation = placement.split('-')[1];
  2865. // if shift shiftvariation is specified, run the modifier
  2866. if (shiftvariation) {
  2867. var _data$offsets = data.offsets,
  2868. reference = _data$offsets.reference,
  2869. popper = _data$offsets.popper;
  2870. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  2871. var side = isVertical ? 'left' : 'top';
  2872. var measurement = isVertical ? 'width' : 'height';
  2873. var shiftOffsets = {
  2874. start: defineProperty({}, side, reference[side]),
  2875. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  2876. };
  2877. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  2878. }
  2879. return data;
  2880. }
  2881. /**
  2882. * @function
  2883. * @memberof Modifiers
  2884. * @argument {Object} data - The data object generated by update method
  2885. * @argument {Object} options - Modifiers configuration and options
  2886. * @returns {Object} The data object, properly modified
  2887. */
  2888. function hide(data) {
  2889. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  2890. return data;
  2891. }
  2892. var refRect = data.offsets.reference;
  2893. var bound = find(data.instance.modifiers, function (modifier) {
  2894. return modifier.name === 'preventOverflow';
  2895. }).boundaries;
  2896. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  2897. // Avoid unnecessary DOM access if visibility hasn't changed
  2898. if (data.hide === true) {
  2899. return data;
  2900. }
  2901. data.hide = true;
  2902. data.attributes['x-out-of-boundaries'] = '';
  2903. } else {
  2904. // Avoid unnecessary DOM access if visibility hasn't changed
  2905. if (data.hide === false) {
  2906. return data;
  2907. }
  2908. data.hide = false;
  2909. data.attributes['x-out-of-boundaries'] = false;
  2910. }
  2911. return data;
  2912. }
  2913. /**
  2914. * @function
  2915. * @memberof Modifiers
  2916. * @argument {Object} data - The data object generated by `update` method
  2917. * @argument {Object} options - Modifiers configuration and options
  2918. * @returns {Object} The data object, properly modified
  2919. */
  2920. function inner(data) {
  2921. var placement = data.placement;
  2922. var basePlacement = placement.split('-')[0];
  2923. var _data$offsets = data.offsets,
  2924. popper = _data$offsets.popper,
  2925. reference = _data$offsets.reference;
  2926. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  2927. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  2928. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  2929. data.placement = getOppositePlacement(placement);
  2930. data.offsets.popper = getClientRect(popper);
  2931. return data;
  2932. }
  2933. /**
  2934. * Modifier function, each modifier can have a function of this type assigned
  2935. * to its `fn` property.<br />
  2936. * These functions will be called on each update, this means that you must
  2937. * make sure they are performant enough to avoid performance bottlenecks.
  2938. *
  2939. * @function ModifierFn
  2940. * @argument {dataObject} data - The data object generated by `update` method
  2941. * @argument {Object} options - Modifiers configuration and options
  2942. * @returns {dataObject} The data object, properly modified
  2943. */
  2944. /**
  2945. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  2946. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  2947. * needed by the library.
  2948. *
  2949. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  2950. * All the other properties are configurations that could be tweaked.
  2951. * @namespace modifiers
  2952. */
  2953. var modifiers = {
  2954. /**
  2955. * Modifier used to shift the popper on the start or end of its reference
  2956. * element.<br />
  2957. * It will read the variation of the `placement` property.<br />
  2958. * It can be one either `-end` or `-start`.
  2959. * @memberof modifiers
  2960. * @inner
  2961. */
  2962. shift: {
  2963. /** @prop {number} order=100 - Index used to define the order of execution */
  2964. order: 100,
  2965. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  2966. enabled: true,
  2967. /** @prop {ModifierFn} */
  2968. fn: shift
  2969. },
  2970. /**
  2971. * The `offset` modifier can shift your popper on both its axis.
  2972. *
  2973. * It accepts the following units:
  2974. * - `px` or unit-less, interpreted as pixels
  2975. * - `%` or `%r`, percentage relative to the length of the reference element
  2976. * - `%p`, percentage relative to the length of the popper element
  2977. * - `vw`, CSS viewport width unit
  2978. * - `vh`, CSS viewport height unit
  2979. *
  2980. * For length is intended the main axis relative to the placement of the popper.<br />
  2981. * This means that if the placement is `top` or `bottom`, the length will be the
  2982. * `width`. In case of `left` or `right`, it will be the `height`.
  2983. *
  2984. * You can provide a single value (as `Number` or `String`), or a pair of values
  2985. * as `String` divided by a comma or one (or more) white spaces.<br />
  2986. * The latter is a deprecated method because it leads to confusion and will be
  2987. * removed in v2.<br />
  2988. * Additionally, it accepts additions and subtractions between different units.
  2989. * Note that multiplications and divisions aren't supported.
  2990. *
  2991. * Valid examples are:
  2992. * ```
  2993. * 10
  2994. * '10%'
  2995. * '10, 10'
  2996. * '10%, 10'
  2997. * '10 + 10%'
  2998. * '10 - 5vh + 3%'
  2999. * '-10px + 5vh, 5px - 6%'
  3000. * ```
  3001. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  3002. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  3003. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  3004. *
  3005. * @memberof modifiers
  3006. * @inner
  3007. */
  3008. offset: {
  3009. /** @prop {number} order=200 - Index used to define the order of execution */
  3010. order: 200,
  3011. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3012. enabled: true,
  3013. /** @prop {ModifierFn} */
  3014. fn: offset,
  3015. /** @prop {Number|String} offset=0
  3016. * The offset value as described in the modifier description
  3017. */
  3018. offset: 0
  3019. },
  3020. /**
  3021. * Modifier used to prevent the popper from being positioned outside the boundary.
  3022. *
  3023. * A scenario exists where the reference itself is not within the boundaries.<br />
  3024. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  3025. * In this case we need to decide whether the popper should either:
  3026. *
  3027. * - detach from the reference and remain "trapped" in the boundaries, or
  3028. * - if it should ignore the boundary and "escape with its reference"
  3029. *
  3030. * When `escapeWithReference` is set to`true` and reference is completely
  3031. * outside its boundaries, the popper will overflow (or completely leave)
  3032. * the boundaries in order to remain attached to the edge of the reference.
  3033. *
  3034. * @memberof modifiers
  3035. * @inner
  3036. */
  3037. preventOverflow: {
  3038. /** @prop {number} order=300 - Index used to define the order of execution */
  3039. order: 300,
  3040. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3041. enabled: true,
  3042. /** @prop {ModifierFn} */
  3043. fn: preventOverflow,
  3044. /**
  3045. * @prop {Array} [priority=['left','right','top','bottom']]
  3046. * Popper will try to prevent overflow following these priorities by default,
  3047. * then, it could overflow on the left and on top of the `boundariesElement`
  3048. */
  3049. priority: ['left', 'right', 'top', 'bottom'],
  3050. /**
  3051. * @prop {number} padding=5
  3052. * Amount of pixel used to define a minimum distance between the boundaries
  3053. * and the popper. This makes sure the popper always has a little padding
  3054. * between the edges of its container
  3055. */
  3056. padding: 5,
  3057. /**
  3058. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  3059. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  3060. * `viewport` or any DOM element.
  3061. */
  3062. boundariesElement: 'scrollParent'
  3063. },
  3064. /**
  3065. * Modifier used to make sure the reference and its popper stay near each other
  3066. * without leaving any gap between the two. Especially useful when the arrow is
  3067. * enabled and you want to ensure that it points to its reference element.
  3068. * It cares only about the first axis. You can still have poppers with margin
  3069. * between the popper and its reference element.
  3070. * @memberof modifiers
  3071. * @inner
  3072. */
  3073. keepTogether: {
  3074. /** @prop {number} order=400 - Index used to define the order of execution */
  3075. order: 400,
  3076. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3077. enabled: true,
  3078. /** @prop {ModifierFn} */
  3079. fn: keepTogether
  3080. },
  3081. /**
  3082. * This modifier is used to move the `arrowElement` of the popper to make
  3083. * sure it is positioned between the reference element and its popper element.
  3084. * It will read the outer size of the `arrowElement` node to detect how many
  3085. * pixels of conjunction are needed.
  3086. *
  3087. * It has no effect if no `arrowElement` is provided.
  3088. * @memberof modifiers
  3089. * @inner
  3090. */
  3091. arrow: {
  3092. /** @prop {number} order=500 - Index used to define the order of execution */
  3093. order: 500,
  3094. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3095. enabled: true,
  3096. /** @prop {ModifierFn} */
  3097. fn: arrow,
  3098. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  3099. element: '[x-arrow]'
  3100. },
  3101. /**
  3102. * Modifier used to flip the popper's placement when it starts to overlap its
  3103. * reference element.
  3104. *
  3105. * Requires the `preventOverflow` modifier before it in order to work.
  3106. *
  3107. * **NOTE:** this modifier will interrupt the current update cycle and will
  3108. * restart it if it detects the need to flip the placement.
  3109. * @memberof modifiers
  3110. * @inner
  3111. */
  3112. flip: {
  3113. /** @prop {number} order=600 - Index used to define the order of execution */
  3114. order: 600,
  3115. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3116. enabled: true,
  3117. /** @prop {ModifierFn} */
  3118. fn: flip,
  3119. /**
  3120. * @prop {String|Array} behavior='flip'
  3121. * The behavior used to change the popper's placement. It can be one of
  3122. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  3123. * placements (with optional variations)
  3124. */
  3125. behavior: 'flip',
  3126. /**
  3127. * @prop {number} padding=5
  3128. * The popper will flip if it hits the edges of the `boundariesElement`
  3129. */
  3130. padding: 5,
  3131. /**
  3132. * @prop {String|HTMLElement} boundariesElement='viewport'
  3133. * The element which will define the boundaries of the popper position.
  3134. * The popper will never be placed outside of the defined boundaries
  3135. * (except if `keepTogether` is enabled)
  3136. */
  3137. boundariesElement: 'viewport'
  3138. },
  3139. /**
  3140. * Modifier used to make the popper flow toward the inner of the reference element.
  3141. * By default, when this modifier is disabled, the popper will be placed outside
  3142. * the reference element.
  3143. * @memberof modifiers
  3144. * @inner
  3145. */
  3146. inner: {
  3147. /** @prop {number} order=700 - Index used to define the order of execution */
  3148. order: 700,
  3149. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  3150. enabled: false,
  3151. /** @prop {ModifierFn} */
  3152. fn: inner
  3153. },
  3154. /**
  3155. * Modifier used to hide the popper when its reference element is outside of the
  3156. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  3157. * be used to hide with a CSS selector the popper when its reference is
  3158. * out of boundaries.
  3159. *
  3160. * Requires the `preventOverflow` modifier before it in order to work.
  3161. * @memberof modifiers
  3162. * @inner
  3163. */
  3164. hide: {
  3165. /** @prop {number} order=800 - Index used to define the order of execution */
  3166. order: 800,
  3167. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3168. enabled: true,
  3169. /** @prop {ModifierFn} */
  3170. fn: hide
  3171. },
  3172. /**
  3173. * Computes the style that will be applied to the popper element to gets
  3174. * properly positioned.
  3175. *
  3176. * Note that this modifier will not touch the DOM, it just prepares the styles
  3177. * so that `applyStyle` modifier can apply it. This separation is useful
  3178. * in case you need to replace `applyStyle` with a custom implementation.
  3179. *
  3180. * This modifier has `850` as `order` value to maintain backward compatibility
  3181. * with previous versions of Popper.js. Expect the modifiers ordering method
  3182. * to change in future major versions of the library.
  3183. *
  3184. * @memberof modifiers
  3185. * @inner
  3186. */
  3187. computeStyle: {
  3188. /** @prop {number} order=850 - Index used to define the order of execution */
  3189. order: 850,
  3190. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3191. enabled: true,
  3192. /** @prop {ModifierFn} */
  3193. fn: computeStyle,
  3194. /**
  3195. * @prop {Boolean} gpuAcceleration=true
  3196. * If true, it uses the CSS 3D transformation to position the popper.
  3197. * Otherwise, it will use the `top` and `left` properties
  3198. */
  3199. gpuAcceleration: true,
  3200. /**
  3201. * @prop {string} [x='bottom']
  3202. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  3203. * Change this if your popper should grow in a direction different from `bottom`
  3204. */
  3205. x: 'bottom',
  3206. /**
  3207. * @prop {string} [x='left']
  3208. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  3209. * Change this if your popper should grow in a direction different from `right`
  3210. */
  3211. y: 'right'
  3212. },
  3213. /**
  3214. * Applies the computed styles to the popper element.
  3215. *
  3216. * All the DOM manipulations are limited to this modifier. This is useful in case
  3217. * you want to integrate Popper.js inside a framework or view library and you
  3218. * want to delegate all the DOM manipulations to it.
  3219. *
  3220. * Note that if you disable this modifier, you must make sure the popper element
  3221. * has its position set to `absolute` before Popper.js can do its work!
  3222. *
  3223. * Just disable this modifier and define your own to achieve the desired effect.
  3224. *
  3225. * @memberof modifiers
  3226. * @inner
  3227. */
  3228. applyStyle: {
  3229. /** @prop {number} order=900 - Index used to define the order of execution */
  3230. order: 900,
  3231. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  3232. enabled: true,
  3233. /** @prop {ModifierFn} */
  3234. fn: applyStyle,
  3235. /** @prop {Function} */
  3236. onLoad: applyStyleOnLoad,
  3237. /**
  3238. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  3239. * @prop {Boolean} gpuAcceleration=true
  3240. * If true, it uses the CSS 3D transformation to position the popper.
  3241. * Otherwise, it will use the `top` and `left` properties
  3242. */
  3243. gpuAcceleration: undefined
  3244. }
  3245. };
  3246. /**
  3247. * The `dataObject` is an object containing all the information used by Popper.js.
  3248. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  3249. * @name dataObject
  3250. * @property {Object} data.instance The Popper.js instance
  3251. * @property {String} data.placement Placement applied to popper
  3252. * @property {String} data.originalPlacement Placement originally defined on init
  3253. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  3254. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  3255. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  3256. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  3257. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  3258. * @property {Object} data.boundaries Offsets of the popper boundaries
  3259. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  3260. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  3261. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  3262. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  3263. */
  3264. /**
  3265. * Default options provided to Popper.js constructor.<br />
  3266. * These can be overridden using the `options` argument of Popper.js.<br />
  3267. * To override an option, simply pass an object with the same
  3268. * structure of the `options` object, as the 3rd argument. For example:
  3269. * ```
  3270. * new Popper(ref, pop, {
  3271. * modifiers: {
  3272. * preventOverflow: { enabled: false }
  3273. * }
  3274. * })
  3275. * ```
  3276. * @type {Object}
  3277. * @static
  3278. * @memberof Popper
  3279. */
  3280. var Defaults = {
  3281. /**
  3282. * Popper's placement.
  3283. * @prop {Popper.placements} placement='bottom'
  3284. */
  3285. placement: 'bottom',
  3286. /**
  3287. * Set this to true if you want popper to position it self in 'fixed' mode
  3288. * @prop {Boolean} positionFixed=false
  3289. */
  3290. positionFixed: false,
  3291. /**
  3292. * Whether events (resize, scroll) are initially enabled.
  3293. * @prop {Boolean} eventsEnabled=true
  3294. */
  3295. eventsEnabled: true,
  3296. /**
  3297. * Set to true if you want to automatically remove the popper when
  3298. * you call the `destroy` method.
  3299. * @prop {Boolean} removeOnDestroy=false
  3300. */
  3301. removeOnDestroy: false,
  3302. /**
  3303. * Callback called when the popper is created.<br />
  3304. * By default, it is set to no-op.<br />
  3305. * Access Popper.js instance with `data.instance`.
  3306. * @prop {onCreate}
  3307. */
  3308. onCreate: function onCreate() {},
  3309. /**
  3310. * Callback called when the popper is updated. This callback is not called
  3311. * on the initialization/creation of the popper, but only on subsequent
  3312. * updates.<br />
  3313. * By default, it is set to no-op.<br />
  3314. * Access Popper.js instance with `data.instance`.
  3315. * @prop {onUpdate}
  3316. */
  3317. onUpdate: function onUpdate() {},
  3318. /**
  3319. * List of modifiers used to modify the offsets before they are applied to the popper.
  3320. * They provide most of the functionalities of Popper.js.
  3321. * @prop {modifiers}
  3322. */
  3323. modifiers: modifiers
  3324. };
  3325. /**
  3326. * @callback onCreate
  3327. * @param {dataObject} data
  3328. */
  3329. /**
  3330. * @callback onUpdate
  3331. * @param {dataObject} data
  3332. */
  3333. // Utils
  3334. // Methods
  3335. var Popper = function () {
  3336. /**
  3337. * Creates a new Popper.js instance.
  3338. * @class Popper
  3339. * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
  3340. * @param {HTMLElement} popper - The HTML element used as the popper
  3341. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  3342. * @return {Object} instance - The generated Popper.js instance
  3343. */
  3344. function Popper(reference, popper) {
  3345. var _this = this;
  3346. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3347. classCallCheck(this, Popper);
  3348. this.scheduleUpdate = function () {
  3349. return requestAnimationFrame(_this.update);
  3350. };
  3351. // make update() debounced, so that it only runs at most once-per-tick
  3352. this.update = debounce(this.update.bind(this));
  3353. // with {} we create a new object with the options inside it
  3354. this.options = _extends({}, Popper.Defaults, options);
  3355. // init state
  3356. this.state = {
  3357. isDestroyed: false,
  3358. isCreated: false,
  3359. scrollParents: []
  3360. };
  3361. // get reference and popper elements (allow jQuery wrappers)
  3362. this.reference = reference && reference.jquery ? reference[0] : reference;
  3363. this.popper = popper && popper.jquery ? popper[0] : popper;
  3364. // Deep merge modifiers options
  3365. this.options.modifiers = {};
  3366. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  3367. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  3368. });
  3369. // Refactoring modifiers' list (Object => Array)
  3370. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  3371. return _extends({
  3372. name: name
  3373. }, _this.options.modifiers[name]);
  3374. })
  3375. // sort the modifiers by order
  3376. .sort(function (a, b) {
  3377. return a.order - b.order;
  3378. });
  3379. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  3380. // such code is executed in the same order of its modifier
  3381. // they could add new properties to their options configuration
  3382. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  3383. this.modifiers.forEach(function (modifierOptions) {
  3384. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  3385. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  3386. }
  3387. });
  3388. // fire the first update to position the popper in the right place
  3389. this.update();
  3390. var eventsEnabled = this.options.eventsEnabled;
  3391. if (eventsEnabled) {
  3392. // setup event listeners, they will take care of update the position in specific situations
  3393. this.enableEventListeners();
  3394. }
  3395. this.state.eventsEnabled = eventsEnabled;
  3396. }
  3397. // We can't use class properties because they don't get listed in the
  3398. // class prototype and break stuff like Sinon stubs
  3399. createClass(Popper, [{
  3400. key: 'update',
  3401. value: function update$$1() {
  3402. return update.call(this);
  3403. }
  3404. }, {
  3405. key: 'destroy',
  3406. value: function destroy$$1() {
  3407. return destroy.call(this);
  3408. }
  3409. }, {
  3410. key: 'enableEventListeners',
  3411. value: function enableEventListeners$$1() {
  3412. return enableEventListeners.call(this);
  3413. }
  3414. }, {
  3415. key: 'disableEventListeners',
  3416. value: function disableEventListeners$$1() {
  3417. return disableEventListeners.call(this);
  3418. }
  3419. /**
  3420. * Schedules an update. It will run on the next UI update available.
  3421. * @method scheduleUpdate
  3422. * @memberof Popper
  3423. */
  3424. /**
  3425. * Collection of utilities useful when writing custom modifiers.
  3426. * Starting from version 1.7, this method is available only if you
  3427. * include `popper-utils.js` before `popper.js`.
  3428. *
  3429. * **DEPRECATION**: This way to access PopperUtils is deprecated
  3430. * and will be removed in v2! Use the PopperUtils module directly instead.
  3431. * Due to the high instability of the methods contained in Utils, we can't
  3432. * guarantee them to follow semver. Use them at your own risk!
  3433. * @static
  3434. * @private
  3435. * @type {Object}
  3436. * @deprecated since version 1.8
  3437. * @member Utils
  3438. * @memberof Popper
  3439. */
  3440. }]);
  3441. return Popper;
  3442. }();
  3443. /**
  3444. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  3445. * and lets you use it as replacement of a real DOM node.<br />
  3446. * You can use this method to position a popper relatively to a set of coordinates
  3447. * in case you don't have a DOM node to use as reference.
  3448. *
  3449. * ```
  3450. * new Popper(referenceObject, popperNode);
  3451. * ```
  3452. *
  3453. * NB: This feature isn't supported in Internet Explorer 10.
  3454. * @name referenceObject
  3455. * @property {Function} data.getBoundingClientRect
  3456. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  3457. * @property {number} data.clientWidth
  3458. * An ES6 getter that will return the width of the virtual reference element.
  3459. * @property {number} data.clientHeight
  3460. * An ES6 getter that will return the height of the virtual reference element.
  3461. */
  3462. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  3463. Popper.placements = placements;
  3464. Popper.Defaults = Defaults;
  3465. /**
  3466. * ------------------------------------------------------------------------
  3467. * Constants
  3468. * ------------------------------------------------------------------------
  3469. */
  3470. var NAME$4 = 'dropdown';
  3471. var VERSION$4 = '4.2.1';
  3472. var DATA_KEY$4 = 'bs.dropdown';
  3473. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3474. var DATA_API_KEY$4 = '.data-api';
  3475. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3476. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3477. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3478. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3479. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3480. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3481. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3482. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3483. var Event$4 = {
  3484. HIDE: "hide" + EVENT_KEY$4,
  3485. HIDDEN: "hidden" + EVENT_KEY$4,
  3486. SHOW: "show" + EVENT_KEY$4,
  3487. SHOWN: "shown" + EVENT_KEY$4,
  3488. CLICK: "click" + EVENT_KEY$4,
  3489. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3490. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3491. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3492. };
  3493. var ClassName$4 = {
  3494. DISABLED: 'disabled',
  3495. SHOW: 'show',
  3496. DROPUP: 'dropup',
  3497. DROPRIGHT: 'dropright',
  3498. DROPLEFT: 'dropleft',
  3499. MENURIGHT: 'dropdown-menu-right',
  3500. MENULEFT: 'dropdown-menu-left',
  3501. POSITION_STATIC: 'position-static'
  3502. };
  3503. var Selector$4 = {
  3504. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3505. FORM_CHILD: '.dropdown form',
  3506. MENU: '.dropdown-menu',
  3507. NAVBAR_NAV: '.navbar-nav',
  3508. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3509. };
  3510. var AttachmentMap = {
  3511. TOP: 'top-start',
  3512. TOPEND: 'top-end',
  3513. BOTTOM: 'bottom-start',
  3514. BOTTOMEND: 'bottom-end',
  3515. RIGHT: 'right-start',
  3516. RIGHTEND: 'right-end',
  3517. LEFT: 'left-start',
  3518. LEFTEND: 'left-end'
  3519. };
  3520. var Default$2 = {
  3521. offset: 0,
  3522. flip: true,
  3523. boundary: 'scrollParent',
  3524. reference: 'toggle',
  3525. display: 'dynamic'
  3526. };
  3527. var DefaultType$2 = {
  3528. offset: '(number|string|function)',
  3529. flip: 'boolean',
  3530. boundary: '(string|element)',
  3531. reference: '(string|element)',
  3532. display: 'string'
  3533. /**
  3534. * ------------------------------------------------------------------------
  3535. * Class Definition
  3536. * ------------------------------------------------------------------------
  3537. */
  3538. };
  3539. var Dropdown =
  3540. /*#__PURE__*/
  3541. function () {
  3542. function Dropdown(element, config) {
  3543. this._element = element;
  3544. this._popper = null;
  3545. this._config = this._getConfig(config);
  3546. this._menu = this._getMenuElement();
  3547. this._inNavbar = this._detectNavbar();
  3548. this._addEventListeners();
  3549. } // Getters
  3550. var _proto = Dropdown.prototype;
  3551. // Public
  3552. _proto.toggle = function toggle() {
  3553. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3554. return;
  3555. }
  3556. var parent = Dropdown._getParentFromElement(this._element);
  3557. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3558. Dropdown._clearMenus();
  3559. if (isActive) {
  3560. return;
  3561. }
  3562. var relatedTarget = {
  3563. relatedTarget: this._element
  3564. };
  3565. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3566. $(parent).trigger(showEvent);
  3567. if (showEvent.isDefaultPrevented()) {
  3568. return;
  3569. } // Disable totally Popper.js for Dropdown in Navbar
  3570. if (!this._inNavbar) {
  3571. /**
  3572. * Check for Popper dependency
  3573. * Popper - https://popper.js.org
  3574. */
  3575. if (typeof Popper === 'undefined') {
  3576. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3577. }
  3578. var referenceElement = this._element;
  3579. if (this._config.reference === 'parent') {
  3580. referenceElement = parent;
  3581. } else if (Util.isElement(this._config.reference)) {
  3582. referenceElement = this._config.reference; // Check if it's jQuery element
  3583. if (typeof this._config.reference.jquery !== 'undefined') {
  3584. referenceElement = this._config.reference[0];
  3585. }
  3586. } // If boundary is not `scrollParent`, then set position to `static`
  3587. // to allow the menu to "escape" the scroll parent's boundaries
  3588. // https://github.com/twbs/bootstrap/issues/24251
  3589. if (this._config.boundary !== 'scrollParent') {
  3590. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3591. }
  3592. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3593. } // If this is a touch-enabled device we add extra
  3594. // empty mouseover listeners to the body's immediate children;
  3595. // only needed because of broken event delegation on iOS
  3596. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3597. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3598. $(document.body).children().on('mouseover', null, $.noop);
  3599. }
  3600. this._element.focus();
  3601. this._element.setAttribute('aria-expanded', true);
  3602. $(this._menu).toggleClass(ClassName$4.SHOW);
  3603. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3604. };
  3605. _proto.show = function show() {
  3606. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3607. return;
  3608. }
  3609. var relatedTarget = {
  3610. relatedTarget: this._element
  3611. };
  3612. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3613. var parent = Dropdown._getParentFromElement(this._element);
  3614. $(parent).trigger(showEvent);
  3615. if (showEvent.isDefaultPrevented()) {
  3616. return;
  3617. }
  3618. $(this._menu).toggleClass(ClassName$4.SHOW);
  3619. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3620. };
  3621. _proto.hide = function hide() {
  3622. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3623. return;
  3624. }
  3625. var relatedTarget = {
  3626. relatedTarget: this._element
  3627. };
  3628. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3629. var parent = Dropdown._getParentFromElement(this._element);
  3630. $(parent).trigger(hideEvent);
  3631. if (hideEvent.isDefaultPrevented()) {
  3632. return;
  3633. }
  3634. $(this._menu).toggleClass(ClassName$4.SHOW);
  3635. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3636. };
  3637. _proto.dispose = function dispose() {
  3638. $.removeData(this._element, DATA_KEY$4);
  3639. $(this._element).off(EVENT_KEY$4);
  3640. this._element = null;
  3641. this._menu = null;
  3642. if (this._popper !== null) {
  3643. this._popper.destroy();
  3644. this._popper = null;
  3645. }
  3646. };
  3647. _proto.update = function update() {
  3648. this._inNavbar = this._detectNavbar();
  3649. if (this._popper !== null) {
  3650. this._popper.scheduleUpdate();
  3651. }
  3652. }; // Private
  3653. _proto._addEventListeners = function _addEventListeners() {
  3654. var _this = this;
  3655. $(this._element).on(Event$4.CLICK, function (event) {
  3656. event.preventDefault();
  3657. event.stopPropagation();
  3658. _this.toggle();
  3659. });
  3660. };
  3661. _proto._getConfig = function _getConfig(config) {
  3662. config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
  3663. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3664. return config;
  3665. };
  3666. _proto._getMenuElement = function _getMenuElement() {
  3667. if (!this._menu) {
  3668. var parent = Dropdown._getParentFromElement(this._element);
  3669. if (parent) {
  3670. this._menu = parent.querySelector(Selector$4.MENU);
  3671. }
  3672. }
  3673. return this._menu;
  3674. };
  3675. _proto._getPlacement = function _getPlacement() {
  3676. var $parentDropdown = $(this._element.parentNode);
  3677. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3678. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3679. placement = AttachmentMap.TOP;
  3680. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3681. placement = AttachmentMap.TOPEND;
  3682. }
  3683. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3684. placement = AttachmentMap.RIGHT;
  3685. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3686. placement = AttachmentMap.LEFT;
  3687. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3688. placement = AttachmentMap.BOTTOMEND;
  3689. }
  3690. return placement;
  3691. };
  3692. _proto._detectNavbar = function _detectNavbar() {
  3693. return $(this._element).closest('.navbar').length > 0;
  3694. };
  3695. _proto._getPopperConfig = function _getPopperConfig() {
  3696. var _this2 = this;
  3697. var offsetConf = {};
  3698. if (typeof this._config.offset === 'function') {
  3699. offsetConf.fn = function (data) {
  3700. data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets) || {});
  3701. return data;
  3702. };
  3703. } else {
  3704. offsetConf.offset = this._config.offset;
  3705. }
  3706. var popperConfig = {
  3707. placement: this._getPlacement(),
  3708. modifiers: {
  3709. offset: offsetConf,
  3710. flip: {
  3711. enabled: this._config.flip
  3712. },
  3713. preventOverflow: {
  3714. boundariesElement: this._config.boundary
  3715. }
  3716. } // Disable Popper.js if we have a static display
  3717. };
  3718. if (this._config.display === 'static') {
  3719. popperConfig.modifiers.applyStyle = {
  3720. enabled: false
  3721. };
  3722. }
  3723. return popperConfig;
  3724. }; // Static
  3725. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3726. return this.each(function () {
  3727. var data = $(this).data(DATA_KEY$4);
  3728. var _config = typeof config === 'object' ? config : null;
  3729. if (!data) {
  3730. data = new Dropdown(this, _config);
  3731. $(this).data(DATA_KEY$4, data);
  3732. }
  3733. if (typeof config === 'string') {
  3734. if (typeof data[config] === 'undefined') {
  3735. throw new TypeError("No method named \"" + config + "\"");
  3736. }
  3737. data[config]();
  3738. }
  3739. });
  3740. };
  3741. Dropdown._clearMenus = function _clearMenus(event) {
  3742. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3743. return;
  3744. }
  3745. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3746. for (var i = 0, len = toggles.length; i < len; i++) {
  3747. var parent = Dropdown._getParentFromElement(toggles[i]);
  3748. var context = $(toggles[i]).data(DATA_KEY$4);
  3749. var relatedTarget = {
  3750. relatedTarget: toggles[i]
  3751. };
  3752. if (event && event.type === 'click') {
  3753. relatedTarget.clickEvent = event;
  3754. }
  3755. if (!context) {
  3756. continue;
  3757. }
  3758. var dropdownMenu = context._menu;
  3759. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3760. continue;
  3761. }
  3762. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3763. continue;
  3764. }
  3765. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3766. $(parent).trigger(hideEvent);
  3767. if (hideEvent.isDefaultPrevented()) {
  3768. continue;
  3769. } // If this is a touch-enabled device we remove the extra
  3770. // empty mouseover listeners we added for iOS support
  3771. if ('ontouchstart' in document.documentElement) {
  3772. $(document.body).children().off('mouseover', null, $.noop);
  3773. }
  3774. toggles[i].setAttribute('aria-expanded', 'false');
  3775. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3776. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3777. }
  3778. };
  3779. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3780. var parent;
  3781. var selector = Util.getSelectorFromElement(element);
  3782. if (selector) {
  3783. parent = document.querySelector(selector);
  3784. }
  3785. return parent || element.parentNode;
  3786. }; // eslint-disable-next-line complexity
  3787. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3788. // If not input/textarea:
  3789. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3790. // If input/textarea:
  3791. // - If space key => not a dropdown command
  3792. // - If key is other than escape
  3793. // - If key is not up or down => not a dropdown command
  3794. // - If trigger inside the menu => not a dropdown command
  3795. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3796. return;
  3797. }
  3798. event.preventDefault();
  3799. event.stopPropagation();
  3800. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3801. return;
  3802. }
  3803. var parent = Dropdown._getParentFromElement(this);
  3804. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3805. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3806. if (event.which === ESCAPE_KEYCODE) {
  3807. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3808. $(toggle).trigger('focus');
  3809. }
  3810. $(this).trigger('click');
  3811. return;
  3812. }
  3813. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS));
  3814. if (items.length === 0) {
  3815. return;
  3816. }
  3817. var index = items.indexOf(event.target);
  3818. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3819. // Up
  3820. index--;
  3821. }
  3822. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3823. // Down
  3824. index++;
  3825. }
  3826. if (index < 0) {
  3827. index = 0;
  3828. }
  3829. items[index].focus();
  3830. };
  3831. _createClass(Dropdown, null, [{
  3832. key: "VERSION",
  3833. get: function get() {
  3834. return VERSION$4;
  3835. }
  3836. }, {
  3837. key: "Default",
  3838. get: function get() {
  3839. return Default$2;
  3840. }
  3841. }, {
  3842. key: "DefaultType",
  3843. get: function get() {
  3844. return DefaultType$2;
  3845. }
  3846. }]);
  3847. return Dropdown;
  3848. }();
  3849. /**
  3850. * ------------------------------------------------------------------------
  3851. * Data Api implementation
  3852. * ------------------------------------------------------------------------
  3853. */
  3854. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  3855. event.preventDefault();
  3856. event.stopPropagation();
  3857. Dropdown._jQueryInterface.call($(this), 'toggle');
  3858. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3859. e.stopPropagation();
  3860. });
  3861. /**
  3862. * ------------------------------------------------------------------------
  3863. * jQuery
  3864. * ------------------------------------------------------------------------
  3865. */
  3866. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3867. $.fn[NAME$4].Constructor = Dropdown;
  3868. $.fn[NAME$4].noConflict = function () {
  3869. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3870. return Dropdown._jQueryInterface;
  3871. };
  3872. /**
  3873. * ------------------------------------------------------------------------
  3874. * Constants
  3875. * ------------------------------------------------------------------------
  3876. */
  3877. var NAME$5 = 'modal';
  3878. var VERSION$5 = '4.2.1';
  3879. var DATA_KEY$5 = 'bs.modal';
  3880. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3881. var DATA_API_KEY$5 = '.data-api';
  3882. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3883. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3884. var Default$3 = {
  3885. backdrop: true,
  3886. keyboard: true,
  3887. focus: true,
  3888. show: true
  3889. };
  3890. var DefaultType$3 = {
  3891. backdrop: '(boolean|string)',
  3892. keyboard: 'boolean',
  3893. focus: 'boolean',
  3894. show: 'boolean'
  3895. };
  3896. var Event$5 = {
  3897. HIDE: "hide" + EVENT_KEY$5,
  3898. HIDDEN: "hidden" + EVENT_KEY$5,
  3899. SHOW: "show" + EVENT_KEY$5,
  3900. SHOWN: "shown" + EVENT_KEY$5,
  3901. FOCUSIN: "focusin" + EVENT_KEY$5,
  3902. RESIZE: "resize" + EVENT_KEY$5,
  3903. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3904. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3905. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3906. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3907. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3908. };
  3909. var ClassName$5 = {
  3910. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3911. BACKDROP: 'modal-backdrop',
  3912. OPEN: 'modal-open',
  3913. FADE: 'fade',
  3914. SHOW: 'show'
  3915. };
  3916. var Selector$5 = {
  3917. DIALOG: '.modal-dialog',
  3918. DATA_TOGGLE: '[data-toggle="modal"]',
  3919. DATA_DISMISS: '[data-dismiss="modal"]',
  3920. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3921. STICKY_CONTENT: '.sticky-top'
  3922. /**
  3923. * ------------------------------------------------------------------------
  3924. * Class Definition
  3925. * ------------------------------------------------------------------------
  3926. */
  3927. };
  3928. var Modal =
  3929. /*#__PURE__*/
  3930. function () {
  3931. function Modal(element, config) {
  3932. this._config = this._getConfig(config);
  3933. this._element = element;
  3934. this._dialog = element.querySelector(Selector$5.DIALOG);
  3935. this._backdrop = null;
  3936. this._isShown = false;
  3937. this._isBodyOverflowing = false;
  3938. this._ignoreBackdropClick = false;
  3939. this._isTransitioning = false;
  3940. this._scrollbarWidth = 0;
  3941. } // Getters
  3942. var _proto = Modal.prototype;
  3943. // Public
  3944. _proto.toggle = function toggle(relatedTarget) {
  3945. return this._isShown ? this.hide() : this.show(relatedTarget);
  3946. };
  3947. _proto.show = function show(relatedTarget) {
  3948. var _this = this;
  3949. if (this._isShown || this._isTransitioning) {
  3950. return;
  3951. }
  3952. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3953. this._isTransitioning = true;
  3954. }
  3955. var showEvent = $.Event(Event$5.SHOW, {
  3956. relatedTarget: relatedTarget
  3957. });
  3958. $(this._element).trigger(showEvent);
  3959. if (this._isShown || showEvent.isDefaultPrevented()) {
  3960. return;
  3961. }
  3962. this._isShown = true;
  3963. this._checkScrollbar();
  3964. this._setScrollbar();
  3965. this._adjustDialog();
  3966. this._setEscapeEvent();
  3967. this._setResizeEvent();
  3968. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3969. return _this.hide(event);
  3970. });
  3971. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3972. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3973. if ($(event.target).is(_this._element)) {
  3974. _this._ignoreBackdropClick = true;
  3975. }
  3976. });
  3977. });
  3978. this._showBackdrop(function () {
  3979. return _this._showElement(relatedTarget);
  3980. });
  3981. };
  3982. _proto.hide = function hide(event) {
  3983. var _this2 = this;
  3984. if (event) {
  3985. event.preventDefault();
  3986. }
  3987. if (!this._isShown || this._isTransitioning) {
  3988. return;
  3989. }
  3990. var hideEvent = $.Event(Event$5.HIDE);
  3991. $(this._element).trigger(hideEvent);
  3992. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3993. return;
  3994. }
  3995. this._isShown = false;
  3996. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3997. if (transition) {
  3998. this._isTransitioning = true;
  3999. }
  4000. this._setEscapeEvent();
  4001. this._setResizeEvent();
  4002. $(document).off(Event$5.FOCUSIN);
  4003. $(this._element).removeClass(ClassName$5.SHOW);
  4004. $(this._element).off(Event$5.CLICK_DISMISS);
  4005. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4006. if (transition) {
  4007. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4008. $(this._element).one(Util.TRANSITION_END, function (event) {
  4009. return _this2._hideModal(event);
  4010. }).emulateTransitionEnd(transitionDuration);
  4011. } else {
  4012. this._hideModal();
  4013. }
  4014. };
  4015. _proto.dispose = function dispose() {
  4016. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4017. return $(htmlElement).off(EVENT_KEY$5);
  4018. });
  4019. /**
  4020. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4021. * Do not move `document` in `htmlElements` array
  4022. * It will remove `Event.CLICK_DATA_API` event that should remain
  4023. */
  4024. $(document).off(Event$5.FOCUSIN);
  4025. $.removeData(this._element, DATA_KEY$5);
  4026. this._config = null;
  4027. this._element = null;
  4028. this._dialog = null;
  4029. this._backdrop = null;
  4030. this._isShown = null;
  4031. this._isBodyOverflowing = null;
  4032. this._ignoreBackdropClick = null;
  4033. this._isTransitioning = null;
  4034. this._scrollbarWidth = null;
  4035. };
  4036. _proto.handleUpdate = function handleUpdate() {
  4037. this._adjustDialog();
  4038. }; // Private
  4039. _proto._getConfig = function _getConfig(config) {
  4040. config = _objectSpread({}, Default$3, config);
  4041. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4042. return config;
  4043. };
  4044. _proto._showElement = function _showElement(relatedTarget) {
  4045. var _this3 = this;
  4046. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4047. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4048. // Don't move modal's DOM position
  4049. document.body.appendChild(this._element);
  4050. }
  4051. this._element.style.display = 'block';
  4052. this._element.removeAttribute('aria-hidden');
  4053. this._element.setAttribute('aria-modal', true);
  4054. this._element.scrollTop = 0;
  4055. if (transition) {
  4056. Util.reflow(this._element);
  4057. }
  4058. $(this._element).addClass(ClassName$5.SHOW);
  4059. if (this._config.focus) {
  4060. this._enforceFocus();
  4061. }
  4062. var shownEvent = $.Event(Event$5.SHOWN, {
  4063. relatedTarget: relatedTarget
  4064. });
  4065. var transitionComplete = function transitionComplete() {
  4066. if (_this3._config.focus) {
  4067. _this3._element.focus();
  4068. }
  4069. _this3._isTransitioning = false;
  4070. $(_this3._element).trigger(shownEvent);
  4071. };
  4072. if (transition) {
  4073. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4074. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4075. } else {
  4076. transitionComplete();
  4077. }
  4078. };
  4079. _proto._enforceFocus = function _enforceFocus() {
  4080. var _this4 = this;
  4081. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4082. .on(Event$5.FOCUSIN, function (event) {
  4083. if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
  4084. _this4._element.focus();
  4085. }
  4086. });
  4087. };
  4088. _proto._setEscapeEvent = function _setEscapeEvent() {
  4089. var _this5 = this;
  4090. if (this._isShown && this._config.keyboard) {
  4091. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4092. if (event.which === ESCAPE_KEYCODE$1) {
  4093. event.preventDefault();
  4094. _this5.hide();
  4095. }
  4096. });
  4097. } else if (!this._isShown) {
  4098. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4099. }
  4100. };
  4101. _proto._setResizeEvent = function _setResizeEvent() {
  4102. var _this6 = this;
  4103. if (this._isShown) {
  4104. $(window).on(Event$5.RESIZE, function (event) {
  4105. return _this6.handleUpdate(event);
  4106. });
  4107. } else {
  4108. $(window).off(Event$5.RESIZE);
  4109. }
  4110. };
  4111. _proto._hideModal = function _hideModal() {
  4112. var _this7 = this;
  4113. this._element.style.display = 'none';
  4114. this._element.setAttribute('aria-hidden', true);
  4115. this._element.removeAttribute('aria-modal');
  4116. this._isTransitioning = false;
  4117. this._showBackdrop(function () {
  4118. $(document.body).removeClass(ClassName$5.OPEN);
  4119. _this7._resetAdjustments();
  4120. _this7._resetScrollbar();
  4121. $(_this7._element).trigger(Event$5.HIDDEN);
  4122. });
  4123. };
  4124. _proto._removeBackdrop = function _removeBackdrop() {
  4125. if (this._backdrop) {
  4126. $(this._backdrop).remove();
  4127. this._backdrop = null;
  4128. }
  4129. };
  4130. _proto._showBackdrop = function _showBackdrop(callback) {
  4131. var _this8 = this;
  4132. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4133. if (this._isShown && this._config.backdrop) {
  4134. this._backdrop = document.createElement('div');
  4135. this._backdrop.className = ClassName$5.BACKDROP;
  4136. if (animate) {
  4137. this._backdrop.classList.add(animate);
  4138. }
  4139. $(this._backdrop).appendTo(document.body);
  4140. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4141. if (_this8._ignoreBackdropClick) {
  4142. _this8._ignoreBackdropClick = false;
  4143. return;
  4144. }
  4145. if (event.target !== event.currentTarget) {
  4146. return;
  4147. }
  4148. if (_this8._config.backdrop === 'static') {
  4149. _this8._element.focus();
  4150. } else {
  4151. _this8.hide();
  4152. }
  4153. });
  4154. if (animate) {
  4155. Util.reflow(this._backdrop);
  4156. }
  4157. $(this._backdrop).addClass(ClassName$5.SHOW);
  4158. if (!callback) {
  4159. return;
  4160. }
  4161. if (!animate) {
  4162. callback();
  4163. return;
  4164. }
  4165. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4166. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4167. } else if (!this._isShown && this._backdrop) {
  4168. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4169. var callbackRemove = function callbackRemove() {
  4170. _this8._removeBackdrop();
  4171. if (callback) {
  4172. callback();
  4173. }
  4174. };
  4175. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4176. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4177. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4178. } else {
  4179. callbackRemove();
  4180. }
  4181. } else if (callback) {
  4182. callback();
  4183. }
  4184. }; // ----------------------------------------------------------------------
  4185. // the following methods are used to handle overflowing modals
  4186. // todo (fat): these should probably be refactored out of modal.js
  4187. // ----------------------------------------------------------------------
  4188. _proto._adjustDialog = function _adjustDialog() {
  4189. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4190. if (!this._isBodyOverflowing && isModalOverflowing) {
  4191. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4192. }
  4193. if (this._isBodyOverflowing && !isModalOverflowing) {
  4194. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4195. }
  4196. };
  4197. _proto._resetAdjustments = function _resetAdjustments() {
  4198. this._element.style.paddingLeft = '';
  4199. this._element.style.paddingRight = '';
  4200. };
  4201. _proto._checkScrollbar = function _checkScrollbar() {
  4202. var rect = document.body.getBoundingClientRect();
  4203. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4204. this._scrollbarWidth = this._getScrollbarWidth();
  4205. };
  4206. _proto._setScrollbar = function _setScrollbar() {
  4207. var _this9 = this;
  4208. if (this._isBodyOverflowing) {
  4209. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4210. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4211. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4212. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4213. $(fixedContent).each(function (index, element) {
  4214. var actualPadding = element.style.paddingRight;
  4215. var calculatedPadding = $(element).css('padding-right');
  4216. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
  4217. }); // Adjust sticky content margin
  4218. $(stickyContent).each(function (index, element) {
  4219. var actualMargin = element.style.marginRight;
  4220. var calculatedMargin = $(element).css('margin-right');
  4221. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
  4222. }); // Adjust body padding
  4223. var actualPadding = document.body.style.paddingRight;
  4224. var calculatedPadding = $(document.body).css('padding-right');
  4225. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4226. }
  4227. $(document.body).addClass(ClassName$5.OPEN);
  4228. };
  4229. _proto._resetScrollbar = function _resetScrollbar() {
  4230. // Restore fixed content padding
  4231. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4232. $(fixedContent).each(function (index, element) {
  4233. var padding = $(element).data('padding-right');
  4234. $(element).removeData('padding-right');
  4235. element.style.paddingRight = padding ? padding : '';
  4236. }); // Restore sticky content
  4237. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4238. $(elements).each(function (index, element) {
  4239. var margin = $(element).data('margin-right');
  4240. if (typeof margin !== 'undefined') {
  4241. $(element).css('margin-right', margin).removeData('margin-right');
  4242. }
  4243. }); // Restore body padding
  4244. var padding = $(document.body).data('padding-right');
  4245. $(document.body).removeData('padding-right');
  4246. document.body.style.paddingRight = padding ? padding : '';
  4247. };
  4248. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4249. // thx d.walsh
  4250. var scrollDiv = document.createElement('div');
  4251. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4252. document.body.appendChild(scrollDiv);
  4253. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4254. document.body.removeChild(scrollDiv);
  4255. return scrollbarWidth;
  4256. }; // Static
  4257. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4258. return this.each(function () {
  4259. var data = $(this).data(DATA_KEY$5);
  4260. var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
  4261. if (!data) {
  4262. data = new Modal(this, _config);
  4263. $(this).data(DATA_KEY$5, data);
  4264. }
  4265. if (typeof config === 'string') {
  4266. if (typeof data[config] === 'undefined') {
  4267. throw new TypeError("No method named \"" + config + "\"");
  4268. }
  4269. data[config](relatedTarget);
  4270. } else if (_config.show) {
  4271. data.show(relatedTarget);
  4272. }
  4273. });
  4274. };
  4275. _createClass(Modal, null, [{
  4276. key: "VERSION",
  4277. get: function get() {
  4278. return VERSION$5;
  4279. }
  4280. }, {
  4281. key: "Default",
  4282. get: function get() {
  4283. return Default$3;
  4284. }
  4285. }]);
  4286. return Modal;
  4287. }();
  4288. /**
  4289. * ------------------------------------------------------------------------
  4290. * Data Api implementation
  4291. * ------------------------------------------------------------------------
  4292. */
  4293. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4294. var _this10 = this;
  4295. var target;
  4296. var selector = Util.getSelectorFromElement(this);
  4297. if (selector) {
  4298. target = document.querySelector(selector);
  4299. }
  4300. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());
  4301. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4302. event.preventDefault();
  4303. }
  4304. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4305. if (showEvent.isDefaultPrevented()) {
  4306. // Only register focus restorer if modal will actually get shown
  4307. return;
  4308. }
  4309. $target.one(Event$5.HIDDEN, function () {
  4310. if ($(_this10).is(':visible')) {
  4311. _this10.focus();
  4312. }
  4313. });
  4314. });
  4315. Modal._jQueryInterface.call($(target), config, this);
  4316. });
  4317. /**
  4318. * ------------------------------------------------------------------------
  4319. * jQuery
  4320. * ------------------------------------------------------------------------
  4321. */
  4322. $.fn[NAME$5] = Modal._jQueryInterface;
  4323. $.fn[NAME$5].Constructor = Modal;
  4324. $.fn[NAME$5].noConflict = function () {
  4325. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4326. return Modal._jQueryInterface;
  4327. };
  4328. /**
  4329. * ------------------------------------------------------------------------
  4330. * Constants
  4331. * ------------------------------------------------------------------------
  4332. */
  4333. var NAME$6 = 'tooltip';
  4334. var VERSION$6 = '4.2.1';
  4335. var DATA_KEY$6 = 'bs.tooltip';
  4336. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4337. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4338. var CLASS_PREFIX = 'bs-tooltip';
  4339. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4340. var DefaultType$4 = {
  4341. animation: 'boolean',
  4342. template: 'string',
  4343. title: '(string|element|function)',
  4344. trigger: 'string',
  4345. delay: '(number|object)',
  4346. html: 'boolean',
  4347. selector: '(string|boolean)',
  4348. placement: '(string|function)',
  4349. offset: '(number|string)',
  4350. container: '(string|element|boolean)',
  4351. fallbackPlacement: '(string|array)',
  4352. boundary: '(string|element)'
  4353. };
  4354. var AttachmentMap$1 = {
  4355. AUTO: 'auto',
  4356. TOP: 'top',
  4357. RIGHT: 'right',
  4358. BOTTOM: 'bottom',
  4359. LEFT: 'left'
  4360. };
  4361. var Default$4 = {
  4362. animation: true,
  4363. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4364. trigger: 'hover focus',
  4365. title: '',
  4366. delay: 0,
  4367. html: false,
  4368. selector: false,
  4369. placement: 'top',
  4370. offset: 0,
  4371. container: false,
  4372. fallbackPlacement: 'flip',
  4373. boundary: 'scrollParent'
  4374. };
  4375. var HoverState = {
  4376. SHOW: 'show',
  4377. OUT: 'out'
  4378. };
  4379. var Event$6 = {
  4380. HIDE: "hide" + EVENT_KEY$6,
  4381. HIDDEN: "hidden" + EVENT_KEY$6,
  4382. SHOW: "show" + EVENT_KEY$6,
  4383. SHOWN: "shown" + EVENT_KEY$6,
  4384. INSERTED: "inserted" + EVENT_KEY$6,
  4385. CLICK: "click" + EVENT_KEY$6,
  4386. FOCUSIN: "focusin" + EVENT_KEY$6,
  4387. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4388. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4389. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4390. };
  4391. var ClassName$6 = {
  4392. FADE: 'fade',
  4393. SHOW: 'show'
  4394. };
  4395. var Selector$6 = {
  4396. TOOLTIP: '.tooltip',
  4397. TOOLTIP_INNER: '.tooltip-inner',
  4398. ARROW: '.arrow'
  4399. };
  4400. var Trigger = {
  4401. HOVER: 'hover',
  4402. FOCUS: 'focus',
  4403. CLICK: 'click',
  4404. MANUAL: 'manual'
  4405. /**
  4406. * ------------------------------------------------------------------------
  4407. * Class Definition
  4408. * ------------------------------------------------------------------------
  4409. */
  4410. };
  4411. var Tooltip =
  4412. /*#__PURE__*/
  4413. function () {
  4414. function Tooltip(element, config) {
  4415. /**
  4416. * Check for Popper dependency
  4417. * Popper - https://popper.js.org
  4418. */
  4419. if (typeof Popper === 'undefined') {
  4420. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4421. } // private
  4422. this._isEnabled = true;
  4423. this._timeout = 0;
  4424. this._hoverState = '';
  4425. this._activeTrigger = {};
  4426. this._popper = null; // Protected
  4427. this.element = element;
  4428. this.config = this._getConfig(config);
  4429. this.tip = null;
  4430. this._setListeners();
  4431. } // Getters
  4432. var _proto = Tooltip.prototype;
  4433. // Public
  4434. _proto.enable = function enable() {
  4435. this._isEnabled = true;
  4436. };
  4437. _proto.disable = function disable() {
  4438. this._isEnabled = false;
  4439. };
  4440. _proto.toggleEnabled = function toggleEnabled() {
  4441. this._isEnabled = !this._isEnabled;
  4442. };
  4443. _proto.toggle = function toggle(event) {
  4444. if (!this._isEnabled) {
  4445. return;
  4446. }
  4447. if (event) {
  4448. var dataKey = this.constructor.DATA_KEY;
  4449. var context = $(event.currentTarget).data(dataKey);
  4450. if (!context) {
  4451. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4452. $(event.currentTarget).data(dataKey, context);
  4453. }
  4454. context._activeTrigger.click = !context._activeTrigger.click;
  4455. if (context._isWithActiveTrigger()) {
  4456. context._enter(null, context);
  4457. } else {
  4458. context._leave(null, context);
  4459. }
  4460. } else {
  4461. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4462. this._leave(null, this);
  4463. return;
  4464. }
  4465. this._enter(null, this);
  4466. }
  4467. };
  4468. _proto.dispose = function dispose() {
  4469. clearTimeout(this._timeout);
  4470. $.removeData(this.element, this.constructor.DATA_KEY);
  4471. $(this.element).off(this.constructor.EVENT_KEY);
  4472. $(this.element).closest('.modal').off('hide.bs.modal');
  4473. if (this.tip) {
  4474. $(this.tip).remove();
  4475. }
  4476. this._isEnabled = null;
  4477. this._timeout = null;
  4478. this._hoverState = null;
  4479. this._activeTrigger = null;
  4480. if (this._popper !== null) {
  4481. this._popper.destroy();
  4482. }
  4483. this._popper = null;
  4484. this.element = null;
  4485. this.config = null;
  4486. this.tip = null;
  4487. };
  4488. _proto.show = function show() {
  4489. var _this = this;
  4490. if ($(this.element).css('display') === 'none') {
  4491. throw new Error('Please use show on visible elements');
  4492. }
  4493. var showEvent = $.Event(this.constructor.Event.SHOW);
  4494. if (this.isWithContent() && this._isEnabled) {
  4495. $(this.element).trigger(showEvent);
  4496. var shadowRoot = Util.findShadowRoot(this.element);
  4497. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4498. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4499. return;
  4500. }
  4501. var tip = this.getTipElement();
  4502. var tipId = Util.getUID(this.constructor.NAME);
  4503. tip.setAttribute('id', tipId);
  4504. this.element.setAttribute('aria-describedby', tipId);
  4505. this.setContent();
  4506. if (this.config.animation) {
  4507. $(tip).addClass(ClassName$6.FADE);
  4508. }
  4509. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4510. var attachment = this._getAttachment(placement);
  4511. this.addAttachmentClass(attachment);
  4512. var container = this._getContainer();
  4513. $(tip).data(this.constructor.DATA_KEY, this);
  4514. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4515. $(tip).appendTo(container);
  4516. }
  4517. $(this.element).trigger(this.constructor.Event.INSERTED);
  4518. this._popper = new Popper(this.element, tip, {
  4519. placement: attachment,
  4520. modifiers: {
  4521. offset: {
  4522. offset: this.config.offset
  4523. },
  4524. flip: {
  4525. behavior: this.config.fallbackPlacement
  4526. },
  4527. arrow: {
  4528. element: Selector$6.ARROW
  4529. },
  4530. preventOverflow: {
  4531. boundariesElement: this.config.boundary
  4532. }
  4533. },
  4534. onCreate: function onCreate(data) {
  4535. if (data.originalPlacement !== data.placement) {
  4536. _this._handlePopperPlacementChange(data);
  4537. }
  4538. },
  4539. onUpdate: function onUpdate(data) {
  4540. return _this._handlePopperPlacementChange(data);
  4541. }
  4542. });
  4543. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4544. // empty mouseover listeners to the body's immediate children;
  4545. // only needed because of broken event delegation on iOS
  4546. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4547. if ('ontouchstart' in document.documentElement) {
  4548. $(document.body).children().on('mouseover', null, $.noop);
  4549. }
  4550. var complete = function complete() {
  4551. if (_this.config.animation) {
  4552. _this._fixTransition();
  4553. }
  4554. var prevHoverState = _this._hoverState;
  4555. _this._hoverState = null;
  4556. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4557. if (prevHoverState === HoverState.OUT) {
  4558. _this._leave(null, _this);
  4559. }
  4560. };
  4561. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4562. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4563. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4564. } else {
  4565. complete();
  4566. }
  4567. }
  4568. };
  4569. _proto.hide = function hide(callback) {
  4570. var _this2 = this;
  4571. var tip = this.getTipElement();
  4572. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4573. var complete = function complete() {
  4574. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4575. tip.parentNode.removeChild(tip);
  4576. }
  4577. _this2._cleanTipClass();
  4578. _this2.element.removeAttribute('aria-describedby');
  4579. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4580. if (_this2._popper !== null) {
  4581. _this2._popper.destroy();
  4582. }
  4583. if (callback) {
  4584. callback();
  4585. }
  4586. };
  4587. $(this.element).trigger(hideEvent);
  4588. if (hideEvent.isDefaultPrevented()) {
  4589. return;
  4590. }
  4591. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4592. // empty mouseover listeners we added for iOS support
  4593. if ('ontouchstart' in document.documentElement) {
  4594. $(document.body).children().off('mouseover', null, $.noop);
  4595. }
  4596. this._activeTrigger[Trigger.CLICK] = false;
  4597. this._activeTrigger[Trigger.FOCUS] = false;
  4598. this._activeTrigger[Trigger.HOVER] = false;
  4599. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4600. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4601. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4602. } else {
  4603. complete();
  4604. }
  4605. this._hoverState = '';
  4606. };
  4607. _proto.update = function update() {
  4608. if (this._popper !== null) {
  4609. this._popper.scheduleUpdate();
  4610. }
  4611. }; // Protected
  4612. _proto.isWithContent = function isWithContent() {
  4613. return Boolean(this.getTitle());
  4614. };
  4615. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4616. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4617. };
  4618. _proto.getTipElement = function getTipElement() {
  4619. this.tip = this.tip || $(this.config.template)[0];
  4620. return this.tip;
  4621. };
  4622. _proto.setContent = function setContent() {
  4623. var tip = this.getTipElement();
  4624. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4625. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4626. };
  4627. _proto.setElementContent = function setElementContent($element, content) {
  4628. var html = this.config.html;
  4629. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4630. // Content is a DOM node or a jQuery
  4631. if (html) {
  4632. if (!$(content).parent().is($element)) {
  4633. $element.empty().append(content);
  4634. }
  4635. } else {
  4636. $element.text($(content).text());
  4637. }
  4638. } else {
  4639. $element[html ? 'html' : 'text'](content);
  4640. }
  4641. };
  4642. _proto.getTitle = function getTitle() {
  4643. var title = this.element.getAttribute('data-original-title');
  4644. if (!title) {
  4645. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4646. }
  4647. return title;
  4648. }; // Private
  4649. _proto._getContainer = function _getContainer() {
  4650. if (this.config.container === false) {
  4651. return document.body;
  4652. }
  4653. if (Util.isElement(this.config.container)) {
  4654. return $(this.config.container);
  4655. }
  4656. return $(document).find(this.config.container);
  4657. };
  4658. _proto._getAttachment = function _getAttachment(placement) {
  4659. return AttachmentMap$1[placement.toUpperCase()];
  4660. };
  4661. _proto._setListeners = function _setListeners() {
  4662. var _this3 = this;
  4663. var triggers = this.config.trigger.split(' ');
  4664. triggers.forEach(function (trigger) {
  4665. if (trigger === 'click') {
  4666. $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) {
  4667. return _this3.toggle(event);
  4668. });
  4669. } else if (trigger !== Trigger.MANUAL) {
  4670. var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
  4671. var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
  4672. $(_this3.element).on(eventIn, _this3.config.selector, function (event) {
  4673. return _this3._enter(event);
  4674. }).on(eventOut, _this3.config.selector, function (event) {
  4675. return _this3._leave(event);
  4676. });
  4677. }
  4678. });
  4679. $(this.element).closest('.modal').on('hide.bs.modal', function () {
  4680. if (_this3.element) {
  4681. _this3.hide();
  4682. }
  4683. });
  4684. if (this.config.selector) {
  4685. this.config = _objectSpread({}, this.config, {
  4686. trigger: 'manual',
  4687. selector: ''
  4688. });
  4689. } else {
  4690. this._fixTitle();
  4691. }
  4692. };
  4693. _proto._fixTitle = function _fixTitle() {
  4694. var titleType = typeof this.element.getAttribute('data-original-title');
  4695. if (this.element.getAttribute('title') || titleType !== 'string') {
  4696. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4697. this.element.setAttribute('title', '');
  4698. }
  4699. };
  4700. _proto._enter = function _enter(event, context) {
  4701. var dataKey = this.constructor.DATA_KEY;
  4702. context = context || $(event.currentTarget).data(dataKey);
  4703. if (!context) {
  4704. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4705. $(event.currentTarget).data(dataKey, context);
  4706. }
  4707. if (event) {
  4708. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4709. }
  4710. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4711. context._hoverState = HoverState.SHOW;
  4712. return;
  4713. }
  4714. clearTimeout(context._timeout);
  4715. context._hoverState = HoverState.SHOW;
  4716. if (!context.config.delay || !context.config.delay.show) {
  4717. context.show();
  4718. return;
  4719. }
  4720. context._timeout = setTimeout(function () {
  4721. if (context._hoverState === HoverState.SHOW) {
  4722. context.show();
  4723. }
  4724. }, context.config.delay.show);
  4725. };
  4726. _proto._leave = function _leave(event, context) {
  4727. var dataKey = this.constructor.DATA_KEY;
  4728. context = context || $(event.currentTarget).data(dataKey);
  4729. if (!context) {
  4730. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4731. $(event.currentTarget).data(dataKey, context);
  4732. }
  4733. if (event) {
  4734. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4735. }
  4736. if (context._isWithActiveTrigger()) {
  4737. return;
  4738. }
  4739. clearTimeout(context._timeout);
  4740. context._hoverState = HoverState.OUT;
  4741. if (!context.config.delay || !context.config.delay.hide) {
  4742. context.hide();
  4743. return;
  4744. }
  4745. context._timeout = setTimeout(function () {
  4746. if (context._hoverState === HoverState.OUT) {
  4747. context.hide();
  4748. }
  4749. }, context.config.delay.hide);
  4750. };
  4751. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4752. for (var trigger in this._activeTrigger) {
  4753. if (this._activeTrigger[trigger]) {
  4754. return true;
  4755. }
  4756. }
  4757. return false;
  4758. };
  4759. _proto._getConfig = function _getConfig(config) {
  4760. config = _objectSpread({}, this.constructor.Default, $(this.element).data(), typeof config === 'object' && config ? config : {});
  4761. if (typeof config.delay === 'number') {
  4762. config.delay = {
  4763. show: config.delay,
  4764. hide: config.delay
  4765. };
  4766. }
  4767. if (typeof config.title === 'number') {
  4768. config.title = config.title.toString();
  4769. }
  4770. if (typeof config.content === 'number') {
  4771. config.content = config.content.toString();
  4772. }
  4773. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4774. return config;
  4775. };
  4776. _proto._getDelegateConfig = function _getDelegateConfig() {
  4777. var config = {};
  4778. if (this.config) {
  4779. for (var key in this.config) {
  4780. if (this.constructor.Default[key] !== this.config[key]) {
  4781. config[key] = this.config[key];
  4782. }
  4783. }
  4784. }
  4785. return config;
  4786. };
  4787. _proto._cleanTipClass = function _cleanTipClass() {
  4788. var $tip = $(this.getTipElement());
  4789. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4790. if (tabClass !== null && tabClass.length) {
  4791. $tip.removeClass(tabClass.join(''));
  4792. }
  4793. };
  4794. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4795. var popperInstance = popperData.instance;
  4796. this.tip = popperInstance.popper;
  4797. this._cleanTipClass();
  4798. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4799. };
  4800. _proto._fixTransition = function _fixTransition() {
  4801. var tip = this.getTipElement();
  4802. var initConfigAnimation = this.config.animation;
  4803. if (tip.getAttribute('x-placement') !== null) {
  4804. return;
  4805. }
  4806. $(tip).removeClass(ClassName$6.FADE);
  4807. this.config.animation = false;
  4808. this.hide();
  4809. this.show();
  4810. this.config.animation = initConfigAnimation;
  4811. }; // Static
  4812. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4813. return this.each(function () {
  4814. var data = $(this).data(DATA_KEY$6);
  4815. var _config = typeof config === 'object' && config;
  4816. if (!data && /dispose|hide/.test(config)) {
  4817. return;
  4818. }
  4819. if (!data) {
  4820. data = new Tooltip(this, _config);
  4821. $(this).data(DATA_KEY$6, data);
  4822. }
  4823. if (typeof config === 'string') {
  4824. if (typeof data[config] === 'undefined') {
  4825. throw new TypeError("No method named \"" + config + "\"");
  4826. }
  4827. data[config]();
  4828. }
  4829. });
  4830. };
  4831. _createClass(Tooltip, null, [{
  4832. key: "VERSION",
  4833. get: function get() {
  4834. return VERSION$6;
  4835. }
  4836. }, {
  4837. key: "Default",
  4838. get: function get() {
  4839. return Default$4;
  4840. }
  4841. }, {
  4842. key: "NAME",
  4843. get: function get() {
  4844. return NAME$6;
  4845. }
  4846. }, {
  4847. key: "DATA_KEY",
  4848. get: function get() {
  4849. return DATA_KEY$6;
  4850. }
  4851. }, {
  4852. key: "Event",
  4853. get: function get() {
  4854. return Event$6;
  4855. }
  4856. }, {
  4857. key: "EVENT_KEY",
  4858. get: function get() {
  4859. return EVENT_KEY$6;
  4860. }
  4861. }, {
  4862. key: "DefaultType",
  4863. get: function get() {
  4864. return DefaultType$4;
  4865. }
  4866. }]);
  4867. return Tooltip;
  4868. }();
  4869. /**
  4870. * ------------------------------------------------------------------------
  4871. * jQuery
  4872. * ------------------------------------------------------------------------
  4873. */
  4874. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4875. $.fn[NAME$6].Constructor = Tooltip;
  4876. $.fn[NAME$6].noConflict = function () {
  4877. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4878. return Tooltip._jQueryInterface;
  4879. };
  4880. /**
  4881. * ------------------------------------------------------------------------
  4882. * Constants
  4883. * ------------------------------------------------------------------------
  4884. */
  4885. var NAME$7 = 'popover';
  4886. var VERSION$7 = '4.2.1';
  4887. var DATA_KEY$7 = 'bs.popover';
  4888. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4889. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4890. var CLASS_PREFIX$1 = 'bs-popover';
  4891. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4892. var Default$5 = _objectSpread({}, Tooltip.Default, {
  4893. placement: 'right',
  4894. trigger: 'click',
  4895. content: '',
  4896. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4897. });
  4898. var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, {
  4899. content: '(string|element|function)'
  4900. });
  4901. var ClassName$7 = {
  4902. FADE: 'fade',
  4903. SHOW: 'show'
  4904. };
  4905. var Selector$7 = {
  4906. TITLE: '.popover-header',
  4907. CONTENT: '.popover-body'
  4908. };
  4909. var Event$7 = {
  4910. HIDE: "hide" + EVENT_KEY$7,
  4911. HIDDEN: "hidden" + EVENT_KEY$7,
  4912. SHOW: "show" + EVENT_KEY$7,
  4913. SHOWN: "shown" + EVENT_KEY$7,
  4914. INSERTED: "inserted" + EVENT_KEY$7,
  4915. CLICK: "click" + EVENT_KEY$7,
  4916. FOCUSIN: "focusin" + EVENT_KEY$7,
  4917. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4918. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4919. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4920. /**
  4921. * ------------------------------------------------------------------------
  4922. * Class Definition
  4923. * ------------------------------------------------------------------------
  4924. */
  4925. };
  4926. var Popover =
  4927. /*#__PURE__*/
  4928. function (_Tooltip) {
  4929. _inheritsLoose(Popover, _Tooltip);
  4930. function Popover() {
  4931. return _Tooltip.apply(this, arguments) || this;
  4932. }
  4933. var _proto = Popover.prototype;
  4934. // Overrides
  4935. _proto.isWithContent = function isWithContent() {
  4936. return this.getTitle() || this._getContent();
  4937. };
  4938. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4939. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4940. };
  4941. _proto.getTipElement = function getTipElement() {
  4942. this.tip = this.tip || $(this.config.template)[0];
  4943. return this.tip;
  4944. };
  4945. _proto.setContent = function setContent() {
  4946. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4947. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4948. var content = this._getContent();
  4949. if (typeof content === 'function') {
  4950. content = content.call(this.element);
  4951. }
  4952. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4953. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4954. }; // Private
  4955. _proto._getContent = function _getContent() {
  4956. return this.element.getAttribute('data-content') || this.config.content;
  4957. };
  4958. _proto._cleanTipClass = function _cleanTipClass() {
  4959. var $tip = $(this.getTipElement());
  4960. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4961. if (tabClass !== null && tabClass.length > 0) {
  4962. $tip.removeClass(tabClass.join(''));
  4963. }
  4964. }; // Static
  4965. Popover._jQueryInterface = function _jQueryInterface(config) {
  4966. return this.each(function () {
  4967. var data = $(this).data(DATA_KEY$7);
  4968. var _config = typeof config === 'object' ? config : null;
  4969. if (!data && /dispose|hide/.test(config)) {
  4970. return;
  4971. }
  4972. if (!data) {
  4973. data = new Popover(this, _config);
  4974. $(this).data(DATA_KEY$7, data);
  4975. }
  4976. if (typeof config === 'string') {
  4977. if (typeof data[config] === 'undefined') {
  4978. throw new TypeError("No method named \"" + config + "\"");
  4979. }
  4980. data[config]();
  4981. }
  4982. });
  4983. };
  4984. _createClass(Popover, null, [{
  4985. key: "VERSION",
  4986. // Getters
  4987. get: function get() {
  4988. return VERSION$7;
  4989. }
  4990. }, {
  4991. key: "Default",
  4992. get: function get() {
  4993. return Default$5;
  4994. }
  4995. }, {
  4996. key: "NAME",
  4997. get: function get() {
  4998. return NAME$7;
  4999. }
  5000. }, {
  5001. key: "DATA_KEY",
  5002. get: function get() {
  5003. return DATA_KEY$7;
  5004. }
  5005. }, {
  5006. key: "Event",
  5007. get: function get() {
  5008. return Event$7;
  5009. }
  5010. }, {
  5011. key: "EVENT_KEY",
  5012. get: function get() {
  5013. return EVENT_KEY$7;
  5014. }
  5015. }, {
  5016. key: "DefaultType",
  5017. get: function get() {
  5018. return DefaultType$5;
  5019. }
  5020. }]);
  5021. return Popover;
  5022. }(Tooltip);
  5023. /**
  5024. * ------------------------------------------------------------------------
  5025. * jQuery
  5026. * ------------------------------------------------------------------------
  5027. */
  5028. $.fn[NAME$7] = Popover._jQueryInterface;
  5029. $.fn[NAME$7].Constructor = Popover;
  5030. $.fn[NAME$7].noConflict = function () {
  5031. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5032. return Popover._jQueryInterface;
  5033. };
  5034. /**
  5035. * ------------------------------------------------------------------------
  5036. * Constants
  5037. * ------------------------------------------------------------------------
  5038. */
  5039. var NAME$8 = 'scrollspy';
  5040. var VERSION$8 = '4.2.1';
  5041. var DATA_KEY$8 = 'bs.scrollspy';
  5042. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5043. var DATA_API_KEY$6 = '.data-api';
  5044. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5045. var Default$6 = {
  5046. offset: 10,
  5047. method: 'auto',
  5048. target: ''
  5049. };
  5050. var DefaultType$6 = {
  5051. offset: 'number',
  5052. method: 'string',
  5053. target: '(string|element)'
  5054. };
  5055. var Event$8 = {
  5056. ACTIVATE: "activate" + EVENT_KEY$8,
  5057. SCROLL: "scroll" + EVENT_KEY$8,
  5058. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5059. };
  5060. var ClassName$8 = {
  5061. DROPDOWN_ITEM: 'dropdown-item',
  5062. DROPDOWN_MENU: 'dropdown-menu',
  5063. ACTIVE: 'active'
  5064. };
  5065. var Selector$8 = {
  5066. DATA_SPY: '[data-spy="scroll"]',
  5067. ACTIVE: '.active',
  5068. NAV_LIST_GROUP: '.nav, .list-group',
  5069. NAV_LINKS: '.nav-link',
  5070. NAV_ITEMS: '.nav-item',
  5071. LIST_ITEMS: '.list-group-item',
  5072. DROPDOWN: '.dropdown',
  5073. DROPDOWN_ITEMS: '.dropdown-item',
  5074. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5075. };
  5076. var OffsetMethod = {
  5077. OFFSET: 'offset',
  5078. POSITION: 'position'
  5079. /**
  5080. * ------------------------------------------------------------------------
  5081. * Class Definition
  5082. * ------------------------------------------------------------------------
  5083. */
  5084. };
  5085. var ScrollSpy =
  5086. /*#__PURE__*/
  5087. function () {
  5088. function ScrollSpy(element, config) {
  5089. var _this = this;
  5090. this._element = element;
  5091. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5092. this._config = this._getConfig(config);
  5093. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5094. this._offsets = [];
  5095. this._targets = [];
  5096. this._activeTarget = null;
  5097. this._scrollHeight = 0;
  5098. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5099. return _this._process(event);
  5100. });
  5101. this.refresh();
  5102. this._process();
  5103. } // Getters
  5104. var _proto = ScrollSpy.prototype;
  5105. // Public
  5106. _proto.refresh = function refresh() {
  5107. var _this2 = this;
  5108. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5109. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5110. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5111. this._offsets = [];
  5112. this._targets = [];
  5113. this._scrollHeight = this._getScrollHeight();
  5114. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5115. targets.map(function (element) {
  5116. var target;
  5117. var targetSelector = Util.getSelectorFromElement(element);
  5118. if (targetSelector) {
  5119. target = document.querySelector(targetSelector);
  5120. }
  5121. if (target) {
  5122. var targetBCR = target.getBoundingClientRect();
  5123. if (targetBCR.width || targetBCR.height) {
  5124. // TODO (fat): remove sketch reliance on jQuery position/offset
  5125. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5126. }
  5127. }
  5128. return null;
  5129. }).filter(function (item) {
  5130. return item;
  5131. }).sort(function (a, b) {
  5132. return a[0] - b[0];
  5133. }).forEach(function (item) {
  5134. _this2._offsets.push(item[0]);
  5135. _this2._targets.push(item[1]);
  5136. });
  5137. };
  5138. _proto.dispose = function dispose() {
  5139. $.removeData(this._element, DATA_KEY$8);
  5140. $(this._scrollElement).off(EVENT_KEY$8);
  5141. this._element = null;
  5142. this._scrollElement = null;
  5143. this._config = null;
  5144. this._selector = null;
  5145. this._offsets = null;
  5146. this._targets = null;
  5147. this._activeTarget = null;
  5148. this._scrollHeight = null;
  5149. }; // Private
  5150. _proto._getConfig = function _getConfig(config) {
  5151. config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {});
  5152. if (typeof config.target !== 'string') {
  5153. var id = $(config.target).attr('id');
  5154. if (!id) {
  5155. id = Util.getUID(NAME$8);
  5156. $(config.target).attr('id', id);
  5157. }
  5158. config.target = "#" + id;
  5159. }
  5160. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5161. return config;
  5162. };
  5163. _proto._getScrollTop = function _getScrollTop() {
  5164. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5165. };
  5166. _proto._getScrollHeight = function _getScrollHeight() {
  5167. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5168. };
  5169. _proto._getOffsetHeight = function _getOffsetHeight() {
  5170. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5171. };
  5172. _proto._process = function _process() {
  5173. var scrollTop = this._getScrollTop() + this._config.offset;
  5174. var scrollHeight = this._getScrollHeight();
  5175. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5176. if (this._scrollHeight !== scrollHeight) {
  5177. this.refresh();
  5178. }
  5179. if (scrollTop >= maxScroll) {
  5180. var target = this._targets[this._targets.length - 1];
  5181. if (this._activeTarget !== target) {
  5182. this._activate(target);
  5183. }
  5184. return;
  5185. }
  5186. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5187. this._activeTarget = null;
  5188. this._clear();
  5189. return;
  5190. }
  5191. var offsetLength = this._offsets.length;
  5192. for (var i = offsetLength; i--;) {
  5193. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5194. if (isActiveTarget) {
  5195. this._activate(this._targets[i]);
  5196. }
  5197. }
  5198. };
  5199. _proto._activate = function _activate(target) {
  5200. this._activeTarget = target;
  5201. this._clear();
  5202. var queries = this._selector.split(',').map(function (selector) {
  5203. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5204. });
  5205. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5206. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5207. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5208. $link.addClass(ClassName$8.ACTIVE);
  5209. } else {
  5210. // Set triggered link as active
  5211. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5212. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5213. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  5214. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5215. }
  5216. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5217. relatedTarget: target
  5218. });
  5219. };
  5220. _proto._clear = function _clear() {
  5221. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5222. return node.classList.contains(ClassName$8.ACTIVE);
  5223. }).forEach(function (node) {
  5224. return node.classList.remove(ClassName$8.ACTIVE);
  5225. });
  5226. }; // Static
  5227. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5228. return this.each(function () {
  5229. var data = $(this).data(DATA_KEY$8);
  5230. var _config = typeof config === 'object' && config;
  5231. if (!data) {
  5232. data = new ScrollSpy(this, _config);
  5233. $(this).data(DATA_KEY$8, data);
  5234. }
  5235. if (typeof config === 'string') {
  5236. if (typeof data[config] === 'undefined') {
  5237. throw new TypeError("No method named \"" + config + "\"");
  5238. }
  5239. data[config]();
  5240. }
  5241. });
  5242. };
  5243. _createClass(ScrollSpy, null, [{
  5244. key: "VERSION",
  5245. get: function get() {
  5246. return VERSION$8;
  5247. }
  5248. }, {
  5249. key: "Default",
  5250. get: function get() {
  5251. return Default$6;
  5252. }
  5253. }]);
  5254. return ScrollSpy;
  5255. }();
  5256. /**
  5257. * ------------------------------------------------------------------------
  5258. * Data Api implementation
  5259. * ------------------------------------------------------------------------
  5260. */
  5261. $(window).on(Event$8.LOAD_DATA_API, function () {
  5262. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5263. var scrollSpysLength = scrollSpys.length;
  5264. for (var i = scrollSpysLength; i--;) {
  5265. var $spy = $(scrollSpys[i]);
  5266. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5267. }
  5268. });
  5269. /**
  5270. * ------------------------------------------------------------------------
  5271. * jQuery
  5272. * ------------------------------------------------------------------------
  5273. */
  5274. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5275. $.fn[NAME$8].Constructor = ScrollSpy;
  5276. $.fn[NAME$8].noConflict = function () {
  5277. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5278. return ScrollSpy._jQueryInterface;
  5279. };
  5280. /**
  5281. * ------------------------------------------------------------------------
  5282. * Constants
  5283. * ------------------------------------------------------------------------
  5284. */
  5285. var NAME$9 = 'tab';
  5286. var VERSION$9 = '4.2.1';
  5287. var DATA_KEY$9 = 'bs.tab';
  5288. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5289. var DATA_API_KEY$7 = '.data-api';
  5290. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5291. var Event$9 = {
  5292. HIDE: "hide" + EVENT_KEY$9,
  5293. HIDDEN: "hidden" + EVENT_KEY$9,
  5294. SHOW: "show" + EVENT_KEY$9,
  5295. SHOWN: "shown" + EVENT_KEY$9,
  5296. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5297. };
  5298. var ClassName$9 = {
  5299. DROPDOWN_MENU: 'dropdown-menu',
  5300. ACTIVE: 'active',
  5301. DISABLED: 'disabled',
  5302. FADE: 'fade',
  5303. SHOW: 'show'
  5304. };
  5305. var Selector$9 = {
  5306. DROPDOWN: '.dropdown',
  5307. NAV_LIST_GROUP: '.nav, .list-group',
  5308. ACTIVE: '.active',
  5309. ACTIVE_UL: '> li > .active',
  5310. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5311. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5312. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5313. /**
  5314. * ------------------------------------------------------------------------
  5315. * Class Definition
  5316. * ------------------------------------------------------------------------
  5317. */
  5318. };
  5319. var Tab =
  5320. /*#__PURE__*/
  5321. function () {
  5322. function Tab(element) {
  5323. this._element = element;
  5324. } // Getters
  5325. var _proto = Tab.prototype;
  5326. // Public
  5327. _proto.show = function show() {
  5328. var _this = this;
  5329. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5330. return;
  5331. }
  5332. var target;
  5333. var previous;
  5334. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5335. var selector = Util.getSelectorFromElement(this._element);
  5336. if (listElement) {
  5337. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5338. previous = $.makeArray($(listElement).find(itemSelector));
  5339. previous = previous[previous.length - 1];
  5340. }
  5341. var hideEvent = $.Event(Event$9.HIDE, {
  5342. relatedTarget: this._element
  5343. });
  5344. var showEvent = $.Event(Event$9.SHOW, {
  5345. relatedTarget: previous
  5346. });
  5347. if (previous) {
  5348. $(previous).trigger(hideEvent);
  5349. }
  5350. $(this._element).trigger(showEvent);
  5351. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5352. return;
  5353. }
  5354. if (selector) {
  5355. target = document.querySelector(selector);
  5356. }
  5357. this._activate(this._element, listElement);
  5358. var complete = function complete() {
  5359. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5360. relatedTarget: _this._element
  5361. });
  5362. var shownEvent = $.Event(Event$9.SHOWN, {
  5363. relatedTarget: previous
  5364. });
  5365. $(previous).trigger(hiddenEvent);
  5366. $(_this._element).trigger(shownEvent);
  5367. };
  5368. if (target) {
  5369. this._activate(target, target.parentNode, complete);
  5370. } else {
  5371. complete();
  5372. }
  5373. };
  5374. _proto.dispose = function dispose() {
  5375. $.removeData(this._element, DATA_KEY$9);
  5376. this._element = null;
  5377. }; // Private
  5378. _proto._activate = function _activate(element, container, callback) {
  5379. var _this2 = this;
  5380. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5381. var active = activeElements[0];
  5382. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5383. var complete = function complete() {
  5384. return _this2._transitionComplete(element, active, callback);
  5385. };
  5386. if (active && isTransitioning) {
  5387. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5388. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5389. } else {
  5390. complete();
  5391. }
  5392. };
  5393. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5394. if (active) {
  5395. $(active).removeClass(ClassName$9.ACTIVE);
  5396. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5397. if (dropdownChild) {
  5398. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5399. }
  5400. if (active.getAttribute('role') === 'tab') {
  5401. active.setAttribute('aria-selected', false);
  5402. }
  5403. }
  5404. $(element).addClass(ClassName$9.ACTIVE);
  5405. if (element.getAttribute('role') === 'tab') {
  5406. element.setAttribute('aria-selected', true);
  5407. }
  5408. Util.reflow(element);
  5409. $(element).addClass(ClassName$9.SHOW);
  5410. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5411. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5412. if (dropdownElement) {
  5413. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5414. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5415. }
  5416. element.setAttribute('aria-expanded', true);
  5417. }
  5418. if (callback) {
  5419. callback();
  5420. }
  5421. }; // Static
  5422. Tab._jQueryInterface = function _jQueryInterface(config) {
  5423. return this.each(function () {
  5424. var $this = $(this);
  5425. var data = $this.data(DATA_KEY$9);
  5426. if (!data) {
  5427. data = new Tab(this);
  5428. $this.data(DATA_KEY$9, data);
  5429. }
  5430. if (typeof config === 'string') {
  5431. if (typeof data[config] === 'undefined') {
  5432. throw new TypeError("No method named \"" + config + "\"");
  5433. }
  5434. data[config]();
  5435. }
  5436. });
  5437. };
  5438. _createClass(Tab, null, [{
  5439. key: "VERSION",
  5440. get: function get() {
  5441. return VERSION$9;
  5442. }
  5443. }]);
  5444. return Tab;
  5445. }();
  5446. /**
  5447. * ------------------------------------------------------------------------
  5448. * Data Api implementation
  5449. * ------------------------------------------------------------------------
  5450. */
  5451. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5452. event.preventDefault();
  5453. Tab._jQueryInterface.call($(this), 'show');
  5454. });
  5455. /**
  5456. * ------------------------------------------------------------------------
  5457. * jQuery
  5458. * ------------------------------------------------------------------------
  5459. */
  5460. $.fn[NAME$9] = Tab._jQueryInterface;
  5461. $.fn[NAME$9].Constructor = Tab;
  5462. $.fn[NAME$9].noConflict = function () {
  5463. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5464. return Tab._jQueryInterface;
  5465. };
  5466. /**
  5467. * ------------------------------------------------------------------------
  5468. * Constants
  5469. * ------------------------------------------------------------------------
  5470. */
  5471. var NAME$a = 'toast';
  5472. var VERSION$a = '4.2.1';
  5473. var DATA_KEY$a = 'bs.toast';
  5474. var EVENT_KEY$a = "." + DATA_KEY$a;
  5475. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5476. var Event$a = {
  5477. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5478. HIDE: "hide" + EVENT_KEY$a,
  5479. HIDDEN: "hidden" + EVENT_KEY$a,
  5480. SHOW: "show" + EVENT_KEY$a,
  5481. SHOWN: "shown" + EVENT_KEY$a
  5482. };
  5483. var ClassName$a = {
  5484. FADE: 'fade',
  5485. HIDE: 'hide',
  5486. SHOW: 'show',
  5487. SHOWING: 'showing'
  5488. };
  5489. var DefaultType$7 = {
  5490. animation: 'boolean',
  5491. autohide: 'boolean',
  5492. delay: 'number'
  5493. };
  5494. var Default$7 = {
  5495. animation: true,
  5496. autohide: true,
  5497. delay: 500
  5498. };
  5499. var Selector$a = {
  5500. DATA_DISMISS: '[data-dismiss="toast"]'
  5501. /**
  5502. * ------------------------------------------------------------------------
  5503. * Class Definition
  5504. * ------------------------------------------------------------------------
  5505. */
  5506. };
  5507. var Toast =
  5508. /*#__PURE__*/
  5509. function () {
  5510. function Toast(element, config) {
  5511. this._element = element;
  5512. this._config = this._getConfig(config);
  5513. this._timeout = null;
  5514. this._setListeners();
  5515. } // Getters
  5516. var _proto = Toast.prototype;
  5517. // Public
  5518. _proto.show = function show() {
  5519. var _this = this;
  5520. $(this._element).trigger(Event$a.SHOW);
  5521. if (this._config.animation) {
  5522. this._element.classList.add(ClassName$a.FADE);
  5523. }
  5524. var complete = function complete() {
  5525. _this._element.classList.remove(ClassName$a.SHOWING);
  5526. _this._element.classList.add(ClassName$a.SHOW);
  5527. $(_this._element).trigger(Event$a.SHOWN);
  5528. if (_this._config.autohide) {
  5529. _this.hide();
  5530. }
  5531. };
  5532. this._element.classList.remove(ClassName$a.HIDE);
  5533. this._element.classList.add(ClassName$a.SHOWING);
  5534. if (this._config.animation) {
  5535. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5536. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5537. } else {
  5538. complete();
  5539. }
  5540. };
  5541. _proto.hide = function hide(withoutTimeout) {
  5542. var _this2 = this;
  5543. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5544. return;
  5545. }
  5546. $(this._element).trigger(Event$a.HIDE);
  5547. if (withoutTimeout) {
  5548. this._close();
  5549. } else {
  5550. this._timeout = setTimeout(function () {
  5551. _this2._close();
  5552. }, this._config.delay);
  5553. }
  5554. };
  5555. _proto.dispose = function dispose() {
  5556. clearTimeout(this._timeout);
  5557. this._timeout = null;
  5558. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5559. this._element.classList.remove(ClassName$a.SHOW);
  5560. }
  5561. $(this._element).off(Event$a.CLICK_DISMISS);
  5562. $.removeData(this._element, DATA_KEY$a);
  5563. this._element = null;
  5564. this._config = null;
  5565. }; // Private
  5566. _proto._getConfig = function _getConfig(config) {
  5567. config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
  5568. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5569. return config;
  5570. };
  5571. _proto._setListeners = function _setListeners() {
  5572. var _this3 = this;
  5573. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5574. return _this3.hide(true);
  5575. });
  5576. };
  5577. _proto._close = function _close() {
  5578. var _this4 = this;
  5579. var complete = function complete() {
  5580. _this4._element.classList.add(ClassName$a.HIDE);
  5581. $(_this4._element).trigger(Event$a.HIDDEN);
  5582. };
  5583. this._element.classList.remove(ClassName$a.SHOW);
  5584. if (this._config.animation) {
  5585. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5586. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5587. } else {
  5588. complete();
  5589. }
  5590. }; // Static
  5591. Toast._jQueryInterface = function _jQueryInterface(config) {
  5592. return this.each(function () {
  5593. var $element = $(this);
  5594. var data = $element.data(DATA_KEY$a);
  5595. var _config = typeof config === 'object' && config;
  5596. if (!data) {
  5597. data = new Toast(this, _config);
  5598. $element.data(DATA_KEY$a, data);
  5599. }
  5600. if (typeof config === 'string') {
  5601. if (typeof data[config] === 'undefined') {
  5602. throw new TypeError("No method named \"" + config + "\"");
  5603. }
  5604. data[config](this);
  5605. }
  5606. });
  5607. };
  5608. _createClass(Toast, null, [{
  5609. key: "VERSION",
  5610. get: function get() {
  5611. return VERSION$a;
  5612. }
  5613. }, {
  5614. key: "DefaultType",
  5615. get: function get() {
  5616. return DefaultType$7;
  5617. }
  5618. }]);
  5619. return Toast;
  5620. }();
  5621. /**
  5622. * ------------------------------------------------------------------------
  5623. * jQuery
  5624. * ------------------------------------------------------------------------
  5625. */
  5626. $.fn[NAME$a] = Toast._jQueryInterface;
  5627. $.fn[NAME$a].Constructor = Toast;
  5628. $.fn[NAME$a].noConflict = function () {
  5629. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5630. return Toast._jQueryInterface;
  5631. };
  5632. /**
  5633. * --------------------------------------------------------------------------
  5634. * Bootstrap (v4.2.1): index.js
  5635. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5636. * --------------------------------------------------------------------------
  5637. */
  5638. (function () {
  5639. if (typeof $ === 'undefined') {
  5640. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  5641. }
  5642. var version = $.fn.jquery.split(' ')[0].split('.');
  5643. var minMajor = 1;
  5644. var ltMajor = 2;
  5645. var minMinor = 9;
  5646. var minPatch = 1;
  5647. var maxMajor = 4;
  5648. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  5649. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  5650. }
  5651. })();
  5652. exports.Util = Util;
  5653. exports.Alert = Alert;
  5654. exports.Button = Button;
  5655. exports.Carousel = Carousel;
  5656. exports.Collapse = Collapse;
  5657. exports.Dropdown = Dropdown;
  5658. exports.Modal = Modal;
  5659. exports.Popover = Popover;
  5660. exports.Scrollspy = ScrollSpy;
  5661. exports.Tab = Tab;
  5662. exports.Toast = Toast;
  5663. exports.Tooltip = Tooltip;
  5664. Object.defineProperty(exports, '__esModule', { value: true });
  5665. })));
  5666. //# sourceMappingURL=bootstrap.bundle.js.map