bootstrap.bundle.js 225 KB

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