bootstrap.bundle.js 204 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780
  1. /*!
  2. * Bootstrap v5.1.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' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory());
  10. }(this, (function () { 'use strict';
  11. /**
  12. * --------------------------------------------------------------------------
  13. * Bootstrap (v5.1.0): util/index.js
  14. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  15. * --------------------------------------------------------------------------
  16. */
  17. const MAX_UID = 1000000;
  18. const MILLISECONDS_MULTIPLIER = 1000;
  19. const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  20. const toType = obj => {
  21. if (obj === null || obj === undefined) {
  22. return `${obj}`;
  23. }
  24. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  25. };
  26. /**
  27. * --------------------------------------------------------------------------
  28. * Public Util Api
  29. * --------------------------------------------------------------------------
  30. */
  31. const getUID = prefix => {
  32. do {
  33. prefix += Math.floor(Math.random() * MAX_UID);
  34. } while (document.getElementById(prefix));
  35. return prefix;
  36. };
  37. const getSelector = element => {
  38. let selector = element.getAttribute('data-bs-target');
  39. if (!selector || selector === '#') {
  40. let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
  41. // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
  42. // `document.querySelector` will rightfully complain it is invalid.
  43. // See https://github.com/twbs/bootstrap/issues/32273
  44. if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
  45. return null;
  46. } // Just in case some CMS puts out a full URL with the anchor appended
  47. if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
  48. hrefAttr = `#${hrefAttr.split('#')[1]}`;
  49. }
  50. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
  51. }
  52. return selector;
  53. };
  54. const getSelectorFromElement = element => {
  55. const selector = getSelector(element);
  56. if (selector) {
  57. return document.querySelector(selector) ? selector : null;
  58. }
  59. return null;
  60. };
  61. const getElementFromSelector = element => {
  62. const selector = getSelector(element);
  63. return selector ? document.querySelector(selector) : null;
  64. };
  65. const getTransitionDurationFromElement = element => {
  66. if (!element) {
  67. return 0;
  68. } // Get transition-duration of the element
  69. let {
  70. transitionDuration,
  71. transitionDelay
  72. } = window.getComputedStyle(element);
  73. const floatTransitionDuration = Number.parseFloat(transitionDuration);
  74. const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  75. if (!floatTransitionDuration && !floatTransitionDelay) {
  76. return 0;
  77. } // If multiple durations are defined, take the first
  78. transitionDuration = transitionDuration.split(',')[0];
  79. transitionDelay = transitionDelay.split(',')[0];
  80. return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  81. };
  82. const triggerTransitionEnd = element => {
  83. element.dispatchEvent(new Event(TRANSITION_END));
  84. };
  85. const isElement$1 = obj => {
  86. if (!obj || typeof obj !== 'object') {
  87. return false;
  88. }
  89. if (typeof obj.jquery !== 'undefined') {
  90. obj = obj[0];
  91. }
  92. return typeof obj.nodeType !== 'undefined';
  93. };
  94. const getElement = obj => {
  95. if (isElement$1(obj)) {
  96. // it's a jQuery object or a node element
  97. return obj.jquery ? obj[0] : obj;
  98. }
  99. if (typeof obj === 'string' && obj.length > 0) {
  100. return document.querySelector(obj);
  101. }
  102. return null;
  103. };
  104. const typeCheckConfig = (componentName, config, configTypes) => {
  105. Object.keys(configTypes).forEach(property => {
  106. const expectedTypes = configTypes[property];
  107. const value = config[property];
  108. const valueType = value && isElement$1(value) ? 'element' : toType(value);
  109. if (!new RegExp(expectedTypes).test(valueType)) {
  110. throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
  111. }
  112. });
  113. };
  114. const isVisible = element => {
  115. if (!isElement$1(element) || element.getClientRects().length === 0) {
  116. return false;
  117. }
  118. return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
  119. };
  120. const isDisabled = element => {
  121. if (!element || element.nodeType !== Node.ELEMENT_NODE) {
  122. return true;
  123. }
  124. if (element.classList.contains('disabled')) {
  125. return true;
  126. }
  127. if (typeof element.disabled !== 'undefined') {
  128. return element.disabled;
  129. }
  130. return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
  131. };
  132. const findShadowRoot = element => {
  133. if (!document.documentElement.attachShadow) {
  134. return null;
  135. } // Can find the shadow root otherwise it'll return the document
  136. if (typeof element.getRootNode === 'function') {
  137. const root = element.getRootNode();
  138. return root instanceof ShadowRoot ? root : null;
  139. }
  140. if (element instanceof ShadowRoot) {
  141. return element;
  142. } // when we don't find a shadow root
  143. if (!element.parentNode) {
  144. return null;
  145. }
  146. return findShadowRoot(element.parentNode);
  147. };
  148. const noop = () => {};
  149. /**
  150. * Trick to restart an element's animation
  151. *
  152. * @param {HTMLElement} element
  153. * @return void
  154. *
  155. * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
  156. */
  157. const reflow = element => {
  158. // eslint-disable-next-line no-unused-expressions
  159. element.offsetHeight;
  160. };
  161. const getjQuery = () => {
  162. const {
  163. jQuery
  164. } = window;
  165. if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
  166. return jQuery;
  167. }
  168. return null;
  169. };
  170. const DOMContentLoadedCallbacks = [];
  171. const onDOMContentLoaded = callback => {
  172. if (document.readyState === 'loading') {
  173. // add listener on the first call when the document is in loading state
  174. if (!DOMContentLoadedCallbacks.length) {
  175. document.addEventListener('DOMContentLoaded', () => {
  176. DOMContentLoadedCallbacks.forEach(callback => callback());
  177. });
  178. }
  179. DOMContentLoadedCallbacks.push(callback);
  180. } else {
  181. callback();
  182. }
  183. };
  184. const isRTL = () => document.documentElement.dir === 'rtl';
  185. const defineJQueryPlugin = plugin => {
  186. onDOMContentLoaded(() => {
  187. const $ = getjQuery();
  188. /* istanbul ignore if */
  189. if ($) {
  190. const name = plugin.NAME;
  191. const JQUERY_NO_CONFLICT = $.fn[name];
  192. $.fn[name] = plugin.jQueryInterface;
  193. $.fn[name].Constructor = plugin;
  194. $.fn[name].noConflict = () => {
  195. $.fn[name] = JQUERY_NO_CONFLICT;
  196. return plugin.jQueryInterface;
  197. };
  198. }
  199. });
  200. };
  201. const execute = callback => {
  202. if (typeof callback === 'function') {
  203. callback();
  204. }
  205. };
  206. const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
  207. if (!waitForTransition) {
  208. execute(callback);
  209. return;
  210. }
  211. const durationPadding = 5;
  212. const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
  213. let called = false;
  214. const handler = ({
  215. target
  216. }) => {
  217. if (target !== transitionElement) {
  218. return;
  219. }
  220. called = true;
  221. transitionElement.removeEventListener(TRANSITION_END, handler);
  222. execute(callback);
  223. };
  224. transitionElement.addEventListener(TRANSITION_END, handler);
  225. setTimeout(() => {
  226. if (!called) {
  227. triggerTransitionEnd(transitionElement);
  228. }
  229. }, emulatedDuration);
  230. };
  231. /**
  232. * Return the previous/next element of a list.
  233. *
  234. * @param {array} list The list of elements
  235. * @param activeElement The active element
  236. * @param shouldGetNext Choose to get next or previous element
  237. * @param isCycleAllowed
  238. * @return {Element|elem} The proper element
  239. */
  240. const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
  241. let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
  242. if (index === -1) {
  243. return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
  244. }
  245. const listLength = list.length;
  246. index += shouldGetNext ? 1 : -1;
  247. if (isCycleAllowed) {
  248. index = (index + listLength) % listLength;
  249. }
  250. return list[Math.max(0, Math.min(index, listLength - 1))];
  251. };
  252. /**
  253. * --------------------------------------------------------------------------
  254. * Bootstrap (v5.1.0): dom/event-handler.js
  255. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  256. * --------------------------------------------------------------------------
  257. */
  258. /**
  259. * ------------------------------------------------------------------------
  260. * Constants
  261. * ------------------------------------------------------------------------
  262. */
  263. const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  264. const stripNameRegex = /\..*/;
  265. const stripUidRegex = /::\d+$/;
  266. const eventRegistry = {}; // Events storage
  267. let uidEvent = 1;
  268. const customEvents = {
  269. mouseenter: 'mouseover',
  270. mouseleave: 'mouseout'
  271. };
  272. const customEventsRegex = /^(mouseenter|mouseleave)/i;
  273. const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
  274. /**
  275. * ------------------------------------------------------------------------
  276. * Private methods
  277. * ------------------------------------------------------------------------
  278. */
  279. function getUidEvent(element, uid) {
  280. return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
  281. }
  282. function getEvent(element) {
  283. const uid = getUidEvent(element);
  284. element.uidEvent = uid;
  285. eventRegistry[uid] = eventRegistry[uid] || {};
  286. return eventRegistry[uid];
  287. }
  288. function bootstrapHandler(element, fn) {
  289. return function handler(event) {
  290. event.delegateTarget = element;
  291. if (handler.oneOff) {
  292. EventHandler.off(element, event.type, fn);
  293. }
  294. return fn.apply(element, [event]);
  295. };
  296. }
  297. function bootstrapDelegationHandler(element, selector, fn) {
  298. return function handler(event) {
  299. const domElements = element.querySelectorAll(selector);
  300. for (let {
  301. target
  302. } = event; target && target !== this; target = target.parentNode) {
  303. for (let i = domElements.length; i--;) {
  304. if (domElements[i] === target) {
  305. event.delegateTarget = target;
  306. if (handler.oneOff) {
  307. // eslint-disable-next-line unicorn/consistent-destructuring
  308. EventHandler.off(element, event.type, selector, fn);
  309. }
  310. return fn.apply(target, [event]);
  311. }
  312. }
  313. } // To please ESLint
  314. return null;
  315. };
  316. }
  317. function findHandler(events, handler, delegationSelector = null) {
  318. const uidEventList = Object.keys(events);
  319. for (let i = 0, len = uidEventList.length; i < len; i++) {
  320. const event = events[uidEventList[i]];
  321. if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
  322. return event;
  323. }
  324. }
  325. return null;
  326. }
  327. function normalizeParams(originalTypeEvent, handler, delegationFn) {
  328. const delegation = typeof handler === 'string';
  329. const originalHandler = delegation ? delegationFn : handler;
  330. let typeEvent = getTypeEvent(originalTypeEvent);
  331. const isNative = nativeEvents.has(typeEvent);
  332. if (!isNative) {
  333. typeEvent = originalTypeEvent;
  334. }
  335. return [delegation, originalHandler, typeEvent];
  336. }
  337. function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
  338. if (typeof originalTypeEvent !== 'string' || !element) {
  339. return;
  340. }
  341. if (!handler) {
  342. handler = delegationFn;
  343. delegationFn = null;
  344. } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
  345. // this prevents the handler from being dispatched the same way as mouseover or mouseout does
  346. if (customEventsRegex.test(originalTypeEvent)) {
  347. const wrapFn = fn => {
  348. return function (event) {
  349. if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
  350. return fn.call(this, event);
  351. }
  352. };
  353. };
  354. if (delegationFn) {
  355. delegationFn = wrapFn(delegationFn);
  356. } else {
  357. handler = wrapFn(handler);
  358. }
  359. }
  360. const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
  361. const events = getEvent(element);
  362. const handlers = events[typeEvent] || (events[typeEvent] = {});
  363. const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
  364. if (previousFn) {
  365. previousFn.oneOff = previousFn.oneOff && oneOff;
  366. return;
  367. }
  368. const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
  369. const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
  370. fn.delegationSelector = delegation ? handler : null;
  371. fn.originalHandler = originalHandler;
  372. fn.oneOff = oneOff;
  373. fn.uidEvent = uid;
  374. handlers[uid] = fn;
  375. element.addEventListener(typeEvent, fn, delegation);
  376. }
  377. function removeHandler(element, events, typeEvent, handler, delegationSelector) {
  378. const fn = findHandler(events[typeEvent], handler, delegationSelector);
  379. if (!fn) {
  380. return;
  381. }
  382. element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
  383. delete events[typeEvent][fn.uidEvent];
  384. }
  385. function removeNamespacedHandlers(element, events, typeEvent, namespace) {
  386. const storeElementEvent = events[typeEvent] || {};
  387. Object.keys(storeElementEvent).forEach(handlerKey => {
  388. if (handlerKey.includes(namespace)) {
  389. const event = storeElementEvent[handlerKey];
  390. removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
  391. }
  392. });
  393. }
  394. function getTypeEvent(event) {
  395. // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
  396. event = event.replace(stripNameRegex, '');
  397. return customEvents[event] || event;
  398. }
  399. const EventHandler = {
  400. on(element, event, handler, delegationFn) {
  401. addHandler(element, event, handler, delegationFn, false);
  402. },
  403. one(element, event, handler, delegationFn) {
  404. addHandler(element, event, handler, delegationFn, true);
  405. },
  406. off(element, originalTypeEvent, handler, delegationFn) {
  407. if (typeof originalTypeEvent !== 'string' || !element) {
  408. return;
  409. }
  410. const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
  411. const inNamespace = typeEvent !== originalTypeEvent;
  412. const events = getEvent(element);
  413. const isNamespace = originalTypeEvent.startsWith('.');
  414. if (typeof originalHandler !== 'undefined') {
  415. // Simplest case: handler is passed, remove that listener ONLY.
  416. if (!events || !events[typeEvent]) {
  417. return;
  418. }
  419. removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
  420. return;
  421. }
  422. if (isNamespace) {
  423. Object.keys(events).forEach(elementEvent => {
  424. removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
  425. });
  426. }
  427. const storeElementEvent = events[typeEvent] || {};
  428. Object.keys(storeElementEvent).forEach(keyHandlers => {
  429. const handlerKey = keyHandlers.replace(stripUidRegex, '');
  430. if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
  431. const event = storeElementEvent[keyHandlers];
  432. removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
  433. }
  434. });
  435. },
  436. trigger(element, event, args) {
  437. if (typeof event !== 'string' || !element) {
  438. return null;
  439. }
  440. const $ = getjQuery();
  441. const typeEvent = getTypeEvent(event);
  442. const inNamespace = event !== typeEvent;
  443. const isNative = nativeEvents.has(typeEvent);
  444. let jQueryEvent;
  445. let bubbles = true;
  446. let nativeDispatch = true;
  447. let defaultPrevented = false;
  448. let evt = null;
  449. if (inNamespace && $) {
  450. jQueryEvent = $.Event(event, args);
  451. $(element).trigger(jQueryEvent);
  452. bubbles = !jQueryEvent.isPropagationStopped();
  453. nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
  454. defaultPrevented = jQueryEvent.isDefaultPrevented();
  455. }
  456. if (isNative) {
  457. evt = document.createEvent('HTMLEvents');
  458. evt.initEvent(typeEvent, bubbles, true);
  459. } else {
  460. evt = new CustomEvent(event, {
  461. bubbles,
  462. cancelable: true
  463. });
  464. } // merge custom information in our event
  465. if (typeof args !== 'undefined') {
  466. Object.keys(args).forEach(key => {
  467. Object.defineProperty(evt, key, {
  468. get() {
  469. return args[key];
  470. }
  471. });
  472. });
  473. }
  474. if (defaultPrevented) {
  475. evt.preventDefault();
  476. }
  477. if (nativeDispatch) {
  478. element.dispatchEvent(evt);
  479. }
  480. if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
  481. jQueryEvent.preventDefault();
  482. }
  483. return evt;
  484. }
  485. };
  486. /**
  487. * --------------------------------------------------------------------------
  488. * Bootstrap (v5.1.0): dom/data.js
  489. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  490. * --------------------------------------------------------------------------
  491. */
  492. /**
  493. * ------------------------------------------------------------------------
  494. * Constants
  495. * ------------------------------------------------------------------------
  496. */
  497. const elementMap = new Map();
  498. var Data = {
  499. set(element, key, instance) {
  500. if (!elementMap.has(element)) {
  501. elementMap.set(element, new Map());
  502. }
  503. const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
  504. // can be removed later when multiple key/instances are fine to be used
  505. if (!instanceMap.has(key) && instanceMap.size !== 0) {
  506. // eslint-disable-next-line no-console
  507. console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
  508. return;
  509. }
  510. instanceMap.set(key, instance);
  511. },
  512. get(element, key) {
  513. if (elementMap.has(element)) {
  514. return elementMap.get(element).get(key) || null;
  515. }
  516. return null;
  517. },
  518. remove(element, key) {
  519. if (!elementMap.has(element)) {
  520. return;
  521. }
  522. const instanceMap = elementMap.get(element);
  523. instanceMap.delete(key); // free up element references if there are no instances left for an element
  524. if (instanceMap.size === 0) {
  525. elementMap.delete(element);
  526. }
  527. }
  528. };
  529. /**
  530. * --------------------------------------------------------------------------
  531. * Bootstrap (v5.1.0): base-component.js
  532. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  533. * --------------------------------------------------------------------------
  534. */
  535. /**
  536. * ------------------------------------------------------------------------
  537. * Constants
  538. * ------------------------------------------------------------------------
  539. */
  540. const VERSION = '5.1.0';
  541. class BaseComponent {
  542. constructor(element) {
  543. element = getElement(element);
  544. if (!element) {
  545. return;
  546. }
  547. this._element = element;
  548. Data.set(this._element, this.constructor.DATA_KEY, this);
  549. }
  550. dispose() {
  551. Data.remove(this._element, this.constructor.DATA_KEY);
  552. EventHandler.off(this._element, this.constructor.EVENT_KEY);
  553. Object.getOwnPropertyNames(this).forEach(propertyName => {
  554. this[propertyName] = null;
  555. });
  556. }
  557. _queueCallback(callback, element, isAnimated = true) {
  558. executeAfterTransition(callback, element, isAnimated);
  559. }
  560. /** Static */
  561. static getInstance(element) {
  562. return Data.get(getElement(element), this.DATA_KEY);
  563. }
  564. static getOrCreateInstance(element, config = {}) {
  565. return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
  566. }
  567. static get VERSION() {
  568. return VERSION;
  569. }
  570. static get NAME() {
  571. throw new Error('You have to implement the static method "NAME", for each component!');
  572. }
  573. static get DATA_KEY() {
  574. return `bs.${this.NAME}`;
  575. }
  576. static get EVENT_KEY() {
  577. return `.${this.DATA_KEY}`;
  578. }
  579. }
  580. /**
  581. * --------------------------------------------------------------------------
  582. * Bootstrap (v5.1.0): util/component-functions.js
  583. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  584. * --------------------------------------------------------------------------
  585. */
  586. const enableDismissTrigger = (component, method = 'hide') => {
  587. const clickEvent = `click.dismiss${component.EVENT_KEY}`;
  588. const name = component.NAME;
  589. EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
  590. if (['A', 'AREA'].includes(this.tagName)) {
  591. event.preventDefault();
  592. }
  593. if (isDisabled(this)) {
  594. return;
  595. }
  596. const target = getElementFromSelector(this) || this.closest(`.${name}`);
  597. const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
  598. instance[method]();
  599. });
  600. };
  601. /**
  602. * --------------------------------------------------------------------------
  603. * Bootstrap (v5.1.0): alert.js
  604. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  605. * --------------------------------------------------------------------------
  606. */
  607. /**
  608. * ------------------------------------------------------------------------
  609. * Constants
  610. * ------------------------------------------------------------------------
  611. */
  612. const NAME$d = 'alert';
  613. const DATA_KEY$c = 'bs.alert';
  614. const EVENT_KEY$c = `.${DATA_KEY$c}`;
  615. const EVENT_CLOSE = `close${EVENT_KEY$c}`;
  616. const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
  617. const CLASS_NAME_FADE$5 = 'fade';
  618. const CLASS_NAME_SHOW$8 = 'show';
  619. /**
  620. * ------------------------------------------------------------------------
  621. * Class Definition
  622. * ------------------------------------------------------------------------
  623. */
  624. class Alert extends BaseComponent {
  625. // Getters
  626. static get NAME() {
  627. return NAME$d;
  628. } // Public
  629. close() {
  630. const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
  631. if (closeEvent.defaultPrevented) {
  632. return;
  633. }
  634. this._element.classList.remove(CLASS_NAME_SHOW$8);
  635. const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
  636. this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
  637. } // Private
  638. _destroyElement() {
  639. this._element.remove();
  640. EventHandler.trigger(this._element, EVENT_CLOSED);
  641. this.dispose();
  642. } // Static
  643. static jQueryInterface(config) {
  644. return this.each(function () {
  645. const data = Alert.getOrCreateInstance(this);
  646. if (typeof config !== 'string') {
  647. return;
  648. }
  649. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  650. throw new TypeError(`No method named "${config}"`);
  651. }
  652. data[config](this);
  653. });
  654. }
  655. }
  656. /**
  657. * ------------------------------------------------------------------------
  658. * Data Api implementation
  659. * ------------------------------------------------------------------------
  660. */
  661. enableDismissTrigger(Alert, 'close');
  662. /**
  663. * ------------------------------------------------------------------------
  664. * jQuery
  665. * ------------------------------------------------------------------------
  666. * add .Alert to jQuery only if jQuery is present
  667. */
  668. defineJQueryPlugin(Alert);
  669. /**
  670. * --------------------------------------------------------------------------
  671. * Bootstrap (v5.1.0): button.js
  672. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  673. * --------------------------------------------------------------------------
  674. */
  675. /**
  676. * ------------------------------------------------------------------------
  677. * Constants
  678. * ------------------------------------------------------------------------
  679. */
  680. const NAME$c = 'button';
  681. const DATA_KEY$b = 'bs.button';
  682. const EVENT_KEY$b = `.${DATA_KEY$b}`;
  683. const DATA_API_KEY$7 = '.data-api';
  684. const CLASS_NAME_ACTIVE$3 = 'active';
  685. const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
  686. const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
  687. /**
  688. * ------------------------------------------------------------------------
  689. * Class Definition
  690. * ------------------------------------------------------------------------
  691. */
  692. class Button extends BaseComponent {
  693. // Getters
  694. static get NAME() {
  695. return NAME$c;
  696. } // Public
  697. toggle() {
  698. // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
  699. this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
  700. } // Static
  701. static jQueryInterface(config) {
  702. return this.each(function () {
  703. const data = Button.getOrCreateInstance(this);
  704. if (config === 'toggle') {
  705. data[config]();
  706. }
  707. });
  708. }
  709. }
  710. /**
  711. * ------------------------------------------------------------------------
  712. * Data Api implementation
  713. * ------------------------------------------------------------------------
  714. */
  715. EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
  716. event.preventDefault();
  717. const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
  718. const data = Button.getOrCreateInstance(button);
  719. data.toggle();
  720. });
  721. /**
  722. * ------------------------------------------------------------------------
  723. * jQuery
  724. * ------------------------------------------------------------------------
  725. * add .Button to jQuery only if jQuery is present
  726. */
  727. defineJQueryPlugin(Button);
  728. /**
  729. * --------------------------------------------------------------------------
  730. * Bootstrap (v5.1.0): dom/manipulator.js
  731. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  732. * --------------------------------------------------------------------------
  733. */
  734. function normalizeData(val) {
  735. if (val === 'true') {
  736. return true;
  737. }
  738. if (val === 'false') {
  739. return false;
  740. }
  741. if (val === Number(val).toString()) {
  742. return Number(val);
  743. }
  744. if (val === '' || val === 'null') {
  745. return null;
  746. }
  747. return val;
  748. }
  749. function normalizeDataKey(key) {
  750. return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
  751. }
  752. const Manipulator = {
  753. setDataAttribute(element, key, value) {
  754. element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
  755. },
  756. removeDataAttribute(element, key) {
  757. element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
  758. },
  759. getDataAttributes(element) {
  760. if (!element) {
  761. return {};
  762. }
  763. const attributes = {};
  764. Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => {
  765. let pureKey = key.replace(/^bs/, '');
  766. pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
  767. attributes[pureKey] = normalizeData(element.dataset[key]);
  768. });
  769. return attributes;
  770. },
  771. getDataAttribute(element, key) {
  772. return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
  773. },
  774. offset(element) {
  775. const rect = element.getBoundingClientRect();
  776. return {
  777. top: rect.top + window.pageYOffset,
  778. left: rect.left + window.pageXOffset
  779. };
  780. },
  781. position(element) {
  782. return {
  783. top: element.offsetTop,
  784. left: element.offsetLeft
  785. };
  786. }
  787. };
  788. /**
  789. * --------------------------------------------------------------------------
  790. * Bootstrap (v5.1.0): dom/selector-engine.js
  791. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  792. * --------------------------------------------------------------------------
  793. */
  794. const NODE_TEXT = 3;
  795. const SelectorEngine = {
  796. find(selector, element = document.documentElement) {
  797. return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
  798. },
  799. findOne(selector, element = document.documentElement) {
  800. return Element.prototype.querySelector.call(element, selector);
  801. },
  802. children(element, selector) {
  803. return [].concat(...element.children).filter(child => child.matches(selector));
  804. },
  805. parents(element, selector) {
  806. const parents = [];
  807. let ancestor = element.parentNode;
  808. while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
  809. if (ancestor.matches(selector)) {
  810. parents.push(ancestor);
  811. }
  812. ancestor = ancestor.parentNode;
  813. }
  814. return parents;
  815. },
  816. prev(element, selector) {
  817. let previous = element.previousElementSibling;
  818. while (previous) {
  819. if (previous.matches(selector)) {
  820. return [previous];
  821. }
  822. previous = previous.previousElementSibling;
  823. }
  824. return [];
  825. },
  826. next(element, selector) {
  827. let next = element.nextElementSibling;
  828. while (next) {
  829. if (next.matches(selector)) {
  830. return [next];
  831. }
  832. next = next.nextElementSibling;
  833. }
  834. return [];
  835. },
  836. focusableChildren(element) {
  837. const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
  838. return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
  839. }
  840. };
  841. /**
  842. * --------------------------------------------------------------------------
  843. * Bootstrap (v5.1.0): carousel.js
  844. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  845. * --------------------------------------------------------------------------
  846. */
  847. /**
  848. * ------------------------------------------------------------------------
  849. * Constants
  850. * ------------------------------------------------------------------------
  851. */
  852. const NAME$b = 'carousel';
  853. const DATA_KEY$a = 'bs.carousel';
  854. const EVENT_KEY$a = `.${DATA_KEY$a}`;
  855. const DATA_API_KEY$6 = '.data-api';
  856. const ARROW_LEFT_KEY = 'ArrowLeft';
  857. const ARROW_RIGHT_KEY = 'ArrowRight';
  858. const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  859. const SWIPE_THRESHOLD = 40;
  860. const Default$a = {
  861. interval: 5000,
  862. keyboard: true,
  863. slide: false,
  864. pause: 'hover',
  865. wrap: true,
  866. touch: true
  867. };
  868. const DefaultType$a = {
  869. interval: '(number|boolean)',
  870. keyboard: 'boolean',
  871. slide: '(boolean|string)',
  872. pause: '(string|boolean)',
  873. wrap: 'boolean',
  874. touch: 'boolean'
  875. };
  876. const ORDER_NEXT = 'next';
  877. const ORDER_PREV = 'prev';
  878. const DIRECTION_LEFT = 'left';
  879. const DIRECTION_RIGHT = 'right';
  880. const KEY_TO_DIRECTION = {
  881. [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
  882. [ARROW_RIGHT_KEY]: DIRECTION_LEFT
  883. };
  884. const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
  885. const EVENT_SLID = `slid${EVENT_KEY$a}`;
  886. const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
  887. const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
  888. const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
  889. const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
  890. const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
  891. const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
  892. const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
  893. const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
  894. const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
  895. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
  896. const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
  897. const CLASS_NAME_CAROUSEL = 'carousel';
  898. const CLASS_NAME_ACTIVE$2 = 'active';
  899. const CLASS_NAME_SLIDE = 'slide';
  900. const CLASS_NAME_END = 'carousel-item-end';
  901. const CLASS_NAME_START = 'carousel-item-start';
  902. const CLASS_NAME_NEXT = 'carousel-item-next';
  903. const CLASS_NAME_PREV = 'carousel-item-prev';
  904. const CLASS_NAME_POINTER_EVENT = 'pointer-event';
  905. const SELECTOR_ACTIVE$1 = '.active';
  906. const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  907. const SELECTOR_ITEM = '.carousel-item';
  908. const SELECTOR_ITEM_IMG = '.carousel-item img';
  909. const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  910. const SELECTOR_INDICATORS = '.carousel-indicators';
  911. const SELECTOR_INDICATOR = '[data-bs-target]';
  912. const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
  913. const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
  914. const POINTER_TYPE_TOUCH = 'touch';
  915. const POINTER_TYPE_PEN = 'pen';
  916. /**
  917. * ------------------------------------------------------------------------
  918. * Class Definition
  919. * ------------------------------------------------------------------------
  920. */
  921. class Carousel extends BaseComponent {
  922. constructor(element, config) {
  923. super(element);
  924. this._items = null;
  925. this._interval = null;
  926. this._activeElement = null;
  927. this._isPaused = false;
  928. this._isSliding = false;
  929. this.touchTimeout = null;
  930. this.touchStartX = 0;
  931. this.touchDeltaX = 0;
  932. this._config = this._getConfig(config);
  933. this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
  934. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  935. this._pointerEvent = Boolean(window.PointerEvent);
  936. this._addEventListeners();
  937. } // Getters
  938. static get Default() {
  939. return Default$a;
  940. }
  941. static get NAME() {
  942. return NAME$b;
  943. } // Public
  944. next() {
  945. this._slide(ORDER_NEXT);
  946. }
  947. nextWhenVisible() {
  948. // Don't call next when the page isn't visible
  949. // or the carousel or its parent isn't visible
  950. if (!document.hidden && isVisible(this._element)) {
  951. this.next();
  952. }
  953. }
  954. prev() {
  955. this._slide(ORDER_PREV);
  956. }
  957. pause(event) {
  958. if (!event) {
  959. this._isPaused = true;
  960. }
  961. if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
  962. triggerTransitionEnd(this._element);
  963. this.cycle(true);
  964. }
  965. clearInterval(this._interval);
  966. this._interval = null;
  967. }
  968. cycle(event) {
  969. if (!event) {
  970. this._isPaused = false;
  971. }
  972. if (this._interval) {
  973. clearInterval(this._interval);
  974. this._interval = null;
  975. }
  976. if (this._config && this._config.interval && !this._isPaused) {
  977. this._updateInterval();
  978. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  979. }
  980. }
  981. to(index) {
  982. this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  983. const activeIndex = this._getItemIndex(this._activeElement);
  984. if (index > this._items.length - 1 || index < 0) {
  985. return;
  986. }
  987. if (this._isSliding) {
  988. EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
  989. return;
  990. }
  991. if (activeIndex === index) {
  992. this.pause();
  993. this.cycle();
  994. return;
  995. }
  996. const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
  997. this._slide(order, this._items[index]);
  998. } // Private
  999. _getConfig(config) {
  1000. config = { ...Default$a,
  1001. ...Manipulator.getDataAttributes(this._element),
  1002. ...(typeof config === 'object' ? config : {})
  1003. };
  1004. typeCheckConfig(NAME$b, config, DefaultType$a);
  1005. return config;
  1006. }
  1007. _handleSwipe() {
  1008. const absDeltax = Math.abs(this.touchDeltaX);
  1009. if (absDeltax <= SWIPE_THRESHOLD) {
  1010. return;
  1011. }
  1012. const direction = absDeltax / this.touchDeltaX;
  1013. this.touchDeltaX = 0;
  1014. if (!direction) {
  1015. return;
  1016. }
  1017. this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
  1018. }
  1019. _addEventListeners() {
  1020. if (this._config.keyboard) {
  1021. EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
  1022. }
  1023. if (this._config.pause === 'hover') {
  1024. EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event));
  1025. EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event));
  1026. }
  1027. if (this._config.touch && this._touchSupported) {
  1028. this._addTouchEventListeners();
  1029. }
  1030. }
  1031. _addTouchEventListeners() {
  1032. const start = event => {
  1033. if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
  1034. this.touchStartX = event.clientX;
  1035. } else if (!this._pointerEvent) {
  1036. this.touchStartX = event.touches[0].clientX;
  1037. }
  1038. };
  1039. const move = event => {
  1040. // ensure swiping with one touch and not pinching
  1041. this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
  1042. };
  1043. const end = event => {
  1044. if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
  1045. this.touchDeltaX = event.clientX - this.touchStartX;
  1046. }
  1047. this._handleSwipe();
  1048. if (this._config.pause === 'hover') {
  1049. // If it's a touch-enabled device, mouseenter/leave are fired as
  1050. // part of the mouse compatibility events on first tap - the carousel
  1051. // would stop cycling until user tapped out of it;
  1052. // here, we listen for touchend, explicitly pause the carousel
  1053. // (as if it's the second time we tap on it, mouseenter compat event
  1054. // is NOT fired) and after a timeout (to allow for mouse compatibility
  1055. // events to fire) we explicitly restart cycling
  1056. this.pause();
  1057. if (this.touchTimeout) {
  1058. clearTimeout(this.touchTimeout);
  1059. }
  1060. this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
  1061. }
  1062. };
  1063. SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
  1064. EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault());
  1065. });
  1066. if (this._pointerEvent) {
  1067. EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event));
  1068. EventHandler.on(this._element, EVENT_POINTERUP, event => end(event));
  1069. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  1070. } else {
  1071. EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event));
  1072. EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event));
  1073. EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event));
  1074. }
  1075. }
  1076. _keydown(event) {
  1077. if (/input|textarea/i.test(event.target.tagName)) {
  1078. return;
  1079. }
  1080. const direction = KEY_TO_DIRECTION[event.key];
  1081. if (direction) {
  1082. event.preventDefault();
  1083. this._slide(direction);
  1084. }
  1085. }
  1086. _getItemIndex(element) {
  1087. this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
  1088. return this._items.indexOf(element);
  1089. }
  1090. _getItemByOrder(order, activeElement) {
  1091. const isNext = order === ORDER_NEXT;
  1092. return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
  1093. }
  1094. _triggerSlideEvent(relatedTarget, eventDirectionName) {
  1095. const targetIndex = this._getItemIndex(relatedTarget);
  1096. const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
  1097. return EventHandler.trigger(this._element, EVENT_SLIDE, {
  1098. relatedTarget,
  1099. direction: eventDirectionName,
  1100. from: fromIndex,
  1101. to: targetIndex
  1102. });
  1103. }
  1104. _setActiveIndicatorElement(element) {
  1105. if (this._indicatorsElement) {
  1106. const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
  1107. activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
  1108. activeIndicator.removeAttribute('aria-current');
  1109. const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
  1110. for (let i = 0; i < indicators.length; i++) {
  1111. if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
  1112. indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
  1113. indicators[i].setAttribute('aria-current', 'true');
  1114. break;
  1115. }
  1116. }
  1117. }
  1118. }
  1119. _updateInterval() {
  1120. const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1121. if (!element) {
  1122. return;
  1123. }
  1124. const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
  1125. if (elementInterval) {
  1126. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  1127. this._config.interval = elementInterval;
  1128. } else {
  1129. this._config.interval = this._config.defaultInterval || this._config.interval;
  1130. }
  1131. }
  1132. _slide(directionOrOrder, element) {
  1133. const order = this._directionToOrder(directionOrOrder);
  1134. const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1135. const activeElementIndex = this._getItemIndex(activeElement);
  1136. const nextElement = element || this._getItemByOrder(order, activeElement);
  1137. const nextElementIndex = this._getItemIndex(nextElement);
  1138. const isCycling = Boolean(this._interval);
  1139. const isNext = order === ORDER_NEXT;
  1140. const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
  1141. const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
  1142. const eventDirectionName = this._orderToDirection(order);
  1143. if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
  1144. this._isSliding = false;
  1145. return;
  1146. }
  1147. if (this._isSliding) {
  1148. return;
  1149. }
  1150. const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  1151. if (slideEvent.defaultPrevented) {
  1152. return;
  1153. }
  1154. if (!activeElement || !nextElement) {
  1155. // Some weirdness is happening, so we bail
  1156. return;
  1157. }
  1158. this._isSliding = true;
  1159. if (isCycling) {
  1160. this.pause();
  1161. }
  1162. this._setActiveIndicatorElement(nextElement);
  1163. this._activeElement = nextElement;
  1164. const triggerSlidEvent = () => {
  1165. EventHandler.trigger(this._element, EVENT_SLID, {
  1166. relatedTarget: nextElement,
  1167. direction: eventDirectionName,
  1168. from: activeElementIndex,
  1169. to: nextElementIndex
  1170. });
  1171. };
  1172. if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
  1173. nextElement.classList.add(orderClassName);
  1174. reflow(nextElement);
  1175. activeElement.classList.add(directionalClassName);
  1176. nextElement.classList.add(directionalClassName);
  1177. const completeCallBack = () => {
  1178. nextElement.classList.remove(directionalClassName, orderClassName);
  1179. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1180. activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
  1181. this._isSliding = false;
  1182. setTimeout(triggerSlidEvent, 0);
  1183. };
  1184. this._queueCallback(completeCallBack, activeElement, true);
  1185. } else {
  1186. activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
  1187. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1188. this._isSliding = false;
  1189. triggerSlidEvent();
  1190. }
  1191. if (isCycling) {
  1192. this.cycle();
  1193. }
  1194. }
  1195. _directionToOrder(direction) {
  1196. if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
  1197. return direction;
  1198. }
  1199. if (isRTL()) {
  1200. return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
  1201. }
  1202. return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
  1203. }
  1204. _orderToDirection(order) {
  1205. if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
  1206. return order;
  1207. }
  1208. if (isRTL()) {
  1209. return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
  1210. }
  1211. return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
  1212. } // Static
  1213. static carouselInterface(element, config) {
  1214. const data = Carousel.getOrCreateInstance(element, config);
  1215. let {
  1216. _config
  1217. } = data;
  1218. if (typeof config === 'object') {
  1219. _config = { ..._config,
  1220. ...config
  1221. };
  1222. }
  1223. const action = typeof config === 'string' ? config : _config.slide;
  1224. if (typeof config === 'number') {
  1225. data.to(config);
  1226. } else if (typeof action === 'string') {
  1227. if (typeof data[action] === 'undefined') {
  1228. throw new TypeError(`No method named "${action}"`);
  1229. }
  1230. data[action]();
  1231. } else if (_config.interval && _config.ride) {
  1232. data.pause();
  1233. data.cycle();
  1234. }
  1235. }
  1236. static jQueryInterface(config) {
  1237. return this.each(function () {
  1238. Carousel.carouselInterface(this, config);
  1239. });
  1240. }
  1241. static dataApiClickHandler(event) {
  1242. const target = getElementFromSelector(this);
  1243. if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
  1244. return;
  1245. }
  1246. const config = { ...Manipulator.getDataAttributes(target),
  1247. ...Manipulator.getDataAttributes(this)
  1248. };
  1249. const slideIndex = this.getAttribute('data-bs-slide-to');
  1250. if (slideIndex) {
  1251. config.interval = false;
  1252. }
  1253. Carousel.carouselInterface(target, config);
  1254. if (slideIndex) {
  1255. Carousel.getInstance(target).to(slideIndex);
  1256. }
  1257. event.preventDefault();
  1258. }
  1259. }
  1260. /**
  1261. * ------------------------------------------------------------------------
  1262. * Data Api implementation
  1263. * ------------------------------------------------------------------------
  1264. */
  1265. EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
  1266. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  1267. const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
  1268. for (let i = 0, len = carousels.length; i < len; i++) {
  1269. Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
  1270. }
  1271. });
  1272. /**
  1273. * ------------------------------------------------------------------------
  1274. * jQuery
  1275. * ------------------------------------------------------------------------
  1276. * add .Carousel to jQuery only if jQuery is present
  1277. */
  1278. defineJQueryPlugin(Carousel);
  1279. /**
  1280. * --------------------------------------------------------------------------
  1281. * Bootstrap (v5.1.0): collapse.js
  1282. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1283. * --------------------------------------------------------------------------
  1284. */
  1285. /**
  1286. * ------------------------------------------------------------------------
  1287. * Constants
  1288. * ------------------------------------------------------------------------
  1289. */
  1290. const NAME$a = 'collapse';
  1291. const DATA_KEY$9 = 'bs.collapse';
  1292. const EVENT_KEY$9 = `.${DATA_KEY$9}`;
  1293. const DATA_API_KEY$5 = '.data-api';
  1294. const Default$9 = {
  1295. toggle: true,
  1296. parent: null
  1297. };
  1298. const DefaultType$9 = {
  1299. toggle: 'boolean',
  1300. parent: '(null|element)'
  1301. };
  1302. const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
  1303. const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
  1304. const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
  1305. const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
  1306. const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
  1307. const CLASS_NAME_SHOW$7 = 'show';
  1308. const CLASS_NAME_COLLAPSE = 'collapse';
  1309. const CLASS_NAME_COLLAPSING = 'collapsing';
  1310. const CLASS_NAME_COLLAPSED = 'collapsed';
  1311. const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
  1312. const WIDTH = 'width';
  1313. const HEIGHT = 'height';
  1314. const SELECTOR_ACTIVES = '.show, .collapsing';
  1315. const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
  1316. /**
  1317. * ------------------------------------------------------------------------
  1318. * Class Definition
  1319. * ------------------------------------------------------------------------
  1320. */
  1321. class Collapse extends BaseComponent {
  1322. constructor(element, config) {
  1323. super(element);
  1324. this._isTransitioning = false;
  1325. this._config = this._getConfig(config);
  1326. this._triggerArray = [];
  1327. const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
  1328. for (let i = 0, len = toggleList.length; i < len; i++) {
  1329. const elem = toggleList[i];
  1330. const selector = getSelectorFromElement(elem);
  1331. const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element);
  1332. if (selector !== null && filterElement.length) {
  1333. this._selector = selector;
  1334. this._triggerArray.push(elem);
  1335. }
  1336. }
  1337. this._initializeChildren();
  1338. if (!this._config.parent) {
  1339. this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
  1340. }
  1341. if (this._config.toggle) {
  1342. this.toggle();
  1343. }
  1344. } // Getters
  1345. static get Default() {
  1346. return Default$9;
  1347. }
  1348. static get NAME() {
  1349. return NAME$a;
  1350. } // Public
  1351. toggle() {
  1352. if (this._isShown()) {
  1353. this.hide();
  1354. } else {
  1355. this.show();
  1356. }
  1357. }
  1358. show() {
  1359. if (this._isTransitioning || this._isShown()) {
  1360. return;
  1361. }
  1362. let actives = [];
  1363. let activesData;
  1364. if (this._config.parent) {
  1365. const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
  1366. actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
  1367. }
  1368. const container = SelectorEngine.findOne(this._selector);
  1369. if (actives.length) {
  1370. const tempActiveData = actives.find(elem => container !== elem);
  1371. activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
  1372. if (activesData && activesData._isTransitioning) {
  1373. return;
  1374. }
  1375. }
  1376. const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
  1377. if (startEvent.defaultPrevented) {
  1378. return;
  1379. }
  1380. actives.forEach(elemActive => {
  1381. if (container !== elemActive) {
  1382. Collapse.getOrCreateInstance(elemActive, {
  1383. toggle: false
  1384. }).hide();
  1385. }
  1386. if (!activesData) {
  1387. Data.set(elemActive, DATA_KEY$9, null);
  1388. }
  1389. });
  1390. const dimension = this._getDimension();
  1391. this._element.classList.remove(CLASS_NAME_COLLAPSE);
  1392. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1393. this._element.style[dimension] = 0;
  1394. this._addAriaAndCollapsedClass(this._triggerArray, true);
  1395. this._isTransitioning = true;
  1396. const complete = () => {
  1397. this._isTransitioning = false;
  1398. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1399. this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1400. this._element.style[dimension] = '';
  1401. EventHandler.trigger(this._element, EVENT_SHOWN$5);
  1402. };
  1403. const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1404. const scrollSize = `scroll${capitalizedDimension}`;
  1405. this._queueCallback(complete, this._element, true);
  1406. this._element.style[dimension] = `${this._element[scrollSize]}px`;
  1407. }
  1408. hide() {
  1409. if (this._isTransitioning || !this._isShown()) {
  1410. return;
  1411. }
  1412. const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
  1413. if (startEvent.defaultPrevented) {
  1414. return;
  1415. }
  1416. const dimension = this._getDimension();
  1417. this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
  1418. reflow(this._element);
  1419. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1420. this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1421. const triggerArrayLength = this._triggerArray.length;
  1422. for (let i = 0; i < triggerArrayLength; i++) {
  1423. const trigger = this._triggerArray[i];
  1424. const elem = getElementFromSelector(trigger);
  1425. if (elem && !this._isShown(elem)) {
  1426. this._addAriaAndCollapsedClass([trigger], false);
  1427. }
  1428. }
  1429. this._isTransitioning = true;
  1430. const complete = () => {
  1431. this._isTransitioning = false;
  1432. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1433. this._element.classList.add(CLASS_NAME_COLLAPSE);
  1434. EventHandler.trigger(this._element, EVENT_HIDDEN$5);
  1435. };
  1436. this._element.style[dimension] = '';
  1437. this._queueCallback(complete, this._element, true);
  1438. }
  1439. _isShown(element = this._element) {
  1440. return element.classList.contains(CLASS_NAME_SHOW$7);
  1441. } // Private
  1442. _getConfig(config) {
  1443. config = { ...Default$9,
  1444. ...Manipulator.getDataAttributes(this._element),
  1445. ...config
  1446. };
  1447. config.toggle = Boolean(config.toggle); // Coerce string values
  1448. config.parent = getElement(config.parent);
  1449. typeCheckConfig(NAME$a, config, DefaultType$9);
  1450. return config;
  1451. }
  1452. _getDimension() {
  1453. return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
  1454. }
  1455. _initializeChildren() {
  1456. if (!this._config.parent) {
  1457. return;
  1458. }
  1459. const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
  1460. SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
  1461. const selected = getElementFromSelector(element);
  1462. if (selected) {
  1463. this._addAriaAndCollapsedClass([element], this._isShown(selected));
  1464. }
  1465. });
  1466. }
  1467. _addAriaAndCollapsedClass(triggerArray, isOpen) {
  1468. if (!triggerArray.length) {
  1469. return;
  1470. }
  1471. triggerArray.forEach(elem => {
  1472. if (isOpen) {
  1473. elem.classList.remove(CLASS_NAME_COLLAPSED);
  1474. } else {
  1475. elem.classList.add(CLASS_NAME_COLLAPSED);
  1476. }
  1477. elem.setAttribute('aria-expanded', isOpen);
  1478. });
  1479. } // Static
  1480. static jQueryInterface(config) {
  1481. return this.each(function () {
  1482. const _config = {};
  1483. if (typeof config === 'string' && /show|hide/.test(config)) {
  1484. _config.toggle = false;
  1485. }
  1486. const data = Collapse.getOrCreateInstance(this, _config);
  1487. if (typeof config === 'string') {
  1488. if (typeof data[config] === 'undefined') {
  1489. throw new TypeError(`No method named "${config}"`);
  1490. }
  1491. data[config]();
  1492. }
  1493. });
  1494. }
  1495. }
  1496. /**
  1497. * ------------------------------------------------------------------------
  1498. * Data Api implementation
  1499. * ------------------------------------------------------------------------
  1500. */
  1501. EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) {
  1502. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1503. if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
  1504. event.preventDefault();
  1505. }
  1506. const selector = getSelectorFromElement(this);
  1507. const selectorElements = SelectorEngine.find(selector);
  1508. selectorElements.forEach(element => {
  1509. Collapse.getOrCreateInstance(element, {
  1510. toggle: false
  1511. }).toggle();
  1512. });
  1513. });
  1514. /**
  1515. * ------------------------------------------------------------------------
  1516. * jQuery
  1517. * ------------------------------------------------------------------------
  1518. * add .Collapse to jQuery only if jQuery is present
  1519. */
  1520. defineJQueryPlugin(Collapse);
  1521. var top = 'top';
  1522. var bottom = 'bottom';
  1523. var right = 'right';
  1524. var left = 'left';
  1525. var auto = 'auto';
  1526. var basePlacements = [top, bottom, right, left];
  1527. var start = 'start';
  1528. var end = 'end';
  1529. var clippingParents = 'clippingParents';
  1530. var viewport = 'viewport';
  1531. var popper = 'popper';
  1532. var reference = 'reference';
  1533. var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
  1534. return acc.concat([placement + "-" + start, placement + "-" + end]);
  1535. }, []);
  1536. var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
  1537. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  1538. }, []); // modifiers that need to read the DOM
  1539. var beforeRead = 'beforeRead';
  1540. var read = 'read';
  1541. var afterRead = 'afterRead'; // pure-logic modifiers
  1542. var beforeMain = 'beforeMain';
  1543. var main = 'main';
  1544. var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
  1545. var beforeWrite = 'beforeWrite';
  1546. var write = 'write';
  1547. var afterWrite = 'afterWrite';
  1548. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  1549. function getNodeName(element) {
  1550. return element ? (element.nodeName || '').toLowerCase() : null;
  1551. }
  1552. function getWindow(node) {
  1553. if (node == null) {
  1554. return window;
  1555. }
  1556. if (node.toString() !== '[object Window]') {
  1557. var ownerDocument = node.ownerDocument;
  1558. return ownerDocument ? ownerDocument.defaultView || window : window;
  1559. }
  1560. return node;
  1561. }
  1562. function isElement(node) {
  1563. var OwnElement = getWindow(node).Element;
  1564. return node instanceof OwnElement || node instanceof Element;
  1565. }
  1566. function isHTMLElement(node) {
  1567. var OwnElement = getWindow(node).HTMLElement;
  1568. return node instanceof OwnElement || node instanceof HTMLElement;
  1569. }
  1570. function isShadowRoot(node) {
  1571. // IE 11 has no ShadowRoot
  1572. if (typeof ShadowRoot === 'undefined') {
  1573. return false;
  1574. }
  1575. var OwnElement = getWindow(node).ShadowRoot;
  1576. return node instanceof OwnElement || node instanceof ShadowRoot;
  1577. }
  1578. // and applies them to the HTMLElements such as popper and arrow
  1579. function applyStyles(_ref) {
  1580. var state = _ref.state;
  1581. Object.keys(state.elements).forEach(function (name) {
  1582. var style = state.styles[name] || {};
  1583. var attributes = state.attributes[name] || {};
  1584. var element = state.elements[name]; // arrow is optional + virtual elements
  1585. if (!isHTMLElement(element) || !getNodeName(element)) {
  1586. return;
  1587. } // Flow doesn't support to extend this property, but it's the most
  1588. // effective way to apply styles to an HTMLElement
  1589. // $FlowFixMe[cannot-write]
  1590. Object.assign(element.style, style);
  1591. Object.keys(attributes).forEach(function (name) {
  1592. var value = attributes[name];
  1593. if (value === false) {
  1594. element.removeAttribute(name);
  1595. } else {
  1596. element.setAttribute(name, value === true ? '' : value);
  1597. }
  1598. });
  1599. });
  1600. }
  1601. function effect$2(_ref2) {
  1602. var state = _ref2.state;
  1603. var initialStyles = {
  1604. popper: {
  1605. position: state.options.strategy,
  1606. left: '0',
  1607. top: '0',
  1608. margin: '0'
  1609. },
  1610. arrow: {
  1611. position: 'absolute'
  1612. },
  1613. reference: {}
  1614. };
  1615. Object.assign(state.elements.popper.style, initialStyles.popper);
  1616. state.styles = initialStyles;
  1617. if (state.elements.arrow) {
  1618. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  1619. }
  1620. return function () {
  1621. Object.keys(state.elements).forEach(function (name) {
  1622. var element = state.elements[name];
  1623. var attributes = state.attributes[name] || {};
  1624. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
  1625. var style = styleProperties.reduce(function (style, property) {
  1626. style[property] = '';
  1627. return style;
  1628. }, {}); // arrow is optional + virtual elements
  1629. if (!isHTMLElement(element) || !getNodeName(element)) {
  1630. return;
  1631. }
  1632. Object.assign(element.style, style);
  1633. Object.keys(attributes).forEach(function (attribute) {
  1634. element.removeAttribute(attribute);
  1635. });
  1636. });
  1637. };
  1638. } // eslint-disable-next-line import/no-unused-modules
  1639. var applyStyles$1 = {
  1640. name: 'applyStyles',
  1641. enabled: true,
  1642. phase: 'write',
  1643. fn: applyStyles,
  1644. effect: effect$2,
  1645. requires: ['computeStyles']
  1646. };
  1647. function getBasePlacement(placement) {
  1648. return placement.split('-')[0];
  1649. }
  1650. var round$1 = Math.round;
  1651. function getBoundingClientRect(element, includeScale) {
  1652. if (includeScale === void 0) {
  1653. includeScale = false;
  1654. }
  1655. var rect = element.getBoundingClientRect();
  1656. var scaleX = 1;
  1657. var scaleY = 1;
  1658. if (isHTMLElement(element) && includeScale) {
  1659. // Fallback to 1 in case both values are `0`
  1660. scaleX = rect.width / element.offsetWidth || 1;
  1661. scaleY = rect.height / element.offsetHeight || 1;
  1662. }
  1663. return {
  1664. width: round$1(rect.width / scaleX),
  1665. height: round$1(rect.height / scaleY),
  1666. top: round$1(rect.top / scaleY),
  1667. right: round$1(rect.right / scaleX),
  1668. bottom: round$1(rect.bottom / scaleY),
  1669. left: round$1(rect.left / scaleX),
  1670. x: round$1(rect.left / scaleX),
  1671. y: round$1(rect.top / scaleY)
  1672. };
  1673. }
  1674. // means it doesn't take into account transforms.
  1675. function getLayoutRect(element) {
  1676. var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
  1677. // Fixes https://github.com/popperjs/popper-core/issues/1223
  1678. var width = element.offsetWidth;
  1679. var height = element.offsetHeight;
  1680. if (Math.abs(clientRect.width - width) <= 1) {
  1681. width = clientRect.width;
  1682. }
  1683. if (Math.abs(clientRect.height - height) <= 1) {
  1684. height = clientRect.height;
  1685. }
  1686. return {
  1687. x: element.offsetLeft,
  1688. y: element.offsetTop,
  1689. width: width,
  1690. height: height
  1691. };
  1692. }
  1693. function contains(parent, child) {
  1694. var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
  1695. if (parent.contains(child)) {
  1696. return true;
  1697. } // then fallback to custom implementation with Shadow DOM support
  1698. else if (rootNode && isShadowRoot(rootNode)) {
  1699. var next = child;
  1700. do {
  1701. if (next && parent.isSameNode(next)) {
  1702. return true;
  1703. } // $FlowFixMe[prop-missing]: need a better way to handle this...
  1704. next = next.parentNode || next.host;
  1705. } while (next);
  1706. } // Give up, the result is false
  1707. return false;
  1708. }
  1709. function getComputedStyle$1(element) {
  1710. return getWindow(element).getComputedStyle(element);
  1711. }
  1712. function isTableElement(element) {
  1713. return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
  1714. }
  1715. function getDocumentElement(element) {
  1716. // $FlowFixMe[incompatible-return]: assume body is always available
  1717. return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
  1718. element.document) || window.document).documentElement;
  1719. }
  1720. function getParentNode(element) {
  1721. if (getNodeName(element) === 'html') {
  1722. return element;
  1723. }
  1724. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  1725. // $FlowFixMe[incompatible-return]
  1726. // $FlowFixMe[prop-missing]
  1727. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  1728. element.parentNode || ( // DOM Element detected
  1729. isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  1730. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  1731. getDocumentElement(element) // fallback
  1732. );
  1733. }
  1734. function getTrueOffsetParent(element) {
  1735. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  1736. getComputedStyle$1(element).position === 'fixed') {
  1737. return null;
  1738. }
  1739. return element.offsetParent;
  1740. } // `.offsetParent` reports `null` for fixed elements, while absolute elements
  1741. // return the containing block
  1742. function getContainingBlock(element) {
  1743. var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
  1744. var isIE = navigator.userAgent.indexOf('Trident') !== -1;
  1745. if (isIE && isHTMLElement(element)) {
  1746. // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
  1747. var elementCss = getComputedStyle$1(element);
  1748. if (elementCss.position === 'fixed') {
  1749. return null;
  1750. }
  1751. }
  1752. var currentNode = getParentNode(element);
  1753. while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
  1754. var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
  1755. // create a containing block.
  1756. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  1757. if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
  1758. return currentNode;
  1759. } else {
  1760. currentNode = currentNode.parentNode;
  1761. }
  1762. }
  1763. return null;
  1764. } // Gets the closest ancestor positioned element. Handles some edge cases,
  1765. // such as table ancestors and cross browser bugs.
  1766. function getOffsetParent(element) {
  1767. var window = getWindow(element);
  1768. var offsetParent = getTrueOffsetParent(element);
  1769. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  1770. offsetParent = getTrueOffsetParent(offsetParent);
  1771. }
  1772. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) {
  1773. return window;
  1774. }
  1775. return offsetParent || getContainingBlock(element) || window;
  1776. }
  1777. function getMainAxisFromPlacement(placement) {
  1778. return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
  1779. }
  1780. var max = Math.max;
  1781. var min = Math.min;
  1782. var round = Math.round;
  1783. function within(min$1, value, max$1) {
  1784. return max(min$1, min(value, max$1));
  1785. }
  1786. function getFreshSideObject() {
  1787. return {
  1788. top: 0,
  1789. right: 0,
  1790. bottom: 0,
  1791. left: 0
  1792. };
  1793. }
  1794. function mergePaddingObject(paddingObject) {
  1795. return Object.assign({}, getFreshSideObject(), paddingObject);
  1796. }
  1797. function expandToHashMap(value, keys) {
  1798. return keys.reduce(function (hashMap, key) {
  1799. hashMap[key] = value;
  1800. return hashMap;
  1801. }, {});
  1802. }
  1803. var toPaddingObject = function toPaddingObject(padding, state) {
  1804. padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
  1805. placement: state.placement
  1806. })) : padding;
  1807. return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  1808. };
  1809. function arrow(_ref) {
  1810. var _state$modifiersData$;
  1811. var state = _ref.state,
  1812. name = _ref.name,
  1813. options = _ref.options;
  1814. var arrowElement = state.elements.arrow;
  1815. var popperOffsets = state.modifiersData.popperOffsets;
  1816. var basePlacement = getBasePlacement(state.placement);
  1817. var axis = getMainAxisFromPlacement(basePlacement);
  1818. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  1819. var len = isVertical ? 'height' : 'width';
  1820. if (!arrowElement || !popperOffsets) {
  1821. return;
  1822. }
  1823. var paddingObject = toPaddingObject(options.padding, state);
  1824. var arrowRect = getLayoutRect(arrowElement);
  1825. var minProp = axis === 'y' ? top : left;
  1826. var maxProp = axis === 'y' ? bottom : right;
  1827. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
  1828. var startDiff = popperOffsets[axis] - state.rects.reference[axis];
  1829. var arrowOffsetParent = getOffsetParent(arrowElement);
  1830. var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  1831. var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
  1832. // outside of the popper bounds
  1833. var min = paddingObject[minProp];
  1834. var max = clientSize - arrowRect[len] - paddingObject[maxProp];
  1835. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  1836. var offset = within(min, center, max); // Prevents breaking syntax highlighting...
  1837. var axisProp = axis;
  1838. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
  1839. }
  1840. function effect$1(_ref2) {
  1841. var state = _ref2.state,
  1842. options = _ref2.options;
  1843. var _options$element = options.element,
  1844. arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
  1845. if (arrowElement == null) {
  1846. return;
  1847. } // CSS selector
  1848. if (typeof arrowElement === 'string') {
  1849. arrowElement = state.elements.popper.querySelector(arrowElement);
  1850. if (!arrowElement) {
  1851. return;
  1852. }
  1853. }
  1854. if (!contains(state.elements.popper, arrowElement)) {
  1855. return;
  1856. }
  1857. state.elements.arrow = arrowElement;
  1858. } // eslint-disable-next-line import/no-unused-modules
  1859. var arrow$1 = {
  1860. name: 'arrow',
  1861. enabled: true,
  1862. phase: 'main',
  1863. fn: arrow,
  1864. effect: effect$1,
  1865. requires: ['popperOffsets'],
  1866. requiresIfExists: ['preventOverflow']
  1867. };
  1868. var unsetSides = {
  1869. top: 'auto',
  1870. right: 'auto',
  1871. bottom: 'auto',
  1872. left: 'auto'
  1873. }; // Round the offsets to the nearest suitable subpixel based on the DPR.
  1874. // Zooming can change the DPR, but it seems to report a value that will
  1875. // cleanly divide the values into the appropriate subpixels.
  1876. function roundOffsetsByDPR(_ref) {
  1877. var x = _ref.x,
  1878. y = _ref.y;
  1879. var win = window;
  1880. var dpr = win.devicePixelRatio || 1;
  1881. return {
  1882. x: round(round(x * dpr) / dpr) || 0,
  1883. y: round(round(y * dpr) / dpr) || 0
  1884. };
  1885. }
  1886. function mapToStyles(_ref2) {
  1887. var _Object$assign2;
  1888. var popper = _ref2.popper,
  1889. popperRect = _ref2.popperRect,
  1890. placement = _ref2.placement,
  1891. offsets = _ref2.offsets,
  1892. position = _ref2.position,
  1893. gpuAcceleration = _ref2.gpuAcceleration,
  1894. adaptive = _ref2.adaptive,
  1895. roundOffsets = _ref2.roundOffsets;
  1896. var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
  1897. _ref3$x = _ref3.x,
  1898. x = _ref3$x === void 0 ? 0 : _ref3$x,
  1899. _ref3$y = _ref3.y,
  1900. y = _ref3$y === void 0 ? 0 : _ref3$y;
  1901. var hasX = offsets.hasOwnProperty('x');
  1902. var hasY = offsets.hasOwnProperty('y');
  1903. var sideX = left;
  1904. var sideY = top;
  1905. var win = window;
  1906. if (adaptive) {
  1907. var offsetParent = getOffsetParent(popper);
  1908. var heightProp = 'clientHeight';
  1909. var widthProp = 'clientWidth';
  1910. if (offsetParent === getWindow(popper)) {
  1911. offsetParent = getDocumentElement(popper);
  1912. if (getComputedStyle$1(offsetParent).position !== 'static') {
  1913. heightProp = 'scrollHeight';
  1914. widthProp = 'scrollWidth';
  1915. }
  1916. } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
  1917. offsetParent = offsetParent;
  1918. if (placement === top) {
  1919. sideY = bottom; // $FlowFixMe[prop-missing]
  1920. y -= offsetParent[heightProp] - popperRect.height;
  1921. y *= gpuAcceleration ? 1 : -1;
  1922. }
  1923. if (placement === left) {
  1924. sideX = right; // $FlowFixMe[prop-missing]
  1925. x -= offsetParent[widthProp] - popperRect.width;
  1926. x *= gpuAcceleration ? 1 : -1;
  1927. }
  1928. }
  1929. var commonStyles = Object.assign({
  1930. position: position
  1931. }, adaptive && unsetSides);
  1932. if (gpuAcceleration) {
  1933. var _Object$assign;
  1934. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  1935. }
  1936. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
  1937. }
  1938. function computeStyles(_ref4) {
  1939. var state = _ref4.state,
  1940. options = _ref4.options;
  1941. var _options$gpuAccelerat = options.gpuAcceleration,
  1942. gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
  1943. _options$adaptive = options.adaptive,
  1944. adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
  1945. _options$roundOffsets = options.roundOffsets,
  1946. roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  1947. var commonStyles = {
  1948. placement: getBasePlacement(state.placement),
  1949. popper: state.elements.popper,
  1950. popperRect: state.rects.popper,
  1951. gpuAcceleration: gpuAcceleration
  1952. };
  1953. if (state.modifiersData.popperOffsets != null) {
  1954. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  1955. offsets: state.modifiersData.popperOffsets,
  1956. position: state.options.strategy,
  1957. adaptive: adaptive,
  1958. roundOffsets: roundOffsets
  1959. })));
  1960. }
  1961. if (state.modifiersData.arrow != null) {
  1962. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  1963. offsets: state.modifiersData.arrow,
  1964. position: 'absolute',
  1965. adaptive: false,
  1966. roundOffsets: roundOffsets
  1967. })));
  1968. }
  1969. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  1970. 'data-popper-placement': state.placement
  1971. });
  1972. } // eslint-disable-next-line import/no-unused-modules
  1973. var computeStyles$1 = {
  1974. name: 'computeStyles',
  1975. enabled: true,
  1976. phase: 'beforeWrite',
  1977. fn: computeStyles,
  1978. data: {}
  1979. };
  1980. var passive = {
  1981. passive: true
  1982. };
  1983. function effect(_ref) {
  1984. var state = _ref.state,
  1985. instance = _ref.instance,
  1986. options = _ref.options;
  1987. var _options$scroll = options.scroll,
  1988. scroll = _options$scroll === void 0 ? true : _options$scroll,
  1989. _options$resize = options.resize,
  1990. resize = _options$resize === void 0 ? true : _options$resize;
  1991. var window = getWindow(state.elements.popper);
  1992. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  1993. if (scroll) {
  1994. scrollParents.forEach(function (scrollParent) {
  1995. scrollParent.addEventListener('scroll', instance.update, passive);
  1996. });
  1997. }
  1998. if (resize) {
  1999. window.addEventListener('resize', instance.update, passive);
  2000. }
  2001. return function () {
  2002. if (scroll) {
  2003. scrollParents.forEach(function (scrollParent) {
  2004. scrollParent.removeEventListener('scroll', instance.update, passive);
  2005. });
  2006. }
  2007. if (resize) {
  2008. window.removeEventListener('resize', instance.update, passive);
  2009. }
  2010. };
  2011. } // eslint-disable-next-line import/no-unused-modules
  2012. var eventListeners = {
  2013. name: 'eventListeners',
  2014. enabled: true,
  2015. phase: 'write',
  2016. fn: function fn() {},
  2017. effect: effect,
  2018. data: {}
  2019. };
  2020. var hash$1 = {
  2021. left: 'right',
  2022. right: 'left',
  2023. bottom: 'top',
  2024. top: 'bottom'
  2025. };
  2026. function getOppositePlacement(placement) {
  2027. return placement.replace(/left|right|bottom|top/g, function (matched) {
  2028. return hash$1[matched];
  2029. });
  2030. }
  2031. var hash = {
  2032. start: 'end',
  2033. end: 'start'
  2034. };
  2035. function getOppositeVariationPlacement(placement) {
  2036. return placement.replace(/start|end/g, function (matched) {
  2037. return hash[matched];
  2038. });
  2039. }
  2040. function getWindowScroll(node) {
  2041. var win = getWindow(node);
  2042. var scrollLeft = win.pageXOffset;
  2043. var scrollTop = win.pageYOffset;
  2044. return {
  2045. scrollLeft: scrollLeft,
  2046. scrollTop: scrollTop
  2047. };
  2048. }
  2049. function getWindowScrollBarX(element) {
  2050. // If <html> has a CSS width greater than the viewport, then this will be
  2051. // incorrect for RTL.
  2052. // Popper 1 is broken in this case and never had a bug report so let's assume
  2053. // it's not an issue. I don't think anyone ever specifies width on <html>
  2054. // anyway.
  2055. // Browsers where the left scrollbar doesn't cause an issue report `0` for
  2056. // this (e.g. Edge 2019, IE11, Safari)
  2057. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  2058. }
  2059. function getViewportRect(element) {
  2060. var win = getWindow(element);
  2061. var html = getDocumentElement(element);
  2062. var visualViewport = win.visualViewport;
  2063. var width = html.clientWidth;
  2064. var height = html.clientHeight;
  2065. var x = 0;
  2066. var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
  2067. // can be obscured underneath it.
  2068. // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
  2069. // if it isn't open, so if this isn't available, the popper will be detected
  2070. // to overflow the bottom of the screen too early.
  2071. if (visualViewport) {
  2072. width = visualViewport.width;
  2073. height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
  2074. // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
  2075. // errors due to floating point numbers, so we need to check precision.
  2076. // Safari returns a number <= 0, usually < -1 when pinch-zoomed
  2077. // Feature detection fails in mobile emulation mode in Chrome.
  2078. // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
  2079. // 0.001
  2080. // Fallback here: "Not Safari" userAgent
  2081. if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
  2082. x = visualViewport.offsetLeft;
  2083. y = visualViewport.offsetTop;
  2084. }
  2085. }
  2086. return {
  2087. width: width,
  2088. height: height,
  2089. x: x + getWindowScrollBarX(element),
  2090. y: y
  2091. };
  2092. }
  2093. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  2094. function getDocumentRect(element) {
  2095. var _element$ownerDocumen;
  2096. var html = getDocumentElement(element);
  2097. var winScroll = getWindowScroll(element);
  2098. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  2099. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  2100. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  2101. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  2102. var y = -winScroll.scrollTop;
  2103. if (getComputedStyle$1(body || html).direction === 'rtl') {
  2104. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  2105. }
  2106. return {
  2107. width: width,
  2108. height: height,
  2109. x: x,
  2110. y: y
  2111. };
  2112. }
  2113. function isScrollParent(element) {
  2114. // Firefox wants us to check `-x` and `-y` variations as well
  2115. var _getComputedStyle = getComputedStyle$1(element),
  2116. overflow = _getComputedStyle.overflow,
  2117. overflowX = _getComputedStyle.overflowX,
  2118. overflowY = _getComputedStyle.overflowY;
  2119. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  2120. }
  2121. function getScrollParent(node) {
  2122. if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
  2123. // $FlowFixMe[incompatible-return]: assume body is always available
  2124. return node.ownerDocument.body;
  2125. }
  2126. if (isHTMLElement(node) && isScrollParent(node)) {
  2127. return node;
  2128. }
  2129. return getScrollParent(getParentNode(node));
  2130. }
  2131. /*
  2132. given a DOM element, return the list of all scroll parents, up the list of ancesors
  2133. until we get to the top window object. This list is what we attach scroll listeners
  2134. to, because if any of these parent elements scroll, we'll need to re-calculate the
  2135. reference element's position.
  2136. */
  2137. function listScrollParents(element, list) {
  2138. var _element$ownerDocumen;
  2139. if (list === void 0) {
  2140. list = [];
  2141. }
  2142. var scrollParent = getScrollParent(element);
  2143. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  2144. var win = getWindow(scrollParent);
  2145. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  2146. var updatedList = list.concat(target);
  2147. return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  2148. updatedList.concat(listScrollParents(getParentNode(target)));
  2149. }
  2150. function rectToClientRect(rect) {
  2151. return Object.assign({}, rect, {
  2152. left: rect.x,
  2153. top: rect.y,
  2154. right: rect.x + rect.width,
  2155. bottom: rect.y + rect.height
  2156. });
  2157. }
  2158. function getInnerBoundingClientRect(element) {
  2159. var rect = getBoundingClientRect(element);
  2160. rect.top = rect.top + element.clientTop;
  2161. rect.left = rect.left + element.clientLeft;
  2162. rect.bottom = rect.top + element.clientHeight;
  2163. rect.right = rect.left + element.clientWidth;
  2164. rect.width = element.clientWidth;
  2165. rect.height = element.clientHeight;
  2166. rect.x = rect.left;
  2167. rect.y = rect.top;
  2168. return rect;
  2169. }
  2170. function getClientRectFromMixedType(element, clippingParent) {
  2171. return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  2172. } // A "clipping parent" is an overflowable container with the characteristic of
  2173. // clipping (or hiding) overflowing elements with a position different from
  2174. // `initial`
  2175. function getClippingParents(element) {
  2176. var clippingParents = listScrollParents(getParentNode(element));
  2177. var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;
  2178. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  2179. if (!isElement(clipperElement)) {
  2180. return [];
  2181. } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
  2182. return clippingParents.filter(function (clippingParent) {
  2183. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
  2184. });
  2185. } // Gets the maximum area that the element is visible in due to any number of
  2186. // clipping parents
  2187. function getClippingRect(element, boundary, rootBoundary) {
  2188. var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
  2189. var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
  2190. var firstClippingParent = clippingParents[0];
  2191. var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
  2192. var rect = getClientRectFromMixedType(element, clippingParent);
  2193. accRect.top = max(rect.top, accRect.top);
  2194. accRect.right = min(rect.right, accRect.right);
  2195. accRect.bottom = min(rect.bottom, accRect.bottom);
  2196. accRect.left = max(rect.left, accRect.left);
  2197. return accRect;
  2198. }, getClientRectFromMixedType(element, firstClippingParent));
  2199. clippingRect.width = clippingRect.right - clippingRect.left;
  2200. clippingRect.height = clippingRect.bottom - clippingRect.top;
  2201. clippingRect.x = clippingRect.left;
  2202. clippingRect.y = clippingRect.top;
  2203. return clippingRect;
  2204. }
  2205. function getVariation(placement) {
  2206. return placement.split('-')[1];
  2207. }
  2208. function computeOffsets(_ref) {
  2209. var reference = _ref.reference,
  2210. element = _ref.element,
  2211. placement = _ref.placement;
  2212. var basePlacement = placement ? getBasePlacement(placement) : null;
  2213. var variation = placement ? getVariation(placement) : null;
  2214. var commonX = reference.x + reference.width / 2 - element.width / 2;
  2215. var commonY = reference.y + reference.height / 2 - element.height / 2;
  2216. var offsets;
  2217. switch (basePlacement) {
  2218. case top:
  2219. offsets = {
  2220. x: commonX,
  2221. y: reference.y - element.height
  2222. };
  2223. break;
  2224. case bottom:
  2225. offsets = {
  2226. x: commonX,
  2227. y: reference.y + reference.height
  2228. };
  2229. break;
  2230. case right:
  2231. offsets = {
  2232. x: reference.x + reference.width,
  2233. y: commonY
  2234. };
  2235. break;
  2236. case left:
  2237. offsets = {
  2238. x: reference.x - element.width,
  2239. y: commonY
  2240. };
  2241. break;
  2242. default:
  2243. offsets = {
  2244. x: reference.x,
  2245. y: reference.y
  2246. };
  2247. }
  2248. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  2249. if (mainAxis != null) {
  2250. var len = mainAxis === 'y' ? 'height' : 'width';
  2251. switch (variation) {
  2252. case start:
  2253. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  2254. break;
  2255. case end:
  2256. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  2257. break;
  2258. }
  2259. }
  2260. return offsets;
  2261. }
  2262. function detectOverflow(state, options) {
  2263. if (options === void 0) {
  2264. options = {};
  2265. }
  2266. var _options = options,
  2267. _options$placement = _options.placement,
  2268. placement = _options$placement === void 0 ? state.placement : _options$placement,
  2269. _options$boundary = _options.boundary,
  2270. boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
  2271. _options$rootBoundary = _options.rootBoundary,
  2272. rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
  2273. _options$elementConte = _options.elementContext,
  2274. elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
  2275. _options$altBoundary = _options.altBoundary,
  2276. altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
  2277. _options$padding = _options.padding,
  2278. padding = _options$padding === void 0 ? 0 : _options$padding;
  2279. var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  2280. var altContext = elementContext === popper ? reference : popper;
  2281. var referenceElement = state.elements.reference;
  2282. var popperRect = state.rects.popper;
  2283. var element = state.elements[altBoundary ? altContext : elementContext];
  2284. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
  2285. var referenceClientRect = getBoundingClientRect(referenceElement);
  2286. var popperOffsets = computeOffsets({
  2287. reference: referenceClientRect,
  2288. element: popperRect,
  2289. strategy: 'absolute',
  2290. placement: placement
  2291. });
  2292. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
  2293. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
  2294. // 0 or negative = within the clipping rect
  2295. var overflowOffsets = {
  2296. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  2297. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  2298. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  2299. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  2300. };
  2301. var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
  2302. if (elementContext === popper && offsetData) {
  2303. var offset = offsetData[placement];
  2304. Object.keys(overflowOffsets).forEach(function (key) {
  2305. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  2306. var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
  2307. overflowOffsets[key] += offset[axis] * multiply;
  2308. });
  2309. }
  2310. return overflowOffsets;
  2311. }
  2312. function computeAutoPlacement(state, options) {
  2313. if (options === void 0) {
  2314. options = {};
  2315. }
  2316. var _options = options,
  2317. placement = _options.placement,
  2318. boundary = _options.boundary,
  2319. rootBoundary = _options.rootBoundary,
  2320. padding = _options.padding,
  2321. flipVariations = _options.flipVariations,
  2322. _options$allowedAutoP = _options.allowedAutoPlacements,
  2323. allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  2324. var variation = getVariation(placement);
  2325. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
  2326. return getVariation(placement) === variation;
  2327. }) : basePlacements;
  2328. var allowedPlacements = placements$1.filter(function (placement) {
  2329. return allowedAutoPlacements.indexOf(placement) >= 0;
  2330. });
  2331. if (allowedPlacements.length === 0) {
  2332. allowedPlacements = placements$1;
  2333. } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
  2334. var overflows = allowedPlacements.reduce(function (acc, placement) {
  2335. acc[placement] = detectOverflow(state, {
  2336. placement: placement,
  2337. boundary: boundary,
  2338. rootBoundary: rootBoundary,
  2339. padding: padding
  2340. })[getBasePlacement(placement)];
  2341. return acc;
  2342. }, {});
  2343. return Object.keys(overflows).sort(function (a, b) {
  2344. return overflows[a] - overflows[b];
  2345. });
  2346. }
  2347. function getExpandedFallbackPlacements(placement) {
  2348. if (getBasePlacement(placement) === auto) {
  2349. return [];
  2350. }
  2351. var oppositePlacement = getOppositePlacement(placement);
  2352. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  2353. }
  2354. function flip(_ref) {
  2355. var state = _ref.state,
  2356. options = _ref.options,
  2357. name = _ref.name;
  2358. if (state.modifiersData[name]._skip) {
  2359. return;
  2360. }
  2361. var _options$mainAxis = options.mainAxis,
  2362. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  2363. _options$altAxis = options.altAxis,
  2364. checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
  2365. specifiedFallbackPlacements = options.fallbackPlacements,
  2366. padding = options.padding,
  2367. boundary = options.boundary,
  2368. rootBoundary = options.rootBoundary,
  2369. altBoundary = options.altBoundary,
  2370. _options$flipVariatio = options.flipVariations,
  2371. flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
  2372. allowedAutoPlacements = options.allowedAutoPlacements;
  2373. var preferredPlacement = state.options.placement;
  2374. var basePlacement = getBasePlacement(preferredPlacement);
  2375. var isBasePlacement = basePlacement === preferredPlacement;
  2376. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  2377. var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
  2378. return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
  2379. placement: placement,
  2380. boundary: boundary,
  2381. rootBoundary: rootBoundary,
  2382. padding: padding,
  2383. flipVariations: flipVariations,
  2384. allowedAutoPlacements: allowedAutoPlacements
  2385. }) : placement);
  2386. }, []);
  2387. var referenceRect = state.rects.reference;
  2388. var popperRect = state.rects.popper;
  2389. var checksMap = new Map();
  2390. var makeFallbackChecks = true;
  2391. var firstFittingPlacement = placements[0];
  2392. for (var i = 0; i < placements.length; i++) {
  2393. var placement = placements[i];
  2394. var _basePlacement = getBasePlacement(placement);
  2395. var isStartVariation = getVariation(placement) === start;
  2396. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  2397. var len = isVertical ? 'width' : 'height';
  2398. var overflow = detectOverflow(state, {
  2399. placement: placement,
  2400. boundary: boundary,
  2401. rootBoundary: rootBoundary,
  2402. altBoundary: altBoundary,
  2403. padding: padding
  2404. });
  2405. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  2406. if (referenceRect[len] > popperRect[len]) {
  2407. mainVariationSide = getOppositePlacement(mainVariationSide);
  2408. }
  2409. var altVariationSide = getOppositePlacement(mainVariationSide);
  2410. var checks = [];
  2411. if (checkMainAxis) {
  2412. checks.push(overflow[_basePlacement] <= 0);
  2413. }
  2414. if (checkAltAxis) {
  2415. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  2416. }
  2417. if (checks.every(function (check) {
  2418. return check;
  2419. })) {
  2420. firstFittingPlacement = placement;
  2421. makeFallbackChecks = false;
  2422. break;
  2423. }
  2424. checksMap.set(placement, checks);
  2425. }
  2426. if (makeFallbackChecks) {
  2427. // `2` may be desired in some cases – research later
  2428. var numberOfChecks = flipVariations ? 3 : 1;
  2429. var _loop = function _loop(_i) {
  2430. var fittingPlacement = placements.find(function (placement) {
  2431. var checks = checksMap.get(placement);
  2432. if (checks) {
  2433. return checks.slice(0, _i).every(function (check) {
  2434. return check;
  2435. });
  2436. }
  2437. });
  2438. if (fittingPlacement) {
  2439. firstFittingPlacement = fittingPlacement;
  2440. return "break";
  2441. }
  2442. };
  2443. for (var _i = numberOfChecks; _i > 0; _i--) {
  2444. var _ret = _loop(_i);
  2445. if (_ret === "break") break;
  2446. }
  2447. }
  2448. if (state.placement !== firstFittingPlacement) {
  2449. state.modifiersData[name]._skip = true;
  2450. state.placement = firstFittingPlacement;
  2451. state.reset = true;
  2452. }
  2453. } // eslint-disable-next-line import/no-unused-modules
  2454. var flip$1 = {
  2455. name: 'flip',
  2456. enabled: true,
  2457. phase: 'main',
  2458. fn: flip,
  2459. requiresIfExists: ['offset'],
  2460. data: {
  2461. _skip: false
  2462. }
  2463. };
  2464. function getSideOffsets(overflow, rect, preventedOffsets) {
  2465. if (preventedOffsets === void 0) {
  2466. preventedOffsets = {
  2467. x: 0,
  2468. y: 0
  2469. };
  2470. }
  2471. return {
  2472. top: overflow.top - rect.height - preventedOffsets.y,
  2473. right: overflow.right - rect.width + preventedOffsets.x,
  2474. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  2475. left: overflow.left - rect.width - preventedOffsets.x
  2476. };
  2477. }
  2478. function isAnySideFullyClipped(overflow) {
  2479. return [top, right, bottom, left].some(function (side) {
  2480. return overflow[side] >= 0;
  2481. });
  2482. }
  2483. function hide(_ref) {
  2484. var state = _ref.state,
  2485. name = _ref.name;
  2486. var referenceRect = state.rects.reference;
  2487. var popperRect = state.rects.popper;
  2488. var preventedOffsets = state.modifiersData.preventOverflow;
  2489. var referenceOverflow = detectOverflow(state, {
  2490. elementContext: 'reference'
  2491. });
  2492. var popperAltOverflow = detectOverflow(state, {
  2493. altBoundary: true
  2494. });
  2495. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  2496. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  2497. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  2498. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  2499. state.modifiersData[name] = {
  2500. referenceClippingOffsets: referenceClippingOffsets,
  2501. popperEscapeOffsets: popperEscapeOffsets,
  2502. isReferenceHidden: isReferenceHidden,
  2503. hasPopperEscaped: hasPopperEscaped
  2504. };
  2505. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  2506. 'data-popper-reference-hidden': isReferenceHidden,
  2507. 'data-popper-escaped': hasPopperEscaped
  2508. });
  2509. } // eslint-disable-next-line import/no-unused-modules
  2510. var hide$1 = {
  2511. name: 'hide',
  2512. enabled: true,
  2513. phase: 'main',
  2514. requiresIfExists: ['preventOverflow'],
  2515. fn: hide
  2516. };
  2517. function distanceAndSkiddingToXY(placement, rects, offset) {
  2518. var basePlacement = getBasePlacement(placement);
  2519. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  2520. var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
  2521. placement: placement
  2522. })) : offset,
  2523. skidding = _ref[0],
  2524. distance = _ref[1];
  2525. skidding = skidding || 0;
  2526. distance = (distance || 0) * invertDistance;
  2527. return [left, right].indexOf(basePlacement) >= 0 ? {
  2528. x: distance,
  2529. y: skidding
  2530. } : {
  2531. x: skidding,
  2532. y: distance
  2533. };
  2534. }
  2535. function offset(_ref2) {
  2536. var state = _ref2.state,
  2537. options = _ref2.options,
  2538. name = _ref2.name;
  2539. var _options$offset = options.offset,
  2540. offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  2541. var data = placements.reduce(function (acc, placement) {
  2542. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
  2543. return acc;
  2544. }, {});
  2545. var _data$state$placement = data[state.placement],
  2546. x = _data$state$placement.x,
  2547. y = _data$state$placement.y;
  2548. if (state.modifiersData.popperOffsets != null) {
  2549. state.modifiersData.popperOffsets.x += x;
  2550. state.modifiersData.popperOffsets.y += y;
  2551. }
  2552. state.modifiersData[name] = data;
  2553. } // eslint-disable-next-line import/no-unused-modules
  2554. var offset$1 = {
  2555. name: 'offset',
  2556. enabled: true,
  2557. phase: 'main',
  2558. requires: ['popperOffsets'],
  2559. fn: offset
  2560. };
  2561. function popperOffsets(_ref) {
  2562. var state = _ref.state,
  2563. name = _ref.name;
  2564. // Offsets are the actual position the popper needs to have to be
  2565. // properly positioned near its reference element
  2566. // This is the most basic placement, and will be adjusted by
  2567. // the modifiers in the next step
  2568. state.modifiersData[name] = computeOffsets({
  2569. reference: state.rects.reference,
  2570. element: state.rects.popper,
  2571. strategy: 'absolute',
  2572. placement: state.placement
  2573. });
  2574. } // eslint-disable-next-line import/no-unused-modules
  2575. var popperOffsets$1 = {
  2576. name: 'popperOffsets',
  2577. enabled: true,
  2578. phase: 'read',
  2579. fn: popperOffsets,
  2580. data: {}
  2581. };
  2582. function getAltAxis(axis) {
  2583. return axis === 'x' ? 'y' : 'x';
  2584. }
  2585. function preventOverflow(_ref) {
  2586. var state = _ref.state,
  2587. options = _ref.options,
  2588. name = _ref.name;
  2589. var _options$mainAxis = options.mainAxis,
  2590. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  2591. _options$altAxis = options.altAxis,
  2592. checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
  2593. boundary = options.boundary,
  2594. rootBoundary = options.rootBoundary,
  2595. altBoundary = options.altBoundary,
  2596. padding = options.padding,
  2597. _options$tether = options.tether,
  2598. tether = _options$tether === void 0 ? true : _options$tether,
  2599. _options$tetherOffset = options.tetherOffset,
  2600. tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  2601. var overflow = detectOverflow(state, {
  2602. boundary: boundary,
  2603. rootBoundary: rootBoundary,
  2604. padding: padding,
  2605. altBoundary: altBoundary
  2606. });
  2607. var basePlacement = getBasePlacement(state.placement);
  2608. var variation = getVariation(state.placement);
  2609. var isBasePlacement = !variation;
  2610. var mainAxis = getMainAxisFromPlacement(basePlacement);
  2611. var altAxis = getAltAxis(mainAxis);
  2612. var popperOffsets = state.modifiersData.popperOffsets;
  2613. var referenceRect = state.rects.reference;
  2614. var popperRect = state.rects.popper;
  2615. var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
  2616. placement: state.placement
  2617. })) : tetherOffset;
  2618. var data = {
  2619. x: 0,
  2620. y: 0
  2621. };
  2622. if (!popperOffsets) {
  2623. return;
  2624. }
  2625. if (checkMainAxis || checkAltAxis) {
  2626. var mainSide = mainAxis === 'y' ? top : left;
  2627. var altSide = mainAxis === 'y' ? bottom : right;
  2628. var len = mainAxis === 'y' ? 'height' : 'width';
  2629. var offset = popperOffsets[mainAxis];
  2630. var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
  2631. var max$1 = popperOffsets[mainAxis] - overflow[altSide];
  2632. var additive = tether ? -popperRect[len] / 2 : 0;
  2633. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  2634. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
  2635. // outside the reference bounds
  2636. var arrowElement = state.elements.arrow;
  2637. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  2638. width: 0,
  2639. height: 0
  2640. };
  2641. var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
  2642. var arrowPaddingMin = arrowPaddingObject[mainSide];
  2643. var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
  2644. // to include its full size in the calculation. If the reference is small
  2645. // and near the edge of a boundary, the popper can overflow even if the
  2646. // reference is not overflowing as well (e.g. virtual elements with no
  2647. // width or height)
  2648. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  2649. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
  2650. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
  2651. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  2652. var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  2653. var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
  2654. var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
  2655. var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
  2656. if (checkMainAxis) {
  2657. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
  2658. popperOffsets[mainAxis] = preventedOffset;
  2659. data[mainAxis] = preventedOffset - offset;
  2660. }
  2661. if (checkAltAxis) {
  2662. var _mainSide = mainAxis === 'x' ? top : left;
  2663. var _altSide = mainAxis === 'x' ? bottom : right;
  2664. var _offset = popperOffsets[altAxis];
  2665. var _min = _offset + overflow[_mainSide];
  2666. var _max = _offset - overflow[_altSide];
  2667. var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
  2668. popperOffsets[altAxis] = _preventedOffset;
  2669. data[altAxis] = _preventedOffset - _offset;
  2670. }
  2671. }
  2672. state.modifiersData[name] = data;
  2673. } // eslint-disable-next-line import/no-unused-modules
  2674. var preventOverflow$1 = {
  2675. name: 'preventOverflow',
  2676. enabled: true,
  2677. phase: 'main',
  2678. fn: preventOverflow,
  2679. requiresIfExists: ['offset']
  2680. };
  2681. function getHTMLElementScroll(element) {
  2682. return {
  2683. scrollLeft: element.scrollLeft,
  2684. scrollTop: element.scrollTop
  2685. };
  2686. }
  2687. function getNodeScroll(node) {
  2688. if (node === getWindow(node) || !isHTMLElement(node)) {
  2689. return getWindowScroll(node);
  2690. } else {
  2691. return getHTMLElementScroll(node);
  2692. }
  2693. }
  2694. function isElementScaled(element) {
  2695. var rect = element.getBoundingClientRect();
  2696. var scaleX = rect.width / element.offsetWidth || 1;
  2697. var scaleY = rect.height / element.offsetHeight || 1;
  2698. return scaleX !== 1 || scaleY !== 1;
  2699. } // Returns the composite rect of an element relative to its offsetParent.
  2700. // Composite means it takes into account transforms as well as layout.
  2701. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  2702. if (isFixed === void 0) {
  2703. isFixed = false;
  2704. }
  2705. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  2706. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  2707. var documentElement = getDocumentElement(offsetParent);
  2708. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
  2709. var scroll = {
  2710. scrollLeft: 0,
  2711. scrollTop: 0
  2712. };
  2713. var offsets = {
  2714. x: 0,
  2715. y: 0
  2716. };
  2717. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  2718. if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
  2719. isScrollParent(documentElement)) {
  2720. scroll = getNodeScroll(offsetParent);
  2721. }
  2722. if (isHTMLElement(offsetParent)) {
  2723. offsets = getBoundingClientRect(offsetParent, true);
  2724. offsets.x += offsetParent.clientLeft;
  2725. offsets.y += offsetParent.clientTop;
  2726. } else if (documentElement) {
  2727. offsets.x = getWindowScrollBarX(documentElement);
  2728. }
  2729. }
  2730. return {
  2731. x: rect.left + scroll.scrollLeft - offsets.x,
  2732. y: rect.top + scroll.scrollTop - offsets.y,
  2733. width: rect.width,
  2734. height: rect.height
  2735. };
  2736. }
  2737. function order(modifiers) {
  2738. var map = new Map();
  2739. var visited = new Set();
  2740. var result = [];
  2741. modifiers.forEach(function (modifier) {
  2742. map.set(modifier.name, modifier);
  2743. }); // On visiting object, check for its dependencies and visit them recursively
  2744. function sort(modifier) {
  2745. visited.add(modifier.name);
  2746. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  2747. requires.forEach(function (dep) {
  2748. if (!visited.has(dep)) {
  2749. var depModifier = map.get(dep);
  2750. if (depModifier) {
  2751. sort(depModifier);
  2752. }
  2753. }
  2754. });
  2755. result.push(modifier);
  2756. }
  2757. modifiers.forEach(function (modifier) {
  2758. if (!visited.has(modifier.name)) {
  2759. // check for visited object
  2760. sort(modifier);
  2761. }
  2762. });
  2763. return result;
  2764. }
  2765. function orderModifiers(modifiers) {
  2766. // order based on dependencies
  2767. var orderedModifiers = order(modifiers); // order based on phase
  2768. return modifierPhases.reduce(function (acc, phase) {
  2769. return acc.concat(orderedModifiers.filter(function (modifier) {
  2770. return modifier.phase === phase;
  2771. }));
  2772. }, []);
  2773. }
  2774. function debounce(fn) {
  2775. var pending;
  2776. return function () {
  2777. if (!pending) {
  2778. pending = new Promise(function (resolve) {
  2779. Promise.resolve().then(function () {
  2780. pending = undefined;
  2781. resolve(fn());
  2782. });
  2783. });
  2784. }
  2785. return pending;
  2786. };
  2787. }
  2788. function mergeByName(modifiers) {
  2789. var merged = modifiers.reduce(function (merged, current) {
  2790. var existing = merged[current.name];
  2791. merged[current.name] = existing ? Object.assign({}, existing, current, {
  2792. options: Object.assign({}, existing.options, current.options),
  2793. data: Object.assign({}, existing.data, current.data)
  2794. }) : current;
  2795. return merged;
  2796. }, {}); // IE11 does not support Object.values
  2797. return Object.keys(merged).map(function (key) {
  2798. return merged[key];
  2799. });
  2800. }
  2801. var DEFAULT_OPTIONS = {
  2802. placement: 'bottom',
  2803. modifiers: [],
  2804. strategy: 'absolute'
  2805. };
  2806. function areValidElements() {
  2807. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2808. args[_key] = arguments[_key];
  2809. }
  2810. return !args.some(function (element) {
  2811. return !(element && typeof element.getBoundingClientRect === 'function');
  2812. });
  2813. }
  2814. function popperGenerator(generatorOptions) {
  2815. if (generatorOptions === void 0) {
  2816. generatorOptions = {};
  2817. }
  2818. var _generatorOptions = generatorOptions,
  2819. _generatorOptions$def = _generatorOptions.defaultModifiers,
  2820. defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
  2821. _generatorOptions$def2 = _generatorOptions.defaultOptions,
  2822. defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  2823. return function createPopper(reference, popper, options) {
  2824. if (options === void 0) {
  2825. options = defaultOptions;
  2826. }
  2827. var state = {
  2828. placement: 'bottom',
  2829. orderedModifiers: [],
  2830. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  2831. modifiersData: {},
  2832. elements: {
  2833. reference: reference,
  2834. popper: popper
  2835. },
  2836. attributes: {},
  2837. styles: {}
  2838. };
  2839. var effectCleanupFns = [];
  2840. var isDestroyed = false;
  2841. var instance = {
  2842. state: state,
  2843. setOptions: function setOptions(options) {
  2844. cleanupModifierEffects();
  2845. state.options = Object.assign({}, defaultOptions, state.options, options);
  2846. state.scrollParents = {
  2847. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  2848. popper: listScrollParents(popper)
  2849. }; // Orders the modifiers based on their dependencies and `phase`
  2850. // properties
  2851. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
  2852. state.orderedModifiers = orderedModifiers.filter(function (m) {
  2853. return m.enabled;
  2854. }); // Validate the provided modifiers so that the consumer will get warned
  2855. runModifierEffects();
  2856. return instance.update();
  2857. },
  2858. // Sync update – it will always be executed, even if not necessary. This
  2859. // is useful for low frequency updates where sync behavior simplifies the
  2860. // logic.
  2861. // For high frequency updates (e.g. `resize` and `scroll` events), always
  2862. // prefer the async Popper#update method
  2863. forceUpdate: function forceUpdate() {
  2864. if (isDestroyed) {
  2865. return;
  2866. }
  2867. var _state$elements = state.elements,
  2868. reference = _state$elements.reference,
  2869. popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
  2870. // anymore
  2871. if (!areValidElements(reference, popper)) {
  2872. return;
  2873. } // Store the reference and popper rects to be read by modifiers
  2874. state.rects = {
  2875. reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
  2876. popper: getLayoutRect(popper)
  2877. }; // Modifiers have the ability to reset the current update cycle. The
  2878. // most common use case for this is the `flip` modifier changing the
  2879. // placement, which then needs to re-run all the modifiers, because the
  2880. // logic was previously ran for the previous placement and is therefore
  2881. // stale/incorrect
  2882. state.reset = false;
  2883. state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
  2884. // is filled with the initial data specified by the modifier. This means
  2885. // it doesn't persist and is fresh on each update.
  2886. // To ensure persistent data, use `${name}#persistent`
  2887. state.orderedModifiers.forEach(function (modifier) {
  2888. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  2889. });
  2890. for (var index = 0; index < state.orderedModifiers.length; index++) {
  2891. if (state.reset === true) {
  2892. state.reset = false;
  2893. index = -1;
  2894. continue;
  2895. }
  2896. var _state$orderedModifie = state.orderedModifiers[index],
  2897. fn = _state$orderedModifie.fn,
  2898. _state$orderedModifie2 = _state$orderedModifie.options,
  2899. _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
  2900. name = _state$orderedModifie.name;
  2901. if (typeof fn === 'function') {
  2902. state = fn({
  2903. state: state,
  2904. options: _options,
  2905. name: name,
  2906. instance: instance
  2907. }) || state;
  2908. }
  2909. }
  2910. },
  2911. // Async and optimistically optimized update – it will not be executed if
  2912. // not necessary (debounced to run at most once-per-tick)
  2913. update: debounce(function () {
  2914. return new Promise(function (resolve) {
  2915. instance.forceUpdate();
  2916. resolve(state);
  2917. });
  2918. }),
  2919. destroy: function destroy() {
  2920. cleanupModifierEffects();
  2921. isDestroyed = true;
  2922. }
  2923. };
  2924. if (!areValidElements(reference, popper)) {
  2925. return instance;
  2926. }
  2927. instance.setOptions(options).then(function (state) {
  2928. if (!isDestroyed && options.onFirstUpdate) {
  2929. options.onFirstUpdate(state);
  2930. }
  2931. }); // Modifiers have the ability to execute arbitrary code before the first
  2932. // update cycle runs. They will be executed in the same order as the update
  2933. // cycle. This is useful when a modifier adds some persistent data that
  2934. // other modifiers need to use, but the modifier is run after the dependent
  2935. // one.
  2936. function runModifierEffects() {
  2937. state.orderedModifiers.forEach(function (_ref3) {
  2938. var name = _ref3.name,
  2939. _ref3$options = _ref3.options,
  2940. options = _ref3$options === void 0 ? {} : _ref3$options,
  2941. effect = _ref3.effect;
  2942. if (typeof effect === 'function') {
  2943. var cleanupFn = effect({
  2944. state: state,
  2945. name: name,
  2946. instance: instance,
  2947. options: options
  2948. });
  2949. var noopFn = function noopFn() {};
  2950. effectCleanupFns.push(cleanupFn || noopFn);
  2951. }
  2952. });
  2953. }
  2954. function cleanupModifierEffects() {
  2955. effectCleanupFns.forEach(function (fn) {
  2956. return fn();
  2957. });
  2958. effectCleanupFns = [];
  2959. }
  2960. return instance;
  2961. };
  2962. }
  2963. var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
  2964. var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
  2965. var createPopper$1 = /*#__PURE__*/popperGenerator({
  2966. defaultModifiers: defaultModifiers$1
  2967. }); // eslint-disable-next-line import/no-unused-modules
  2968. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  2969. var createPopper = /*#__PURE__*/popperGenerator({
  2970. defaultModifiers: defaultModifiers
  2971. }); // eslint-disable-next-line import/no-unused-modules
  2972. var Popper = /*#__PURE__*/Object.freeze({
  2973. __proto__: null,
  2974. popperGenerator: popperGenerator,
  2975. detectOverflow: detectOverflow,
  2976. createPopperBase: createPopper$2,
  2977. createPopper: createPopper,
  2978. createPopperLite: createPopper$1,
  2979. top: top,
  2980. bottom: bottom,
  2981. right: right,
  2982. left: left,
  2983. auto: auto,
  2984. basePlacements: basePlacements,
  2985. start: start,
  2986. end: end,
  2987. clippingParents: clippingParents,
  2988. viewport: viewport,
  2989. popper: popper,
  2990. reference: reference,
  2991. variationPlacements: variationPlacements,
  2992. placements: placements,
  2993. beforeRead: beforeRead,
  2994. read: read,
  2995. afterRead: afterRead,
  2996. beforeMain: beforeMain,
  2997. main: main,
  2998. afterMain: afterMain,
  2999. beforeWrite: beforeWrite,
  3000. write: write,
  3001. afterWrite: afterWrite,
  3002. modifierPhases: modifierPhases,
  3003. applyStyles: applyStyles$1,
  3004. arrow: arrow$1,
  3005. computeStyles: computeStyles$1,
  3006. eventListeners: eventListeners,
  3007. flip: flip$1,
  3008. hide: hide$1,
  3009. offset: offset$1,
  3010. popperOffsets: popperOffsets$1,
  3011. preventOverflow: preventOverflow$1
  3012. });
  3013. /**
  3014. * --------------------------------------------------------------------------
  3015. * Bootstrap (v5.1.0): dropdown.js
  3016. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3017. * --------------------------------------------------------------------------
  3018. */
  3019. /**
  3020. * ------------------------------------------------------------------------
  3021. * Constants
  3022. * ------------------------------------------------------------------------
  3023. */
  3024. const NAME$9 = 'dropdown';
  3025. const DATA_KEY$8 = 'bs.dropdown';
  3026. const EVENT_KEY$8 = `.${DATA_KEY$8}`;
  3027. const DATA_API_KEY$4 = '.data-api';
  3028. const ESCAPE_KEY$2 = 'Escape';
  3029. const SPACE_KEY = 'Space';
  3030. const TAB_KEY$1 = 'Tab';
  3031. const ARROW_UP_KEY = 'ArrowUp';
  3032. const ARROW_DOWN_KEY = 'ArrowDown';
  3033. const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
  3034. const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
  3035. const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
  3036. const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
  3037. const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
  3038. const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
  3039. const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
  3040. const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
  3041. const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
  3042. const CLASS_NAME_SHOW$6 = 'show';
  3043. const CLASS_NAME_DROPUP = 'dropup';
  3044. const CLASS_NAME_DROPEND = 'dropend';
  3045. const CLASS_NAME_DROPSTART = 'dropstart';
  3046. const CLASS_NAME_NAVBAR = 'navbar';
  3047. const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
  3048. const SELECTOR_MENU = '.dropdown-menu';
  3049. const SELECTOR_NAVBAR_NAV = '.navbar-nav';
  3050. const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  3051. const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
  3052. const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
  3053. const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
  3054. const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
  3055. const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
  3056. const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
  3057. const Default$8 = {
  3058. offset: [0, 2],
  3059. boundary: 'clippingParents',
  3060. reference: 'toggle',
  3061. display: 'dynamic',
  3062. popperConfig: null,
  3063. autoClose: true
  3064. };
  3065. const DefaultType$8 = {
  3066. offset: '(array|string|function)',
  3067. boundary: '(string|element)',
  3068. reference: '(string|element|object)',
  3069. display: 'string',
  3070. popperConfig: '(null|object|function)',
  3071. autoClose: '(boolean|string)'
  3072. };
  3073. /**
  3074. * ------------------------------------------------------------------------
  3075. * Class Definition
  3076. * ------------------------------------------------------------------------
  3077. */
  3078. class Dropdown extends BaseComponent {
  3079. constructor(element, config) {
  3080. super(element);
  3081. this._popper = null;
  3082. this._config = this._getConfig(config);
  3083. this._menu = this._getMenuElement();
  3084. this._inNavbar = this._detectNavbar();
  3085. } // Getters
  3086. static get Default() {
  3087. return Default$8;
  3088. }
  3089. static get DefaultType() {
  3090. return DefaultType$8;
  3091. }
  3092. static get NAME() {
  3093. return NAME$9;
  3094. } // Public
  3095. toggle() {
  3096. return this._isShown() ? this.hide() : this.show();
  3097. }
  3098. show() {
  3099. if (isDisabled(this._element) || this._isShown(this._menu)) {
  3100. return;
  3101. }
  3102. const relatedTarget = {
  3103. relatedTarget: this._element
  3104. };
  3105. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
  3106. if (showEvent.defaultPrevented) {
  3107. return;
  3108. }
  3109. const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
  3110. if (this._inNavbar) {
  3111. Manipulator.setDataAttribute(this._menu, 'popper', 'none');
  3112. } else {
  3113. this._createPopper(parent);
  3114. } // If this is a touch-enabled device we add extra
  3115. // empty mouseover listeners to the body's immediate children;
  3116. // only needed because of broken event delegation on iOS
  3117. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3118. if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
  3119. [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
  3120. }
  3121. this._element.focus();
  3122. this._element.setAttribute('aria-expanded', true);
  3123. this._menu.classList.add(CLASS_NAME_SHOW$6);
  3124. this._element.classList.add(CLASS_NAME_SHOW$6);
  3125. EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
  3126. }
  3127. hide() {
  3128. if (isDisabled(this._element) || !this._isShown(this._menu)) {
  3129. return;
  3130. }
  3131. const relatedTarget = {
  3132. relatedTarget: this._element
  3133. };
  3134. this._completeHide(relatedTarget);
  3135. }
  3136. dispose() {
  3137. if (this._popper) {
  3138. this._popper.destroy();
  3139. }
  3140. super.dispose();
  3141. }
  3142. update() {
  3143. this._inNavbar = this._detectNavbar();
  3144. if (this._popper) {
  3145. this._popper.update();
  3146. }
  3147. } // Private
  3148. _completeHide(relatedTarget) {
  3149. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
  3150. if (hideEvent.defaultPrevented) {
  3151. return;
  3152. } // If this is a touch-enabled device we remove the extra
  3153. // empty mouseover listeners we added for iOS support
  3154. if ('ontouchstart' in document.documentElement) {
  3155. [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
  3156. }
  3157. if (this._popper) {
  3158. this._popper.destroy();
  3159. }
  3160. this._menu.classList.remove(CLASS_NAME_SHOW$6);
  3161. this._element.classList.remove(CLASS_NAME_SHOW$6);
  3162. this._element.setAttribute('aria-expanded', 'false');
  3163. Manipulator.removeDataAttribute(this._menu, 'popper');
  3164. EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
  3165. }
  3166. _getConfig(config) {
  3167. config = { ...this.constructor.Default,
  3168. ...Manipulator.getDataAttributes(this._element),
  3169. ...config
  3170. };
  3171. typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
  3172. if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
  3173. // Popper virtual elements require a getBoundingClientRect method
  3174. throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
  3175. }
  3176. return config;
  3177. }
  3178. _createPopper(parent) {
  3179. if (typeof Popper === 'undefined') {
  3180. throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
  3181. }
  3182. let referenceElement = this._element;
  3183. if (this._config.reference === 'parent') {
  3184. referenceElement = parent;
  3185. } else if (isElement$1(this._config.reference)) {
  3186. referenceElement = getElement(this._config.reference);
  3187. } else if (typeof this._config.reference === 'object') {
  3188. referenceElement = this._config.reference;
  3189. }
  3190. const popperConfig = this._getPopperConfig();
  3191. const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
  3192. this._popper = createPopper(referenceElement, this._menu, popperConfig);
  3193. if (isDisplayStatic) {
  3194. Manipulator.setDataAttribute(this._menu, 'popper', 'static');
  3195. }
  3196. }
  3197. _isShown(element = this._element) {
  3198. return element.classList.contains(CLASS_NAME_SHOW$6);
  3199. }
  3200. _getMenuElement() {
  3201. return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
  3202. }
  3203. _getPlacement() {
  3204. const parentDropdown = this._element.parentNode;
  3205. if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
  3206. return PLACEMENT_RIGHT;
  3207. }
  3208. if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
  3209. return PLACEMENT_LEFT;
  3210. } // We need to trim the value because custom properties can also include spaces
  3211. const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
  3212. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
  3213. return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  3214. }
  3215. return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
  3216. }
  3217. _detectNavbar() {
  3218. return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
  3219. }
  3220. _getOffset() {
  3221. const {
  3222. offset
  3223. } = this._config;
  3224. if (typeof offset === 'string') {
  3225. return offset.split(',').map(val => Number.parseInt(val, 10));
  3226. }
  3227. if (typeof offset === 'function') {
  3228. return popperData => offset(popperData, this._element);
  3229. }
  3230. return offset;
  3231. }
  3232. _getPopperConfig() {
  3233. const defaultBsPopperConfig = {
  3234. placement: this._getPlacement(),
  3235. modifiers: [{
  3236. name: 'preventOverflow',
  3237. options: {
  3238. boundary: this._config.boundary
  3239. }
  3240. }, {
  3241. name: 'offset',
  3242. options: {
  3243. offset: this._getOffset()
  3244. }
  3245. }]
  3246. }; // Disable Popper if we have a static display
  3247. if (this._config.display === 'static') {
  3248. defaultBsPopperConfig.modifiers = [{
  3249. name: 'applyStyles',
  3250. enabled: false
  3251. }];
  3252. }
  3253. return { ...defaultBsPopperConfig,
  3254. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  3255. };
  3256. }
  3257. _selectMenuItem({
  3258. key,
  3259. target
  3260. }) {
  3261. const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
  3262. if (!items.length) {
  3263. return;
  3264. } // if target isn't included in items (e.g. when expanding the dropdown)
  3265. // allow cycling to get the last item in case key equals ARROW_UP_KEY
  3266. getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
  3267. } // Static
  3268. static jQueryInterface(config) {
  3269. return this.each(function () {
  3270. const data = Dropdown.getOrCreateInstance(this, config);
  3271. if (typeof config !== 'string') {
  3272. return;
  3273. }
  3274. if (typeof data[config] === 'undefined') {
  3275. throw new TypeError(`No method named "${config}"`);
  3276. }
  3277. data[config]();
  3278. });
  3279. }
  3280. static clearMenus(event) {
  3281. if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
  3282. return;
  3283. }
  3284. const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
  3285. for (let i = 0, len = toggles.length; i < len; i++) {
  3286. const context = Dropdown.getInstance(toggles[i]);
  3287. if (!context || context._config.autoClose === false) {
  3288. continue;
  3289. }
  3290. if (!context._isShown()) {
  3291. continue;
  3292. }
  3293. const relatedTarget = {
  3294. relatedTarget: context._element
  3295. };
  3296. if (event) {
  3297. const composedPath = event.composedPath();
  3298. const isMenuTarget = composedPath.includes(context._menu);
  3299. if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
  3300. continue;
  3301. } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
  3302. if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
  3303. continue;
  3304. }
  3305. if (event.type === 'click') {
  3306. relatedTarget.clickEvent = event;
  3307. }
  3308. }
  3309. context._completeHide(relatedTarget);
  3310. }
  3311. }
  3312. static getParentFromElement(element) {
  3313. return getElementFromSelector(element) || element.parentNode;
  3314. }
  3315. static dataApiKeydownHandler(event) {
  3316. // If not input/textarea:
  3317. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3318. // If input/textarea:
  3319. // - If space key => not a dropdown command
  3320. // - If key is other than escape
  3321. // - If key is not up or down => not a dropdown command
  3322. // - If trigger inside the menu => not a dropdown command
  3323. if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
  3324. return;
  3325. }
  3326. const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
  3327. if (!isActive && event.key === ESCAPE_KEY$2) {
  3328. return;
  3329. }
  3330. event.preventDefault();
  3331. event.stopPropagation();
  3332. if (isDisabled(this)) {
  3333. return;
  3334. }
  3335. const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
  3336. const instance = Dropdown.getOrCreateInstance(getToggleButton);
  3337. if (event.key === ESCAPE_KEY$2) {
  3338. instance.hide();
  3339. return;
  3340. }
  3341. if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
  3342. if (!isActive) {
  3343. instance.show();
  3344. }
  3345. instance._selectMenuItem(event);
  3346. return;
  3347. }
  3348. if (!isActive || event.key === SPACE_KEY) {
  3349. Dropdown.clearMenus();
  3350. }
  3351. }
  3352. }
  3353. /**
  3354. * ------------------------------------------------------------------------
  3355. * Data Api implementation
  3356. * ------------------------------------------------------------------------
  3357. */
  3358. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler);
  3359. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  3360. EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus);
  3361. EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  3362. EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
  3363. event.preventDefault();
  3364. Dropdown.getOrCreateInstance(this).toggle();
  3365. });
  3366. /**
  3367. * ------------------------------------------------------------------------
  3368. * jQuery
  3369. * ------------------------------------------------------------------------
  3370. * add .Dropdown to jQuery only if jQuery is present
  3371. */
  3372. defineJQueryPlugin(Dropdown);
  3373. /**
  3374. * --------------------------------------------------------------------------
  3375. * Bootstrap (v5.1.0): util/scrollBar.js
  3376. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3377. * --------------------------------------------------------------------------
  3378. */
  3379. const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  3380. const SELECTOR_STICKY_CONTENT = '.sticky-top';
  3381. class ScrollBarHelper {
  3382. constructor() {
  3383. this._element = document.body;
  3384. }
  3385. getWidth() {
  3386. // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
  3387. const documentWidth = document.documentElement.clientWidth;
  3388. return Math.abs(window.innerWidth - documentWidth);
  3389. }
  3390. hide() {
  3391. const width = this.getWidth();
  3392. this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
  3393. this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
  3394. this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
  3395. this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
  3396. }
  3397. _disableOverFlow() {
  3398. this._saveInitialAttribute(this._element, 'overflow');
  3399. this._element.style.overflow = 'hidden';
  3400. }
  3401. _setElementAttributes(selector, styleProp, callback) {
  3402. const scrollbarWidth = this.getWidth();
  3403. const manipulationCallBack = element => {
  3404. if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
  3405. return;
  3406. }
  3407. this._saveInitialAttribute(element, styleProp);
  3408. const calculatedValue = window.getComputedStyle(element)[styleProp];
  3409. element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
  3410. };
  3411. this._applyManipulationCallback(selector, manipulationCallBack);
  3412. }
  3413. reset() {
  3414. this._resetElementAttributes(this._element, 'overflow');
  3415. this._resetElementAttributes(this._element, 'paddingRight');
  3416. this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
  3417. this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
  3418. }
  3419. _saveInitialAttribute(element, styleProp) {
  3420. const actualValue = element.style[styleProp];
  3421. if (actualValue) {
  3422. Manipulator.setDataAttribute(element, styleProp, actualValue);
  3423. }
  3424. }
  3425. _resetElementAttributes(selector, styleProp) {
  3426. const manipulationCallBack = element => {
  3427. const value = Manipulator.getDataAttribute(element, styleProp);
  3428. if (typeof value === 'undefined') {
  3429. element.style.removeProperty(styleProp);
  3430. } else {
  3431. Manipulator.removeDataAttribute(element, styleProp);
  3432. element.style[styleProp] = value;
  3433. }
  3434. };
  3435. this._applyManipulationCallback(selector, manipulationCallBack);
  3436. }
  3437. _applyManipulationCallback(selector, callBack) {
  3438. if (isElement$1(selector)) {
  3439. callBack(selector);
  3440. } else {
  3441. SelectorEngine.find(selector, this._element).forEach(callBack);
  3442. }
  3443. }
  3444. isOverflowing() {
  3445. return this.getWidth() > 0;
  3446. }
  3447. }
  3448. /**
  3449. * --------------------------------------------------------------------------
  3450. * Bootstrap (v5.1.0): util/backdrop.js
  3451. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3452. * --------------------------------------------------------------------------
  3453. */
  3454. const Default$7 = {
  3455. className: 'modal-backdrop',
  3456. isVisible: true,
  3457. // if false, we use the backdrop helper without adding any element to the dom
  3458. isAnimated: false,
  3459. rootElement: 'body',
  3460. // give the choice to place backdrop under different elements
  3461. clickCallback: null
  3462. };
  3463. const DefaultType$7 = {
  3464. className: 'string',
  3465. isVisible: 'boolean',
  3466. isAnimated: 'boolean',
  3467. rootElement: '(element|string)',
  3468. clickCallback: '(function|null)'
  3469. };
  3470. const NAME$8 = 'backdrop';
  3471. const CLASS_NAME_FADE$4 = 'fade';
  3472. const CLASS_NAME_SHOW$5 = 'show';
  3473. const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
  3474. class Backdrop {
  3475. constructor(config) {
  3476. this._config = this._getConfig(config);
  3477. this._isAppended = false;
  3478. this._element = null;
  3479. }
  3480. show(callback) {
  3481. if (!this._config.isVisible) {
  3482. execute(callback);
  3483. return;
  3484. }
  3485. this._append();
  3486. if (this._config.isAnimated) {
  3487. reflow(this._getElement());
  3488. }
  3489. this._getElement().classList.add(CLASS_NAME_SHOW$5);
  3490. this._emulateAnimation(() => {
  3491. execute(callback);
  3492. });
  3493. }
  3494. hide(callback) {
  3495. if (!this._config.isVisible) {
  3496. execute(callback);
  3497. return;
  3498. }
  3499. this._getElement().classList.remove(CLASS_NAME_SHOW$5);
  3500. this._emulateAnimation(() => {
  3501. this.dispose();
  3502. execute(callback);
  3503. });
  3504. } // Private
  3505. _getElement() {
  3506. if (!this._element) {
  3507. const backdrop = document.createElement('div');
  3508. backdrop.className = this._config.className;
  3509. if (this._config.isAnimated) {
  3510. backdrop.classList.add(CLASS_NAME_FADE$4);
  3511. }
  3512. this._element = backdrop;
  3513. }
  3514. return this._element;
  3515. }
  3516. _getConfig(config) {
  3517. config = { ...Default$7,
  3518. ...(typeof config === 'object' ? config : {})
  3519. }; // use getElement() with the default "body" to get a fresh Element on each instantiation
  3520. config.rootElement = getElement(config.rootElement);
  3521. typeCheckConfig(NAME$8, config, DefaultType$7);
  3522. return config;
  3523. }
  3524. _append() {
  3525. if (this._isAppended) {
  3526. return;
  3527. }
  3528. this._config.rootElement.append(this._getElement());
  3529. EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
  3530. execute(this._config.clickCallback);
  3531. });
  3532. this._isAppended = true;
  3533. }
  3534. dispose() {
  3535. if (!this._isAppended) {
  3536. return;
  3537. }
  3538. EventHandler.off(this._element, EVENT_MOUSEDOWN);
  3539. this._element.remove();
  3540. this._isAppended = false;
  3541. }
  3542. _emulateAnimation(callback) {
  3543. executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
  3544. }
  3545. }
  3546. /**
  3547. * --------------------------------------------------------------------------
  3548. * Bootstrap (v5.1.0): util/focustrap.js
  3549. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3550. * --------------------------------------------------------------------------
  3551. */
  3552. const Default$6 = {
  3553. trapElement: null,
  3554. // The element to trap focus inside of
  3555. autofocus: true
  3556. };
  3557. const DefaultType$6 = {
  3558. trapElement: 'element',
  3559. autofocus: 'boolean'
  3560. };
  3561. const NAME$7 = 'focustrap';
  3562. const DATA_KEY$7 = 'bs.focustrap';
  3563. const EVENT_KEY$7 = `.${DATA_KEY$7}`;
  3564. const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
  3565. const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
  3566. const TAB_KEY = 'Tab';
  3567. const TAB_NAV_FORWARD = 'forward';
  3568. const TAB_NAV_BACKWARD = 'backward';
  3569. class FocusTrap {
  3570. constructor(config) {
  3571. this._config = this._getConfig(config);
  3572. this._isActive = false;
  3573. this._lastTabNavDirection = null;
  3574. }
  3575. activate() {
  3576. const {
  3577. trapElement,
  3578. autofocus
  3579. } = this._config;
  3580. if (this._isActive) {
  3581. return;
  3582. }
  3583. if (autofocus) {
  3584. trapElement.focus();
  3585. }
  3586. EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop
  3587. EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
  3588. EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
  3589. this._isActive = true;
  3590. }
  3591. deactivate() {
  3592. if (!this._isActive) {
  3593. return;
  3594. }
  3595. this._isActive = false;
  3596. EventHandler.off(document, EVENT_KEY$7);
  3597. } // Private
  3598. _handleFocusin(event) {
  3599. const {
  3600. target
  3601. } = event;
  3602. const {
  3603. trapElement
  3604. } = this._config;
  3605. if (target === document || target === trapElement || trapElement.contains(target)) {
  3606. return;
  3607. }
  3608. const elements = SelectorEngine.focusableChildren(trapElement);
  3609. if (elements.length === 0) {
  3610. trapElement.focus();
  3611. } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
  3612. elements[elements.length - 1].focus();
  3613. } else {
  3614. elements[0].focus();
  3615. }
  3616. }
  3617. _handleKeydown(event) {
  3618. if (event.key !== TAB_KEY) {
  3619. return;
  3620. }
  3621. this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
  3622. }
  3623. _getConfig(config) {
  3624. config = { ...Default$6,
  3625. ...(typeof config === 'object' ? config : {})
  3626. };
  3627. typeCheckConfig(NAME$7, config, DefaultType$6);
  3628. return config;
  3629. }
  3630. }
  3631. /**
  3632. * --------------------------------------------------------------------------
  3633. * Bootstrap (v5.1.0): modal.js
  3634. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3635. * --------------------------------------------------------------------------
  3636. */
  3637. /**
  3638. * ------------------------------------------------------------------------
  3639. * Constants
  3640. * ------------------------------------------------------------------------
  3641. */
  3642. const NAME$6 = 'modal';
  3643. const DATA_KEY$6 = 'bs.modal';
  3644. const EVENT_KEY$6 = `.${DATA_KEY$6}`;
  3645. const DATA_API_KEY$3 = '.data-api';
  3646. const ESCAPE_KEY$1 = 'Escape';
  3647. const Default$5 = {
  3648. backdrop: true,
  3649. keyboard: true,
  3650. focus: true
  3651. };
  3652. const DefaultType$5 = {
  3653. backdrop: '(boolean|string)',
  3654. keyboard: 'boolean',
  3655. focus: 'boolean'
  3656. };
  3657. const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
  3658. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
  3659. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
  3660. const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
  3661. const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
  3662. const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
  3663. const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
  3664. const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
  3665. const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
  3666. const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
  3667. const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
  3668. const CLASS_NAME_OPEN = 'modal-open';
  3669. const CLASS_NAME_FADE$3 = 'fade';
  3670. const CLASS_NAME_SHOW$4 = 'show';
  3671. const CLASS_NAME_STATIC = 'modal-static';
  3672. const SELECTOR_DIALOG = '.modal-dialog';
  3673. const SELECTOR_MODAL_BODY = '.modal-body';
  3674. const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
  3675. /**
  3676. * ------------------------------------------------------------------------
  3677. * Class Definition
  3678. * ------------------------------------------------------------------------
  3679. */
  3680. class Modal extends BaseComponent {
  3681. constructor(element, config) {
  3682. super(element);
  3683. this._config = this._getConfig(config);
  3684. this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
  3685. this._backdrop = this._initializeBackDrop();
  3686. this._focustrap = this._initializeFocusTrap();
  3687. this._isShown = false;
  3688. this._ignoreBackdropClick = false;
  3689. this._isTransitioning = false;
  3690. this._scrollBar = new ScrollBarHelper();
  3691. } // Getters
  3692. static get Default() {
  3693. return Default$5;
  3694. }
  3695. static get NAME() {
  3696. return NAME$6;
  3697. } // Public
  3698. toggle(relatedTarget) {
  3699. return this._isShown ? this.hide() : this.show(relatedTarget);
  3700. }
  3701. show(relatedTarget) {
  3702. if (this._isShown || this._isTransitioning) {
  3703. return;
  3704. }
  3705. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  3706. relatedTarget
  3707. });
  3708. if (showEvent.defaultPrevented) {
  3709. return;
  3710. }
  3711. this._isShown = true;
  3712. if (this._isAnimated()) {
  3713. this._isTransitioning = true;
  3714. }
  3715. this._scrollBar.hide();
  3716. document.body.classList.add(CLASS_NAME_OPEN);
  3717. this._adjustDialog();
  3718. this._setEscapeEvent();
  3719. this._setResizeEvent();
  3720. EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
  3721. EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
  3722. if (event.target === this._element) {
  3723. this._ignoreBackdropClick = true;
  3724. }
  3725. });
  3726. });
  3727. this._showBackdrop(() => this._showElement(relatedTarget));
  3728. }
  3729. hide() {
  3730. if (!this._isShown || this._isTransitioning) {
  3731. return;
  3732. }
  3733. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  3734. if (hideEvent.defaultPrevented) {
  3735. return;
  3736. }
  3737. this._isShown = false;
  3738. const isAnimated = this._isAnimated();
  3739. if (isAnimated) {
  3740. this._isTransitioning = true;
  3741. }
  3742. this._setEscapeEvent();
  3743. this._setResizeEvent();
  3744. this._focustrap.deactivate();
  3745. this._element.classList.remove(CLASS_NAME_SHOW$4);
  3746. EventHandler.off(this._element, EVENT_CLICK_DISMISS);
  3747. EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
  3748. this._queueCallback(() => this._hideModal(), this._element, isAnimated);
  3749. }
  3750. dispose() {
  3751. [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
  3752. this._backdrop.dispose();
  3753. this._focustrap.deactivate();
  3754. super.dispose();
  3755. }
  3756. handleUpdate() {
  3757. this._adjustDialog();
  3758. } // Private
  3759. _initializeBackDrop() {
  3760. return new Backdrop({
  3761. isVisible: Boolean(this._config.backdrop),
  3762. // 'static' option will be translated to true, and booleans will keep their value
  3763. isAnimated: this._isAnimated()
  3764. });
  3765. }
  3766. _initializeFocusTrap() {
  3767. return new FocusTrap({
  3768. trapElement: this._element
  3769. });
  3770. }
  3771. _getConfig(config) {
  3772. config = { ...Default$5,
  3773. ...Manipulator.getDataAttributes(this._element),
  3774. ...(typeof config === 'object' ? config : {})
  3775. };
  3776. typeCheckConfig(NAME$6, config, DefaultType$5);
  3777. return config;
  3778. }
  3779. _showElement(relatedTarget) {
  3780. const isAnimated = this._isAnimated();
  3781. const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
  3782. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3783. // Don't move modal's DOM position
  3784. document.body.append(this._element);
  3785. }
  3786. this._element.style.display = 'block';
  3787. this._element.removeAttribute('aria-hidden');
  3788. this._element.setAttribute('aria-modal', true);
  3789. this._element.setAttribute('role', 'dialog');
  3790. this._element.scrollTop = 0;
  3791. if (modalBody) {
  3792. modalBody.scrollTop = 0;
  3793. }
  3794. if (isAnimated) {
  3795. reflow(this._element);
  3796. }
  3797. this._element.classList.add(CLASS_NAME_SHOW$4);
  3798. const transitionComplete = () => {
  3799. if (this._config.focus) {
  3800. this._focustrap.activate();
  3801. }
  3802. this._isTransitioning = false;
  3803. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  3804. relatedTarget
  3805. });
  3806. };
  3807. this._queueCallback(transitionComplete, this._dialog, isAnimated);
  3808. }
  3809. _setEscapeEvent() {
  3810. if (this._isShown) {
  3811. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
  3812. if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
  3813. event.preventDefault();
  3814. this.hide();
  3815. } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
  3816. this._triggerBackdropTransition();
  3817. }
  3818. });
  3819. } else {
  3820. EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
  3821. }
  3822. }
  3823. _setResizeEvent() {
  3824. if (this._isShown) {
  3825. EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
  3826. } else {
  3827. EventHandler.off(window, EVENT_RESIZE);
  3828. }
  3829. }
  3830. _hideModal() {
  3831. this._element.style.display = 'none';
  3832. this._element.setAttribute('aria-hidden', true);
  3833. this._element.removeAttribute('aria-modal');
  3834. this._element.removeAttribute('role');
  3835. this._isTransitioning = false;
  3836. this._backdrop.hide(() => {
  3837. document.body.classList.remove(CLASS_NAME_OPEN);
  3838. this._resetAdjustments();
  3839. this._scrollBar.reset();
  3840. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  3841. });
  3842. }
  3843. _showBackdrop(callback) {
  3844. EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
  3845. if (this._ignoreBackdropClick) {
  3846. this._ignoreBackdropClick = false;
  3847. return;
  3848. }
  3849. if (event.target !== event.currentTarget) {
  3850. return;
  3851. }
  3852. if (this._config.backdrop === true) {
  3853. this.hide();
  3854. } else if (this._config.backdrop === 'static') {
  3855. this._triggerBackdropTransition();
  3856. }
  3857. });
  3858. this._backdrop.show(callback);
  3859. }
  3860. _isAnimated() {
  3861. return this._element.classList.contains(CLASS_NAME_FADE$3);
  3862. }
  3863. _triggerBackdropTransition() {
  3864. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  3865. if (hideEvent.defaultPrevented) {
  3866. return;
  3867. }
  3868. const {
  3869. classList,
  3870. scrollHeight,
  3871. style
  3872. } = this._element;
  3873. const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
  3874. if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
  3875. return;
  3876. }
  3877. if (!isModalOverflowing) {
  3878. style.overflowY = 'hidden';
  3879. }
  3880. classList.add(CLASS_NAME_STATIC);
  3881. this._queueCallback(() => {
  3882. classList.remove(CLASS_NAME_STATIC);
  3883. if (!isModalOverflowing) {
  3884. this._queueCallback(() => {
  3885. style.overflowY = '';
  3886. }, this._dialog);
  3887. }
  3888. }, this._dialog);
  3889. this._element.focus();
  3890. } // ----------------------------------------------------------------------
  3891. // the following methods are used to handle overflowing modals
  3892. // ----------------------------------------------------------------------
  3893. _adjustDialog() {
  3894. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3895. const scrollbarWidth = this._scrollBar.getWidth();
  3896. const isBodyOverflowing = scrollbarWidth > 0;
  3897. if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
  3898. this._element.style.paddingLeft = `${scrollbarWidth}px`;
  3899. }
  3900. if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
  3901. this._element.style.paddingRight = `${scrollbarWidth}px`;
  3902. }
  3903. }
  3904. _resetAdjustments() {
  3905. this._element.style.paddingLeft = '';
  3906. this._element.style.paddingRight = '';
  3907. } // Static
  3908. static jQueryInterface(config, relatedTarget) {
  3909. return this.each(function () {
  3910. const data = Modal.getOrCreateInstance(this, config);
  3911. if (typeof config !== 'string') {
  3912. return;
  3913. }
  3914. if (typeof data[config] === 'undefined') {
  3915. throw new TypeError(`No method named "${config}"`);
  3916. }
  3917. data[config](relatedTarget);
  3918. });
  3919. }
  3920. }
  3921. /**
  3922. * ------------------------------------------------------------------------
  3923. * Data Api implementation
  3924. * ------------------------------------------------------------------------
  3925. */
  3926. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  3927. const target = getElementFromSelector(this);
  3928. if (['A', 'AREA'].includes(this.tagName)) {
  3929. event.preventDefault();
  3930. }
  3931. EventHandler.one(target, EVENT_SHOW$3, showEvent => {
  3932. if (showEvent.defaultPrevented) {
  3933. // only register focus restorer if modal will actually get shown
  3934. return;
  3935. }
  3936. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  3937. if (isVisible(this)) {
  3938. this.focus();
  3939. }
  3940. });
  3941. });
  3942. const data = Modal.getOrCreateInstance(target);
  3943. data.toggle(this);
  3944. });
  3945. enableDismissTrigger(Modal);
  3946. /**
  3947. * ------------------------------------------------------------------------
  3948. * jQuery
  3949. * ------------------------------------------------------------------------
  3950. * add .Modal to jQuery only if jQuery is present
  3951. */
  3952. defineJQueryPlugin(Modal);
  3953. /**
  3954. * --------------------------------------------------------------------------
  3955. * Bootstrap (v5.1.0): offcanvas.js
  3956. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3957. * --------------------------------------------------------------------------
  3958. */
  3959. /**
  3960. * ------------------------------------------------------------------------
  3961. * Constants
  3962. * ------------------------------------------------------------------------
  3963. */
  3964. const NAME$5 = 'offcanvas';
  3965. const DATA_KEY$5 = 'bs.offcanvas';
  3966. const EVENT_KEY$5 = `.${DATA_KEY$5}`;
  3967. const DATA_API_KEY$2 = '.data-api';
  3968. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
  3969. const ESCAPE_KEY = 'Escape';
  3970. const Default$4 = {
  3971. backdrop: true,
  3972. keyboard: true,
  3973. scroll: false
  3974. };
  3975. const DefaultType$4 = {
  3976. backdrop: 'boolean',
  3977. keyboard: 'boolean',
  3978. scroll: 'boolean'
  3979. };
  3980. const CLASS_NAME_SHOW$3 = 'show';
  3981. const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
  3982. const OPEN_SELECTOR = '.offcanvas.show';
  3983. const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
  3984. const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
  3985. const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
  3986. const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
  3987. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
  3988. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
  3989. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  3990. /**
  3991. * ------------------------------------------------------------------------
  3992. * Class Definition
  3993. * ------------------------------------------------------------------------
  3994. */
  3995. class Offcanvas extends BaseComponent {
  3996. constructor(element, config) {
  3997. super(element);
  3998. this._config = this._getConfig(config);
  3999. this._isShown = false;
  4000. this._backdrop = this._initializeBackDrop();
  4001. this._focustrap = this._initializeFocusTrap();
  4002. this._addEventListeners();
  4003. } // Getters
  4004. static get NAME() {
  4005. return NAME$5;
  4006. }
  4007. static get Default() {
  4008. return Default$4;
  4009. } // Public
  4010. toggle(relatedTarget) {
  4011. return this._isShown ? this.hide() : this.show(relatedTarget);
  4012. }
  4013. show(relatedTarget) {
  4014. if (this._isShown) {
  4015. return;
  4016. }
  4017. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
  4018. relatedTarget
  4019. });
  4020. if (showEvent.defaultPrevented) {
  4021. return;
  4022. }
  4023. this._isShown = true;
  4024. this._element.style.visibility = 'visible';
  4025. this._backdrop.show();
  4026. if (!this._config.scroll) {
  4027. new ScrollBarHelper().hide();
  4028. }
  4029. this._element.removeAttribute('aria-hidden');
  4030. this._element.setAttribute('aria-modal', true);
  4031. this._element.setAttribute('role', 'dialog');
  4032. this._element.classList.add(CLASS_NAME_SHOW$3);
  4033. const completeCallBack = () => {
  4034. if (!this._config.scroll) {
  4035. this._focustrap.activate();
  4036. }
  4037. EventHandler.trigger(this._element, EVENT_SHOWN$2, {
  4038. relatedTarget
  4039. });
  4040. };
  4041. this._queueCallback(completeCallBack, this._element, true);
  4042. }
  4043. hide() {
  4044. if (!this._isShown) {
  4045. return;
  4046. }
  4047. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
  4048. if (hideEvent.defaultPrevented) {
  4049. return;
  4050. }
  4051. this._focustrap.deactivate();
  4052. this._element.blur();
  4053. this._isShown = false;
  4054. this._element.classList.remove(CLASS_NAME_SHOW$3);
  4055. this._backdrop.hide();
  4056. const completeCallback = () => {
  4057. this._element.setAttribute('aria-hidden', true);
  4058. this._element.removeAttribute('aria-modal');
  4059. this._element.removeAttribute('role');
  4060. this._element.style.visibility = 'hidden';
  4061. if (!this._config.scroll) {
  4062. new ScrollBarHelper().reset();
  4063. }
  4064. EventHandler.trigger(this._element, EVENT_HIDDEN$2);
  4065. };
  4066. this._queueCallback(completeCallback, this._element, true);
  4067. }
  4068. dispose() {
  4069. this._backdrop.dispose();
  4070. this._focustrap.deactivate();
  4071. super.dispose();
  4072. } // Private
  4073. _getConfig(config) {
  4074. config = { ...Default$4,
  4075. ...Manipulator.getDataAttributes(this._element),
  4076. ...(typeof config === 'object' ? config : {})
  4077. };
  4078. typeCheckConfig(NAME$5, config, DefaultType$4);
  4079. return config;
  4080. }
  4081. _initializeBackDrop() {
  4082. return new Backdrop({
  4083. className: CLASS_NAME_BACKDROP,
  4084. isVisible: this._config.backdrop,
  4085. isAnimated: true,
  4086. rootElement: this._element.parentNode,
  4087. clickCallback: () => this.hide()
  4088. });
  4089. }
  4090. _initializeFocusTrap() {
  4091. return new FocusTrap({
  4092. trapElement: this._element
  4093. });
  4094. }
  4095. _addEventListeners() {
  4096. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  4097. if (this._config.keyboard && event.key === ESCAPE_KEY) {
  4098. this.hide();
  4099. }
  4100. });
  4101. } // Static
  4102. static jQueryInterface(config) {
  4103. return this.each(function () {
  4104. const data = Offcanvas.getOrCreateInstance(this, config);
  4105. if (typeof config !== 'string') {
  4106. return;
  4107. }
  4108. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  4109. throw new TypeError(`No method named "${config}"`);
  4110. }
  4111. data[config](this);
  4112. });
  4113. }
  4114. }
  4115. /**
  4116. * ------------------------------------------------------------------------
  4117. * Data Api implementation
  4118. * ------------------------------------------------------------------------
  4119. */
  4120. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  4121. const target = getElementFromSelector(this);
  4122. if (['A', 'AREA'].includes(this.tagName)) {
  4123. event.preventDefault();
  4124. }
  4125. if (isDisabled(this)) {
  4126. return;
  4127. }
  4128. EventHandler.one(target, EVENT_HIDDEN$2, () => {
  4129. // focus on trigger when it is closed
  4130. if (isVisible(this)) {
  4131. this.focus();
  4132. }
  4133. }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
  4134. const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  4135. if (allReadyOpen && allReadyOpen !== target) {
  4136. Offcanvas.getInstance(allReadyOpen).hide();
  4137. }
  4138. const data = Offcanvas.getOrCreateInstance(target);
  4139. data.toggle(this);
  4140. });
  4141. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
  4142. enableDismissTrigger(Offcanvas);
  4143. /**
  4144. * ------------------------------------------------------------------------
  4145. * jQuery
  4146. * ------------------------------------------------------------------------
  4147. */
  4148. defineJQueryPlugin(Offcanvas);
  4149. /**
  4150. * --------------------------------------------------------------------------
  4151. * Bootstrap (v5.1.0): util/sanitizer.js
  4152. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4153. * --------------------------------------------------------------------------
  4154. */
  4155. const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  4156. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4157. /**
  4158. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4159. *
  4160. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4161. */
  4162. const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
  4163. /**
  4164. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4165. *
  4166. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4167. */
  4168. const 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;
  4169. const allowedAttribute = (attr, allowedAttributeList) => {
  4170. const attrName = attr.nodeName.toLowerCase();
  4171. if (allowedAttributeList.includes(attrName)) {
  4172. if (uriAttrs.has(attrName)) {
  4173. return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
  4174. }
  4175. return true;
  4176. }
  4177. const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute.
  4178. for (let i = 0, len = regExp.length; i < len; i++) {
  4179. if (regExp[i].test(attrName)) {
  4180. return true;
  4181. }
  4182. }
  4183. return false;
  4184. };
  4185. const DefaultAllowlist = {
  4186. // Global attributes allowed on any supplied element below.
  4187. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4188. a: ['target', 'href', 'title', 'rel'],
  4189. area: [],
  4190. b: [],
  4191. br: [],
  4192. col: [],
  4193. code: [],
  4194. div: [],
  4195. em: [],
  4196. hr: [],
  4197. h1: [],
  4198. h2: [],
  4199. h3: [],
  4200. h4: [],
  4201. h5: [],
  4202. h6: [],
  4203. i: [],
  4204. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  4205. li: [],
  4206. ol: [],
  4207. p: [],
  4208. pre: [],
  4209. s: [],
  4210. small: [],
  4211. span: [],
  4212. sub: [],
  4213. sup: [],
  4214. strong: [],
  4215. u: [],
  4216. ul: []
  4217. };
  4218. function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
  4219. if (!unsafeHtml.length) {
  4220. return unsafeHtml;
  4221. }
  4222. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4223. return sanitizeFn(unsafeHtml);
  4224. }
  4225. const domParser = new window.DOMParser();
  4226. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4227. const allowlistKeys = Object.keys(allowList);
  4228. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  4229. for (let i = 0, len = elements.length; i < len; i++) {
  4230. const el = elements[i];
  4231. const elName = el.nodeName.toLowerCase();
  4232. if (!allowlistKeys.includes(elName)) {
  4233. el.remove();
  4234. continue;
  4235. }
  4236. const attributeList = [].concat(...el.attributes);
  4237. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
  4238. attributeList.forEach(attr => {
  4239. if (!allowedAttribute(attr, allowedAttributes)) {
  4240. el.removeAttribute(attr.nodeName);
  4241. }
  4242. });
  4243. }
  4244. return createdDocument.body.innerHTML;
  4245. }
  4246. /**
  4247. * --------------------------------------------------------------------------
  4248. * Bootstrap (v5.1.0): tooltip.js
  4249. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4250. * --------------------------------------------------------------------------
  4251. */
  4252. /**
  4253. * ------------------------------------------------------------------------
  4254. * Constants
  4255. * ------------------------------------------------------------------------
  4256. */
  4257. const NAME$4 = 'tooltip';
  4258. const DATA_KEY$4 = 'bs.tooltip';
  4259. const EVENT_KEY$4 = `.${DATA_KEY$4}`;
  4260. const CLASS_PREFIX$1 = 'bs-tooltip';
  4261. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  4262. const DefaultType$3 = {
  4263. animation: 'boolean',
  4264. template: 'string',
  4265. title: '(string|element|function)',
  4266. trigger: 'string',
  4267. delay: '(number|object)',
  4268. html: 'boolean',
  4269. selector: '(string|boolean)',
  4270. placement: '(string|function)',
  4271. offset: '(array|string|function)',
  4272. container: '(string|element|boolean)',
  4273. fallbackPlacements: 'array',
  4274. boundary: '(string|element)',
  4275. customClass: '(string|function)',
  4276. sanitize: 'boolean',
  4277. sanitizeFn: '(null|function)',
  4278. allowList: 'object',
  4279. popperConfig: '(null|object|function)'
  4280. };
  4281. const AttachmentMap = {
  4282. AUTO: 'auto',
  4283. TOP: 'top',
  4284. RIGHT: isRTL() ? 'left' : 'right',
  4285. BOTTOM: 'bottom',
  4286. LEFT: isRTL() ? 'right' : 'left'
  4287. };
  4288. const Default$3 = {
  4289. animation: true,
  4290. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  4291. trigger: 'hover focus',
  4292. title: '',
  4293. delay: 0,
  4294. html: false,
  4295. selector: false,
  4296. placement: 'top',
  4297. offset: [0, 0],
  4298. container: false,
  4299. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  4300. boundary: 'clippingParents',
  4301. customClass: '',
  4302. sanitize: true,
  4303. sanitizeFn: null,
  4304. allowList: DefaultAllowlist,
  4305. popperConfig: null
  4306. };
  4307. const Event$2 = {
  4308. HIDE: `hide${EVENT_KEY$4}`,
  4309. HIDDEN: `hidden${EVENT_KEY$4}`,
  4310. SHOW: `show${EVENT_KEY$4}`,
  4311. SHOWN: `shown${EVENT_KEY$4}`,
  4312. INSERTED: `inserted${EVENT_KEY$4}`,
  4313. CLICK: `click${EVENT_KEY$4}`,
  4314. FOCUSIN: `focusin${EVENT_KEY$4}`,
  4315. FOCUSOUT: `focusout${EVENT_KEY$4}`,
  4316. MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
  4317. MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
  4318. };
  4319. const CLASS_NAME_FADE$2 = 'fade';
  4320. const CLASS_NAME_MODAL = 'modal';
  4321. const CLASS_NAME_SHOW$2 = 'show';
  4322. const HOVER_STATE_SHOW = 'show';
  4323. const HOVER_STATE_OUT = 'out';
  4324. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  4325. const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
  4326. const EVENT_MODAL_HIDE = 'hide.bs.modal';
  4327. const TRIGGER_HOVER = 'hover';
  4328. const TRIGGER_FOCUS = 'focus';
  4329. const TRIGGER_CLICK = 'click';
  4330. const TRIGGER_MANUAL = 'manual';
  4331. /**
  4332. * ------------------------------------------------------------------------
  4333. * Class Definition
  4334. * ------------------------------------------------------------------------
  4335. */
  4336. class Tooltip extends BaseComponent {
  4337. constructor(element, config) {
  4338. if (typeof Popper === 'undefined') {
  4339. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
  4340. }
  4341. super(element); // private
  4342. this._isEnabled = true;
  4343. this._timeout = 0;
  4344. this._hoverState = '';
  4345. this._activeTrigger = {};
  4346. this._popper = null; // Protected
  4347. this._config = this._getConfig(config);
  4348. this.tip = null;
  4349. this._setListeners();
  4350. } // Getters
  4351. static get Default() {
  4352. return Default$3;
  4353. }
  4354. static get NAME() {
  4355. return NAME$4;
  4356. }
  4357. static get Event() {
  4358. return Event$2;
  4359. }
  4360. static get DefaultType() {
  4361. return DefaultType$3;
  4362. } // Public
  4363. enable() {
  4364. this._isEnabled = true;
  4365. }
  4366. disable() {
  4367. this._isEnabled = false;
  4368. }
  4369. toggleEnabled() {
  4370. this._isEnabled = !this._isEnabled;
  4371. }
  4372. toggle(event) {
  4373. if (!this._isEnabled) {
  4374. return;
  4375. }
  4376. if (event) {
  4377. const context = this._initializeOnDelegatedTarget(event);
  4378. context._activeTrigger.click = !context._activeTrigger.click;
  4379. if (context._isWithActiveTrigger()) {
  4380. context._enter(null, context);
  4381. } else {
  4382. context._leave(null, context);
  4383. }
  4384. } else {
  4385. if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
  4386. this._leave(null, this);
  4387. return;
  4388. }
  4389. this._enter(null, this);
  4390. }
  4391. }
  4392. dispose() {
  4393. clearTimeout(this._timeout);
  4394. EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  4395. if (this.tip) {
  4396. this.tip.remove();
  4397. }
  4398. if (this._popper) {
  4399. this._popper.destroy();
  4400. }
  4401. super.dispose();
  4402. }
  4403. show() {
  4404. if (this._element.style.display === 'none') {
  4405. throw new Error('Please use show on visible elements');
  4406. }
  4407. if (!(this.isWithContent() && this._isEnabled)) {
  4408. return;
  4409. }
  4410. const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
  4411. const shadowRoot = findShadowRoot(this._element);
  4412. const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
  4413. if (showEvent.defaultPrevented || !isInTheDom) {
  4414. return;
  4415. }
  4416. const tip = this.getTipElement();
  4417. const tipId = getUID(this.constructor.NAME);
  4418. tip.setAttribute('id', tipId);
  4419. this._element.setAttribute('aria-describedby', tipId);
  4420. if (this._config.animation) {
  4421. tip.classList.add(CLASS_NAME_FADE$2);
  4422. }
  4423. const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
  4424. const attachment = this._getAttachment(placement);
  4425. this._addAttachmentClass(attachment);
  4426. const {
  4427. container
  4428. } = this._config;
  4429. Data.set(tip, this.constructor.DATA_KEY, this);
  4430. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  4431. container.append(tip);
  4432. EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
  4433. }
  4434. if (this._popper) {
  4435. this._popper.update();
  4436. } else {
  4437. this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment));
  4438. }
  4439. tip.classList.add(CLASS_NAME_SHOW$2);
  4440. const customClass = this._resolvePossibleFunction(this._config.customClass);
  4441. if (customClass) {
  4442. tip.classList.add(...customClass.split(' '));
  4443. } // If this is a touch-enabled device we add extra
  4444. // empty mouseover listeners to the body's immediate children;
  4445. // only needed because of broken event delegation on iOS
  4446. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4447. if ('ontouchstart' in document.documentElement) {
  4448. [].concat(...document.body.children).forEach(element => {
  4449. EventHandler.on(element, 'mouseover', noop);
  4450. });
  4451. }
  4452. const complete = () => {
  4453. const prevHoverState = this._hoverState;
  4454. this._hoverState = null;
  4455. EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
  4456. if (prevHoverState === HOVER_STATE_OUT) {
  4457. this._leave(null, this);
  4458. }
  4459. };
  4460. const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
  4461. this._queueCallback(complete, this.tip, isAnimated);
  4462. }
  4463. hide() {
  4464. if (!this._popper) {
  4465. return;
  4466. }
  4467. const tip = this.getTipElement();
  4468. const complete = () => {
  4469. if (this._isWithActiveTrigger()) {
  4470. return;
  4471. }
  4472. if (this._hoverState !== HOVER_STATE_SHOW) {
  4473. tip.remove();
  4474. }
  4475. this._cleanTipClass();
  4476. this._element.removeAttribute('aria-describedby');
  4477. EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
  4478. if (this._popper) {
  4479. this._popper.destroy();
  4480. this._popper = null;
  4481. }
  4482. };
  4483. const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
  4484. if (hideEvent.defaultPrevented) {
  4485. return;
  4486. }
  4487. tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra
  4488. // empty mouseover listeners we added for iOS support
  4489. if ('ontouchstart' in document.documentElement) {
  4490. [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop));
  4491. }
  4492. this._activeTrigger[TRIGGER_CLICK] = false;
  4493. this._activeTrigger[TRIGGER_FOCUS] = false;
  4494. this._activeTrigger[TRIGGER_HOVER] = false;
  4495. const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
  4496. this._queueCallback(complete, this.tip, isAnimated);
  4497. this._hoverState = '';
  4498. }
  4499. update() {
  4500. if (this._popper !== null) {
  4501. this._popper.update();
  4502. }
  4503. } // Protected
  4504. isWithContent() {
  4505. return Boolean(this.getTitle());
  4506. }
  4507. getTipElement() {
  4508. if (this.tip) {
  4509. return this.tip;
  4510. }
  4511. const element = document.createElement('div');
  4512. element.innerHTML = this._config.template;
  4513. const tip = element.children[0];
  4514. this.setContent(tip);
  4515. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
  4516. this.tip = tip;
  4517. return this.tip;
  4518. }
  4519. setContent(tip) {
  4520. this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
  4521. }
  4522. _sanitizeAndSetContent(template, content, selector) {
  4523. const templateElement = SelectorEngine.findOne(selector, template);
  4524. if (!content && templateElement) {
  4525. templateElement.remove();
  4526. return;
  4527. } // we use append for html objects to maintain js events
  4528. this.setElementContent(templateElement, content);
  4529. }
  4530. setElementContent(element, content) {
  4531. if (element === null) {
  4532. return;
  4533. }
  4534. if (isElement$1(content)) {
  4535. content = getElement(content); // content is a DOM node or a jQuery
  4536. if (this._config.html) {
  4537. if (content.parentNode !== element) {
  4538. element.innerHTML = '';
  4539. element.append(content);
  4540. }
  4541. } else {
  4542. element.textContent = content.textContent;
  4543. }
  4544. return;
  4545. }
  4546. if (this._config.html) {
  4547. if (this._config.sanitize) {
  4548. content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
  4549. }
  4550. element.innerHTML = content;
  4551. } else {
  4552. element.textContent = content;
  4553. }
  4554. }
  4555. getTitle() {
  4556. const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
  4557. return this._resolvePossibleFunction(title);
  4558. }
  4559. updateAttachment(attachment) {
  4560. if (attachment === 'right') {
  4561. return 'end';
  4562. }
  4563. if (attachment === 'left') {
  4564. return 'start';
  4565. }
  4566. return attachment;
  4567. } // Private
  4568. _initializeOnDelegatedTarget(event, context) {
  4569. return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
  4570. }
  4571. _getOffset() {
  4572. const {
  4573. offset
  4574. } = this._config;
  4575. if (typeof offset === 'string') {
  4576. return offset.split(',').map(val => Number.parseInt(val, 10));
  4577. }
  4578. if (typeof offset === 'function') {
  4579. return popperData => offset(popperData, this._element);
  4580. }
  4581. return offset;
  4582. }
  4583. _resolvePossibleFunction(content) {
  4584. return typeof content === 'function' ? content.call(this._element) : content;
  4585. }
  4586. _getPopperConfig(attachment) {
  4587. const defaultBsPopperConfig = {
  4588. placement: attachment,
  4589. modifiers: [{
  4590. name: 'flip',
  4591. options: {
  4592. fallbackPlacements: this._config.fallbackPlacements
  4593. }
  4594. }, {
  4595. name: 'offset',
  4596. options: {
  4597. offset: this._getOffset()
  4598. }
  4599. }, {
  4600. name: 'preventOverflow',
  4601. options: {
  4602. boundary: this._config.boundary
  4603. }
  4604. }, {
  4605. name: 'arrow',
  4606. options: {
  4607. element: `.${this.constructor.NAME}-arrow`
  4608. }
  4609. }, {
  4610. name: 'onChange',
  4611. enabled: true,
  4612. phase: 'afterWrite',
  4613. fn: data => this._handlePopperPlacementChange(data)
  4614. }],
  4615. onFirstUpdate: data => {
  4616. if (data.options.placement !== data.placement) {
  4617. this._handlePopperPlacementChange(data);
  4618. }
  4619. }
  4620. };
  4621. return { ...defaultBsPopperConfig,
  4622. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  4623. };
  4624. }
  4625. _addAttachmentClass(attachment) {
  4626. this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
  4627. }
  4628. _getAttachment(placement) {
  4629. return AttachmentMap[placement.toUpperCase()];
  4630. }
  4631. _setListeners() {
  4632. const triggers = this._config.trigger.split(' ');
  4633. triggers.forEach(trigger => {
  4634. if (trigger === 'click') {
  4635. EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
  4636. } else if (trigger !== TRIGGER_MANUAL) {
  4637. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
  4638. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
  4639. EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event));
  4640. EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event));
  4641. }
  4642. });
  4643. this._hideModalHandler = () => {
  4644. if (this._element) {
  4645. this.hide();
  4646. }
  4647. };
  4648. EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  4649. if (this._config.selector) {
  4650. this._config = { ...this._config,
  4651. trigger: 'manual',
  4652. selector: ''
  4653. };
  4654. } else {
  4655. this._fixTitle();
  4656. }
  4657. }
  4658. _fixTitle() {
  4659. const title = this._element.getAttribute('title');
  4660. const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
  4661. if (title || originalTitleType !== 'string') {
  4662. this._element.setAttribute('data-bs-original-title', title || '');
  4663. if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
  4664. this._element.setAttribute('aria-label', title);
  4665. }
  4666. this._element.setAttribute('title', '');
  4667. }
  4668. }
  4669. _enter(event, context) {
  4670. context = this._initializeOnDelegatedTarget(event, context);
  4671. if (event) {
  4672. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  4673. }
  4674. if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
  4675. context._hoverState = HOVER_STATE_SHOW;
  4676. return;
  4677. }
  4678. clearTimeout(context._timeout);
  4679. context._hoverState = HOVER_STATE_SHOW;
  4680. if (!context._config.delay || !context._config.delay.show) {
  4681. context.show();
  4682. return;
  4683. }
  4684. context._timeout = setTimeout(() => {
  4685. if (context._hoverState === HOVER_STATE_SHOW) {
  4686. context.show();
  4687. }
  4688. }, context._config.delay.show);
  4689. }
  4690. _leave(event, context) {
  4691. context = this._initializeOnDelegatedTarget(event, context);
  4692. if (event) {
  4693. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  4694. }
  4695. if (context._isWithActiveTrigger()) {
  4696. return;
  4697. }
  4698. clearTimeout(context._timeout);
  4699. context._hoverState = HOVER_STATE_OUT;
  4700. if (!context._config.delay || !context._config.delay.hide) {
  4701. context.hide();
  4702. return;
  4703. }
  4704. context._timeout = setTimeout(() => {
  4705. if (context._hoverState === HOVER_STATE_OUT) {
  4706. context.hide();
  4707. }
  4708. }, context._config.delay.hide);
  4709. }
  4710. _isWithActiveTrigger() {
  4711. for (const trigger in this._activeTrigger) {
  4712. if (this._activeTrigger[trigger]) {
  4713. return true;
  4714. }
  4715. }
  4716. return false;
  4717. }
  4718. _getConfig(config) {
  4719. const dataAttributes = Manipulator.getDataAttributes(this._element);
  4720. Object.keys(dataAttributes).forEach(dataAttr => {
  4721. if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
  4722. delete dataAttributes[dataAttr];
  4723. }
  4724. });
  4725. config = { ...this.constructor.Default,
  4726. ...dataAttributes,
  4727. ...(typeof config === 'object' && config ? config : {})
  4728. };
  4729. config.container = config.container === false ? document.body : getElement(config.container);
  4730. if (typeof config.delay === 'number') {
  4731. config.delay = {
  4732. show: config.delay,
  4733. hide: config.delay
  4734. };
  4735. }
  4736. if (typeof config.title === 'number') {
  4737. config.title = config.title.toString();
  4738. }
  4739. if (typeof config.content === 'number') {
  4740. config.content = config.content.toString();
  4741. }
  4742. typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4743. if (config.sanitize) {
  4744. config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
  4745. }
  4746. return config;
  4747. }
  4748. _getDelegateConfig() {
  4749. const config = {};
  4750. for (const key in this._config) {
  4751. if (this.constructor.Default[key] !== this._config[key]) {
  4752. config[key] = this._config[key];
  4753. }
  4754. } // In the future can be replaced with:
  4755. // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
  4756. // `Object.fromEntries(keysWithDifferentValues)`
  4757. return config;
  4758. }
  4759. _cleanTipClass() {
  4760. const tip = this.getTipElement();
  4761. const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
  4762. const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
  4763. if (tabClass !== null && tabClass.length > 0) {
  4764. tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
  4765. }
  4766. }
  4767. _getBasicClassPrefix() {
  4768. return CLASS_PREFIX$1;
  4769. }
  4770. _handlePopperPlacementChange(popperData) {
  4771. const {
  4772. state
  4773. } = popperData;
  4774. if (!state) {
  4775. return;
  4776. }
  4777. this.tip = state.elements.popper;
  4778. this._cleanTipClass();
  4779. this._addAttachmentClass(this._getAttachment(state.placement));
  4780. } // Static
  4781. static jQueryInterface(config) {
  4782. return this.each(function () {
  4783. const data = Tooltip.getOrCreateInstance(this, config);
  4784. if (typeof config === 'string') {
  4785. if (typeof data[config] === 'undefined') {
  4786. throw new TypeError(`No method named "${config}"`);
  4787. }
  4788. data[config]();
  4789. }
  4790. });
  4791. }
  4792. }
  4793. /**
  4794. * ------------------------------------------------------------------------
  4795. * jQuery
  4796. * ------------------------------------------------------------------------
  4797. * add .Tooltip to jQuery only if jQuery is present
  4798. */
  4799. defineJQueryPlugin(Tooltip);
  4800. /**
  4801. * --------------------------------------------------------------------------
  4802. * Bootstrap (v5.1.0): popover.js
  4803. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4804. * --------------------------------------------------------------------------
  4805. */
  4806. /**
  4807. * ------------------------------------------------------------------------
  4808. * Constants
  4809. * ------------------------------------------------------------------------
  4810. */
  4811. const NAME$3 = 'popover';
  4812. const DATA_KEY$3 = 'bs.popover';
  4813. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  4814. const CLASS_PREFIX = 'bs-popover';
  4815. const Default$2 = { ...Tooltip.Default,
  4816. placement: 'right',
  4817. offset: [0, 8],
  4818. trigger: 'click',
  4819. content: '',
  4820. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
  4821. };
  4822. const DefaultType$2 = { ...Tooltip.DefaultType,
  4823. content: '(string|element|function)'
  4824. };
  4825. const Event$1 = {
  4826. HIDE: `hide${EVENT_KEY$3}`,
  4827. HIDDEN: `hidden${EVENT_KEY$3}`,
  4828. SHOW: `show${EVENT_KEY$3}`,
  4829. SHOWN: `shown${EVENT_KEY$3}`,
  4830. INSERTED: `inserted${EVENT_KEY$3}`,
  4831. CLICK: `click${EVENT_KEY$3}`,
  4832. FOCUSIN: `focusin${EVENT_KEY$3}`,
  4833. FOCUSOUT: `focusout${EVENT_KEY$3}`,
  4834. MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
  4835. MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
  4836. };
  4837. const SELECTOR_TITLE = '.popover-header';
  4838. const SELECTOR_CONTENT = '.popover-body';
  4839. /**
  4840. * ------------------------------------------------------------------------
  4841. * Class Definition
  4842. * ------------------------------------------------------------------------
  4843. */
  4844. class Popover extends Tooltip {
  4845. // Getters
  4846. static get Default() {
  4847. return Default$2;
  4848. }
  4849. static get NAME() {
  4850. return NAME$3;
  4851. }
  4852. static get Event() {
  4853. return Event$1;
  4854. }
  4855. static get DefaultType() {
  4856. return DefaultType$2;
  4857. } // Overrides
  4858. isWithContent() {
  4859. return this.getTitle() || this._getContent();
  4860. }
  4861. setContent(tip) {
  4862. this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
  4863. this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
  4864. } // Private
  4865. _getContent() {
  4866. return this._resolvePossibleFunction(this._config.content);
  4867. }
  4868. _getBasicClassPrefix() {
  4869. return CLASS_PREFIX;
  4870. } // Static
  4871. static jQueryInterface(config) {
  4872. return this.each(function () {
  4873. const data = Popover.getOrCreateInstance(this, config);
  4874. if (typeof config === 'string') {
  4875. if (typeof data[config] === 'undefined') {
  4876. throw new TypeError(`No method named "${config}"`);
  4877. }
  4878. data[config]();
  4879. }
  4880. });
  4881. }
  4882. }
  4883. /**
  4884. * ------------------------------------------------------------------------
  4885. * jQuery
  4886. * ------------------------------------------------------------------------
  4887. * add .Popover to jQuery only if jQuery is present
  4888. */
  4889. defineJQueryPlugin(Popover);
  4890. /**
  4891. * --------------------------------------------------------------------------
  4892. * Bootstrap (v5.1.0): scrollspy.js
  4893. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4894. * --------------------------------------------------------------------------
  4895. */
  4896. /**
  4897. * ------------------------------------------------------------------------
  4898. * Constants
  4899. * ------------------------------------------------------------------------
  4900. */
  4901. const NAME$2 = 'scrollspy';
  4902. const DATA_KEY$2 = 'bs.scrollspy';
  4903. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  4904. const DATA_API_KEY$1 = '.data-api';
  4905. const Default$1 = {
  4906. offset: 10,
  4907. method: 'auto',
  4908. target: ''
  4909. };
  4910. const DefaultType$1 = {
  4911. offset: 'number',
  4912. method: 'string',
  4913. target: '(string|element)'
  4914. };
  4915. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  4916. const EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
  4917. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
  4918. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  4919. const CLASS_NAME_ACTIVE$1 = 'active';
  4920. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  4921. const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  4922. const SELECTOR_NAV_LINKS = '.nav-link';
  4923. const SELECTOR_NAV_ITEMS = '.nav-item';
  4924. const SELECTOR_LIST_ITEMS = '.list-group-item';
  4925. const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
  4926. const SELECTOR_DROPDOWN$1 = '.dropdown';
  4927. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  4928. const METHOD_OFFSET = 'offset';
  4929. const METHOD_POSITION = 'position';
  4930. /**
  4931. * ------------------------------------------------------------------------
  4932. * Class Definition
  4933. * ------------------------------------------------------------------------
  4934. */
  4935. class ScrollSpy extends BaseComponent {
  4936. constructor(element, config) {
  4937. super(element);
  4938. this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
  4939. this._config = this._getConfig(config);
  4940. this._offsets = [];
  4941. this._targets = [];
  4942. this._activeTarget = null;
  4943. this._scrollHeight = 0;
  4944. EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
  4945. this.refresh();
  4946. this._process();
  4947. } // Getters
  4948. static get Default() {
  4949. return Default$1;
  4950. }
  4951. static get NAME() {
  4952. return NAME$2;
  4953. } // Public
  4954. refresh() {
  4955. const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  4956. const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4957. const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  4958. this._offsets = [];
  4959. this._targets = [];
  4960. this._scrollHeight = this._getScrollHeight();
  4961. const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
  4962. targets.map(element => {
  4963. const targetSelector = getSelectorFromElement(element);
  4964. const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
  4965. if (target) {
  4966. const targetBCR = target.getBoundingClientRect();
  4967. if (targetBCR.width || targetBCR.height) {
  4968. return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
  4969. }
  4970. }
  4971. return null;
  4972. }).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
  4973. this._offsets.push(item[0]);
  4974. this._targets.push(item[1]);
  4975. });
  4976. }
  4977. dispose() {
  4978. EventHandler.off(this._scrollElement, EVENT_KEY$2);
  4979. super.dispose();
  4980. } // Private
  4981. _getConfig(config) {
  4982. config = { ...Default$1,
  4983. ...Manipulator.getDataAttributes(this._element),
  4984. ...(typeof config === 'object' && config ? config : {})
  4985. };
  4986. config.target = getElement(config.target) || document.documentElement;
  4987. typeCheckConfig(NAME$2, config, DefaultType$1);
  4988. return config;
  4989. }
  4990. _getScrollTop() {
  4991. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  4992. }
  4993. _getScrollHeight() {
  4994. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  4995. }
  4996. _getOffsetHeight() {
  4997. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  4998. }
  4999. _process() {
  5000. const scrollTop = this._getScrollTop() + this._config.offset;
  5001. const scrollHeight = this._getScrollHeight();
  5002. const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5003. if (this._scrollHeight !== scrollHeight) {
  5004. this.refresh();
  5005. }
  5006. if (scrollTop >= maxScroll) {
  5007. const target = this._targets[this._targets.length - 1];
  5008. if (this._activeTarget !== target) {
  5009. this._activate(target);
  5010. }
  5011. return;
  5012. }
  5013. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5014. this._activeTarget = null;
  5015. this._clear();
  5016. return;
  5017. }
  5018. for (let i = this._offsets.length; i--;) {
  5019. const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5020. if (isActiveTarget) {
  5021. this._activate(this._targets[i]);
  5022. }
  5023. }
  5024. }
  5025. _activate(target) {
  5026. this._activeTarget = target;
  5027. this._clear();
  5028. const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
  5029. const link = SelectorEngine.findOne(queries.join(','), this._config.target);
  5030. link.classList.add(CLASS_NAME_ACTIVE$1);
  5031. if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  5032. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
  5033. } else {
  5034. SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
  5035. // Set triggered links parents as active
  5036. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5037. SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); // Handle special case when .nav-link is inside .nav-item
  5038. SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => {
  5039. SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1));
  5040. });
  5041. });
  5042. }
  5043. EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
  5044. relatedTarget: target
  5045. });
  5046. }
  5047. _clear() {
  5048. SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
  5049. } // Static
  5050. static jQueryInterface(config) {
  5051. return this.each(function () {
  5052. const data = ScrollSpy.getOrCreateInstance(this, config);
  5053. if (typeof config !== 'string') {
  5054. return;
  5055. }
  5056. if (typeof data[config] === 'undefined') {
  5057. throw new TypeError(`No method named "${config}"`);
  5058. }
  5059. data[config]();
  5060. });
  5061. }
  5062. }
  5063. /**
  5064. * ------------------------------------------------------------------------
  5065. * Data Api implementation
  5066. * ------------------------------------------------------------------------
  5067. */
  5068. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  5069. SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
  5070. });
  5071. /**
  5072. * ------------------------------------------------------------------------
  5073. * jQuery
  5074. * ------------------------------------------------------------------------
  5075. * add .ScrollSpy to jQuery only if jQuery is present
  5076. */
  5077. defineJQueryPlugin(ScrollSpy);
  5078. /**
  5079. * --------------------------------------------------------------------------
  5080. * Bootstrap (v5.1.0): tab.js
  5081. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5082. * --------------------------------------------------------------------------
  5083. */
  5084. /**
  5085. * ------------------------------------------------------------------------
  5086. * Constants
  5087. * ------------------------------------------------------------------------
  5088. */
  5089. const NAME$1 = 'tab';
  5090. const DATA_KEY$1 = 'bs.tab';
  5091. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  5092. const DATA_API_KEY = '.data-api';
  5093. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  5094. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  5095. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  5096. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  5097. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
  5098. const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  5099. const CLASS_NAME_ACTIVE = 'active';
  5100. const CLASS_NAME_FADE$1 = 'fade';
  5101. const CLASS_NAME_SHOW$1 = 'show';
  5102. const SELECTOR_DROPDOWN = '.dropdown';
  5103. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  5104. const SELECTOR_ACTIVE = '.active';
  5105. const SELECTOR_ACTIVE_UL = ':scope > li > .active';
  5106. const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
  5107. const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  5108. const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
  5109. /**
  5110. * ------------------------------------------------------------------------
  5111. * Class Definition
  5112. * ------------------------------------------------------------------------
  5113. */
  5114. class Tab extends BaseComponent {
  5115. // Getters
  5116. static get NAME() {
  5117. return NAME$1;
  5118. } // Public
  5119. show() {
  5120. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  5121. return;
  5122. }
  5123. let previous;
  5124. const target = getElementFromSelector(this._element);
  5125. const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
  5126. if (listElement) {
  5127. const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
  5128. previous = SelectorEngine.find(itemSelector, listElement);
  5129. previous = previous[previous.length - 1];
  5130. }
  5131. const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
  5132. relatedTarget: this._element
  5133. }) : null;
  5134. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
  5135. relatedTarget: previous
  5136. });
  5137. if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
  5138. return;
  5139. }
  5140. this._activate(this._element, listElement);
  5141. const complete = () => {
  5142. EventHandler.trigger(previous, EVENT_HIDDEN$1, {
  5143. relatedTarget: this._element
  5144. });
  5145. EventHandler.trigger(this._element, EVENT_SHOWN$1, {
  5146. relatedTarget: previous
  5147. });
  5148. };
  5149. if (target) {
  5150. this._activate(target, target.parentNode, complete);
  5151. } else {
  5152. complete();
  5153. }
  5154. } // Private
  5155. _activate(element, container, callback) {
  5156. const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
  5157. const active = activeElements[0];
  5158. const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
  5159. const complete = () => this._transitionComplete(element, active, callback);
  5160. if (active && isTransitioning) {
  5161. active.classList.remove(CLASS_NAME_SHOW$1);
  5162. this._queueCallback(complete, element, true);
  5163. } else {
  5164. complete();
  5165. }
  5166. }
  5167. _transitionComplete(element, active, callback) {
  5168. if (active) {
  5169. active.classList.remove(CLASS_NAME_ACTIVE);
  5170. const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
  5171. if (dropdownChild) {
  5172. dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
  5173. }
  5174. if (active.getAttribute('role') === 'tab') {
  5175. active.setAttribute('aria-selected', false);
  5176. }
  5177. }
  5178. element.classList.add(CLASS_NAME_ACTIVE);
  5179. if (element.getAttribute('role') === 'tab') {
  5180. element.setAttribute('aria-selected', true);
  5181. }
  5182. reflow(element);
  5183. if (element.classList.contains(CLASS_NAME_FADE$1)) {
  5184. element.classList.add(CLASS_NAME_SHOW$1);
  5185. }
  5186. let parent = element.parentNode;
  5187. if (parent && parent.nodeName === 'LI') {
  5188. parent = parent.parentNode;
  5189. }
  5190. if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
  5191. const dropdownElement = element.closest(SELECTOR_DROPDOWN);
  5192. if (dropdownElement) {
  5193. SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
  5194. }
  5195. element.setAttribute('aria-expanded', true);
  5196. }
  5197. if (callback) {
  5198. callback();
  5199. }
  5200. } // Static
  5201. static jQueryInterface(config) {
  5202. return this.each(function () {
  5203. const data = Tab.getOrCreateInstance(this);
  5204. if (typeof config === 'string') {
  5205. if (typeof data[config] === 'undefined') {
  5206. throw new TypeError(`No method named "${config}"`);
  5207. }
  5208. data[config]();
  5209. }
  5210. });
  5211. }
  5212. }
  5213. /**
  5214. * ------------------------------------------------------------------------
  5215. * Data Api implementation
  5216. * ------------------------------------------------------------------------
  5217. */
  5218. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  5219. if (['A', 'AREA'].includes(this.tagName)) {
  5220. event.preventDefault();
  5221. }
  5222. if (isDisabled(this)) {
  5223. return;
  5224. }
  5225. const data = Tab.getOrCreateInstance(this);
  5226. data.show();
  5227. });
  5228. /**
  5229. * ------------------------------------------------------------------------
  5230. * jQuery
  5231. * ------------------------------------------------------------------------
  5232. * add .Tab to jQuery only if jQuery is present
  5233. */
  5234. defineJQueryPlugin(Tab);
  5235. /**
  5236. * --------------------------------------------------------------------------
  5237. * Bootstrap (v5.1.0): toast.js
  5238. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5239. * --------------------------------------------------------------------------
  5240. */
  5241. /**
  5242. * ------------------------------------------------------------------------
  5243. * Constants
  5244. * ------------------------------------------------------------------------
  5245. */
  5246. const NAME = 'toast';
  5247. const DATA_KEY = 'bs.toast';
  5248. const EVENT_KEY = `.${DATA_KEY}`;
  5249. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  5250. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  5251. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  5252. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  5253. const EVENT_HIDE = `hide${EVENT_KEY}`;
  5254. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  5255. const EVENT_SHOW = `show${EVENT_KEY}`;
  5256. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  5257. const CLASS_NAME_FADE = 'fade';
  5258. const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
  5259. const CLASS_NAME_SHOW = 'show';
  5260. const CLASS_NAME_SHOWING = 'showing';
  5261. const DefaultType = {
  5262. animation: 'boolean',
  5263. autohide: 'boolean',
  5264. delay: 'number'
  5265. };
  5266. const Default = {
  5267. animation: true,
  5268. autohide: true,
  5269. delay: 5000
  5270. };
  5271. /**
  5272. * ------------------------------------------------------------------------
  5273. * Class Definition
  5274. * ------------------------------------------------------------------------
  5275. */
  5276. class Toast extends BaseComponent {
  5277. constructor(element, config) {
  5278. super(element);
  5279. this._config = this._getConfig(config);
  5280. this._timeout = null;
  5281. this._hasMouseInteraction = false;
  5282. this._hasKeyboardInteraction = false;
  5283. this._setListeners();
  5284. } // Getters
  5285. static get DefaultType() {
  5286. return DefaultType;
  5287. }
  5288. static get Default() {
  5289. return Default;
  5290. }
  5291. static get NAME() {
  5292. return NAME;
  5293. } // Public
  5294. show() {
  5295. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  5296. if (showEvent.defaultPrevented) {
  5297. return;
  5298. }
  5299. this._clearTimeout();
  5300. if (this._config.animation) {
  5301. this._element.classList.add(CLASS_NAME_FADE);
  5302. }
  5303. const complete = () => {
  5304. this._element.classList.remove(CLASS_NAME_SHOWING);
  5305. EventHandler.trigger(this._element, EVENT_SHOWN);
  5306. this._maybeScheduleHide();
  5307. };
  5308. this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
  5309. reflow(this._element);
  5310. this._element.classList.add(CLASS_NAME_SHOW);
  5311. this._element.classList.add(CLASS_NAME_SHOWING);
  5312. this._queueCallback(complete, this._element, this._config.animation);
  5313. }
  5314. hide() {
  5315. if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
  5316. return;
  5317. }
  5318. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  5319. if (hideEvent.defaultPrevented) {
  5320. return;
  5321. }
  5322. const complete = () => {
  5323. this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
  5324. this._element.classList.remove(CLASS_NAME_SHOWING);
  5325. this._element.classList.remove(CLASS_NAME_SHOW);
  5326. EventHandler.trigger(this._element, EVENT_HIDDEN);
  5327. };
  5328. this._element.classList.add(CLASS_NAME_SHOWING);
  5329. this._queueCallback(complete, this._element, this._config.animation);
  5330. }
  5331. dispose() {
  5332. this._clearTimeout();
  5333. if (this._element.classList.contains(CLASS_NAME_SHOW)) {
  5334. this._element.classList.remove(CLASS_NAME_SHOW);
  5335. }
  5336. super.dispose();
  5337. } // Private
  5338. _getConfig(config) {
  5339. config = { ...Default,
  5340. ...Manipulator.getDataAttributes(this._element),
  5341. ...(typeof config === 'object' && config ? config : {})
  5342. };
  5343. typeCheckConfig(NAME, config, this.constructor.DefaultType);
  5344. return config;
  5345. }
  5346. _maybeScheduleHide() {
  5347. if (!this._config.autohide) {
  5348. return;
  5349. }
  5350. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  5351. return;
  5352. }
  5353. this._timeout = setTimeout(() => {
  5354. this.hide();
  5355. }, this._config.delay);
  5356. }
  5357. _onInteraction(event, isInteracting) {
  5358. switch (event.type) {
  5359. case 'mouseover':
  5360. case 'mouseout':
  5361. this._hasMouseInteraction = isInteracting;
  5362. break;
  5363. case 'focusin':
  5364. case 'focusout':
  5365. this._hasKeyboardInteraction = isInteracting;
  5366. break;
  5367. }
  5368. if (isInteracting) {
  5369. this._clearTimeout();
  5370. return;
  5371. }
  5372. const nextElement = event.relatedTarget;
  5373. if (this._element === nextElement || this._element.contains(nextElement)) {
  5374. return;
  5375. }
  5376. this._maybeScheduleHide();
  5377. }
  5378. _setListeners() {
  5379. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  5380. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  5381. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  5382. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  5383. }
  5384. _clearTimeout() {
  5385. clearTimeout(this._timeout);
  5386. this._timeout = null;
  5387. } // Static
  5388. static jQueryInterface(config) {
  5389. return this.each(function () {
  5390. const data = Toast.getOrCreateInstance(this, config);
  5391. if (typeof config === 'string') {
  5392. if (typeof data[config] === 'undefined') {
  5393. throw new TypeError(`No method named "${config}"`);
  5394. }
  5395. data[config](this);
  5396. }
  5397. });
  5398. }
  5399. }
  5400. enableDismissTrigger(Toast);
  5401. /**
  5402. * ------------------------------------------------------------------------
  5403. * jQuery
  5404. * ------------------------------------------------------------------------
  5405. * add .Toast to jQuery only if jQuery is present
  5406. */
  5407. defineJQueryPlugin(Toast);
  5408. /**
  5409. * --------------------------------------------------------------------------
  5410. * Bootstrap (v5.1.0): index.umd.js
  5411. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5412. * --------------------------------------------------------------------------
  5413. */
  5414. var index_umd = {
  5415. Alert,
  5416. Button,
  5417. Carousel,
  5418. Collapse,
  5419. Dropdown,
  5420. Modal,
  5421. Offcanvas,
  5422. Popover,
  5423. ScrollSpy,
  5424. Tab,
  5425. Toast,
  5426. Tooltip
  5427. };
  5428. return index_umd;
  5429. })));
  5430. //# sourceMappingURL=bootstrap.bundle.js.map