bootstrap.js 145 KB

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