Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

bootstrap.bundle.js 261KB

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