bootstrap.bundle.js 223 KB

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