bootstrap.esm.js 133 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211
  1. /*!
  2. * Bootstrap v5.2.2 (https://getbootstrap.com/)
  3. * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. import * as Popper from '@popperjs/core';
  7. /**
  8. * --------------------------------------------------------------------------
  9. * Bootstrap (v5.2.2): util/index.js
  10. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  11. * --------------------------------------------------------------------------
  12. */
  13. const MAX_UID = 1000000;
  14. const MILLISECONDS_MULTIPLIER = 1000;
  15. const TRANSITION_END = 'transitionend'; // Shout-out Angus Croll (https://goo.gl/pxwQGp)
  16. const toType = object => {
  17. if (object === null || object === undefined) {
  18. return `${object}`;
  19. }
  20. return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
  21. };
  22. /**
  23. * Public Util API
  24. */
  25. const getUID = prefix => {
  26. do {
  27. prefix += Math.floor(Math.random() * MAX_UID);
  28. } while (document.getElementById(prefix));
  29. return prefix;
  30. };
  31. const getSelector = element => {
  32. let selector = element.getAttribute('data-bs-target');
  33. if (!selector || selector === '#') {
  34. let hrefAttribute = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
  35. // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
  36. // `document.querySelector` will rightfully complain it is invalid.
  37. // See https://github.com/twbs/bootstrap/issues/32273
  38. if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) {
  39. return null;
  40. } // Just in case some CMS puts out a full URL with the anchor appended
  41. if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
  42. hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
  43. }
  44. selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
  45. }
  46. return selector;
  47. };
  48. const getSelectorFromElement = element => {
  49. const selector = getSelector(element);
  50. if (selector) {
  51. return document.querySelector(selector) ? selector : null;
  52. }
  53. return null;
  54. };
  55. const getElementFromSelector = element => {
  56. const selector = getSelector(element);
  57. return selector ? document.querySelector(selector) : null;
  58. };
  59. const getTransitionDurationFromElement = element => {
  60. if (!element) {
  61. return 0;
  62. } // Get transition-duration of the element
  63. let {
  64. transitionDuration,
  65. transitionDelay
  66. } = window.getComputedStyle(element);
  67. const floatTransitionDuration = Number.parseFloat(transitionDuration);
  68. const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  69. if (!floatTransitionDuration && !floatTransitionDelay) {
  70. return 0;
  71. } // If multiple durations are defined, take the first
  72. transitionDuration = transitionDuration.split(',')[0];
  73. transitionDelay = transitionDelay.split(',')[0];
  74. return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  75. };
  76. const triggerTransitionEnd = element => {
  77. element.dispatchEvent(new Event(TRANSITION_END));
  78. };
  79. const isElement = object => {
  80. if (!object || typeof object !== 'object') {
  81. return false;
  82. }
  83. if (typeof object.jquery !== 'undefined') {
  84. object = object[0];
  85. }
  86. return typeof object.nodeType !== 'undefined';
  87. };
  88. const getElement = object => {
  89. // it's a jQuery object or a node element
  90. if (isElement(object)) {
  91. return object.jquery ? object[0] : object;
  92. }
  93. if (typeof object === 'string' && object.length > 0) {
  94. return document.querySelector(object);
  95. }
  96. return null;
  97. };
  98. const isVisible = element => {
  99. if (!isElement(element) || element.getClientRects().length === 0) {
  100. return false;
  101. }
  102. const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; // Handle `details` element as its content may falsie appear visible when it is closed
  103. const closedDetails = element.closest('details:not([open])');
  104. if (!closedDetails) {
  105. return elementIsVisible;
  106. }
  107. if (closedDetails !== element) {
  108. const summary = element.closest('summary');
  109. if (summary && summary.parentNode !== closedDetails) {
  110. return false;
  111. }
  112. if (summary === null) {
  113. return false;
  114. }
  115. }
  116. return elementIsVisible;
  117. };
  118. const isDisabled = element => {
  119. if (!element || element.nodeType !== Node.ELEMENT_NODE) {
  120. return true;
  121. }
  122. if (element.classList.contains('disabled')) {
  123. return true;
  124. }
  125. if (typeof element.disabled !== 'undefined') {
  126. return element.disabled;
  127. }
  128. return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
  129. };
  130. const findShadowRoot = element => {
  131. if (!document.documentElement.attachShadow) {
  132. return null;
  133. } // Can find the shadow root otherwise it'll return the document
  134. if (typeof element.getRootNode === 'function') {
  135. const root = element.getRootNode();
  136. return root instanceof ShadowRoot ? root : null;
  137. }
  138. if (element instanceof ShadowRoot) {
  139. return element;
  140. } // when we don't find a shadow root
  141. if (!element.parentNode) {
  142. return null;
  143. }
  144. return findShadowRoot(element.parentNode);
  145. };
  146. const noop = () => {};
  147. /**
  148. * Trick to restart an element's animation
  149. *
  150. * @param {HTMLElement} element
  151. * @return void
  152. *
  153. * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
  154. */
  155. const reflow = element => {
  156. element.offsetHeight; // eslint-disable-line no-unused-expressions
  157. };
  158. const getjQuery = () => {
  159. if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
  160. return window.jQuery;
  161. }
  162. return null;
  163. };
  164. const DOMContentLoadedCallbacks = [];
  165. const onDOMContentLoaded = callback => {
  166. if (document.readyState === 'loading') {
  167. // add listener on the first call when the document is in loading state
  168. if (!DOMContentLoadedCallbacks.length) {
  169. document.addEventListener('DOMContentLoaded', () => {
  170. for (const callback of DOMContentLoadedCallbacks) {
  171. callback();
  172. }
  173. });
  174. }
  175. DOMContentLoadedCallbacks.push(callback);
  176. } else {
  177. callback();
  178. }
  179. };
  180. const isRTL = () => document.documentElement.dir === 'rtl';
  181. const defineJQueryPlugin = plugin => {
  182. onDOMContentLoaded(() => {
  183. const $ = getjQuery();
  184. /* istanbul ignore if */
  185. if ($) {
  186. const name = plugin.NAME;
  187. const JQUERY_NO_CONFLICT = $.fn[name];
  188. $.fn[name] = plugin.jQueryInterface;
  189. $.fn[name].Constructor = plugin;
  190. $.fn[name].noConflict = () => {
  191. $.fn[name] = JQUERY_NO_CONFLICT;
  192. return plugin.jQueryInterface;
  193. };
  194. }
  195. });
  196. };
  197. const execute = callback => {
  198. if (typeof callback === 'function') {
  199. callback();
  200. }
  201. };
  202. const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
  203. if (!waitForTransition) {
  204. execute(callback);
  205. return;
  206. }
  207. const durationPadding = 5;
  208. const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
  209. let called = false;
  210. const handler = ({
  211. target
  212. }) => {
  213. if (target !== transitionElement) {
  214. return;
  215. }
  216. called = true;
  217. transitionElement.removeEventListener(TRANSITION_END, handler);
  218. execute(callback);
  219. };
  220. transitionElement.addEventListener(TRANSITION_END, handler);
  221. setTimeout(() => {
  222. if (!called) {
  223. triggerTransitionEnd(transitionElement);
  224. }
  225. }, emulatedDuration);
  226. };
  227. /**
  228. * Return the previous/next element of a list.
  229. *
  230. * @param {array} list The list of elements
  231. * @param activeElement The active element
  232. * @param shouldGetNext Choose to get next or previous element
  233. * @param isCycleAllowed
  234. * @return {Element|elem} The proper element
  235. */
  236. const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
  237. const listLength = list.length;
  238. let index = list.indexOf(activeElement); // if the element does not exist in the list return an element
  239. // depending on the direction and if cycle is allowed
  240. if (index === -1) {
  241. return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
  242. }
  243. index += shouldGetNext ? 1 : -1;
  244. if (isCycleAllowed) {
  245. index = (index + listLength) % listLength;
  246. }
  247. return list[Math.max(0, Math.min(index, listLength - 1))];
  248. };
  249. /**
  250. * --------------------------------------------------------------------------
  251. * Bootstrap (v5.2.2): dom/event-handler.js
  252. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  253. * --------------------------------------------------------------------------
  254. */
  255. /**
  256. * Constants
  257. */
  258. const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  259. const stripNameRegex = /\..*/;
  260. const stripUidRegex = /::\d+$/;
  261. const eventRegistry = {}; // Events storage
  262. let uidEvent = 1;
  263. const customEvents = {
  264. mouseenter: 'mouseover',
  265. mouseleave: 'mouseout'
  266. };
  267. 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']);
  268. /**
  269. * Private methods
  270. */
  271. function makeEventUid(element, uid) {
  272. return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
  273. }
  274. function getElementEvents(element) {
  275. const uid = makeEventUid(element);
  276. element.uidEvent = uid;
  277. eventRegistry[uid] = eventRegistry[uid] || {};
  278. return eventRegistry[uid];
  279. }
  280. function bootstrapHandler(element, fn) {
  281. return function handler(event) {
  282. hydrateObj(event, {
  283. delegateTarget: element
  284. });
  285. if (handler.oneOff) {
  286. EventHandler.off(element, event.type, fn);
  287. }
  288. return fn.apply(element, [event]);
  289. };
  290. }
  291. function bootstrapDelegationHandler(element, selector, fn) {
  292. return function handler(event) {
  293. const domElements = element.querySelectorAll(selector);
  294. for (let {
  295. target
  296. } = event; target && target !== this; target = target.parentNode) {
  297. for (const domElement of domElements) {
  298. if (domElement !== target) {
  299. continue;
  300. }
  301. hydrateObj(event, {
  302. delegateTarget: target
  303. });
  304. if (handler.oneOff) {
  305. EventHandler.off(element, event.type, selector, fn);
  306. }
  307. return fn.apply(target, [event]);
  308. }
  309. }
  310. };
  311. }
  312. function findHandler(events, callable, delegationSelector = null) {
  313. return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
  314. }
  315. function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
  316. const isDelegated = typeof handler === 'string'; // todo: tooltip passes `false` instead of selector, so we need to check
  317. const callable = isDelegated ? delegationFunction : handler || delegationFunction;
  318. let typeEvent = getTypeEvent(originalTypeEvent);
  319. if (!nativeEvents.has(typeEvent)) {
  320. typeEvent = originalTypeEvent;
  321. }
  322. return [isDelegated, callable, typeEvent];
  323. }
  324. function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
  325. if (typeof originalTypeEvent !== 'string' || !element) {
  326. return;
  327. }
  328. let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
  329. // this prevents the handler from being dispatched the same way as mouseover or mouseout does
  330. if (originalTypeEvent in customEvents) {
  331. const wrapFunction = fn => {
  332. return function (event) {
  333. if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
  334. return fn.call(this, event);
  335. }
  336. };
  337. };
  338. callable = wrapFunction(callable);
  339. }
  340. const events = getElementEvents(element);
  341. const handlers = events[typeEvent] || (events[typeEvent] = {});
  342. const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
  343. if (previousFunction) {
  344. previousFunction.oneOff = previousFunction.oneOff && oneOff;
  345. return;
  346. }
  347. const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
  348. const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
  349. fn.delegationSelector = isDelegated ? handler : null;
  350. fn.callable = callable;
  351. fn.oneOff = oneOff;
  352. fn.uidEvent = uid;
  353. handlers[uid] = fn;
  354. element.addEventListener(typeEvent, fn, isDelegated);
  355. }
  356. function removeHandler(element, events, typeEvent, handler, delegationSelector) {
  357. const fn = findHandler(events[typeEvent], handler, delegationSelector);
  358. if (!fn) {
  359. return;
  360. }
  361. element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
  362. delete events[typeEvent][fn.uidEvent];
  363. }
  364. function removeNamespacedHandlers(element, events, typeEvent, namespace) {
  365. const storeElementEvent = events[typeEvent] || {};
  366. for (const handlerKey of Object.keys(storeElementEvent)) {
  367. if (handlerKey.includes(namespace)) {
  368. const event = storeElementEvent[handlerKey];
  369. removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
  370. }
  371. }
  372. }
  373. function getTypeEvent(event) {
  374. // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
  375. event = event.replace(stripNameRegex, '');
  376. return customEvents[event] || event;
  377. }
  378. const EventHandler = {
  379. on(element, event, handler, delegationFunction) {
  380. addHandler(element, event, handler, delegationFunction, false);
  381. },
  382. one(element, event, handler, delegationFunction) {
  383. addHandler(element, event, handler, delegationFunction, true);
  384. },
  385. off(element, originalTypeEvent, handler, delegationFunction) {
  386. if (typeof originalTypeEvent !== 'string' || !element) {
  387. return;
  388. }
  389. const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
  390. const inNamespace = typeEvent !== originalTypeEvent;
  391. const events = getElementEvents(element);
  392. const storeElementEvent = events[typeEvent] || {};
  393. const isNamespace = originalTypeEvent.startsWith('.');
  394. if (typeof callable !== 'undefined') {
  395. // Simplest case: handler is passed, remove that listener ONLY.
  396. if (!Object.keys(storeElementEvent).length) {
  397. return;
  398. }
  399. removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
  400. return;
  401. }
  402. if (isNamespace) {
  403. for (const elementEvent of Object.keys(events)) {
  404. removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
  405. }
  406. }
  407. for (const keyHandlers of Object.keys(storeElementEvent)) {
  408. const handlerKey = keyHandlers.replace(stripUidRegex, '');
  409. if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
  410. const event = storeElementEvent[keyHandlers];
  411. removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
  412. }
  413. }
  414. },
  415. trigger(element, event, args) {
  416. if (typeof event !== 'string' || !element) {
  417. return null;
  418. }
  419. const $ = getjQuery();
  420. const typeEvent = getTypeEvent(event);
  421. const inNamespace = event !== typeEvent;
  422. let jQueryEvent = null;
  423. let bubbles = true;
  424. let nativeDispatch = true;
  425. let defaultPrevented = false;
  426. if (inNamespace && $) {
  427. jQueryEvent = $.Event(event, args);
  428. $(element).trigger(jQueryEvent);
  429. bubbles = !jQueryEvent.isPropagationStopped();
  430. nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
  431. defaultPrevented = jQueryEvent.isDefaultPrevented();
  432. }
  433. let evt = new Event(event, {
  434. bubbles,
  435. cancelable: true
  436. });
  437. evt = hydrateObj(evt, args);
  438. if (defaultPrevented) {
  439. evt.preventDefault();
  440. }
  441. if (nativeDispatch) {
  442. element.dispatchEvent(evt);
  443. }
  444. if (evt.defaultPrevented && jQueryEvent) {
  445. jQueryEvent.preventDefault();
  446. }
  447. return evt;
  448. }
  449. };
  450. function hydrateObj(obj, meta) {
  451. for (const [key, value] of Object.entries(meta || {})) {
  452. try {
  453. obj[key] = value;
  454. } catch (_unused) {
  455. Object.defineProperty(obj, key, {
  456. configurable: true,
  457. get() {
  458. return value;
  459. }
  460. });
  461. }
  462. }
  463. return obj;
  464. }
  465. /**
  466. * --------------------------------------------------------------------------
  467. * Bootstrap (v5.2.2): dom/data.js
  468. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  469. * --------------------------------------------------------------------------
  470. */
  471. /**
  472. * Constants
  473. */
  474. const elementMap = new Map();
  475. const Data = {
  476. set(element, key, instance) {
  477. if (!elementMap.has(element)) {
  478. elementMap.set(element, new Map());
  479. }
  480. const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
  481. // can be removed later when multiple key/instances are fine to be used
  482. if (!instanceMap.has(key) && instanceMap.size !== 0) {
  483. // eslint-disable-next-line no-console
  484. console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
  485. return;
  486. }
  487. instanceMap.set(key, instance);
  488. },
  489. get(element, key) {
  490. if (elementMap.has(element)) {
  491. return elementMap.get(element).get(key) || null;
  492. }
  493. return null;
  494. },
  495. remove(element, key) {
  496. if (!elementMap.has(element)) {
  497. return;
  498. }
  499. const instanceMap = elementMap.get(element);
  500. instanceMap.delete(key); // free up element references if there are no instances left for an element
  501. if (instanceMap.size === 0) {
  502. elementMap.delete(element);
  503. }
  504. }
  505. };
  506. /**
  507. * --------------------------------------------------------------------------
  508. * Bootstrap (v5.2.2): dom/manipulator.js
  509. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  510. * --------------------------------------------------------------------------
  511. */
  512. function normalizeData(value) {
  513. if (value === 'true') {
  514. return true;
  515. }
  516. if (value === 'false') {
  517. return false;
  518. }
  519. if (value === Number(value).toString()) {
  520. return Number(value);
  521. }
  522. if (value === '' || value === 'null') {
  523. return null;
  524. }
  525. if (typeof value !== 'string') {
  526. return value;
  527. }
  528. try {
  529. return JSON.parse(decodeURIComponent(value));
  530. } catch (_unused) {
  531. return value;
  532. }
  533. }
  534. function normalizeDataKey(key) {
  535. return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
  536. }
  537. const Manipulator = {
  538. setDataAttribute(element, key, value) {
  539. element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
  540. },
  541. removeDataAttribute(element, key) {
  542. element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
  543. },
  544. getDataAttributes(element) {
  545. if (!element) {
  546. return {};
  547. }
  548. const attributes = {};
  549. const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
  550. for (const key of bsKeys) {
  551. let pureKey = key.replace(/^bs/, '');
  552. pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
  553. attributes[pureKey] = normalizeData(element.dataset[key]);
  554. }
  555. return attributes;
  556. },
  557. getDataAttribute(element, key) {
  558. return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
  559. }
  560. };
  561. /**
  562. * --------------------------------------------------------------------------
  563. * Bootstrap (v5.2.2): util/config.js
  564. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  565. * --------------------------------------------------------------------------
  566. */
  567. /**
  568. * Class definition
  569. */
  570. class Config {
  571. // Getters
  572. static get Default() {
  573. return {};
  574. }
  575. static get DefaultType() {
  576. return {};
  577. }
  578. static get NAME() {
  579. throw new Error('You have to implement the static method "NAME", for each component!');
  580. }
  581. _getConfig(config) {
  582. config = this._mergeConfigObj(config);
  583. config = this._configAfterMerge(config);
  584. this._typeCheckConfig(config);
  585. return config;
  586. }
  587. _configAfterMerge(config) {
  588. return config;
  589. }
  590. _mergeConfigObj(config, element) {
  591. const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
  592. return { ...this.constructor.Default,
  593. ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
  594. ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
  595. ...(typeof config === 'object' ? config : {})
  596. };
  597. }
  598. _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
  599. for (const property of Object.keys(configTypes)) {
  600. const expectedTypes = configTypes[property];
  601. const value = config[property];
  602. const valueType = isElement(value) ? 'element' : toType(value);
  603. if (!new RegExp(expectedTypes).test(valueType)) {
  604. throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
  605. }
  606. }
  607. }
  608. }
  609. /**
  610. * --------------------------------------------------------------------------
  611. * Bootstrap (v5.2.2): base-component.js
  612. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  613. * --------------------------------------------------------------------------
  614. */
  615. /**
  616. * Constants
  617. */
  618. const VERSION = '5.2.2';
  619. /**
  620. * Class definition
  621. */
  622. class BaseComponent extends Config {
  623. constructor(element, config) {
  624. super();
  625. element = getElement(element);
  626. if (!element) {
  627. return;
  628. }
  629. this._element = element;
  630. this._config = this._getConfig(config);
  631. Data.set(this._element, this.constructor.DATA_KEY, this);
  632. } // Public
  633. dispose() {
  634. Data.remove(this._element, this.constructor.DATA_KEY);
  635. EventHandler.off(this._element, this.constructor.EVENT_KEY);
  636. for (const propertyName of Object.getOwnPropertyNames(this)) {
  637. this[propertyName] = null;
  638. }
  639. }
  640. _queueCallback(callback, element, isAnimated = true) {
  641. executeAfterTransition(callback, element, isAnimated);
  642. }
  643. _getConfig(config) {
  644. config = this._mergeConfigObj(config, this._element);
  645. config = this._configAfterMerge(config);
  646. this._typeCheckConfig(config);
  647. return config;
  648. } // Static
  649. static getInstance(element) {
  650. return Data.get(getElement(element), this.DATA_KEY);
  651. }
  652. static getOrCreateInstance(element, config = {}) {
  653. return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
  654. }
  655. static get VERSION() {
  656. return VERSION;
  657. }
  658. static get DATA_KEY() {
  659. return `bs.${this.NAME}`;
  660. }
  661. static get EVENT_KEY() {
  662. return `.${this.DATA_KEY}`;
  663. }
  664. static eventName(name) {
  665. return `${name}${this.EVENT_KEY}`;
  666. }
  667. }
  668. /**
  669. * --------------------------------------------------------------------------
  670. * Bootstrap (v5.2.2): util/component-functions.js
  671. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  672. * --------------------------------------------------------------------------
  673. */
  674. const enableDismissTrigger = (component, method = 'hide') => {
  675. const clickEvent = `click.dismiss${component.EVENT_KEY}`;
  676. const name = component.NAME;
  677. EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
  678. if (['A', 'AREA'].includes(this.tagName)) {
  679. event.preventDefault();
  680. }
  681. if (isDisabled(this)) {
  682. return;
  683. }
  684. const target = getElementFromSelector(this) || this.closest(`.${name}`);
  685. const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
  686. instance[method]();
  687. });
  688. };
  689. /**
  690. * --------------------------------------------------------------------------
  691. * Bootstrap (v5.2.2): alert.js
  692. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  693. * --------------------------------------------------------------------------
  694. */
  695. /**
  696. * Constants
  697. */
  698. const NAME$f = 'alert';
  699. const DATA_KEY$a = 'bs.alert';
  700. const EVENT_KEY$b = `.${DATA_KEY$a}`;
  701. const EVENT_CLOSE = `close${EVENT_KEY$b}`;
  702. const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
  703. const CLASS_NAME_FADE$5 = 'fade';
  704. const CLASS_NAME_SHOW$8 = 'show';
  705. /**
  706. * Class definition
  707. */
  708. class Alert extends BaseComponent {
  709. // Getters
  710. static get NAME() {
  711. return NAME$f;
  712. } // Public
  713. close() {
  714. const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
  715. if (closeEvent.defaultPrevented) {
  716. return;
  717. }
  718. this._element.classList.remove(CLASS_NAME_SHOW$8);
  719. const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
  720. this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
  721. } // Private
  722. _destroyElement() {
  723. this._element.remove();
  724. EventHandler.trigger(this._element, EVENT_CLOSED);
  725. this.dispose();
  726. } // Static
  727. static jQueryInterface(config) {
  728. return this.each(function () {
  729. const data = Alert.getOrCreateInstance(this);
  730. if (typeof config !== 'string') {
  731. return;
  732. }
  733. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  734. throw new TypeError(`No method named "${config}"`);
  735. }
  736. data[config](this);
  737. });
  738. }
  739. }
  740. /**
  741. * Data API implementation
  742. */
  743. enableDismissTrigger(Alert, 'close');
  744. /**
  745. * jQuery
  746. */
  747. defineJQueryPlugin(Alert);
  748. /**
  749. * --------------------------------------------------------------------------
  750. * Bootstrap (v5.2.2): button.js
  751. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  752. * --------------------------------------------------------------------------
  753. */
  754. /**
  755. * Constants
  756. */
  757. const NAME$e = 'button';
  758. const DATA_KEY$9 = 'bs.button';
  759. const EVENT_KEY$a = `.${DATA_KEY$9}`;
  760. const DATA_API_KEY$6 = '.data-api';
  761. const CLASS_NAME_ACTIVE$3 = 'active';
  762. const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
  763. const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
  764. /**
  765. * Class definition
  766. */
  767. class Button extends BaseComponent {
  768. // Getters
  769. static get NAME() {
  770. return NAME$e;
  771. } // Public
  772. toggle() {
  773. // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
  774. this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
  775. } // Static
  776. static jQueryInterface(config) {
  777. return this.each(function () {
  778. const data = Button.getOrCreateInstance(this);
  779. if (config === 'toggle') {
  780. data[config]();
  781. }
  782. });
  783. }
  784. }
  785. /**
  786. * Data API implementation
  787. */
  788. EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
  789. event.preventDefault();
  790. const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
  791. const data = Button.getOrCreateInstance(button);
  792. data.toggle();
  793. });
  794. /**
  795. * jQuery
  796. */
  797. defineJQueryPlugin(Button);
  798. /**
  799. * --------------------------------------------------------------------------
  800. * Bootstrap (v5.2.2): dom/selector-engine.js
  801. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  802. * --------------------------------------------------------------------------
  803. */
  804. /**
  805. * Constants
  806. */
  807. const SelectorEngine = {
  808. find(selector, element = document.documentElement) {
  809. return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
  810. },
  811. findOne(selector, element = document.documentElement) {
  812. return Element.prototype.querySelector.call(element, selector);
  813. },
  814. children(element, selector) {
  815. return [].concat(...element.children).filter(child => child.matches(selector));
  816. },
  817. parents(element, selector) {
  818. const parents = [];
  819. let ancestor = element.parentNode.closest(selector);
  820. while (ancestor) {
  821. parents.push(ancestor);
  822. ancestor = ancestor.parentNode.closest(selector);
  823. }
  824. return parents;
  825. },
  826. prev(element, selector) {
  827. let previous = element.previousElementSibling;
  828. while (previous) {
  829. if (previous.matches(selector)) {
  830. return [previous];
  831. }
  832. previous = previous.previousElementSibling;
  833. }
  834. return [];
  835. },
  836. // TODO: this is now unused; remove later along with prev()
  837. next(element, selector) {
  838. let next = element.nextElementSibling;
  839. while (next) {
  840. if (next.matches(selector)) {
  841. return [next];
  842. }
  843. next = next.nextElementSibling;
  844. }
  845. return [];
  846. },
  847. focusableChildren(element) {
  848. const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
  849. return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
  850. }
  851. };
  852. /**
  853. * --------------------------------------------------------------------------
  854. * Bootstrap (v5.2.2): util/swipe.js
  855. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  856. * --------------------------------------------------------------------------
  857. */
  858. /**
  859. * Constants
  860. */
  861. const NAME$d = 'swipe';
  862. const EVENT_KEY$9 = '.bs.swipe';
  863. const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
  864. const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
  865. const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
  866. const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
  867. const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
  868. const POINTER_TYPE_TOUCH = 'touch';
  869. const POINTER_TYPE_PEN = 'pen';
  870. const CLASS_NAME_POINTER_EVENT = 'pointer-event';
  871. const SWIPE_THRESHOLD = 40;
  872. const Default$c = {
  873. endCallback: null,
  874. leftCallback: null,
  875. rightCallback: null
  876. };
  877. const DefaultType$c = {
  878. endCallback: '(function|null)',
  879. leftCallback: '(function|null)',
  880. rightCallback: '(function|null)'
  881. };
  882. /**
  883. * Class definition
  884. */
  885. class Swipe extends Config {
  886. constructor(element, config) {
  887. super();
  888. this._element = element;
  889. if (!element || !Swipe.isSupported()) {
  890. return;
  891. }
  892. this._config = this._getConfig(config);
  893. this._deltaX = 0;
  894. this._supportPointerEvents = Boolean(window.PointerEvent);
  895. this._initEvents();
  896. } // Getters
  897. static get Default() {
  898. return Default$c;
  899. }
  900. static get DefaultType() {
  901. return DefaultType$c;
  902. }
  903. static get NAME() {
  904. return NAME$d;
  905. } // Public
  906. dispose() {
  907. EventHandler.off(this._element, EVENT_KEY$9);
  908. } // Private
  909. _start(event) {
  910. if (!this._supportPointerEvents) {
  911. this._deltaX = event.touches[0].clientX;
  912. return;
  913. }
  914. if (this._eventIsPointerPenTouch(event)) {
  915. this._deltaX = event.clientX;
  916. }
  917. }
  918. _end(event) {
  919. if (this._eventIsPointerPenTouch(event)) {
  920. this._deltaX = event.clientX - this._deltaX;
  921. }
  922. this._handleSwipe();
  923. execute(this._config.endCallback);
  924. }
  925. _move(event) {
  926. this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX;
  927. }
  928. _handleSwipe() {
  929. const absDeltaX = Math.abs(this._deltaX);
  930. if (absDeltaX <= SWIPE_THRESHOLD) {
  931. return;
  932. }
  933. const direction = absDeltaX / this._deltaX;
  934. this._deltaX = 0;
  935. if (!direction) {
  936. return;
  937. }
  938. execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback);
  939. }
  940. _initEvents() {
  941. if (this._supportPointerEvents) {
  942. EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event));
  943. EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event));
  944. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  945. } else {
  946. EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event));
  947. EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event));
  948. EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event));
  949. }
  950. }
  951. _eventIsPointerPenTouch(event) {
  952. return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
  953. } // Static
  954. static isSupported() {
  955. return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  956. }
  957. }
  958. /**
  959. * --------------------------------------------------------------------------
  960. * Bootstrap (v5.2.2): carousel.js
  961. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  962. * --------------------------------------------------------------------------
  963. */
  964. /**
  965. * Constants
  966. */
  967. const NAME$c = 'carousel';
  968. const DATA_KEY$8 = 'bs.carousel';
  969. const EVENT_KEY$8 = `.${DATA_KEY$8}`;
  970. const DATA_API_KEY$5 = '.data-api';
  971. const ARROW_LEFT_KEY$1 = 'ArrowLeft';
  972. const ARROW_RIGHT_KEY$1 = 'ArrowRight';
  973. const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  974. const ORDER_NEXT = 'next';
  975. const ORDER_PREV = 'prev';
  976. const DIRECTION_LEFT = 'left';
  977. const DIRECTION_RIGHT = 'right';
  978. const EVENT_SLIDE = `slide${EVENT_KEY$8}`;
  979. const EVENT_SLID = `slid${EVENT_KEY$8}`;
  980. const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
  981. const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
  982. const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
  983. const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
  984. const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
  985. const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
  986. const CLASS_NAME_CAROUSEL = 'carousel';
  987. const CLASS_NAME_ACTIVE$2 = 'active';
  988. const CLASS_NAME_SLIDE = 'slide';
  989. const CLASS_NAME_END = 'carousel-item-end';
  990. const CLASS_NAME_START = 'carousel-item-start';
  991. const CLASS_NAME_NEXT = 'carousel-item-next';
  992. const CLASS_NAME_PREV = 'carousel-item-prev';
  993. const SELECTOR_ACTIVE = '.active';
  994. const SELECTOR_ITEM = '.carousel-item';
  995. const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
  996. const SELECTOR_ITEM_IMG = '.carousel-item img';
  997. const SELECTOR_INDICATORS = '.carousel-indicators';
  998. const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
  999. const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
  1000. const KEY_TO_DIRECTION = {
  1001. [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
  1002. [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
  1003. };
  1004. const Default$b = {
  1005. interval: 5000,
  1006. keyboard: true,
  1007. pause: 'hover',
  1008. ride: false,
  1009. touch: true,
  1010. wrap: true
  1011. };
  1012. const DefaultType$b = {
  1013. interval: '(number|boolean)',
  1014. // TODO:v6 remove boolean support
  1015. keyboard: 'boolean',
  1016. pause: '(string|boolean)',
  1017. ride: '(boolean|string)',
  1018. touch: 'boolean',
  1019. wrap: 'boolean'
  1020. };
  1021. /**
  1022. * Class definition
  1023. */
  1024. class Carousel extends BaseComponent {
  1025. constructor(element, config) {
  1026. super(element, config);
  1027. this._interval = null;
  1028. this._activeElement = null;
  1029. this._isSliding = false;
  1030. this.touchTimeout = null;
  1031. this._swipeHelper = null;
  1032. this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
  1033. this._addEventListeners();
  1034. if (this._config.ride === CLASS_NAME_CAROUSEL) {
  1035. this.cycle();
  1036. }
  1037. } // Getters
  1038. static get Default() {
  1039. return Default$b;
  1040. }
  1041. static get DefaultType() {
  1042. return DefaultType$b;
  1043. }
  1044. static get NAME() {
  1045. return NAME$c;
  1046. } // Public
  1047. next() {
  1048. this._slide(ORDER_NEXT);
  1049. }
  1050. nextWhenVisible() {
  1051. // FIXME TODO use `document.visibilityState`
  1052. // Don't call next when the page isn't visible
  1053. // or the carousel or its parent isn't visible
  1054. if (!document.hidden && isVisible(this._element)) {
  1055. this.next();
  1056. }
  1057. }
  1058. prev() {
  1059. this._slide(ORDER_PREV);
  1060. }
  1061. pause() {
  1062. if (this._isSliding) {
  1063. triggerTransitionEnd(this._element);
  1064. }
  1065. this._clearInterval();
  1066. }
  1067. cycle() {
  1068. this._clearInterval();
  1069. this._updateInterval();
  1070. this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
  1071. }
  1072. _maybeEnableCycle() {
  1073. if (!this._config.ride) {
  1074. return;
  1075. }
  1076. if (this._isSliding) {
  1077. EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
  1078. return;
  1079. }
  1080. this.cycle();
  1081. }
  1082. to(index) {
  1083. const items = this._getItems();
  1084. if (index > items.length - 1 || index < 0) {
  1085. return;
  1086. }
  1087. if (this._isSliding) {
  1088. EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
  1089. return;
  1090. }
  1091. const activeIndex = this._getItemIndex(this._getActive());
  1092. if (activeIndex === index) {
  1093. return;
  1094. }
  1095. const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
  1096. this._slide(order, items[index]);
  1097. }
  1098. dispose() {
  1099. if (this._swipeHelper) {
  1100. this._swipeHelper.dispose();
  1101. }
  1102. super.dispose();
  1103. } // Private
  1104. _configAfterMerge(config) {
  1105. config.defaultInterval = config.interval;
  1106. return config;
  1107. }
  1108. _addEventListeners() {
  1109. if (this._config.keyboard) {
  1110. EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event));
  1111. }
  1112. if (this._config.pause === 'hover') {
  1113. EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
  1114. EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
  1115. }
  1116. if (this._config.touch && Swipe.isSupported()) {
  1117. this._addTouchEventListeners();
  1118. }
  1119. }
  1120. _addTouchEventListeners() {
  1121. for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
  1122. EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault());
  1123. }
  1124. const endCallBack = () => {
  1125. if (this._config.pause !== 'hover') {
  1126. return;
  1127. } // If it's a touch-enabled device, mouseenter/leave are fired as
  1128. // part of the mouse compatibility events on first tap - the carousel
  1129. // would stop cycling until user tapped out of it;
  1130. // here, we listen for touchend, explicitly pause the carousel
  1131. // (as if it's the second time we tap on it, mouseenter compat event
  1132. // is NOT fired) and after a timeout (to allow for mouse compatibility
  1133. // events to fire) we explicitly restart cycling
  1134. this.pause();
  1135. if (this.touchTimeout) {
  1136. clearTimeout(this.touchTimeout);
  1137. }
  1138. this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
  1139. };
  1140. const swipeConfig = {
  1141. leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
  1142. rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
  1143. endCallback: endCallBack
  1144. };
  1145. this._swipeHelper = new Swipe(this._element, swipeConfig);
  1146. }
  1147. _keydown(event) {
  1148. if (/input|textarea/i.test(event.target.tagName)) {
  1149. return;
  1150. }
  1151. const direction = KEY_TO_DIRECTION[event.key];
  1152. if (direction) {
  1153. event.preventDefault();
  1154. this._slide(this._directionToOrder(direction));
  1155. }
  1156. }
  1157. _getItemIndex(element) {
  1158. return this._getItems().indexOf(element);
  1159. }
  1160. _setActiveIndicatorElement(index) {
  1161. if (!this._indicatorsElement) {
  1162. return;
  1163. }
  1164. const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
  1165. activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
  1166. activeIndicator.removeAttribute('aria-current');
  1167. const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
  1168. if (newActiveIndicator) {
  1169. newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2);
  1170. newActiveIndicator.setAttribute('aria-current', 'true');
  1171. }
  1172. }
  1173. _updateInterval() {
  1174. const element = this._activeElement || this._getActive();
  1175. if (!element) {
  1176. return;
  1177. }
  1178. const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
  1179. this._config.interval = elementInterval || this._config.defaultInterval;
  1180. }
  1181. _slide(order, element = null) {
  1182. if (this._isSliding) {
  1183. return;
  1184. }
  1185. const activeElement = this._getActive();
  1186. const isNext = order === ORDER_NEXT;
  1187. const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
  1188. if (nextElement === activeElement) {
  1189. return;
  1190. }
  1191. const nextElementIndex = this._getItemIndex(nextElement);
  1192. const triggerEvent = eventName => {
  1193. return EventHandler.trigger(this._element, eventName, {
  1194. relatedTarget: nextElement,
  1195. direction: this._orderToDirection(order),
  1196. from: this._getItemIndex(activeElement),
  1197. to: nextElementIndex
  1198. });
  1199. };
  1200. const slideEvent = triggerEvent(EVENT_SLIDE);
  1201. if (slideEvent.defaultPrevented) {
  1202. return;
  1203. }
  1204. if (!activeElement || !nextElement) {
  1205. // Some weirdness is happening, so we bail
  1206. // todo: change tests that use empty divs to avoid this check
  1207. return;
  1208. }
  1209. const isCycling = Boolean(this._interval);
  1210. this.pause();
  1211. this._isSliding = true;
  1212. this._setActiveIndicatorElement(nextElementIndex);
  1213. this._activeElement = nextElement;
  1214. const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
  1215. const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
  1216. nextElement.classList.add(orderClassName);
  1217. reflow(nextElement);
  1218. activeElement.classList.add(directionalClassName);
  1219. nextElement.classList.add(directionalClassName);
  1220. const completeCallBack = () => {
  1221. nextElement.classList.remove(directionalClassName, orderClassName);
  1222. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1223. activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
  1224. this._isSliding = false;
  1225. triggerEvent(EVENT_SLID);
  1226. };
  1227. this._queueCallback(completeCallBack, activeElement, this._isAnimated());
  1228. if (isCycling) {
  1229. this.cycle();
  1230. }
  1231. }
  1232. _isAnimated() {
  1233. return this._element.classList.contains(CLASS_NAME_SLIDE);
  1234. }
  1235. _getActive() {
  1236. return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1237. }
  1238. _getItems() {
  1239. return SelectorEngine.find(SELECTOR_ITEM, this._element);
  1240. }
  1241. _clearInterval() {
  1242. if (this._interval) {
  1243. clearInterval(this._interval);
  1244. this._interval = null;
  1245. }
  1246. }
  1247. _directionToOrder(direction) {
  1248. if (isRTL()) {
  1249. return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
  1250. }
  1251. return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
  1252. }
  1253. _orderToDirection(order) {
  1254. if (isRTL()) {
  1255. return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
  1256. }
  1257. return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
  1258. } // Static
  1259. static jQueryInterface(config) {
  1260. return this.each(function () {
  1261. const data = Carousel.getOrCreateInstance(this, config);
  1262. if (typeof config === 'number') {
  1263. data.to(config);
  1264. return;
  1265. }
  1266. if (typeof config === 'string') {
  1267. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  1268. throw new TypeError(`No method named "${config}"`);
  1269. }
  1270. data[config]();
  1271. }
  1272. });
  1273. }
  1274. }
  1275. /**
  1276. * Data API implementation
  1277. */
  1278. EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) {
  1279. const target = getElementFromSelector(this);
  1280. if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
  1281. return;
  1282. }
  1283. event.preventDefault();
  1284. const carousel = Carousel.getOrCreateInstance(target);
  1285. const slideIndex = this.getAttribute('data-bs-slide-to');
  1286. if (slideIndex) {
  1287. carousel.to(slideIndex);
  1288. carousel._maybeEnableCycle();
  1289. return;
  1290. }
  1291. if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
  1292. carousel.next();
  1293. carousel._maybeEnableCycle();
  1294. return;
  1295. }
  1296. carousel.prev();
  1297. carousel._maybeEnableCycle();
  1298. });
  1299. EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => {
  1300. const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
  1301. for (const carousel of carousels) {
  1302. Carousel.getOrCreateInstance(carousel);
  1303. }
  1304. });
  1305. /**
  1306. * jQuery
  1307. */
  1308. defineJQueryPlugin(Carousel);
  1309. /**
  1310. * --------------------------------------------------------------------------
  1311. * Bootstrap (v5.2.2): collapse.js
  1312. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1313. * --------------------------------------------------------------------------
  1314. */
  1315. /**
  1316. * Constants
  1317. */
  1318. const NAME$b = 'collapse';
  1319. const DATA_KEY$7 = 'bs.collapse';
  1320. const EVENT_KEY$7 = `.${DATA_KEY$7}`;
  1321. const DATA_API_KEY$4 = '.data-api';
  1322. const EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
  1323. const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
  1324. const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
  1325. const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
  1326. const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
  1327. const CLASS_NAME_SHOW$7 = 'show';
  1328. const CLASS_NAME_COLLAPSE = 'collapse';
  1329. const CLASS_NAME_COLLAPSING = 'collapsing';
  1330. const CLASS_NAME_COLLAPSED = 'collapsed';
  1331. const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
  1332. const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
  1333. const WIDTH = 'width';
  1334. const HEIGHT = 'height';
  1335. const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
  1336. const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
  1337. const Default$a = {
  1338. parent: null,
  1339. toggle: true
  1340. };
  1341. const DefaultType$a = {
  1342. parent: '(null|element)',
  1343. toggle: 'boolean'
  1344. };
  1345. /**
  1346. * Class definition
  1347. */
  1348. class Collapse extends BaseComponent {
  1349. constructor(element, config) {
  1350. super(element, config);
  1351. this._isTransitioning = false;
  1352. this._triggerArray = [];
  1353. const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
  1354. for (const elem of toggleList) {
  1355. const selector = getSelectorFromElement(elem);
  1356. const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element);
  1357. if (selector !== null && filterElement.length) {
  1358. this._triggerArray.push(elem);
  1359. }
  1360. }
  1361. this._initializeChildren();
  1362. if (!this._config.parent) {
  1363. this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
  1364. }
  1365. if (this._config.toggle) {
  1366. this.toggle();
  1367. }
  1368. } // Getters
  1369. static get Default() {
  1370. return Default$a;
  1371. }
  1372. static get DefaultType() {
  1373. return DefaultType$a;
  1374. }
  1375. static get NAME() {
  1376. return NAME$b;
  1377. } // Public
  1378. toggle() {
  1379. if (this._isShown()) {
  1380. this.hide();
  1381. } else {
  1382. this.show();
  1383. }
  1384. }
  1385. show() {
  1386. if (this._isTransitioning || this._isShown()) {
  1387. return;
  1388. }
  1389. let activeChildren = []; // find active children
  1390. if (this._config.parent) {
  1391. activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
  1392. toggle: false
  1393. }));
  1394. }
  1395. if (activeChildren.length && activeChildren[0]._isTransitioning) {
  1396. return;
  1397. }
  1398. const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
  1399. if (startEvent.defaultPrevented) {
  1400. return;
  1401. }
  1402. for (const activeInstance of activeChildren) {
  1403. activeInstance.hide();
  1404. }
  1405. const dimension = this._getDimension();
  1406. this._element.classList.remove(CLASS_NAME_COLLAPSE);
  1407. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1408. this._element.style[dimension] = 0;
  1409. this._addAriaAndCollapsedClass(this._triggerArray, true);
  1410. this._isTransitioning = true;
  1411. const complete = () => {
  1412. this._isTransitioning = false;
  1413. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1414. this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1415. this._element.style[dimension] = '';
  1416. EventHandler.trigger(this._element, EVENT_SHOWN$6);
  1417. };
  1418. const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1419. const scrollSize = `scroll${capitalizedDimension}`;
  1420. this._queueCallback(complete, this._element, true);
  1421. this._element.style[dimension] = `${this._element[scrollSize]}px`;
  1422. }
  1423. hide() {
  1424. if (this._isTransitioning || !this._isShown()) {
  1425. return;
  1426. }
  1427. const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
  1428. if (startEvent.defaultPrevented) {
  1429. return;
  1430. }
  1431. const dimension = this._getDimension();
  1432. this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
  1433. reflow(this._element);
  1434. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1435. this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1436. for (const trigger of this._triggerArray) {
  1437. const element = getElementFromSelector(trigger);
  1438. if (element && !this._isShown(element)) {
  1439. this._addAriaAndCollapsedClass([trigger], false);
  1440. }
  1441. }
  1442. this._isTransitioning = true;
  1443. const complete = () => {
  1444. this._isTransitioning = false;
  1445. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1446. this._element.classList.add(CLASS_NAME_COLLAPSE);
  1447. EventHandler.trigger(this._element, EVENT_HIDDEN$6);
  1448. };
  1449. this._element.style[dimension] = '';
  1450. this._queueCallback(complete, this._element, true);
  1451. }
  1452. _isShown(element = this._element) {
  1453. return element.classList.contains(CLASS_NAME_SHOW$7);
  1454. } // Private
  1455. _configAfterMerge(config) {
  1456. config.toggle = Boolean(config.toggle); // Coerce string values
  1457. config.parent = getElement(config.parent);
  1458. return config;
  1459. }
  1460. _getDimension() {
  1461. return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
  1462. }
  1463. _initializeChildren() {
  1464. if (!this._config.parent) {
  1465. return;
  1466. }
  1467. const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4);
  1468. for (const element of children) {
  1469. const selected = getElementFromSelector(element);
  1470. if (selected) {
  1471. this._addAriaAndCollapsedClass([element], this._isShown(selected));
  1472. }
  1473. }
  1474. }
  1475. _getFirstLevelChildren(selector) {
  1476. const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); // remove children if greater depth
  1477. return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element));
  1478. }
  1479. _addAriaAndCollapsedClass(triggerArray, isOpen) {
  1480. if (!triggerArray.length) {
  1481. return;
  1482. }
  1483. for (const element of triggerArray) {
  1484. element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
  1485. element.setAttribute('aria-expanded', isOpen);
  1486. }
  1487. } // Static
  1488. static jQueryInterface(config) {
  1489. const _config = {};
  1490. if (typeof config === 'string' && /show|hide/.test(config)) {
  1491. _config.toggle = false;
  1492. }
  1493. return this.each(function () {
  1494. const data = Collapse.getOrCreateInstance(this, _config);
  1495. if (typeof config === 'string') {
  1496. if (typeof data[config] === 'undefined') {
  1497. throw new TypeError(`No method named "${config}"`);
  1498. }
  1499. data[config]();
  1500. }
  1501. });
  1502. }
  1503. }
  1504. /**
  1505. * Data API implementation
  1506. */
  1507. EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) {
  1508. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1509. if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
  1510. event.preventDefault();
  1511. }
  1512. const selector = getSelectorFromElement(this);
  1513. const selectorElements = SelectorEngine.find(selector);
  1514. for (const element of selectorElements) {
  1515. Collapse.getOrCreateInstance(element, {
  1516. toggle: false
  1517. }).toggle();
  1518. }
  1519. });
  1520. /**
  1521. * jQuery
  1522. */
  1523. defineJQueryPlugin(Collapse);
  1524. /**
  1525. * --------------------------------------------------------------------------
  1526. * Bootstrap (v5.2.2): dropdown.js
  1527. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1528. * --------------------------------------------------------------------------
  1529. */
  1530. /**
  1531. * Constants
  1532. */
  1533. const NAME$a = 'dropdown';
  1534. const DATA_KEY$6 = 'bs.dropdown';
  1535. const EVENT_KEY$6 = `.${DATA_KEY$6}`;
  1536. const DATA_API_KEY$3 = '.data-api';
  1537. const ESCAPE_KEY$2 = 'Escape';
  1538. const TAB_KEY$1 = 'Tab';
  1539. const ARROW_UP_KEY$1 = 'ArrowUp';
  1540. const ARROW_DOWN_KEY$1 = 'ArrowDown';
  1541. const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
  1542. const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
  1543. const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
  1544. const EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
  1545. const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
  1546. const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
  1547. const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
  1548. const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
  1549. const CLASS_NAME_SHOW$6 = 'show';
  1550. const CLASS_NAME_DROPUP = 'dropup';
  1551. const CLASS_NAME_DROPEND = 'dropend';
  1552. const CLASS_NAME_DROPSTART = 'dropstart';
  1553. const CLASS_NAME_DROPUP_CENTER = 'dropup-center';
  1554. const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center';
  1555. const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
  1556. const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
  1557. const SELECTOR_MENU = '.dropdown-menu';
  1558. const SELECTOR_NAVBAR = '.navbar';
  1559. const SELECTOR_NAVBAR_NAV = '.navbar-nav';
  1560. const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  1561. const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
  1562. const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
  1563. const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
  1564. const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
  1565. const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
  1566. const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
  1567. const PLACEMENT_TOPCENTER = 'top';
  1568. const PLACEMENT_BOTTOMCENTER = 'bottom';
  1569. const Default$9 = {
  1570. autoClose: true,
  1571. boundary: 'clippingParents',
  1572. display: 'dynamic',
  1573. offset: [0, 2],
  1574. popperConfig: null,
  1575. reference: 'toggle'
  1576. };
  1577. const DefaultType$9 = {
  1578. autoClose: '(boolean|string)',
  1579. boundary: '(string|element)',
  1580. display: 'string',
  1581. offset: '(array|string|function)',
  1582. popperConfig: '(null|object|function)',
  1583. reference: '(string|element|object)'
  1584. };
  1585. /**
  1586. * Class definition
  1587. */
  1588. class Dropdown extends BaseComponent {
  1589. constructor(element, config) {
  1590. super(element, config);
  1591. this._popper = null;
  1592. this._parent = this._element.parentNode; // dropdown wrapper
  1593. // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
  1594. this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent);
  1595. this._inNavbar = this._detectNavbar();
  1596. } // Getters
  1597. static get Default() {
  1598. return Default$9;
  1599. }
  1600. static get DefaultType() {
  1601. return DefaultType$9;
  1602. }
  1603. static get NAME() {
  1604. return NAME$a;
  1605. } // Public
  1606. toggle() {
  1607. return this._isShown() ? this.hide() : this.show();
  1608. }
  1609. show() {
  1610. if (isDisabled(this._element) || this._isShown()) {
  1611. return;
  1612. }
  1613. const relatedTarget = {
  1614. relatedTarget: this._element
  1615. };
  1616. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
  1617. if (showEvent.defaultPrevented) {
  1618. return;
  1619. }
  1620. this._createPopper(); // If this is a touch-enabled device we add extra
  1621. // empty mouseover listeners to the body's immediate children;
  1622. // only needed because of broken event delegation on iOS
  1623. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  1624. if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
  1625. for (const element of [].concat(...document.body.children)) {
  1626. EventHandler.on(element, 'mouseover', noop);
  1627. }
  1628. }
  1629. this._element.focus();
  1630. this._element.setAttribute('aria-expanded', true);
  1631. this._menu.classList.add(CLASS_NAME_SHOW$6);
  1632. this._element.classList.add(CLASS_NAME_SHOW$6);
  1633. EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
  1634. }
  1635. hide() {
  1636. if (isDisabled(this._element) || !this._isShown()) {
  1637. return;
  1638. }
  1639. const relatedTarget = {
  1640. relatedTarget: this._element
  1641. };
  1642. this._completeHide(relatedTarget);
  1643. }
  1644. dispose() {
  1645. if (this._popper) {
  1646. this._popper.destroy();
  1647. }
  1648. super.dispose();
  1649. }
  1650. update() {
  1651. this._inNavbar = this._detectNavbar();
  1652. if (this._popper) {
  1653. this._popper.update();
  1654. }
  1655. } // Private
  1656. _completeHide(relatedTarget) {
  1657. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
  1658. if (hideEvent.defaultPrevented) {
  1659. return;
  1660. } // If this is a touch-enabled device we remove the extra
  1661. // empty mouseover listeners we added for iOS support
  1662. if ('ontouchstart' in document.documentElement) {
  1663. for (const element of [].concat(...document.body.children)) {
  1664. EventHandler.off(element, 'mouseover', noop);
  1665. }
  1666. }
  1667. if (this._popper) {
  1668. this._popper.destroy();
  1669. }
  1670. this._menu.classList.remove(CLASS_NAME_SHOW$6);
  1671. this._element.classList.remove(CLASS_NAME_SHOW$6);
  1672. this._element.setAttribute('aria-expanded', 'false');
  1673. Manipulator.removeDataAttribute(this._menu, 'popper');
  1674. EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
  1675. }
  1676. _getConfig(config) {
  1677. config = super._getConfig(config);
  1678. if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
  1679. // Popper virtual elements require a getBoundingClientRect method
  1680. throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
  1681. }
  1682. return config;
  1683. }
  1684. _createPopper() {
  1685. if (typeof Popper === 'undefined') {
  1686. throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
  1687. }
  1688. let referenceElement = this._element;
  1689. if (this._config.reference === 'parent') {
  1690. referenceElement = this._parent;
  1691. } else if (isElement(this._config.reference)) {
  1692. referenceElement = getElement(this._config.reference);
  1693. } else if (typeof this._config.reference === 'object') {
  1694. referenceElement = this._config.reference;
  1695. }
  1696. const popperConfig = this._getPopperConfig();
  1697. this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
  1698. }
  1699. _isShown() {
  1700. return this._menu.classList.contains(CLASS_NAME_SHOW$6);
  1701. }
  1702. _getPlacement() {
  1703. const parentDropdown = this._parent;
  1704. if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
  1705. return PLACEMENT_RIGHT;
  1706. }
  1707. if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
  1708. return PLACEMENT_LEFT;
  1709. }
  1710. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
  1711. return PLACEMENT_TOPCENTER;
  1712. }
  1713. if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
  1714. return PLACEMENT_BOTTOMCENTER;
  1715. } // We need to trim the value because custom properties can also include spaces
  1716. const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
  1717. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
  1718. return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  1719. }
  1720. return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
  1721. }
  1722. _detectNavbar() {
  1723. return this._element.closest(SELECTOR_NAVBAR) !== null;
  1724. }
  1725. _getOffset() {
  1726. const {
  1727. offset
  1728. } = this._config;
  1729. if (typeof offset === 'string') {
  1730. return offset.split(',').map(value => Number.parseInt(value, 10));
  1731. }
  1732. if (typeof offset === 'function') {
  1733. return popperData => offset(popperData, this._element);
  1734. }
  1735. return offset;
  1736. }
  1737. _getPopperConfig() {
  1738. const defaultBsPopperConfig = {
  1739. placement: this._getPlacement(),
  1740. modifiers: [{
  1741. name: 'preventOverflow',
  1742. options: {
  1743. boundary: this._config.boundary
  1744. }
  1745. }, {
  1746. name: 'offset',
  1747. options: {
  1748. offset: this._getOffset()
  1749. }
  1750. }]
  1751. }; // Disable Popper if we have a static display or Dropdown is in Navbar
  1752. if (this._inNavbar || this._config.display === 'static') {
  1753. Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // todo:v6 remove
  1754. defaultBsPopperConfig.modifiers = [{
  1755. name: 'applyStyles',
  1756. enabled: false
  1757. }];
  1758. }
  1759. return { ...defaultBsPopperConfig,
  1760. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  1761. };
  1762. }
  1763. _selectMenuItem({
  1764. key,
  1765. target
  1766. }) {
  1767. const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element));
  1768. if (!items.length) {
  1769. return;
  1770. } // if target isn't included in items (e.g. when expanding the dropdown)
  1771. // allow cycling to get the last item in case key equals ARROW_UP_KEY
  1772. getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
  1773. } // Static
  1774. static jQueryInterface(config) {
  1775. return this.each(function () {
  1776. const data = Dropdown.getOrCreateInstance(this, config);
  1777. if (typeof config !== 'string') {
  1778. return;
  1779. }
  1780. if (typeof data[config] === 'undefined') {
  1781. throw new TypeError(`No method named "${config}"`);
  1782. }
  1783. data[config]();
  1784. });
  1785. }
  1786. static clearMenus(event) {
  1787. if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) {
  1788. return;
  1789. }
  1790. const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);
  1791. for (const toggle of openToggles) {
  1792. const context = Dropdown.getInstance(toggle);
  1793. if (!context || context._config.autoClose === false) {
  1794. continue;
  1795. }
  1796. const composedPath = event.composedPath();
  1797. const isMenuTarget = composedPath.includes(context._menu);
  1798. if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
  1799. continue;
  1800. } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
  1801. if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
  1802. continue;
  1803. }
  1804. const relatedTarget = {
  1805. relatedTarget: context._element
  1806. };
  1807. if (event.type === 'click') {
  1808. relatedTarget.clickEvent = event;
  1809. }
  1810. context._completeHide(relatedTarget);
  1811. }
  1812. }
  1813. static dataApiKeydownHandler(event) {
  1814. // If not an UP | DOWN | ESCAPE key => not a dropdown command
  1815. // If input/textarea && if key is other than ESCAPE => not a dropdown command
  1816. const isInput = /input|textarea/i.test(event.target.tagName);
  1817. const isEscapeEvent = event.key === ESCAPE_KEY$2;
  1818. const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key);
  1819. if (!isUpOrDownEvent && !isEscapeEvent) {
  1820. return;
  1821. }
  1822. if (isInput && !isEscapeEvent) {
  1823. return;
  1824. }
  1825. event.preventDefault(); // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
  1826. const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
  1827. const instance = Dropdown.getOrCreateInstance(getToggleButton);
  1828. if (isUpOrDownEvent) {
  1829. event.stopPropagation();
  1830. instance.show();
  1831. instance._selectMenuItem(event);
  1832. return;
  1833. }
  1834. if (instance._isShown()) {
  1835. // else is escape and we check if it is shown
  1836. event.stopPropagation();
  1837. instance.hide();
  1838. getToggleButton.focus();
  1839. }
  1840. }
  1841. }
  1842. /**
  1843. * Data API implementation
  1844. */
  1845. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler);
  1846. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  1847. EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus);
  1848. EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  1849. EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
  1850. event.preventDefault();
  1851. Dropdown.getOrCreateInstance(this).toggle();
  1852. });
  1853. /**
  1854. * jQuery
  1855. */
  1856. defineJQueryPlugin(Dropdown);
  1857. /**
  1858. * --------------------------------------------------------------------------
  1859. * Bootstrap (v5.2.2): util/scrollBar.js
  1860. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1861. * --------------------------------------------------------------------------
  1862. */
  1863. /**
  1864. * Constants
  1865. */
  1866. const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  1867. const SELECTOR_STICKY_CONTENT = '.sticky-top';
  1868. const PROPERTY_PADDING = 'padding-right';
  1869. const PROPERTY_MARGIN = 'margin-right';
  1870. /**
  1871. * Class definition
  1872. */
  1873. class ScrollBarHelper {
  1874. constructor() {
  1875. this._element = document.body;
  1876. } // Public
  1877. getWidth() {
  1878. // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
  1879. const documentWidth = document.documentElement.clientWidth;
  1880. return Math.abs(window.innerWidth - documentWidth);
  1881. }
  1882. hide() {
  1883. const width = this.getWidth();
  1884. this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
  1885. this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
  1886. this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
  1887. this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
  1888. }
  1889. reset() {
  1890. this._resetElementAttributes(this._element, 'overflow');
  1891. this._resetElementAttributes(this._element, PROPERTY_PADDING);
  1892. this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
  1893. this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
  1894. }
  1895. isOverflowing() {
  1896. return this.getWidth() > 0;
  1897. } // Private
  1898. _disableOverFlow() {
  1899. this._saveInitialAttribute(this._element, 'overflow');
  1900. this._element.style.overflow = 'hidden';
  1901. }
  1902. _setElementAttributes(selector, styleProperty, callback) {
  1903. const scrollbarWidth = this.getWidth();
  1904. const manipulationCallBack = element => {
  1905. if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
  1906. return;
  1907. }
  1908. this._saveInitialAttribute(element, styleProperty);
  1909. const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
  1910. element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
  1911. };
  1912. this._applyManipulationCallback(selector, manipulationCallBack);
  1913. }
  1914. _saveInitialAttribute(element, styleProperty) {
  1915. const actualValue = element.style.getPropertyValue(styleProperty);
  1916. if (actualValue) {
  1917. Manipulator.setDataAttribute(element, styleProperty, actualValue);
  1918. }
  1919. }
  1920. _resetElementAttributes(selector, styleProperty) {
  1921. const manipulationCallBack = element => {
  1922. const value = Manipulator.getDataAttribute(element, styleProperty); // We only want to remove the property if the value is `null`; the value can also be zero
  1923. if (value === null) {
  1924. element.style.removeProperty(styleProperty);
  1925. return;
  1926. }
  1927. Manipulator.removeDataAttribute(element, styleProperty);
  1928. element.style.setProperty(styleProperty, value);
  1929. };
  1930. this._applyManipulationCallback(selector, manipulationCallBack);
  1931. }
  1932. _applyManipulationCallback(selector, callBack) {
  1933. if (isElement(selector)) {
  1934. callBack(selector);
  1935. return;
  1936. }
  1937. for (const sel of SelectorEngine.find(selector, this._element)) {
  1938. callBack(sel);
  1939. }
  1940. }
  1941. }
  1942. /**
  1943. * --------------------------------------------------------------------------
  1944. * Bootstrap (v5.2.2): util/backdrop.js
  1945. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1946. * --------------------------------------------------------------------------
  1947. */
  1948. /**
  1949. * Constants
  1950. */
  1951. const NAME$9 = 'backdrop';
  1952. const CLASS_NAME_FADE$4 = 'fade';
  1953. const CLASS_NAME_SHOW$5 = 'show';
  1954. const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
  1955. const Default$8 = {
  1956. className: 'modal-backdrop',
  1957. clickCallback: null,
  1958. isAnimated: false,
  1959. isVisible: true,
  1960. // if false, we use the backdrop helper without adding any element to the dom
  1961. rootElement: 'body' // give the choice to place backdrop under different elements
  1962. };
  1963. const DefaultType$8 = {
  1964. className: 'string',
  1965. clickCallback: '(function|null)',
  1966. isAnimated: 'boolean',
  1967. isVisible: 'boolean',
  1968. rootElement: '(element|string)'
  1969. };
  1970. /**
  1971. * Class definition
  1972. */
  1973. class Backdrop extends Config {
  1974. constructor(config) {
  1975. super();
  1976. this._config = this._getConfig(config);
  1977. this._isAppended = false;
  1978. this._element = null;
  1979. } // Getters
  1980. static get Default() {
  1981. return Default$8;
  1982. }
  1983. static get DefaultType() {
  1984. return DefaultType$8;
  1985. }
  1986. static get NAME() {
  1987. return NAME$9;
  1988. } // Public
  1989. show(callback) {
  1990. if (!this._config.isVisible) {
  1991. execute(callback);
  1992. return;
  1993. }
  1994. this._append();
  1995. const element = this._getElement();
  1996. if (this._config.isAnimated) {
  1997. reflow(element);
  1998. }
  1999. element.classList.add(CLASS_NAME_SHOW$5);
  2000. this._emulateAnimation(() => {
  2001. execute(callback);
  2002. });
  2003. }
  2004. hide(callback) {
  2005. if (!this._config.isVisible) {
  2006. execute(callback);
  2007. return;
  2008. }
  2009. this._getElement().classList.remove(CLASS_NAME_SHOW$5);
  2010. this._emulateAnimation(() => {
  2011. this.dispose();
  2012. execute(callback);
  2013. });
  2014. }
  2015. dispose() {
  2016. if (!this._isAppended) {
  2017. return;
  2018. }
  2019. EventHandler.off(this._element, EVENT_MOUSEDOWN);
  2020. this._element.remove();
  2021. this._isAppended = false;
  2022. } // Private
  2023. _getElement() {
  2024. if (!this._element) {
  2025. const backdrop = document.createElement('div');
  2026. backdrop.className = this._config.className;
  2027. if (this._config.isAnimated) {
  2028. backdrop.classList.add(CLASS_NAME_FADE$4);
  2029. }
  2030. this._element = backdrop;
  2031. }
  2032. return this._element;
  2033. }
  2034. _configAfterMerge(config) {
  2035. // use getElement() with the default "body" to get a fresh Element on each instantiation
  2036. config.rootElement = getElement(config.rootElement);
  2037. return config;
  2038. }
  2039. _append() {
  2040. if (this._isAppended) {
  2041. return;
  2042. }
  2043. const element = this._getElement();
  2044. this._config.rootElement.append(element);
  2045. EventHandler.on(element, EVENT_MOUSEDOWN, () => {
  2046. execute(this._config.clickCallback);
  2047. });
  2048. this._isAppended = true;
  2049. }
  2050. _emulateAnimation(callback) {
  2051. executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
  2052. }
  2053. }
  2054. /**
  2055. * --------------------------------------------------------------------------
  2056. * Bootstrap (v5.2.2): util/focustrap.js
  2057. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2058. * --------------------------------------------------------------------------
  2059. */
  2060. /**
  2061. * Constants
  2062. */
  2063. const NAME$8 = 'focustrap';
  2064. const DATA_KEY$5 = 'bs.focustrap';
  2065. const EVENT_KEY$5 = `.${DATA_KEY$5}`;
  2066. const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
  2067. const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
  2068. const TAB_KEY = 'Tab';
  2069. const TAB_NAV_FORWARD = 'forward';
  2070. const TAB_NAV_BACKWARD = 'backward';
  2071. const Default$7 = {
  2072. autofocus: true,
  2073. trapElement: null // The element to trap focus inside of
  2074. };
  2075. const DefaultType$7 = {
  2076. autofocus: 'boolean',
  2077. trapElement: 'element'
  2078. };
  2079. /**
  2080. * Class definition
  2081. */
  2082. class FocusTrap extends Config {
  2083. constructor(config) {
  2084. super();
  2085. this._config = this._getConfig(config);
  2086. this._isActive = false;
  2087. this._lastTabNavDirection = null;
  2088. } // Getters
  2089. static get Default() {
  2090. return Default$7;
  2091. }
  2092. static get DefaultType() {
  2093. return DefaultType$7;
  2094. }
  2095. static get NAME() {
  2096. return NAME$8;
  2097. } // Public
  2098. activate() {
  2099. if (this._isActive) {
  2100. return;
  2101. }
  2102. if (this._config.autofocus) {
  2103. this._config.trapElement.focus();
  2104. }
  2105. EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop
  2106. EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event));
  2107. EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
  2108. this._isActive = true;
  2109. }
  2110. deactivate() {
  2111. if (!this._isActive) {
  2112. return;
  2113. }
  2114. this._isActive = false;
  2115. EventHandler.off(document, EVENT_KEY$5);
  2116. } // Private
  2117. _handleFocusin(event) {
  2118. const {
  2119. trapElement
  2120. } = this._config;
  2121. if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
  2122. return;
  2123. }
  2124. const elements = SelectorEngine.focusableChildren(trapElement);
  2125. if (elements.length === 0) {
  2126. trapElement.focus();
  2127. } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
  2128. elements[elements.length - 1].focus();
  2129. } else {
  2130. elements[0].focus();
  2131. }
  2132. }
  2133. _handleKeydown(event) {
  2134. if (event.key !== TAB_KEY) {
  2135. return;
  2136. }
  2137. this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
  2138. }
  2139. }
  2140. /**
  2141. * --------------------------------------------------------------------------
  2142. * Bootstrap (v5.2.2): modal.js
  2143. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2144. * --------------------------------------------------------------------------
  2145. */
  2146. /**
  2147. * Constants
  2148. */
  2149. const NAME$7 = 'modal';
  2150. const DATA_KEY$4 = 'bs.modal';
  2151. const EVENT_KEY$4 = `.${DATA_KEY$4}`;
  2152. const DATA_API_KEY$2 = '.data-api';
  2153. const ESCAPE_KEY$1 = 'Escape';
  2154. const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
  2155. const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
  2156. const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
  2157. const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
  2158. const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
  2159. const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
  2160. const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
  2161. const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
  2162. const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
  2163. const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
  2164. const CLASS_NAME_OPEN = 'modal-open';
  2165. const CLASS_NAME_FADE$3 = 'fade';
  2166. const CLASS_NAME_SHOW$4 = 'show';
  2167. const CLASS_NAME_STATIC = 'modal-static';
  2168. const OPEN_SELECTOR$1 = '.modal.show';
  2169. const SELECTOR_DIALOG = '.modal-dialog';
  2170. const SELECTOR_MODAL_BODY = '.modal-body';
  2171. const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
  2172. const Default$6 = {
  2173. backdrop: true,
  2174. focus: true,
  2175. keyboard: true
  2176. };
  2177. const DefaultType$6 = {
  2178. backdrop: '(boolean|string)',
  2179. focus: 'boolean',
  2180. keyboard: 'boolean'
  2181. };
  2182. /**
  2183. * Class definition
  2184. */
  2185. class Modal extends BaseComponent {
  2186. constructor(element, config) {
  2187. super(element, config);
  2188. this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
  2189. this._backdrop = this._initializeBackDrop();
  2190. this._focustrap = this._initializeFocusTrap();
  2191. this._isShown = false;
  2192. this._isTransitioning = false;
  2193. this._scrollBar = new ScrollBarHelper();
  2194. this._addEventListeners();
  2195. } // Getters
  2196. static get Default() {
  2197. return Default$6;
  2198. }
  2199. static get DefaultType() {
  2200. return DefaultType$6;
  2201. }
  2202. static get NAME() {
  2203. return NAME$7;
  2204. } // Public
  2205. toggle(relatedTarget) {
  2206. return this._isShown ? this.hide() : this.show(relatedTarget);
  2207. }
  2208. show(relatedTarget) {
  2209. if (this._isShown || this._isTransitioning) {
  2210. return;
  2211. }
  2212. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
  2213. relatedTarget
  2214. });
  2215. if (showEvent.defaultPrevented) {
  2216. return;
  2217. }
  2218. this._isShown = true;
  2219. this._isTransitioning = true;
  2220. this._scrollBar.hide();
  2221. document.body.classList.add(CLASS_NAME_OPEN);
  2222. this._adjustDialog();
  2223. this._backdrop.show(() => this._showElement(relatedTarget));
  2224. }
  2225. hide() {
  2226. if (!this._isShown || this._isTransitioning) {
  2227. return;
  2228. }
  2229. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
  2230. if (hideEvent.defaultPrevented) {
  2231. return;
  2232. }
  2233. this._isShown = false;
  2234. this._isTransitioning = true;
  2235. this._focustrap.deactivate();
  2236. this._element.classList.remove(CLASS_NAME_SHOW$4);
  2237. this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
  2238. }
  2239. dispose() {
  2240. for (const htmlElement of [window, this._dialog]) {
  2241. EventHandler.off(htmlElement, EVENT_KEY$4);
  2242. }
  2243. this._backdrop.dispose();
  2244. this._focustrap.deactivate();
  2245. super.dispose();
  2246. }
  2247. handleUpdate() {
  2248. this._adjustDialog();
  2249. } // Private
  2250. _initializeBackDrop() {
  2251. return new Backdrop({
  2252. isVisible: Boolean(this._config.backdrop),
  2253. // 'static' option will be translated to true, and booleans will keep their value,
  2254. isAnimated: this._isAnimated()
  2255. });
  2256. }
  2257. _initializeFocusTrap() {
  2258. return new FocusTrap({
  2259. trapElement: this._element
  2260. });
  2261. }
  2262. _showElement(relatedTarget) {
  2263. // try to append dynamic modal
  2264. if (!document.body.contains(this._element)) {
  2265. document.body.append(this._element);
  2266. }
  2267. this._element.style.display = 'block';
  2268. this._element.removeAttribute('aria-hidden');
  2269. this._element.setAttribute('aria-modal', true);
  2270. this._element.setAttribute('role', 'dialog');
  2271. this._element.scrollTop = 0;
  2272. const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
  2273. if (modalBody) {
  2274. modalBody.scrollTop = 0;
  2275. }
  2276. reflow(this._element);
  2277. this._element.classList.add(CLASS_NAME_SHOW$4);
  2278. const transitionComplete = () => {
  2279. if (this._config.focus) {
  2280. this._focustrap.activate();
  2281. }
  2282. this._isTransitioning = false;
  2283. EventHandler.trigger(this._element, EVENT_SHOWN$4, {
  2284. relatedTarget
  2285. });
  2286. };
  2287. this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
  2288. }
  2289. _addEventListeners() {
  2290. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
  2291. if (event.key !== ESCAPE_KEY$1) {
  2292. return;
  2293. }
  2294. if (this._config.keyboard) {
  2295. event.preventDefault();
  2296. this.hide();
  2297. return;
  2298. }
  2299. this._triggerBackdropTransition();
  2300. });
  2301. EventHandler.on(window, EVENT_RESIZE$1, () => {
  2302. if (this._isShown && !this._isTransitioning) {
  2303. this._adjustDialog();
  2304. }
  2305. });
  2306. EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
  2307. // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
  2308. EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
  2309. if (this._element !== event.target || this._element !== event2.target) {
  2310. return;
  2311. }
  2312. if (this._config.backdrop === 'static') {
  2313. this._triggerBackdropTransition();
  2314. return;
  2315. }
  2316. if (this._config.backdrop) {
  2317. this.hide();
  2318. }
  2319. });
  2320. });
  2321. }
  2322. _hideModal() {
  2323. this._element.style.display = 'none';
  2324. this._element.setAttribute('aria-hidden', true);
  2325. this._element.removeAttribute('aria-modal');
  2326. this._element.removeAttribute('role');
  2327. this._isTransitioning = false;
  2328. this._backdrop.hide(() => {
  2329. document.body.classList.remove(CLASS_NAME_OPEN);
  2330. this._resetAdjustments();
  2331. this._scrollBar.reset();
  2332. EventHandler.trigger(this._element, EVENT_HIDDEN$4);
  2333. });
  2334. }
  2335. _isAnimated() {
  2336. return this._element.classList.contains(CLASS_NAME_FADE$3);
  2337. }
  2338. _triggerBackdropTransition() {
  2339. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
  2340. if (hideEvent.defaultPrevented) {
  2341. return;
  2342. }
  2343. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2344. const initialOverflowY = this._element.style.overflowY; // return if the following background transition hasn't yet completed
  2345. if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
  2346. return;
  2347. }
  2348. if (!isModalOverflowing) {
  2349. this._element.style.overflowY = 'hidden';
  2350. }
  2351. this._element.classList.add(CLASS_NAME_STATIC);
  2352. this._queueCallback(() => {
  2353. this._element.classList.remove(CLASS_NAME_STATIC);
  2354. this._queueCallback(() => {
  2355. this._element.style.overflowY = initialOverflowY;
  2356. }, this._dialog);
  2357. }, this._dialog);
  2358. this._element.focus();
  2359. }
  2360. /**
  2361. * The following methods are used to handle overflowing modals
  2362. */
  2363. _adjustDialog() {
  2364. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2365. const scrollbarWidth = this._scrollBar.getWidth();
  2366. const isBodyOverflowing = scrollbarWidth > 0;
  2367. if (isBodyOverflowing && !isModalOverflowing) {
  2368. const property = isRTL() ? 'paddingLeft' : 'paddingRight';
  2369. this._element.style[property] = `${scrollbarWidth}px`;
  2370. }
  2371. if (!isBodyOverflowing && isModalOverflowing) {
  2372. const property = isRTL() ? 'paddingRight' : 'paddingLeft';
  2373. this._element.style[property] = `${scrollbarWidth}px`;
  2374. }
  2375. }
  2376. _resetAdjustments() {
  2377. this._element.style.paddingLeft = '';
  2378. this._element.style.paddingRight = '';
  2379. } // Static
  2380. static jQueryInterface(config, relatedTarget) {
  2381. return this.each(function () {
  2382. const data = Modal.getOrCreateInstance(this, config);
  2383. if (typeof config !== 'string') {
  2384. return;
  2385. }
  2386. if (typeof data[config] === 'undefined') {
  2387. throw new TypeError(`No method named "${config}"`);
  2388. }
  2389. data[config](relatedTarget);
  2390. });
  2391. }
  2392. }
  2393. /**
  2394. * Data API implementation
  2395. */
  2396. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  2397. const target = getElementFromSelector(this);
  2398. if (['A', 'AREA'].includes(this.tagName)) {
  2399. event.preventDefault();
  2400. }
  2401. EventHandler.one(target, EVENT_SHOW$4, showEvent => {
  2402. if (showEvent.defaultPrevented) {
  2403. // only register focus restorer if modal will actually get shown
  2404. return;
  2405. }
  2406. EventHandler.one(target, EVENT_HIDDEN$4, () => {
  2407. if (isVisible(this)) {
  2408. this.focus();
  2409. }
  2410. });
  2411. }); // avoid conflict when clicking modal toggler while another one is open
  2412. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
  2413. if (alreadyOpen) {
  2414. Modal.getInstance(alreadyOpen).hide();
  2415. }
  2416. const data = Modal.getOrCreateInstance(target);
  2417. data.toggle(this);
  2418. });
  2419. enableDismissTrigger(Modal);
  2420. /**
  2421. * jQuery
  2422. */
  2423. defineJQueryPlugin(Modal);
  2424. /**
  2425. * --------------------------------------------------------------------------
  2426. * Bootstrap (v5.2.2): offcanvas.js
  2427. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2428. * --------------------------------------------------------------------------
  2429. */
  2430. /**
  2431. * Constants
  2432. */
  2433. const NAME$6 = 'offcanvas';
  2434. const DATA_KEY$3 = 'bs.offcanvas';
  2435. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  2436. const DATA_API_KEY$1 = '.data-api';
  2437. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2438. const ESCAPE_KEY = 'Escape';
  2439. const CLASS_NAME_SHOW$3 = 'show';
  2440. const CLASS_NAME_SHOWING$1 = 'showing';
  2441. const CLASS_NAME_HIDING = 'hiding';
  2442. const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
  2443. const OPEN_SELECTOR = '.offcanvas.show';
  2444. const EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
  2445. const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
  2446. const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
  2447. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
  2448. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
  2449. const EVENT_RESIZE = `resize${EVENT_KEY$3}`;
  2450. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2451. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
  2452. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  2453. const Default$5 = {
  2454. backdrop: true,
  2455. keyboard: true,
  2456. scroll: false
  2457. };
  2458. const DefaultType$5 = {
  2459. backdrop: '(boolean|string)',
  2460. keyboard: 'boolean',
  2461. scroll: 'boolean'
  2462. };
  2463. /**
  2464. * Class definition
  2465. */
  2466. class Offcanvas extends BaseComponent {
  2467. constructor(element, config) {
  2468. super(element, config);
  2469. this._isShown = false;
  2470. this._backdrop = this._initializeBackDrop();
  2471. this._focustrap = this._initializeFocusTrap();
  2472. this._addEventListeners();
  2473. } // Getters
  2474. static get Default() {
  2475. return Default$5;
  2476. }
  2477. static get DefaultType() {
  2478. return DefaultType$5;
  2479. }
  2480. static get NAME() {
  2481. return NAME$6;
  2482. } // Public
  2483. toggle(relatedTarget) {
  2484. return this._isShown ? this.hide() : this.show(relatedTarget);
  2485. }
  2486. show(relatedTarget) {
  2487. if (this._isShown) {
  2488. return;
  2489. }
  2490. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  2491. relatedTarget
  2492. });
  2493. if (showEvent.defaultPrevented) {
  2494. return;
  2495. }
  2496. this._isShown = true;
  2497. this._backdrop.show();
  2498. if (!this._config.scroll) {
  2499. new ScrollBarHelper().hide();
  2500. }
  2501. this._element.setAttribute('aria-modal', true);
  2502. this._element.setAttribute('role', 'dialog');
  2503. this._element.classList.add(CLASS_NAME_SHOWING$1);
  2504. const completeCallBack = () => {
  2505. if (!this._config.scroll || this._config.backdrop) {
  2506. this._focustrap.activate();
  2507. }
  2508. this._element.classList.add(CLASS_NAME_SHOW$3);
  2509. this._element.classList.remove(CLASS_NAME_SHOWING$1);
  2510. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  2511. relatedTarget
  2512. });
  2513. };
  2514. this._queueCallback(completeCallBack, this._element, true);
  2515. }
  2516. hide() {
  2517. if (!this._isShown) {
  2518. return;
  2519. }
  2520. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  2521. if (hideEvent.defaultPrevented) {
  2522. return;
  2523. }
  2524. this._focustrap.deactivate();
  2525. this._element.blur();
  2526. this._isShown = false;
  2527. this._element.classList.add(CLASS_NAME_HIDING);
  2528. this._backdrop.hide();
  2529. const completeCallback = () => {
  2530. this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
  2531. this._element.removeAttribute('aria-modal');
  2532. this._element.removeAttribute('role');
  2533. if (!this._config.scroll) {
  2534. new ScrollBarHelper().reset();
  2535. }
  2536. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  2537. };
  2538. this._queueCallback(completeCallback, this._element, true);
  2539. }
  2540. dispose() {
  2541. this._backdrop.dispose();
  2542. this._focustrap.deactivate();
  2543. super.dispose();
  2544. } // Private
  2545. _initializeBackDrop() {
  2546. const clickCallback = () => {
  2547. if (this._config.backdrop === 'static') {
  2548. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2549. return;
  2550. }
  2551. this.hide();
  2552. }; // 'static' option will be translated to true, and booleans will keep their value
  2553. const isVisible = Boolean(this._config.backdrop);
  2554. return new Backdrop({
  2555. className: CLASS_NAME_BACKDROP,
  2556. isVisible,
  2557. isAnimated: true,
  2558. rootElement: this._element.parentNode,
  2559. clickCallback: isVisible ? clickCallback : null
  2560. });
  2561. }
  2562. _initializeFocusTrap() {
  2563. return new FocusTrap({
  2564. trapElement: this._element
  2565. });
  2566. }
  2567. _addEventListeners() {
  2568. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  2569. if (event.key !== ESCAPE_KEY) {
  2570. return;
  2571. }
  2572. if (!this._config.keyboard) {
  2573. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2574. return;
  2575. }
  2576. this.hide();
  2577. });
  2578. } // Static
  2579. static jQueryInterface(config) {
  2580. return this.each(function () {
  2581. const data = Offcanvas.getOrCreateInstance(this, config);
  2582. if (typeof config !== 'string') {
  2583. return;
  2584. }
  2585. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  2586. throw new TypeError(`No method named "${config}"`);
  2587. }
  2588. data[config](this);
  2589. });
  2590. }
  2591. }
  2592. /**
  2593. * Data API implementation
  2594. */
  2595. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  2596. const target = getElementFromSelector(this);
  2597. if (['A', 'AREA'].includes(this.tagName)) {
  2598. event.preventDefault();
  2599. }
  2600. if (isDisabled(this)) {
  2601. return;
  2602. }
  2603. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  2604. // focus on trigger when it is closed
  2605. if (isVisible(this)) {
  2606. this.focus();
  2607. }
  2608. }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
  2609. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  2610. if (alreadyOpen && alreadyOpen !== target) {
  2611. Offcanvas.getInstance(alreadyOpen).hide();
  2612. }
  2613. const data = Offcanvas.getOrCreateInstance(target);
  2614. data.toggle(this);
  2615. });
  2616. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  2617. for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
  2618. Offcanvas.getOrCreateInstance(selector).show();
  2619. }
  2620. });
  2621. EventHandler.on(window, EVENT_RESIZE, () => {
  2622. for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
  2623. if (getComputedStyle(element).position !== 'fixed') {
  2624. Offcanvas.getOrCreateInstance(element).hide();
  2625. }
  2626. }
  2627. });
  2628. enableDismissTrigger(Offcanvas);
  2629. /**
  2630. * jQuery
  2631. */
  2632. defineJQueryPlugin(Offcanvas);
  2633. /**
  2634. * --------------------------------------------------------------------------
  2635. * Bootstrap (v5.2.2): util/sanitizer.js
  2636. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2637. * --------------------------------------------------------------------------
  2638. */
  2639. const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  2640. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  2641. /**
  2642. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  2643. *
  2644. * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2645. */
  2646. const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
  2647. /**
  2648. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  2649. *
  2650. * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2651. */
  2652. 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;
  2653. const allowedAttribute = (attribute, allowedAttributeList) => {
  2654. const attributeName = attribute.nodeName.toLowerCase();
  2655. if (allowedAttributeList.includes(attributeName)) {
  2656. if (uriAttributes.has(attributeName)) {
  2657. return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
  2658. }
  2659. return true;
  2660. } // Check if a regular expression validates the attribute.
  2661. return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
  2662. };
  2663. const DefaultAllowlist = {
  2664. // Global attributes allowed on any supplied element below.
  2665. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  2666. a: ['target', 'href', 'title', 'rel'],
  2667. area: [],
  2668. b: [],
  2669. br: [],
  2670. col: [],
  2671. code: [],
  2672. div: [],
  2673. em: [],
  2674. hr: [],
  2675. h1: [],
  2676. h2: [],
  2677. h3: [],
  2678. h4: [],
  2679. h5: [],
  2680. h6: [],
  2681. i: [],
  2682. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  2683. li: [],
  2684. ol: [],
  2685. p: [],
  2686. pre: [],
  2687. s: [],
  2688. small: [],
  2689. span: [],
  2690. sub: [],
  2691. sup: [],
  2692. strong: [],
  2693. u: [],
  2694. ul: []
  2695. };
  2696. function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
  2697. if (!unsafeHtml.length) {
  2698. return unsafeHtml;
  2699. }
  2700. if (sanitizeFunction && typeof sanitizeFunction === 'function') {
  2701. return sanitizeFunction(unsafeHtml);
  2702. }
  2703. const domParser = new window.DOMParser();
  2704. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  2705. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  2706. for (const element of elements) {
  2707. const elementName = element.nodeName.toLowerCase();
  2708. if (!Object.keys(allowList).includes(elementName)) {
  2709. element.remove();
  2710. continue;
  2711. }
  2712. const attributeList = [].concat(...element.attributes);
  2713. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
  2714. for (const attribute of attributeList) {
  2715. if (!allowedAttribute(attribute, allowedAttributes)) {
  2716. element.removeAttribute(attribute.nodeName);
  2717. }
  2718. }
  2719. }
  2720. return createdDocument.body.innerHTML;
  2721. }
  2722. /**
  2723. * --------------------------------------------------------------------------
  2724. * Bootstrap (v5.2.2): util/template-factory.js
  2725. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2726. * --------------------------------------------------------------------------
  2727. */
  2728. /**
  2729. * Constants
  2730. */
  2731. const NAME$5 = 'TemplateFactory';
  2732. const Default$4 = {
  2733. allowList: DefaultAllowlist,
  2734. content: {},
  2735. // { selector : text , selector2 : text2 , }
  2736. extraClass: '',
  2737. html: false,
  2738. sanitize: true,
  2739. sanitizeFn: null,
  2740. template: '<div></div>'
  2741. };
  2742. const DefaultType$4 = {
  2743. allowList: 'object',
  2744. content: 'object',
  2745. extraClass: '(string|function)',
  2746. html: 'boolean',
  2747. sanitize: 'boolean',
  2748. sanitizeFn: '(null|function)',
  2749. template: 'string'
  2750. };
  2751. const DefaultContentType = {
  2752. entry: '(string|element|function|null)',
  2753. selector: '(string|element)'
  2754. };
  2755. /**
  2756. * Class definition
  2757. */
  2758. class TemplateFactory extends Config {
  2759. constructor(config) {
  2760. super();
  2761. this._config = this._getConfig(config);
  2762. } // Getters
  2763. static get Default() {
  2764. return Default$4;
  2765. }
  2766. static get DefaultType() {
  2767. return DefaultType$4;
  2768. }
  2769. static get NAME() {
  2770. return NAME$5;
  2771. } // Public
  2772. getContent() {
  2773. return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
  2774. }
  2775. hasContent() {
  2776. return this.getContent().length > 0;
  2777. }
  2778. changeContent(content) {
  2779. this._checkContent(content);
  2780. this._config.content = { ...this._config.content,
  2781. ...content
  2782. };
  2783. return this;
  2784. }
  2785. toHtml() {
  2786. const templateWrapper = document.createElement('div');
  2787. templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
  2788. for (const [selector, text] of Object.entries(this._config.content)) {
  2789. this._setContent(templateWrapper, text, selector);
  2790. }
  2791. const template = templateWrapper.children[0];
  2792. const extraClass = this._resolvePossibleFunction(this._config.extraClass);
  2793. if (extraClass) {
  2794. template.classList.add(...extraClass.split(' '));
  2795. }
  2796. return template;
  2797. } // Private
  2798. _typeCheckConfig(config) {
  2799. super._typeCheckConfig(config);
  2800. this._checkContent(config.content);
  2801. }
  2802. _checkContent(arg) {
  2803. for (const [selector, content] of Object.entries(arg)) {
  2804. super._typeCheckConfig({
  2805. selector,
  2806. entry: content
  2807. }, DefaultContentType);
  2808. }
  2809. }
  2810. _setContent(template, content, selector) {
  2811. const templateElement = SelectorEngine.findOne(selector, template);
  2812. if (!templateElement) {
  2813. return;
  2814. }
  2815. content = this._resolvePossibleFunction(content);
  2816. if (!content) {
  2817. templateElement.remove();
  2818. return;
  2819. }
  2820. if (isElement(content)) {
  2821. this._putElementInTemplate(getElement(content), templateElement);
  2822. return;
  2823. }
  2824. if (this._config.html) {
  2825. templateElement.innerHTML = this._maybeSanitize(content);
  2826. return;
  2827. }
  2828. templateElement.textContent = content;
  2829. }
  2830. _maybeSanitize(arg) {
  2831. return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
  2832. }
  2833. _resolvePossibleFunction(arg) {
  2834. return typeof arg === 'function' ? arg(this) : arg;
  2835. }
  2836. _putElementInTemplate(element, templateElement) {
  2837. if (this._config.html) {
  2838. templateElement.innerHTML = '';
  2839. templateElement.append(element);
  2840. return;
  2841. }
  2842. templateElement.textContent = element.textContent;
  2843. }
  2844. }
  2845. /**
  2846. * --------------------------------------------------------------------------
  2847. * Bootstrap (v5.2.2): tooltip.js
  2848. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2849. * --------------------------------------------------------------------------
  2850. */
  2851. /**
  2852. * Constants
  2853. */
  2854. const NAME$4 = 'tooltip';
  2855. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  2856. const CLASS_NAME_FADE$2 = 'fade';
  2857. const CLASS_NAME_MODAL = 'modal';
  2858. const CLASS_NAME_SHOW$2 = 'show';
  2859. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  2860. const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
  2861. const EVENT_MODAL_HIDE = 'hide.bs.modal';
  2862. const TRIGGER_HOVER = 'hover';
  2863. const TRIGGER_FOCUS = 'focus';
  2864. const TRIGGER_CLICK = 'click';
  2865. const TRIGGER_MANUAL = 'manual';
  2866. const EVENT_HIDE$2 = 'hide';
  2867. const EVENT_HIDDEN$2 = 'hidden';
  2868. const EVENT_SHOW$2 = 'show';
  2869. const EVENT_SHOWN$2 = 'shown';
  2870. const EVENT_INSERTED = 'inserted';
  2871. const EVENT_CLICK$1 = 'click';
  2872. const EVENT_FOCUSIN$1 = 'focusin';
  2873. const EVENT_FOCUSOUT$1 = 'focusout';
  2874. const EVENT_MOUSEENTER = 'mouseenter';
  2875. const EVENT_MOUSELEAVE = 'mouseleave';
  2876. const AttachmentMap = {
  2877. AUTO: 'auto',
  2878. TOP: 'top',
  2879. RIGHT: isRTL() ? 'left' : 'right',
  2880. BOTTOM: 'bottom',
  2881. LEFT: isRTL() ? 'right' : 'left'
  2882. };
  2883. const Default$3 = {
  2884. allowList: DefaultAllowlist,
  2885. animation: true,
  2886. boundary: 'clippingParents',
  2887. container: false,
  2888. customClass: '',
  2889. delay: 0,
  2890. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  2891. html: false,
  2892. offset: [0, 0],
  2893. placement: 'top',
  2894. popperConfig: null,
  2895. sanitize: true,
  2896. sanitizeFn: null,
  2897. selector: false,
  2898. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  2899. title: '',
  2900. trigger: 'hover focus'
  2901. };
  2902. const DefaultType$3 = {
  2903. allowList: 'object',
  2904. animation: 'boolean',
  2905. boundary: '(string|element)',
  2906. container: '(string|element|boolean)',
  2907. customClass: '(string|function)',
  2908. delay: '(number|object)',
  2909. fallbackPlacements: 'array',
  2910. html: 'boolean',
  2911. offset: '(array|string|function)',
  2912. placement: '(string|function)',
  2913. popperConfig: '(null|object|function)',
  2914. sanitize: 'boolean',
  2915. sanitizeFn: '(null|function)',
  2916. selector: '(string|boolean)',
  2917. template: 'string',
  2918. title: '(string|element|function)',
  2919. trigger: 'string'
  2920. };
  2921. /**
  2922. * Class definition
  2923. */
  2924. class Tooltip extends BaseComponent {
  2925. constructor(element, config) {
  2926. if (typeof Popper === 'undefined') {
  2927. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
  2928. }
  2929. super(element, config); // Private
  2930. this._isEnabled = true;
  2931. this._timeout = 0;
  2932. this._isHovered = null;
  2933. this._activeTrigger = {};
  2934. this._popper = null;
  2935. this._templateFactory = null;
  2936. this._newContent = null; // Protected
  2937. this.tip = null;
  2938. this._setListeners();
  2939. if (!this._config.selector) {
  2940. this._fixTitle();
  2941. }
  2942. } // Getters
  2943. static get Default() {
  2944. return Default$3;
  2945. }
  2946. static get DefaultType() {
  2947. return DefaultType$3;
  2948. }
  2949. static get NAME() {
  2950. return NAME$4;
  2951. } // Public
  2952. enable() {
  2953. this._isEnabled = true;
  2954. }
  2955. disable() {
  2956. this._isEnabled = false;
  2957. }
  2958. toggleEnabled() {
  2959. this._isEnabled = !this._isEnabled;
  2960. }
  2961. toggle() {
  2962. if (!this._isEnabled) {
  2963. return;
  2964. }
  2965. this._activeTrigger.click = !this._activeTrigger.click;
  2966. if (this._isShown()) {
  2967. this._leave();
  2968. return;
  2969. }
  2970. this._enter();
  2971. }
  2972. dispose() {
  2973. clearTimeout(this._timeout);
  2974. EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  2975. if (this.tip) {
  2976. this.tip.remove();
  2977. }
  2978. if (this._element.getAttribute('data-bs-original-title')) {
  2979. this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
  2980. }
  2981. this._disposePopper();
  2982. super.dispose();
  2983. }
  2984. show() {
  2985. if (this._element.style.display === 'none') {
  2986. throw new Error('Please use show on visible elements');
  2987. }
  2988. if (!(this._isWithContent() && this._isEnabled)) {
  2989. return;
  2990. }
  2991. const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
  2992. const shadowRoot = findShadowRoot(this._element);
  2993. const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
  2994. if (showEvent.defaultPrevented || !isInTheDom) {
  2995. return;
  2996. } // todo v6 remove this OR make it optional
  2997. if (this.tip) {
  2998. this.tip.remove();
  2999. this.tip = null;
  3000. }
  3001. const tip = this._getTipElement();
  3002. this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
  3003. const {
  3004. container
  3005. } = this._config;
  3006. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  3007. container.append(tip);
  3008. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
  3009. }
  3010. if (this._popper) {
  3011. this._popper.update();
  3012. } else {
  3013. this._popper = this._createPopper(tip);
  3014. }
  3015. tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra
  3016. // empty mouseover listeners to the body's immediate children;
  3017. // only needed because of broken event delegation on iOS
  3018. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3019. if ('ontouchstart' in document.documentElement) {
  3020. for (const element of [].concat(...document.body.children)) {
  3021. EventHandler.on(element, 'mouseover', noop);
  3022. }
  3023. }
  3024. const complete = () => {
  3025. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
  3026. if (this._isHovered === false) {
  3027. this._leave();
  3028. }
  3029. this._isHovered = false;
  3030. };
  3031. this._queueCallback(complete, this.tip, this._isAnimated());
  3032. }
  3033. hide() {
  3034. if (!this._isShown()) {
  3035. return;
  3036. }
  3037. const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
  3038. if (hideEvent.defaultPrevented) {
  3039. return;
  3040. }
  3041. const tip = this._getTipElement();
  3042. tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra
  3043. // empty mouseover listeners we added for iOS support
  3044. if ('ontouchstart' in document.documentElement) {
  3045. for (const element of [].concat(...document.body.children)) {
  3046. EventHandler.off(element, 'mouseover', noop);
  3047. }
  3048. }
  3049. this._activeTrigger[TRIGGER_CLICK] = false;
  3050. this._activeTrigger[TRIGGER_FOCUS] = false;
  3051. this._activeTrigger[TRIGGER_HOVER] = false;
  3052. this._isHovered = null; // it is a trick to support manual triggering
  3053. const complete = () => {
  3054. if (this._isWithActiveTrigger()) {
  3055. return;
  3056. }
  3057. if (!this._isHovered) {
  3058. tip.remove();
  3059. }
  3060. this._element.removeAttribute('aria-describedby');
  3061. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
  3062. this._disposePopper();
  3063. };
  3064. this._queueCallback(complete, this.tip, this._isAnimated());
  3065. }
  3066. update() {
  3067. if (this._popper) {
  3068. this._popper.update();
  3069. }
  3070. } // Protected
  3071. _isWithContent() {
  3072. return Boolean(this._getTitle());
  3073. }
  3074. _getTipElement() {
  3075. if (!this.tip) {
  3076. this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
  3077. }
  3078. return this.tip;
  3079. }
  3080. _createTipElement(content) {
  3081. const tip = this._getTemplateFactory(content).toHtml(); // todo: remove this check on v6
  3082. if (!tip) {
  3083. return null;
  3084. }
  3085. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); // todo: on v6 the following can be achieved with CSS only
  3086. tip.classList.add(`bs-${this.constructor.NAME}-auto`);
  3087. const tipId = getUID(this.constructor.NAME).toString();
  3088. tip.setAttribute('id', tipId);
  3089. if (this._isAnimated()) {
  3090. tip.classList.add(CLASS_NAME_FADE$2);
  3091. }
  3092. return tip;
  3093. }
  3094. setContent(content) {
  3095. this._newContent = content;
  3096. if (this._isShown()) {
  3097. this._disposePopper();
  3098. this.show();
  3099. }
  3100. }
  3101. _getTemplateFactory(content) {
  3102. if (this._templateFactory) {
  3103. this._templateFactory.changeContent(content);
  3104. } else {
  3105. this._templateFactory = new TemplateFactory({ ...this._config,
  3106. // the `content` var has to be after `this._config`
  3107. // to override config.content in case of popover
  3108. content,
  3109. extraClass: this._resolvePossibleFunction(this._config.customClass)
  3110. });
  3111. }
  3112. return this._templateFactory;
  3113. }
  3114. _getContentForTemplate() {
  3115. return {
  3116. [SELECTOR_TOOLTIP_INNER]: this._getTitle()
  3117. };
  3118. }
  3119. _getTitle() {
  3120. return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
  3121. } // Private
  3122. _initializeOnDelegatedTarget(event) {
  3123. return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
  3124. }
  3125. _isAnimated() {
  3126. return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
  3127. }
  3128. _isShown() {
  3129. return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
  3130. }
  3131. _createPopper(tip) {
  3132. const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
  3133. const attachment = AttachmentMap[placement.toUpperCase()];
  3134. return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
  3135. }
  3136. _getOffset() {
  3137. const {
  3138. offset
  3139. } = this._config;
  3140. if (typeof offset === 'string') {
  3141. return offset.split(',').map(value => Number.parseInt(value, 10));
  3142. }
  3143. if (typeof offset === 'function') {
  3144. return popperData => offset(popperData, this._element);
  3145. }
  3146. return offset;
  3147. }
  3148. _resolvePossibleFunction(arg) {
  3149. return typeof arg === 'function' ? arg.call(this._element) : arg;
  3150. }
  3151. _getPopperConfig(attachment) {
  3152. const defaultBsPopperConfig = {
  3153. placement: attachment,
  3154. modifiers: [{
  3155. name: 'flip',
  3156. options: {
  3157. fallbackPlacements: this._config.fallbackPlacements
  3158. }
  3159. }, {
  3160. name: 'offset',
  3161. options: {
  3162. offset: this._getOffset()
  3163. }
  3164. }, {
  3165. name: 'preventOverflow',
  3166. options: {
  3167. boundary: this._config.boundary
  3168. }
  3169. }, {
  3170. name: 'arrow',
  3171. options: {
  3172. element: `.${this.constructor.NAME}-arrow`
  3173. }
  3174. }, {
  3175. name: 'preSetPlacement',
  3176. enabled: true,
  3177. phase: 'beforeMain',
  3178. fn: data => {
  3179. // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
  3180. // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
  3181. this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
  3182. }
  3183. }]
  3184. };
  3185. return { ...defaultBsPopperConfig,
  3186. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  3187. };
  3188. }
  3189. _setListeners() {
  3190. const triggers = this._config.trigger.split(' ');
  3191. for (const trigger of triggers) {
  3192. if (trigger === 'click') {
  3193. EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => {
  3194. const context = this._initializeOnDelegatedTarget(event);
  3195. context.toggle();
  3196. });
  3197. } else if (trigger !== TRIGGER_MANUAL) {
  3198. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
  3199. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
  3200. EventHandler.on(this._element, eventIn, this._config.selector, event => {
  3201. const context = this._initializeOnDelegatedTarget(event);
  3202. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  3203. context._enter();
  3204. });
  3205. EventHandler.on(this._element, eventOut, this._config.selector, event => {
  3206. const context = this._initializeOnDelegatedTarget(event);
  3207. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  3208. context._leave();
  3209. });
  3210. }
  3211. }
  3212. this._hideModalHandler = () => {
  3213. if (this._element) {
  3214. this.hide();
  3215. }
  3216. };
  3217. EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3218. }
  3219. _fixTitle() {
  3220. const title = this._element.getAttribute('title');
  3221. if (!title) {
  3222. return;
  3223. }
  3224. if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
  3225. this._element.setAttribute('aria-label', title);
  3226. }
  3227. this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
  3228. this._element.removeAttribute('title');
  3229. }
  3230. _enter() {
  3231. if (this._isShown() || this._isHovered) {
  3232. this._isHovered = true;
  3233. return;
  3234. }
  3235. this._isHovered = true;
  3236. this._setTimeout(() => {
  3237. if (this._isHovered) {
  3238. this.show();
  3239. }
  3240. }, this._config.delay.show);
  3241. }
  3242. _leave() {
  3243. if (this._isWithActiveTrigger()) {
  3244. return;
  3245. }
  3246. this._isHovered = false;
  3247. this._setTimeout(() => {
  3248. if (!this._isHovered) {
  3249. this.hide();
  3250. }
  3251. }, this._config.delay.hide);
  3252. }
  3253. _setTimeout(handler, timeout) {
  3254. clearTimeout(this._timeout);
  3255. this._timeout = setTimeout(handler, timeout);
  3256. }
  3257. _isWithActiveTrigger() {
  3258. return Object.values(this._activeTrigger).includes(true);
  3259. }
  3260. _getConfig(config) {
  3261. const dataAttributes = Manipulator.getDataAttributes(this._element);
  3262. for (const dataAttribute of Object.keys(dataAttributes)) {
  3263. if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
  3264. delete dataAttributes[dataAttribute];
  3265. }
  3266. }
  3267. config = { ...dataAttributes,
  3268. ...(typeof config === 'object' && config ? config : {})
  3269. };
  3270. config = this._mergeConfigObj(config);
  3271. config = this._configAfterMerge(config);
  3272. this._typeCheckConfig(config);
  3273. return config;
  3274. }
  3275. _configAfterMerge(config) {
  3276. config.container = config.container === false ? document.body : getElement(config.container);
  3277. if (typeof config.delay === 'number') {
  3278. config.delay = {
  3279. show: config.delay,
  3280. hide: config.delay
  3281. };
  3282. }
  3283. if (typeof config.title === 'number') {
  3284. config.title = config.title.toString();
  3285. }
  3286. if (typeof config.content === 'number') {
  3287. config.content = config.content.toString();
  3288. }
  3289. return config;
  3290. }
  3291. _getDelegateConfig() {
  3292. const config = {};
  3293. for (const key in this._config) {
  3294. if (this.constructor.Default[key] !== this._config[key]) {
  3295. config[key] = this._config[key];
  3296. }
  3297. }
  3298. config.selector = false;
  3299. config.trigger = 'manual'; // In the future can be replaced with:
  3300. // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
  3301. // `Object.fromEntries(keysWithDifferentValues)`
  3302. return config;
  3303. }
  3304. _disposePopper() {
  3305. if (this._popper) {
  3306. this._popper.destroy();
  3307. this._popper = null;
  3308. }
  3309. } // Static
  3310. static jQueryInterface(config) {
  3311. return this.each(function () {
  3312. const data = Tooltip.getOrCreateInstance(this, config);
  3313. if (typeof config !== 'string') {
  3314. return;
  3315. }
  3316. if (typeof data[config] === 'undefined') {
  3317. throw new TypeError(`No method named "${config}"`);
  3318. }
  3319. data[config]();
  3320. });
  3321. }
  3322. }
  3323. /**
  3324. * jQuery
  3325. */
  3326. defineJQueryPlugin(Tooltip);
  3327. /**
  3328. * --------------------------------------------------------------------------
  3329. * Bootstrap (v5.2.2): popover.js
  3330. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3331. * --------------------------------------------------------------------------
  3332. */
  3333. /**
  3334. * Constants
  3335. */
  3336. const NAME$3 = 'popover';
  3337. const SELECTOR_TITLE = '.popover-header';
  3338. const SELECTOR_CONTENT = '.popover-body';
  3339. const Default$2 = { ...Tooltip.Default,
  3340. content: '',
  3341. offset: [0, 8],
  3342. placement: 'right',
  3343. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
  3344. trigger: 'click'
  3345. };
  3346. const DefaultType$2 = { ...Tooltip.DefaultType,
  3347. content: '(null|string|element|function)'
  3348. };
  3349. /**
  3350. * Class definition
  3351. */
  3352. class Popover extends Tooltip {
  3353. // Getters
  3354. static get Default() {
  3355. return Default$2;
  3356. }
  3357. static get DefaultType() {
  3358. return DefaultType$2;
  3359. }
  3360. static get NAME() {
  3361. return NAME$3;
  3362. } // Overrides
  3363. _isWithContent() {
  3364. return this._getTitle() || this._getContent();
  3365. } // Private
  3366. _getContentForTemplate() {
  3367. return {
  3368. [SELECTOR_TITLE]: this._getTitle(),
  3369. [SELECTOR_CONTENT]: this._getContent()
  3370. };
  3371. }
  3372. _getContent() {
  3373. return this._resolvePossibleFunction(this._config.content);
  3374. } // Static
  3375. static jQueryInterface(config) {
  3376. return this.each(function () {
  3377. const data = Popover.getOrCreateInstance(this, config);
  3378. if (typeof config !== 'string') {
  3379. return;
  3380. }
  3381. if (typeof data[config] === 'undefined') {
  3382. throw new TypeError(`No method named "${config}"`);
  3383. }
  3384. data[config]();
  3385. });
  3386. }
  3387. }
  3388. /**
  3389. * jQuery
  3390. */
  3391. defineJQueryPlugin(Popover);
  3392. /**
  3393. * --------------------------------------------------------------------------
  3394. * Bootstrap (v5.2.2): scrollspy.js
  3395. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3396. * --------------------------------------------------------------------------
  3397. */
  3398. /**
  3399. * Constants
  3400. */
  3401. const NAME$2 = 'scrollspy';
  3402. const DATA_KEY$2 = 'bs.scrollspy';
  3403. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  3404. const DATA_API_KEY = '.data-api';
  3405. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  3406. const EVENT_CLICK = `click${EVENT_KEY$2}`;
  3407. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
  3408. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  3409. const CLASS_NAME_ACTIVE$1 = 'active';
  3410. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  3411. const SELECTOR_TARGET_LINKS = '[href]';
  3412. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  3413. const SELECTOR_NAV_LINKS = '.nav-link';
  3414. const SELECTOR_NAV_ITEMS = '.nav-item';
  3415. const SELECTOR_LIST_ITEMS = '.list-group-item';
  3416. const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
  3417. const SELECTOR_DROPDOWN = '.dropdown';
  3418. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  3419. const Default$1 = {
  3420. offset: null,
  3421. // TODO: v6 @deprecated, keep it for backwards compatibility reasons
  3422. rootMargin: '0px 0px -25%',
  3423. smoothScroll: false,
  3424. target: null,
  3425. threshold: [0.1, 0.5, 1]
  3426. };
  3427. const DefaultType$1 = {
  3428. offset: '(number|null)',
  3429. // TODO v6 @deprecated, keep it for backwards compatibility reasons
  3430. rootMargin: 'string',
  3431. smoothScroll: 'boolean',
  3432. target: 'element',
  3433. threshold: 'array'
  3434. };
  3435. /**
  3436. * Class definition
  3437. */
  3438. class ScrollSpy extends BaseComponent {
  3439. constructor(element, config) {
  3440. super(element, config); // this._element is the observablesContainer and config.target the menu links wrapper
  3441. this._targetLinks = new Map();
  3442. this._observableSections = new Map();
  3443. this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
  3444. this._activeTarget = null;
  3445. this._observer = null;
  3446. this._previousScrollData = {
  3447. visibleEntryTop: 0,
  3448. parentScrollTop: 0
  3449. };
  3450. this.refresh(); // initialize
  3451. } // Getters
  3452. static get Default() {
  3453. return Default$1;
  3454. }
  3455. static get DefaultType() {
  3456. return DefaultType$1;
  3457. }
  3458. static get NAME() {
  3459. return NAME$2;
  3460. } // Public
  3461. refresh() {
  3462. this._initializeTargetsAndObservables();
  3463. this._maybeEnableSmoothScroll();
  3464. if (this._observer) {
  3465. this._observer.disconnect();
  3466. } else {
  3467. this._observer = this._getNewObserver();
  3468. }
  3469. for (const section of this._observableSections.values()) {
  3470. this._observer.observe(section);
  3471. }
  3472. }
  3473. dispose() {
  3474. this._observer.disconnect();
  3475. super.dispose();
  3476. } // Private
  3477. _configAfterMerge(config) {
  3478. // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
  3479. config.target = getElement(config.target) || document.body; // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
  3480. config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
  3481. if (typeof config.threshold === 'string') {
  3482. config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
  3483. }
  3484. return config;
  3485. }
  3486. _maybeEnableSmoothScroll() {
  3487. if (!this._config.smoothScroll) {
  3488. return;
  3489. } // unregister any previous listeners
  3490. EventHandler.off(this._config.target, EVENT_CLICK);
  3491. EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
  3492. const observableSection = this._observableSections.get(event.target.hash);
  3493. if (observableSection) {
  3494. event.preventDefault();
  3495. const root = this._rootElement || window;
  3496. const height = observableSection.offsetTop - this._element.offsetTop;
  3497. if (root.scrollTo) {
  3498. root.scrollTo({
  3499. top: height,
  3500. behavior: 'smooth'
  3501. });
  3502. return;
  3503. } // Chrome 60 doesn't support `scrollTo`
  3504. root.scrollTop = height;
  3505. }
  3506. });
  3507. }
  3508. _getNewObserver() {
  3509. const options = {
  3510. root: this._rootElement,
  3511. threshold: this._config.threshold,
  3512. rootMargin: this._config.rootMargin
  3513. };
  3514. return new IntersectionObserver(entries => this._observerCallback(entries), options);
  3515. } // The logic of selection
  3516. _observerCallback(entries) {
  3517. const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
  3518. const activate = entry => {
  3519. this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
  3520. this._process(targetElement(entry));
  3521. };
  3522. const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
  3523. const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
  3524. this._previousScrollData.parentScrollTop = parentScrollTop;
  3525. for (const entry of entries) {
  3526. if (!entry.isIntersecting) {
  3527. this._activeTarget = null;
  3528. this._clearActiveClass(targetElement(entry));
  3529. continue;
  3530. }
  3531. const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; // if we are scrolling down, pick the bigger offsetTop
  3532. if (userScrollsDown && entryIsLowerThanPrevious) {
  3533. activate(entry); // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
  3534. if (!parentScrollTop) {
  3535. return;
  3536. }
  3537. continue;
  3538. } // if we are scrolling up, pick the smallest offsetTop
  3539. if (!userScrollsDown && !entryIsLowerThanPrevious) {
  3540. activate(entry);
  3541. }
  3542. }
  3543. }
  3544. _initializeTargetsAndObservables() {
  3545. this._targetLinks = new Map();
  3546. this._observableSections = new Map();
  3547. const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
  3548. for (const anchor of targetLinks) {
  3549. // ensure that the anchor has an id and is not disabled
  3550. if (!anchor.hash || isDisabled(anchor)) {
  3551. continue;
  3552. }
  3553. const observableSection = SelectorEngine.findOne(anchor.hash, this._element); // ensure that the observableSection exists & is visible
  3554. if (isVisible(observableSection)) {
  3555. this._targetLinks.set(anchor.hash, anchor);
  3556. this._observableSections.set(anchor.hash, observableSection);
  3557. }
  3558. }
  3559. }
  3560. _process(target) {
  3561. if (this._activeTarget === target) {
  3562. return;
  3563. }
  3564. this._clearActiveClass(this._config.target);
  3565. this._activeTarget = target;
  3566. target.classList.add(CLASS_NAME_ACTIVE$1);
  3567. this._activateParents(target);
  3568. EventHandler.trigger(this._element, EVENT_ACTIVATE, {
  3569. relatedTarget: target
  3570. });
  3571. }
  3572. _activateParents(target) {
  3573. // Activate dropdown parents
  3574. if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  3575. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
  3576. return;
  3577. }
  3578. for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
  3579. // Set triggered links parents as active
  3580. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  3581. for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
  3582. item.classList.add(CLASS_NAME_ACTIVE$1);
  3583. }
  3584. }
  3585. }
  3586. _clearActiveClass(parent) {
  3587. parent.classList.remove(CLASS_NAME_ACTIVE$1);
  3588. const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
  3589. for (const node of activeNodes) {
  3590. node.classList.remove(CLASS_NAME_ACTIVE$1);
  3591. }
  3592. } // Static
  3593. static jQueryInterface(config) {
  3594. return this.each(function () {
  3595. const data = ScrollSpy.getOrCreateInstance(this, config);
  3596. if (typeof config !== 'string') {
  3597. return;
  3598. }
  3599. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3600. throw new TypeError(`No method named "${config}"`);
  3601. }
  3602. data[config]();
  3603. });
  3604. }
  3605. }
  3606. /**
  3607. * Data API implementation
  3608. */
  3609. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
  3610. for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
  3611. ScrollSpy.getOrCreateInstance(spy);
  3612. }
  3613. });
  3614. /**
  3615. * jQuery
  3616. */
  3617. defineJQueryPlugin(ScrollSpy);
  3618. /**
  3619. * --------------------------------------------------------------------------
  3620. * Bootstrap (v5.2.2): tab.js
  3621. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3622. * --------------------------------------------------------------------------
  3623. */
  3624. /**
  3625. * Constants
  3626. */
  3627. const NAME$1 = 'tab';
  3628. const DATA_KEY$1 = 'bs.tab';
  3629. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  3630. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  3631. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  3632. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  3633. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  3634. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
  3635. const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
  3636. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
  3637. const ARROW_LEFT_KEY = 'ArrowLeft';
  3638. const ARROW_RIGHT_KEY = 'ArrowRight';
  3639. const ARROW_UP_KEY = 'ArrowUp';
  3640. const ARROW_DOWN_KEY = 'ArrowDown';
  3641. const CLASS_NAME_ACTIVE = 'active';
  3642. const CLASS_NAME_FADE$1 = 'fade';
  3643. const CLASS_NAME_SHOW$1 = 'show';
  3644. const CLASS_DROPDOWN = 'dropdown';
  3645. const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  3646. const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
  3647. const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)';
  3648. const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
  3649. const SELECTOR_OUTER = '.nav-item, .list-group-item';
  3650. const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
  3651. const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // todo:v6: could be only `tab`
  3652. const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
  3653. const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
  3654. /**
  3655. * Class definition
  3656. */
  3657. class Tab extends BaseComponent {
  3658. constructor(element) {
  3659. super(element);
  3660. this._parent = this._element.closest(SELECTOR_TAB_PANEL);
  3661. if (!this._parent) {
  3662. return; // todo: should Throw exception on v6
  3663. // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
  3664. } // Set up initial aria attributes
  3665. this._setInitialAttributes(this._parent, this._getChildren());
  3666. EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
  3667. } // Getters
  3668. static get NAME() {
  3669. return NAME$1;
  3670. } // Public
  3671. show() {
  3672. // Shows this elem and deactivate the active sibling if exists
  3673. const innerElem = this._element;
  3674. if (this._elemIsActive(innerElem)) {
  3675. return;
  3676. } // Search for active tab on same parent to deactivate it
  3677. const active = this._getActiveElem();
  3678. const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
  3679. relatedTarget: innerElem
  3680. }) : null;
  3681. const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
  3682. relatedTarget: active
  3683. });
  3684. if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
  3685. return;
  3686. }
  3687. this._deactivate(active, innerElem);
  3688. this._activate(innerElem, active);
  3689. } // Private
  3690. _activate(element, relatedElem) {
  3691. if (!element) {
  3692. return;
  3693. }
  3694. element.classList.add(CLASS_NAME_ACTIVE);
  3695. this._activate(getElementFromSelector(element)); // Search and activate/show the proper section
  3696. const complete = () => {
  3697. if (element.getAttribute('role') !== 'tab') {
  3698. element.classList.add(CLASS_NAME_SHOW$1);
  3699. return;
  3700. }
  3701. element.removeAttribute('tabindex');
  3702. element.setAttribute('aria-selected', true);
  3703. this._toggleDropDown(element, true);
  3704. EventHandler.trigger(element, EVENT_SHOWN$1, {
  3705. relatedTarget: relatedElem
  3706. });
  3707. };
  3708. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  3709. }
  3710. _deactivate(element, relatedElem) {
  3711. if (!element) {
  3712. return;
  3713. }
  3714. element.classList.remove(CLASS_NAME_ACTIVE);
  3715. element.blur();
  3716. this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too
  3717. const complete = () => {
  3718. if (element.getAttribute('role') !== 'tab') {
  3719. element.classList.remove(CLASS_NAME_SHOW$1);
  3720. return;
  3721. }
  3722. element.setAttribute('aria-selected', false);
  3723. element.setAttribute('tabindex', '-1');
  3724. this._toggleDropDown(element, false);
  3725. EventHandler.trigger(element, EVENT_HIDDEN$1, {
  3726. relatedTarget: relatedElem
  3727. });
  3728. };
  3729. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  3730. }
  3731. _keydown(event) {
  3732. if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
  3733. return;
  3734. }
  3735. event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
  3736. event.preventDefault();
  3737. const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
  3738. const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
  3739. if (nextActiveElement) {
  3740. nextActiveElement.focus({
  3741. preventScroll: true
  3742. });
  3743. Tab.getOrCreateInstance(nextActiveElement).show();
  3744. }
  3745. }
  3746. _getChildren() {
  3747. // collection of inner elements
  3748. return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
  3749. }
  3750. _getActiveElem() {
  3751. return this._getChildren().find(child => this._elemIsActive(child)) || null;
  3752. }
  3753. _setInitialAttributes(parent, children) {
  3754. this._setAttributeIfNotExists(parent, 'role', 'tablist');
  3755. for (const child of children) {
  3756. this._setInitialAttributesOnChild(child);
  3757. }
  3758. }
  3759. _setInitialAttributesOnChild(child) {
  3760. child = this._getInnerElement(child);
  3761. const isActive = this._elemIsActive(child);
  3762. const outerElem = this._getOuterElement(child);
  3763. child.setAttribute('aria-selected', isActive);
  3764. if (outerElem !== child) {
  3765. this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
  3766. }
  3767. if (!isActive) {
  3768. child.setAttribute('tabindex', '-1');
  3769. }
  3770. this._setAttributeIfNotExists(child, 'role', 'tab'); // set attributes to the related panel too
  3771. this._setInitialAttributesOnTargetPanel(child);
  3772. }
  3773. _setInitialAttributesOnTargetPanel(child) {
  3774. const target = getElementFromSelector(child);
  3775. if (!target) {
  3776. return;
  3777. }
  3778. this._setAttributeIfNotExists(target, 'role', 'tabpanel');
  3779. if (child.id) {
  3780. this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`);
  3781. }
  3782. }
  3783. _toggleDropDown(element, open) {
  3784. const outerElem = this._getOuterElement(element);
  3785. if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
  3786. return;
  3787. }
  3788. const toggle = (selector, className) => {
  3789. const element = SelectorEngine.findOne(selector, outerElem);
  3790. if (element) {
  3791. element.classList.toggle(className, open);
  3792. }
  3793. };
  3794. toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
  3795. toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
  3796. outerElem.setAttribute('aria-expanded', open);
  3797. }
  3798. _setAttributeIfNotExists(element, attribute, value) {
  3799. if (!element.hasAttribute(attribute)) {
  3800. element.setAttribute(attribute, value);
  3801. }
  3802. }
  3803. _elemIsActive(elem) {
  3804. return elem.classList.contains(CLASS_NAME_ACTIVE);
  3805. } // Try to get the inner element (usually the .nav-link)
  3806. _getInnerElement(elem) {
  3807. return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
  3808. } // Try to get the outer element (usually the .nav-item)
  3809. _getOuterElement(elem) {
  3810. return elem.closest(SELECTOR_OUTER) || elem;
  3811. } // Static
  3812. static jQueryInterface(config) {
  3813. return this.each(function () {
  3814. const data = Tab.getOrCreateInstance(this);
  3815. if (typeof config !== 'string') {
  3816. return;
  3817. }
  3818. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3819. throw new TypeError(`No method named "${config}"`);
  3820. }
  3821. data[config]();
  3822. });
  3823. }
  3824. }
  3825. /**
  3826. * Data API implementation
  3827. */
  3828. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  3829. if (['A', 'AREA'].includes(this.tagName)) {
  3830. event.preventDefault();
  3831. }
  3832. if (isDisabled(this)) {
  3833. return;
  3834. }
  3835. Tab.getOrCreateInstance(this).show();
  3836. });
  3837. /**
  3838. * Initialize on focus
  3839. */
  3840. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  3841. for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
  3842. Tab.getOrCreateInstance(element);
  3843. }
  3844. });
  3845. /**
  3846. * jQuery
  3847. */
  3848. defineJQueryPlugin(Tab);
  3849. /**
  3850. * --------------------------------------------------------------------------
  3851. * Bootstrap (v5.2.2): toast.js
  3852. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3853. * --------------------------------------------------------------------------
  3854. */
  3855. /**
  3856. * Constants
  3857. */
  3858. const NAME = 'toast';
  3859. const DATA_KEY = 'bs.toast';
  3860. const EVENT_KEY = `.${DATA_KEY}`;
  3861. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  3862. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  3863. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  3864. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  3865. const EVENT_HIDE = `hide${EVENT_KEY}`;
  3866. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  3867. const EVENT_SHOW = `show${EVENT_KEY}`;
  3868. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  3869. const CLASS_NAME_FADE = 'fade';
  3870. const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
  3871. const CLASS_NAME_SHOW = 'show';
  3872. const CLASS_NAME_SHOWING = 'showing';
  3873. const DefaultType = {
  3874. animation: 'boolean',
  3875. autohide: 'boolean',
  3876. delay: 'number'
  3877. };
  3878. const Default = {
  3879. animation: true,
  3880. autohide: true,
  3881. delay: 5000
  3882. };
  3883. /**
  3884. * Class definition
  3885. */
  3886. class Toast extends BaseComponent {
  3887. constructor(element, config) {
  3888. super(element, config);
  3889. this._timeout = null;
  3890. this._hasMouseInteraction = false;
  3891. this._hasKeyboardInteraction = false;
  3892. this._setListeners();
  3893. } // Getters
  3894. static get Default() {
  3895. return Default;
  3896. }
  3897. static get DefaultType() {
  3898. return DefaultType;
  3899. }
  3900. static get NAME() {
  3901. return NAME;
  3902. } // Public
  3903. show() {
  3904. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  3905. if (showEvent.defaultPrevented) {
  3906. return;
  3907. }
  3908. this._clearTimeout();
  3909. if (this._config.animation) {
  3910. this._element.classList.add(CLASS_NAME_FADE);
  3911. }
  3912. const complete = () => {
  3913. this._element.classList.remove(CLASS_NAME_SHOWING);
  3914. EventHandler.trigger(this._element, EVENT_SHOWN);
  3915. this._maybeScheduleHide();
  3916. };
  3917. this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
  3918. reflow(this._element);
  3919. this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
  3920. this._queueCallback(complete, this._element, this._config.animation);
  3921. }
  3922. hide() {
  3923. if (!this.isShown()) {
  3924. return;
  3925. }
  3926. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  3927. if (hideEvent.defaultPrevented) {
  3928. return;
  3929. }
  3930. const complete = () => {
  3931. this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
  3932. this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
  3933. EventHandler.trigger(this._element, EVENT_HIDDEN);
  3934. };
  3935. this._element.classList.add(CLASS_NAME_SHOWING);
  3936. this._queueCallback(complete, this._element, this._config.animation);
  3937. }
  3938. dispose() {
  3939. this._clearTimeout();
  3940. if (this.isShown()) {
  3941. this._element.classList.remove(CLASS_NAME_SHOW);
  3942. }
  3943. super.dispose();
  3944. }
  3945. isShown() {
  3946. return this._element.classList.contains(CLASS_NAME_SHOW);
  3947. } // Private
  3948. _maybeScheduleHide() {
  3949. if (!this._config.autohide) {
  3950. return;
  3951. }
  3952. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  3953. return;
  3954. }
  3955. this._timeout = setTimeout(() => {
  3956. this.hide();
  3957. }, this._config.delay);
  3958. }
  3959. _onInteraction(event, isInteracting) {
  3960. switch (event.type) {
  3961. case 'mouseover':
  3962. case 'mouseout':
  3963. {
  3964. this._hasMouseInteraction = isInteracting;
  3965. break;
  3966. }
  3967. case 'focusin':
  3968. case 'focusout':
  3969. {
  3970. this._hasKeyboardInteraction = isInteracting;
  3971. break;
  3972. }
  3973. }
  3974. if (isInteracting) {
  3975. this._clearTimeout();
  3976. return;
  3977. }
  3978. const nextElement = event.relatedTarget;
  3979. if (this._element === nextElement || this._element.contains(nextElement)) {
  3980. return;
  3981. }
  3982. this._maybeScheduleHide();
  3983. }
  3984. _setListeners() {
  3985. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  3986. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  3987. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  3988. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  3989. }
  3990. _clearTimeout() {
  3991. clearTimeout(this._timeout);
  3992. this._timeout = null;
  3993. } // Static
  3994. static jQueryInterface(config) {
  3995. return this.each(function () {
  3996. const data = Toast.getOrCreateInstance(this, config);
  3997. if (typeof config === 'string') {
  3998. if (typeof data[config] === 'undefined') {
  3999. throw new TypeError(`No method named "${config}"`);
  4000. }
  4001. data[config](this);
  4002. }
  4003. });
  4004. }
  4005. }
  4006. /**
  4007. * Data API implementation
  4008. */
  4009. enableDismissTrigger(Toast);
  4010. /**
  4011. * jQuery
  4012. */
  4013. defineJQueryPlugin(Toast);
  4014. export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Offcanvas, Popover, ScrollSpy, Tab, Toast, Tooltip };
  4015. //# sourceMappingURL=bootstrap.esm.js.map