bootstrap.esm.js 136 KB

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