bootstrap.bundle.js 203 KB

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