bootstrap.bundle.js 205 KB

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