דברים שרואים מכאן לא רואים בכלל
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

bootstrap.js 142KB

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