bootstrap.js 142 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497
  1. /*!
  2. * Bootstrap v5.3.7 (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.7';
  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. // Explicitly return focus to the trigger element
  1746. this._element.focus();
  1747. }
  1748. _getConfig(config) {
  1749. config = super._getConfig(config);
  1750. if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
  1751. // Popper virtual elements require a getBoundingClientRect method
  1752. throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
  1753. }
  1754. return config;
  1755. }
  1756. _createPopper() {
  1757. if (typeof Popper__namespace === 'undefined') {
  1758. throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org/docs/v2/)');
  1759. }
  1760. let referenceElement = this._element;
  1761. if (this._config.reference === 'parent') {
  1762. referenceElement = this._parent;
  1763. } else if (isElement(this._config.reference)) {
  1764. referenceElement = getElement(this._config.reference);
  1765. } else if (typeof this._config.reference === 'object') {
  1766. referenceElement = this._config.reference;
  1767. }
  1768. const popperConfig = this._getPopperConfig();
  1769. this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
  1770. }
  1771. _isShown() {
  1772. return this._menu.classList.contains(CLASS_NAME_SHOW$6);
  1773. }
  1774. _getPlacement() {
  1775. const parentDropdown = this._parent;
  1776. if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
  1777. return PLACEMENT_RIGHT;
  1778. }
  1779. if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
  1780. return PLACEMENT_LEFT;
  1781. }
  1782. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
  1783. return PLACEMENT_TOPCENTER;
  1784. }
  1785. if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
  1786. return PLACEMENT_BOTTOMCENTER;
  1787. }
  1788. // We need to trim the value because custom properties can also include spaces
  1789. const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
  1790. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
  1791. return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  1792. }
  1793. return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
  1794. }
  1795. _detectNavbar() {
  1796. return this._element.closest(SELECTOR_NAVBAR) !== null;
  1797. }
  1798. _getOffset() {
  1799. const {
  1800. offset
  1801. } = this._config;
  1802. if (typeof offset === 'string') {
  1803. return offset.split(',').map(value => Number.parseInt(value, 10));
  1804. }
  1805. if (typeof offset === 'function') {
  1806. return popperData => offset(popperData, this._element);
  1807. }
  1808. return offset;
  1809. }
  1810. _getPopperConfig() {
  1811. const defaultBsPopperConfig = {
  1812. placement: this._getPlacement(),
  1813. modifiers: [{
  1814. name: 'preventOverflow',
  1815. options: {
  1816. boundary: this._config.boundary
  1817. }
  1818. }, {
  1819. name: 'offset',
  1820. options: {
  1821. offset: this._getOffset()
  1822. }
  1823. }]
  1824. };
  1825. // Disable Popper if we have a static display or Dropdown is in Navbar
  1826. if (this._inNavbar || this._config.display === 'static') {
  1827. Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // TODO: v6 remove
  1828. defaultBsPopperConfig.modifiers = [{
  1829. name: 'applyStyles',
  1830. enabled: false
  1831. }];
  1832. }
  1833. return {
  1834. ...defaultBsPopperConfig,
  1835. ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
  1836. };
  1837. }
  1838. _selectMenuItem({
  1839. key,
  1840. target
  1841. }) {
  1842. const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element));
  1843. if (!items.length) {
  1844. return;
  1845. }
  1846. // if target isn't included in items (e.g. when expanding the dropdown)
  1847. // allow cycling to get the last item in case key equals ARROW_UP_KEY
  1848. getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
  1849. }
  1850. // Static
  1851. static jQueryInterface(config) {
  1852. return this.each(function () {
  1853. const data = Dropdown.getOrCreateInstance(this, config);
  1854. if (typeof config !== 'string') {
  1855. return;
  1856. }
  1857. if (typeof data[config] === 'undefined') {
  1858. throw new TypeError(`No method named "${config}"`);
  1859. }
  1860. data[config]();
  1861. });
  1862. }
  1863. static clearMenus(event) {
  1864. if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) {
  1865. return;
  1866. }
  1867. const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);
  1868. for (const toggle of openToggles) {
  1869. const context = Dropdown.getInstance(toggle);
  1870. if (!context || context._config.autoClose === false) {
  1871. continue;
  1872. }
  1873. const composedPath = event.composedPath();
  1874. const isMenuTarget = composedPath.includes(context._menu);
  1875. if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
  1876. continue;
  1877. }
  1878. // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
  1879. if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
  1880. continue;
  1881. }
  1882. const relatedTarget = {
  1883. relatedTarget: context._element
  1884. };
  1885. if (event.type === 'click') {
  1886. relatedTarget.clickEvent = event;
  1887. }
  1888. context._completeHide(relatedTarget);
  1889. }
  1890. }
  1891. static dataApiKeydownHandler(event) {
  1892. // If not an UP | DOWN | ESCAPE key => not a dropdown command
  1893. // If input/textarea && if key is other than ESCAPE => not a dropdown command
  1894. const isInput = /input|textarea/i.test(event.target.tagName);
  1895. const isEscapeEvent = event.key === ESCAPE_KEY$2;
  1896. const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key);
  1897. if (!isUpOrDownEvent && !isEscapeEvent) {
  1898. return;
  1899. }
  1900. if (isInput && !isEscapeEvent) {
  1901. return;
  1902. }
  1903. event.preventDefault();
  1904. // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
  1905. 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);
  1906. const instance = Dropdown.getOrCreateInstance(getToggleButton);
  1907. if (isUpOrDownEvent) {
  1908. event.stopPropagation();
  1909. instance.show();
  1910. instance._selectMenuItem(event);
  1911. return;
  1912. }
  1913. if (instance._isShown()) {
  1914. // else is escape and we check if it is shown
  1915. event.stopPropagation();
  1916. instance.hide();
  1917. getToggleButton.focus();
  1918. }
  1919. }
  1920. }
  1921. /**
  1922. * Data API implementation
  1923. */
  1924. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler);
  1925. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  1926. EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus);
  1927. EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  1928. EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
  1929. event.preventDefault();
  1930. Dropdown.getOrCreateInstance(this).toggle();
  1931. });
  1932. /**
  1933. * jQuery
  1934. */
  1935. defineJQueryPlugin(Dropdown);
  1936. /**
  1937. * --------------------------------------------------------------------------
  1938. * Bootstrap util/backdrop.js
  1939. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1940. * --------------------------------------------------------------------------
  1941. */
  1942. /**
  1943. * Constants
  1944. */
  1945. const NAME$9 = 'backdrop';
  1946. const CLASS_NAME_FADE$4 = 'fade';
  1947. const CLASS_NAME_SHOW$5 = 'show';
  1948. const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
  1949. const Default$8 = {
  1950. className: 'modal-backdrop',
  1951. clickCallback: null,
  1952. isAnimated: false,
  1953. isVisible: true,
  1954. // if false, we use the backdrop helper without adding any element to the dom
  1955. rootElement: 'body' // give the choice to place backdrop under different elements
  1956. };
  1957. const DefaultType$8 = {
  1958. className: 'string',
  1959. clickCallback: '(function|null)',
  1960. isAnimated: 'boolean',
  1961. isVisible: 'boolean',
  1962. rootElement: '(element|string)'
  1963. };
  1964. /**
  1965. * Class definition
  1966. */
  1967. class Backdrop extends Config {
  1968. constructor(config) {
  1969. super();
  1970. this._config = this._getConfig(config);
  1971. this._isAppended = false;
  1972. this._element = null;
  1973. }
  1974. // Getters
  1975. static get Default() {
  1976. return Default$8;
  1977. }
  1978. static get DefaultType() {
  1979. return DefaultType$8;
  1980. }
  1981. static get NAME() {
  1982. return NAME$9;
  1983. }
  1984. // Public
  1985. show(callback) {
  1986. if (!this._config.isVisible) {
  1987. execute(callback);
  1988. return;
  1989. }
  1990. this._append();
  1991. const element = this._getElement();
  1992. if (this._config.isAnimated) {
  1993. reflow(element);
  1994. }
  1995. element.classList.add(CLASS_NAME_SHOW$5);
  1996. this._emulateAnimation(() => {
  1997. execute(callback);
  1998. });
  1999. }
  2000. hide(callback) {
  2001. if (!this._config.isVisible) {
  2002. execute(callback);
  2003. return;
  2004. }
  2005. this._getElement().classList.remove(CLASS_NAME_SHOW$5);
  2006. this._emulateAnimation(() => {
  2007. this.dispose();
  2008. execute(callback);
  2009. });
  2010. }
  2011. dispose() {
  2012. if (!this._isAppended) {
  2013. return;
  2014. }
  2015. EventHandler.off(this._element, EVENT_MOUSEDOWN);
  2016. this._element.remove();
  2017. this._isAppended = false;
  2018. }
  2019. // Private
  2020. _getElement() {
  2021. if (!this._element) {
  2022. const backdrop = document.createElement('div');
  2023. backdrop.className = this._config.className;
  2024. if (this._config.isAnimated) {
  2025. backdrop.classList.add(CLASS_NAME_FADE$4);
  2026. }
  2027. this._element = backdrop;
  2028. }
  2029. return this._element;
  2030. }
  2031. _configAfterMerge(config) {
  2032. // use getElement() with the default "body" to get a fresh Element on each instantiation
  2033. config.rootElement = getElement(config.rootElement);
  2034. return config;
  2035. }
  2036. _append() {
  2037. if (this._isAppended) {
  2038. return;
  2039. }
  2040. const element = this._getElement();
  2041. this._config.rootElement.append(element);
  2042. EventHandler.on(element, EVENT_MOUSEDOWN, () => {
  2043. execute(this._config.clickCallback);
  2044. });
  2045. this._isAppended = true;
  2046. }
  2047. _emulateAnimation(callback) {
  2048. executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
  2049. }
  2050. }
  2051. /**
  2052. * --------------------------------------------------------------------------
  2053. * Bootstrap util/focustrap.js
  2054. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2055. * --------------------------------------------------------------------------
  2056. */
  2057. /**
  2058. * Constants
  2059. */
  2060. const NAME$8 = 'focustrap';
  2061. const DATA_KEY$5 = 'bs.focustrap';
  2062. const EVENT_KEY$5 = `.${DATA_KEY$5}`;
  2063. const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
  2064. const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
  2065. const TAB_KEY = 'Tab';
  2066. const TAB_NAV_FORWARD = 'forward';
  2067. const TAB_NAV_BACKWARD = 'backward';
  2068. const Default$7 = {
  2069. autofocus: true,
  2070. trapElement: null // The element to trap focus inside of
  2071. };
  2072. const DefaultType$7 = {
  2073. autofocus: 'boolean',
  2074. trapElement: 'element'
  2075. };
  2076. /**
  2077. * Class definition
  2078. */
  2079. class FocusTrap extends Config {
  2080. constructor(config) {
  2081. super();
  2082. this._config = this._getConfig(config);
  2083. this._isActive = false;
  2084. this._lastTabNavDirection = null;
  2085. }
  2086. // Getters
  2087. static get Default() {
  2088. return Default$7;
  2089. }
  2090. static get DefaultType() {
  2091. return DefaultType$7;
  2092. }
  2093. static get NAME() {
  2094. return NAME$8;
  2095. }
  2096. // Public
  2097. activate() {
  2098. if (this._isActive) {
  2099. return;
  2100. }
  2101. if (this._config.autofocus) {
  2102. this._config.trapElement.focus();
  2103. }
  2104. EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop
  2105. EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event));
  2106. EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
  2107. this._isActive = true;
  2108. }
  2109. deactivate() {
  2110. if (!this._isActive) {
  2111. return;
  2112. }
  2113. this._isActive = false;
  2114. EventHandler.off(document, EVENT_KEY$5);
  2115. }
  2116. // Private
  2117. _handleFocusin(event) {
  2118. const {
  2119. trapElement
  2120. } = this._config;
  2121. if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
  2122. return;
  2123. }
  2124. const elements = SelectorEngine.focusableChildren(trapElement);
  2125. if (elements.length === 0) {
  2126. trapElement.focus();
  2127. } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
  2128. elements[elements.length - 1].focus();
  2129. } else {
  2130. elements[0].focus();
  2131. }
  2132. }
  2133. _handleKeydown(event) {
  2134. if (event.key !== TAB_KEY) {
  2135. return;
  2136. }
  2137. this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
  2138. }
  2139. }
  2140. /**
  2141. * --------------------------------------------------------------------------
  2142. * Bootstrap util/scrollBar.js
  2143. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2144. * --------------------------------------------------------------------------
  2145. */
  2146. /**
  2147. * Constants
  2148. */
  2149. const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  2150. const SELECTOR_STICKY_CONTENT = '.sticky-top';
  2151. const PROPERTY_PADDING = 'padding-right';
  2152. const PROPERTY_MARGIN = 'margin-right';
  2153. /**
  2154. * Class definition
  2155. */
  2156. class ScrollBarHelper {
  2157. constructor() {
  2158. this._element = document.body;
  2159. }
  2160. // Public
  2161. getWidth() {
  2162. // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
  2163. const documentWidth = document.documentElement.clientWidth;
  2164. return Math.abs(window.innerWidth - documentWidth);
  2165. }
  2166. hide() {
  2167. const width = this.getWidth();
  2168. this._disableOverFlow();
  2169. // give padding to element to balance the hidden scrollbar width
  2170. this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
  2171. // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
  2172. this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
  2173. this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
  2174. }
  2175. reset() {
  2176. this._resetElementAttributes(this._element, 'overflow');
  2177. this._resetElementAttributes(this._element, PROPERTY_PADDING);
  2178. this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
  2179. this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
  2180. }
  2181. isOverflowing() {
  2182. return this.getWidth() > 0;
  2183. }
  2184. // Private
  2185. _disableOverFlow() {
  2186. this._saveInitialAttribute(this._element, 'overflow');
  2187. this._element.style.overflow = 'hidden';
  2188. }
  2189. _setElementAttributes(selector, styleProperty, callback) {
  2190. const scrollbarWidth = this.getWidth();
  2191. const manipulationCallBack = element => {
  2192. if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
  2193. return;
  2194. }
  2195. this._saveInitialAttribute(element, styleProperty);
  2196. const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
  2197. element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
  2198. };
  2199. this._applyManipulationCallback(selector, manipulationCallBack);
  2200. }
  2201. _saveInitialAttribute(element, styleProperty) {
  2202. const actualValue = element.style.getPropertyValue(styleProperty);
  2203. if (actualValue) {
  2204. Manipulator.setDataAttribute(element, styleProperty, actualValue);
  2205. }
  2206. }
  2207. _resetElementAttributes(selector, styleProperty) {
  2208. const manipulationCallBack = element => {
  2209. const value = Manipulator.getDataAttribute(element, styleProperty);
  2210. // We only want to remove the property if the value is `null`; the value can also be zero
  2211. if (value === null) {
  2212. element.style.removeProperty(styleProperty);
  2213. return;
  2214. }
  2215. Manipulator.removeDataAttribute(element, styleProperty);
  2216. element.style.setProperty(styleProperty, value);
  2217. };
  2218. this._applyManipulationCallback(selector, manipulationCallBack);
  2219. }
  2220. _applyManipulationCallback(selector, callBack) {
  2221. if (isElement(selector)) {
  2222. callBack(selector);
  2223. return;
  2224. }
  2225. for (const sel of SelectorEngine.find(selector, this._element)) {
  2226. callBack(sel);
  2227. }
  2228. }
  2229. }
  2230. /**
  2231. * --------------------------------------------------------------------------
  2232. * Bootstrap modal.js
  2233. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2234. * --------------------------------------------------------------------------
  2235. */
  2236. /**
  2237. * Constants
  2238. */
  2239. const NAME$7 = 'modal';
  2240. const DATA_KEY$4 = 'bs.modal';
  2241. const EVENT_KEY$4 = `.${DATA_KEY$4}`;
  2242. const DATA_API_KEY$2 = '.data-api';
  2243. const ESCAPE_KEY$1 = 'Escape';
  2244. const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
  2245. const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
  2246. const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
  2247. const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
  2248. const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
  2249. const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
  2250. const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
  2251. const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
  2252. const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
  2253. const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
  2254. const CLASS_NAME_OPEN = 'modal-open';
  2255. const CLASS_NAME_FADE$3 = 'fade';
  2256. const CLASS_NAME_SHOW$4 = 'show';
  2257. const CLASS_NAME_STATIC = 'modal-static';
  2258. const OPEN_SELECTOR$1 = '.modal.show';
  2259. const SELECTOR_DIALOG = '.modal-dialog';
  2260. const SELECTOR_MODAL_BODY = '.modal-body';
  2261. const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
  2262. const Default$6 = {
  2263. backdrop: true,
  2264. focus: true,
  2265. keyboard: true
  2266. };
  2267. const DefaultType$6 = {
  2268. backdrop: '(boolean|string)',
  2269. focus: 'boolean',
  2270. keyboard: 'boolean'
  2271. };
  2272. /**
  2273. * Class definition
  2274. */
  2275. class Modal extends BaseComponent {
  2276. constructor(element, config) {
  2277. super(element, config);
  2278. this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
  2279. this._backdrop = this._initializeBackDrop();
  2280. this._focustrap = this._initializeFocusTrap();
  2281. this._isShown = false;
  2282. this._isTransitioning = false;
  2283. this._scrollBar = new ScrollBarHelper();
  2284. this._addEventListeners();
  2285. }
  2286. // Getters
  2287. static get Default() {
  2288. return Default$6;
  2289. }
  2290. static get DefaultType() {
  2291. return DefaultType$6;
  2292. }
  2293. static get NAME() {
  2294. return NAME$7;
  2295. }
  2296. // Public
  2297. toggle(relatedTarget) {
  2298. return this._isShown ? this.hide() : this.show(relatedTarget);
  2299. }
  2300. show(relatedTarget) {
  2301. if (this._isShown || this._isTransitioning) {
  2302. return;
  2303. }
  2304. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
  2305. relatedTarget
  2306. });
  2307. if (showEvent.defaultPrevented) {
  2308. return;
  2309. }
  2310. this._isShown = true;
  2311. this._isTransitioning = true;
  2312. this._scrollBar.hide();
  2313. document.body.classList.add(CLASS_NAME_OPEN);
  2314. this._adjustDialog();
  2315. this._backdrop.show(() => this._showElement(relatedTarget));
  2316. }
  2317. hide() {
  2318. if (!this._isShown || this._isTransitioning) {
  2319. return;
  2320. }
  2321. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
  2322. if (hideEvent.defaultPrevented) {
  2323. return;
  2324. }
  2325. this._isShown = false;
  2326. this._isTransitioning = true;
  2327. this._focustrap.deactivate();
  2328. this._element.classList.remove(CLASS_NAME_SHOW$4);
  2329. this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
  2330. }
  2331. dispose() {
  2332. EventHandler.off(window, EVENT_KEY$4);
  2333. EventHandler.off(this._dialog, EVENT_KEY$4);
  2334. this._backdrop.dispose();
  2335. this._focustrap.deactivate();
  2336. super.dispose();
  2337. }
  2338. handleUpdate() {
  2339. this._adjustDialog();
  2340. }
  2341. // Private
  2342. _initializeBackDrop() {
  2343. return new Backdrop({
  2344. isVisible: Boolean(this._config.backdrop),
  2345. // 'static' option will be translated to true, and booleans will keep their value,
  2346. isAnimated: this._isAnimated()
  2347. });
  2348. }
  2349. _initializeFocusTrap() {
  2350. return new FocusTrap({
  2351. trapElement: this._element
  2352. });
  2353. }
  2354. _showElement(relatedTarget) {
  2355. // try to append dynamic modal
  2356. if (!document.body.contains(this._element)) {
  2357. document.body.append(this._element);
  2358. }
  2359. this._element.style.display = 'block';
  2360. this._element.removeAttribute('aria-hidden');
  2361. this._element.setAttribute('aria-modal', true);
  2362. this._element.setAttribute('role', 'dialog');
  2363. this._element.scrollTop = 0;
  2364. const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
  2365. if (modalBody) {
  2366. modalBody.scrollTop = 0;
  2367. }
  2368. reflow(this._element);
  2369. this._element.classList.add(CLASS_NAME_SHOW$4);
  2370. const transitionComplete = () => {
  2371. if (this._config.focus) {
  2372. this._focustrap.activate();
  2373. }
  2374. this._isTransitioning = false;
  2375. EventHandler.trigger(this._element, EVENT_SHOWN$4, {
  2376. relatedTarget
  2377. });
  2378. };
  2379. this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
  2380. }
  2381. _addEventListeners() {
  2382. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
  2383. if (event.key !== ESCAPE_KEY$1) {
  2384. return;
  2385. }
  2386. if (this._config.keyboard) {
  2387. this.hide();
  2388. return;
  2389. }
  2390. this._triggerBackdropTransition();
  2391. });
  2392. EventHandler.on(window, EVENT_RESIZE$1, () => {
  2393. if (this._isShown && !this._isTransitioning) {
  2394. this._adjustDialog();
  2395. }
  2396. });
  2397. EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
  2398. // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
  2399. EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
  2400. if (this._element !== event.target || this._element !== event2.target) {
  2401. return;
  2402. }
  2403. if (this._config.backdrop === 'static') {
  2404. this._triggerBackdropTransition();
  2405. return;
  2406. }
  2407. if (this._config.backdrop) {
  2408. this.hide();
  2409. }
  2410. });
  2411. });
  2412. }
  2413. _hideModal() {
  2414. this._element.style.display = 'none';
  2415. this._element.setAttribute('aria-hidden', true);
  2416. this._element.removeAttribute('aria-modal');
  2417. this._element.removeAttribute('role');
  2418. this._isTransitioning = false;
  2419. this._backdrop.hide(() => {
  2420. document.body.classList.remove(CLASS_NAME_OPEN);
  2421. this._resetAdjustments();
  2422. this._scrollBar.reset();
  2423. EventHandler.trigger(this._element, EVENT_HIDDEN$4);
  2424. });
  2425. }
  2426. _isAnimated() {
  2427. return this._element.classList.contains(CLASS_NAME_FADE$3);
  2428. }
  2429. _triggerBackdropTransition() {
  2430. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
  2431. if (hideEvent.defaultPrevented) {
  2432. return;
  2433. }
  2434. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2435. const initialOverflowY = this._element.style.overflowY;
  2436. // return if the following background transition hasn't yet completed
  2437. if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
  2438. return;
  2439. }
  2440. if (!isModalOverflowing) {
  2441. this._element.style.overflowY = 'hidden';
  2442. }
  2443. this._element.classList.add(CLASS_NAME_STATIC);
  2444. this._queueCallback(() => {
  2445. this._element.classList.remove(CLASS_NAME_STATIC);
  2446. this._queueCallback(() => {
  2447. this._element.style.overflowY = initialOverflowY;
  2448. }, this._dialog);
  2449. }, this._dialog);
  2450. this._element.focus();
  2451. }
  2452. /**
  2453. * The following methods are used to handle overflowing modals
  2454. */
  2455. _adjustDialog() {
  2456. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2457. const scrollbarWidth = this._scrollBar.getWidth();
  2458. const isBodyOverflowing = scrollbarWidth > 0;
  2459. if (isBodyOverflowing && !isModalOverflowing) {
  2460. const property = isRTL() ? 'paddingLeft' : 'paddingRight';
  2461. this._element.style[property] = `${scrollbarWidth}px`;
  2462. }
  2463. if (!isBodyOverflowing && isModalOverflowing) {
  2464. const property = isRTL() ? 'paddingRight' : 'paddingLeft';
  2465. this._element.style[property] = `${scrollbarWidth}px`;
  2466. }
  2467. }
  2468. _resetAdjustments() {
  2469. this._element.style.paddingLeft = '';
  2470. this._element.style.paddingRight = '';
  2471. }
  2472. // Static
  2473. static jQueryInterface(config, relatedTarget) {
  2474. return this.each(function () {
  2475. const data = Modal.getOrCreateInstance(this, config);
  2476. if (typeof config !== 'string') {
  2477. return;
  2478. }
  2479. if (typeof data[config] === 'undefined') {
  2480. throw new TypeError(`No method named "${config}"`);
  2481. }
  2482. data[config](relatedTarget);
  2483. });
  2484. }
  2485. }
  2486. /**
  2487. * Data API implementation
  2488. */
  2489. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  2490. const target = SelectorEngine.getElementFromSelector(this);
  2491. if (['A', 'AREA'].includes(this.tagName)) {
  2492. event.preventDefault();
  2493. }
  2494. EventHandler.one(target, EVENT_SHOW$4, showEvent => {
  2495. if (showEvent.defaultPrevented) {
  2496. // only register focus restorer if modal will actually get shown
  2497. return;
  2498. }
  2499. EventHandler.one(target, EVENT_HIDDEN$4, () => {
  2500. if (isVisible(this)) {
  2501. this.focus();
  2502. }
  2503. });
  2504. });
  2505. // avoid conflict when clicking modal toggler while another one is open
  2506. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
  2507. if (alreadyOpen) {
  2508. Modal.getInstance(alreadyOpen).hide();
  2509. }
  2510. const data = Modal.getOrCreateInstance(target);
  2511. data.toggle(this);
  2512. });
  2513. enableDismissTrigger(Modal);
  2514. /**
  2515. * jQuery
  2516. */
  2517. defineJQueryPlugin(Modal);
  2518. /**
  2519. * --------------------------------------------------------------------------
  2520. * Bootstrap offcanvas.js
  2521. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2522. * --------------------------------------------------------------------------
  2523. */
  2524. /**
  2525. * Constants
  2526. */
  2527. const NAME$6 = 'offcanvas';
  2528. const DATA_KEY$3 = 'bs.offcanvas';
  2529. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  2530. const DATA_API_KEY$1 = '.data-api';
  2531. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2532. const ESCAPE_KEY = 'Escape';
  2533. const CLASS_NAME_SHOW$3 = 'show';
  2534. const CLASS_NAME_SHOWING$1 = 'showing';
  2535. const CLASS_NAME_HIDING = 'hiding';
  2536. const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
  2537. const OPEN_SELECTOR = '.offcanvas.show';
  2538. const EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
  2539. const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
  2540. const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
  2541. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
  2542. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
  2543. const EVENT_RESIZE = `resize${EVENT_KEY$3}`;
  2544. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2545. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
  2546. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  2547. const Default$5 = {
  2548. backdrop: true,
  2549. keyboard: true,
  2550. scroll: false
  2551. };
  2552. const DefaultType$5 = {
  2553. backdrop: '(boolean|string)',
  2554. keyboard: 'boolean',
  2555. scroll: 'boolean'
  2556. };
  2557. /**
  2558. * Class definition
  2559. */
  2560. class Offcanvas extends BaseComponent {
  2561. constructor(element, config) {
  2562. super(element, config);
  2563. this._isShown = false;
  2564. this._backdrop = this._initializeBackDrop();
  2565. this._focustrap = this._initializeFocusTrap();
  2566. this._addEventListeners();
  2567. }
  2568. // Getters
  2569. static get Default() {
  2570. return Default$5;
  2571. }
  2572. static get DefaultType() {
  2573. return DefaultType$5;
  2574. }
  2575. static get NAME() {
  2576. return NAME$6;
  2577. }
  2578. // Public
  2579. toggle(relatedTarget) {
  2580. return this._isShown ? this.hide() : this.show(relatedTarget);
  2581. }
  2582. show(relatedTarget) {
  2583. if (this._isShown) {
  2584. return;
  2585. }
  2586. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  2587. relatedTarget
  2588. });
  2589. if (showEvent.defaultPrevented) {
  2590. return;
  2591. }
  2592. this._isShown = true;
  2593. this._backdrop.show();
  2594. if (!this._config.scroll) {
  2595. new ScrollBarHelper().hide();
  2596. }
  2597. this._element.setAttribute('aria-modal', true);
  2598. this._element.setAttribute('role', 'dialog');
  2599. this._element.classList.add(CLASS_NAME_SHOWING$1);
  2600. const completeCallBack = () => {
  2601. if (!this._config.scroll || this._config.backdrop) {
  2602. this._focustrap.activate();
  2603. }
  2604. this._element.classList.add(CLASS_NAME_SHOW$3);
  2605. this._element.classList.remove(CLASS_NAME_SHOWING$1);
  2606. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  2607. relatedTarget
  2608. });
  2609. };
  2610. this._queueCallback(completeCallBack, this._element, true);
  2611. }
  2612. hide() {
  2613. if (!this._isShown) {
  2614. return;
  2615. }
  2616. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  2617. if (hideEvent.defaultPrevented) {
  2618. return;
  2619. }
  2620. this._focustrap.deactivate();
  2621. this._element.blur();
  2622. this._isShown = false;
  2623. this._element.classList.add(CLASS_NAME_HIDING);
  2624. this._backdrop.hide();
  2625. const completeCallback = () => {
  2626. this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
  2627. this._element.removeAttribute('aria-modal');
  2628. this._element.removeAttribute('role');
  2629. if (!this._config.scroll) {
  2630. new ScrollBarHelper().reset();
  2631. }
  2632. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  2633. };
  2634. this._queueCallback(completeCallback, this._element, true);
  2635. }
  2636. dispose() {
  2637. this._backdrop.dispose();
  2638. this._focustrap.deactivate();
  2639. super.dispose();
  2640. }
  2641. // Private
  2642. _initializeBackDrop() {
  2643. const clickCallback = () => {
  2644. if (this._config.backdrop === 'static') {
  2645. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2646. return;
  2647. }
  2648. this.hide();
  2649. };
  2650. // 'static' option will be translated to true, and booleans will keep their value
  2651. const isVisible = Boolean(this._config.backdrop);
  2652. return new Backdrop({
  2653. className: CLASS_NAME_BACKDROP,
  2654. isVisible,
  2655. isAnimated: true,
  2656. rootElement: this._element.parentNode,
  2657. clickCallback: isVisible ? clickCallback : null
  2658. });
  2659. }
  2660. _initializeFocusTrap() {
  2661. return new FocusTrap({
  2662. trapElement: this._element
  2663. });
  2664. }
  2665. _addEventListeners() {
  2666. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  2667. if (event.key !== ESCAPE_KEY) {
  2668. return;
  2669. }
  2670. if (this._config.keyboard) {
  2671. this.hide();
  2672. return;
  2673. }
  2674. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2675. });
  2676. }
  2677. // Static
  2678. static jQueryInterface(config) {
  2679. return this.each(function () {
  2680. const data = Offcanvas.getOrCreateInstance(this, config);
  2681. if (typeof config !== 'string') {
  2682. return;
  2683. }
  2684. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  2685. throw new TypeError(`No method named "${config}"`);
  2686. }
  2687. data[config](this);
  2688. });
  2689. }
  2690. }
  2691. /**
  2692. * Data API implementation
  2693. */
  2694. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  2695. const target = SelectorEngine.getElementFromSelector(this);
  2696. if (['A', 'AREA'].includes(this.tagName)) {
  2697. event.preventDefault();
  2698. }
  2699. if (isDisabled(this)) {
  2700. return;
  2701. }
  2702. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  2703. // focus on trigger when it is closed
  2704. if (isVisible(this)) {
  2705. this.focus();
  2706. }
  2707. });
  2708. // avoid conflict when clicking a toggler of an offcanvas, while another is open
  2709. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  2710. if (alreadyOpen && alreadyOpen !== target) {
  2711. Offcanvas.getInstance(alreadyOpen).hide();
  2712. }
  2713. const data = Offcanvas.getOrCreateInstance(target);
  2714. data.toggle(this);
  2715. });
  2716. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  2717. for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
  2718. Offcanvas.getOrCreateInstance(selector).show();
  2719. }
  2720. });
  2721. EventHandler.on(window, EVENT_RESIZE, () => {
  2722. for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
  2723. if (getComputedStyle(element).position !== 'fixed') {
  2724. Offcanvas.getOrCreateInstance(element).hide();
  2725. }
  2726. }
  2727. });
  2728. enableDismissTrigger(Offcanvas);
  2729. /**
  2730. * jQuery
  2731. */
  2732. defineJQueryPlugin(Offcanvas);
  2733. /**
  2734. * --------------------------------------------------------------------------
  2735. * Bootstrap util/sanitizer.js
  2736. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2737. * --------------------------------------------------------------------------
  2738. */
  2739. // js-docs-start allow-list
  2740. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  2741. const DefaultAllowlist = {
  2742. // Global attributes allowed on any supplied element below.
  2743. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  2744. a: ['target', 'href', 'title', 'rel'],
  2745. area: [],
  2746. b: [],
  2747. br: [],
  2748. col: [],
  2749. code: [],
  2750. dd: [],
  2751. div: [],
  2752. dl: [],
  2753. dt: [],
  2754. em: [],
  2755. hr: [],
  2756. h1: [],
  2757. h2: [],
  2758. h3: [],
  2759. h4: [],
  2760. h5: [],
  2761. h6: [],
  2762. i: [],
  2763. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  2764. li: [],
  2765. ol: [],
  2766. p: [],
  2767. pre: [],
  2768. s: [],
  2769. small: [],
  2770. span: [],
  2771. sub: [],
  2772. sup: [],
  2773. strong: [],
  2774. u: [],
  2775. ul: []
  2776. };
  2777. // js-docs-end allow-list
  2778. const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  2779. /**
  2780. * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
  2781. * contexts.
  2782. *
  2783. * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
  2784. */
  2785. const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
  2786. const allowedAttribute = (attribute, allowedAttributeList) => {
  2787. const attributeName = attribute.nodeName.toLowerCase();
  2788. if (allowedAttributeList.includes(attributeName)) {
  2789. if (uriAttributes.has(attributeName)) {
  2790. return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue));
  2791. }
  2792. return true;
  2793. }
  2794. // Check if a regular expression validates the attribute.
  2795. return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
  2796. };
  2797. function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
  2798. if (!unsafeHtml.length) {
  2799. return unsafeHtml;
  2800. }
  2801. if (sanitizeFunction && typeof sanitizeFunction === 'function') {
  2802. return sanitizeFunction(unsafeHtml);
  2803. }
  2804. const domParser = new window.DOMParser();
  2805. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  2806. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  2807. for (const element of elements) {
  2808. const elementName = element.nodeName.toLowerCase();
  2809. if (!Object.keys(allowList).includes(elementName)) {
  2810. element.remove();
  2811. continue;
  2812. }
  2813. const attributeList = [].concat(...element.attributes);
  2814. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
  2815. for (const attribute of attributeList) {
  2816. if (!allowedAttribute(attribute, allowedAttributes)) {
  2817. element.removeAttribute(attribute.nodeName);
  2818. }
  2819. }
  2820. }
  2821. return createdDocument.body.innerHTML;
  2822. }
  2823. /**
  2824. * --------------------------------------------------------------------------
  2825. * Bootstrap util/template-factory.js
  2826. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2827. * --------------------------------------------------------------------------
  2828. */
  2829. /**
  2830. * Constants
  2831. */
  2832. const NAME$5 = 'TemplateFactory';
  2833. const Default$4 = {
  2834. allowList: DefaultAllowlist,
  2835. content: {},
  2836. // { selector : text , selector2 : text2 , }
  2837. extraClass: '',
  2838. html: false,
  2839. sanitize: true,
  2840. sanitizeFn: null,
  2841. template: '<div></div>'
  2842. };
  2843. const DefaultType$4 = {
  2844. allowList: 'object',
  2845. content: 'object',
  2846. extraClass: '(string|function)',
  2847. html: 'boolean',
  2848. sanitize: 'boolean',
  2849. sanitizeFn: '(null|function)',
  2850. template: 'string'
  2851. };
  2852. const DefaultContentType = {
  2853. entry: '(string|element|function|null)',
  2854. selector: '(string|element)'
  2855. };
  2856. /**
  2857. * Class definition
  2858. */
  2859. class TemplateFactory extends Config {
  2860. constructor(config) {
  2861. super();
  2862. this._config = this._getConfig(config);
  2863. }
  2864. // Getters
  2865. static get Default() {
  2866. return Default$4;
  2867. }
  2868. static get DefaultType() {
  2869. return DefaultType$4;
  2870. }
  2871. static get NAME() {
  2872. return NAME$5;
  2873. }
  2874. // Public
  2875. getContent() {
  2876. return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
  2877. }
  2878. hasContent() {
  2879. return this.getContent().length > 0;
  2880. }
  2881. changeContent(content) {
  2882. this._checkContent(content);
  2883. this._config.content = {
  2884. ...this._config.content,
  2885. ...content
  2886. };
  2887. return this;
  2888. }
  2889. toHtml() {
  2890. const templateWrapper = document.createElement('div');
  2891. templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
  2892. for (const [selector, text] of Object.entries(this._config.content)) {
  2893. this._setContent(templateWrapper, text, selector);
  2894. }
  2895. const template = templateWrapper.children[0];
  2896. const extraClass = this._resolvePossibleFunction(this._config.extraClass);
  2897. if (extraClass) {
  2898. template.classList.add(...extraClass.split(' '));
  2899. }
  2900. return template;
  2901. }
  2902. // Private
  2903. _typeCheckConfig(config) {
  2904. super._typeCheckConfig(config);
  2905. this._checkContent(config.content);
  2906. }
  2907. _checkContent(arg) {
  2908. for (const [selector, content] of Object.entries(arg)) {
  2909. super._typeCheckConfig({
  2910. selector,
  2911. entry: content
  2912. }, DefaultContentType);
  2913. }
  2914. }
  2915. _setContent(template, content, selector) {
  2916. const templateElement = SelectorEngine.findOne(selector, template);
  2917. if (!templateElement) {
  2918. return;
  2919. }
  2920. content = this._resolvePossibleFunction(content);
  2921. if (!content) {
  2922. templateElement.remove();
  2923. return;
  2924. }
  2925. if (isElement(content)) {
  2926. this._putElementInTemplate(getElement(content), templateElement);
  2927. return;
  2928. }
  2929. if (this._config.html) {
  2930. templateElement.innerHTML = this._maybeSanitize(content);
  2931. return;
  2932. }
  2933. templateElement.textContent = content;
  2934. }
  2935. _maybeSanitize(arg) {
  2936. return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
  2937. }
  2938. _resolvePossibleFunction(arg) {
  2939. return execute(arg, [undefined, this]);
  2940. }
  2941. _putElementInTemplate(element, templateElement) {
  2942. if (this._config.html) {
  2943. templateElement.innerHTML = '';
  2944. templateElement.append(element);
  2945. return;
  2946. }
  2947. templateElement.textContent = element.textContent;
  2948. }
  2949. }
  2950. /**
  2951. * --------------------------------------------------------------------------
  2952. * Bootstrap tooltip.js
  2953. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2954. * --------------------------------------------------------------------------
  2955. */
  2956. /**
  2957. * Constants
  2958. */
  2959. const NAME$4 = 'tooltip';
  2960. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  2961. const CLASS_NAME_FADE$2 = 'fade';
  2962. const CLASS_NAME_MODAL = 'modal';
  2963. const CLASS_NAME_SHOW$2 = 'show';
  2964. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  2965. const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
  2966. const EVENT_MODAL_HIDE = 'hide.bs.modal';
  2967. const TRIGGER_HOVER = 'hover';
  2968. const TRIGGER_FOCUS = 'focus';
  2969. const TRIGGER_CLICK = 'click';
  2970. const TRIGGER_MANUAL = 'manual';
  2971. const EVENT_HIDE$2 = 'hide';
  2972. const EVENT_HIDDEN$2 = 'hidden';
  2973. const EVENT_SHOW$2 = 'show';
  2974. const EVENT_SHOWN$2 = 'shown';
  2975. const EVENT_INSERTED = 'inserted';
  2976. const EVENT_CLICK$1 = 'click';
  2977. const EVENT_FOCUSIN$1 = 'focusin';
  2978. const EVENT_FOCUSOUT$1 = 'focusout';
  2979. const EVENT_MOUSEENTER = 'mouseenter';
  2980. const EVENT_MOUSELEAVE = 'mouseleave';
  2981. const AttachmentMap = {
  2982. AUTO: 'auto',
  2983. TOP: 'top',
  2984. RIGHT: isRTL() ? 'left' : 'right',
  2985. BOTTOM: 'bottom',
  2986. LEFT: isRTL() ? 'right' : 'left'
  2987. };
  2988. const Default$3 = {
  2989. allowList: DefaultAllowlist,
  2990. animation: true,
  2991. boundary: 'clippingParents',
  2992. container: false,
  2993. customClass: '',
  2994. delay: 0,
  2995. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  2996. html: false,
  2997. offset: [0, 6],
  2998. placement: 'top',
  2999. popperConfig: null,
  3000. sanitize: true,
  3001. sanitizeFn: null,
  3002. selector: false,
  3003. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  3004. title: '',
  3005. trigger: 'hover focus'
  3006. };
  3007. const DefaultType$3 = {
  3008. allowList: 'object',
  3009. animation: 'boolean',
  3010. boundary: '(string|element)',
  3011. container: '(string|element|boolean)',
  3012. customClass: '(string|function)',
  3013. delay: '(number|object)',
  3014. fallbackPlacements: 'array',
  3015. html: 'boolean',
  3016. offset: '(array|string|function)',
  3017. placement: '(string|function)',
  3018. popperConfig: '(null|object|function)',
  3019. sanitize: 'boolean',
  3020. sanitizeFn: '(null|function)',
  3021. selector: '(string|boolean)',
  3022. template: 'string',
  3023. title: '(string|element|function)',
  3024. trigger: 'string'
  3025. };
  3026. /**
  3027. * Class definition
  3028. */
  3029. class Tooltip extends BaseComponent {
  3030. constructor(element, config) {
  3031. if (typeof Popper__namespace === 'undefined') {
  3032. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org/docs/v2/)');
  3033. }
  3034. super(element, config);
  3035. // Private
  3036. this._isEnabled = true;
  3037. this._timeout = 0;
  3038. this._isHovered = null;
  3039. this._activeTrigger = {};
  3040. this._popper = null;
  3041. this._templateFactory = null;
  3042. this._newContent = null;
  3043. // Protected
  3044. this.tip = null;
  3045. this._setListeners();
  3046. if (!this._config.selector) {
  3047. this._fixTitle();
  3048. }
  3049. }
  3050. // Getters
  3051. static get Default() {
  3052. return Default$3;
  3053. }
  3054. static get DefaultType() {
  3055. return DefaultType$3;
  3056. }
  3057. static get NAME() {
  3058. return NAME$4;
  3059. }
  3060. // Public
  3061. enable() {
  3062. this._isEnabled = true;
  3063. }
  3064. disable() {
  3065. this._isEnabled = false;
  3066. }
  3067. toggleEnabled() {
  3068. this._isEnabled = !this._isEnabled;
  3069. }
  3070. toggle() {
  3071. if (!this._isEnabled) {
  3072. return;
  3073. }
  3074. if (this._isShown()) {
  3075. this._leave();
  3076. return;
  3077. }
  3078. this._enter();
  3079. }
  3080. dispose() {
  3081. clearTimeout(this._timeout);
  3082. EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3083. if (this._element.getAttribute('data-bs-original-title')) {
  3084. this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
  3085. }
  3086. this._disposePopper();
  3087. super.dispose();
  3088. }
  3089. show() {
  3090. if (this._element.style.display === 'none') {
  3091. throw new Error('Please use show on visible elements');
  3092. }
  3093. if (!(this._isWithContent() && this._isEnabled)) {
  3094. return;
  3095. }
  3096. const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
  3097. const shadowRoot = findShadowRoot(this._element);
  3098. const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
  3099. if (showEvent.defaultPrevented || !isInTheDom) {
  3100. return;
  3101. }
  3102. // TODO: v6 remove this or make it optional
  3103. this._disposePopper();
  3104. const tip = this._getTipElement();
  3105. this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
  3106. const {
  3107. container
  3108. } = this._config;
  3109. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  3110. container.append(tip);
  3111. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
  3112. }
  3113. this._popper = this._createPopper(tip);
  3114. tip.classList.add(CLASS_NAME_SHOW$2);
  3115. // If this is a touch-enabled device we add extra
  3116. // empty mouseover listeners to the body's immediate children;
  3117. // only needed because of broken event delegation on iOS
  3118. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3119. if ('ontouchstart' in document.documentElement) {
  3120. for (const element of [].concat(...document.body.children)) {
  3121. EventHandler.on(element, 'mouseover', noop);
  3122. }
  3123. }
  3124. const complete = () => {
  3125. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
  3126. if (this._isHovered === false) {
  3127. this._leave();
  3128. }
  3129. this._isHovered = false;
  3130. };
  3131. this._queueCallback(complete, this.tip, this._isAnimated());
  3132. }
  3133. hide() {
  3134. if (!this._isShown()) {
  3135. return;
  3136. }
  3137. const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
  3138. if (hideEvent.defaultPrevented) {
  3139. return;
  3140. }
  3141. const tip = this._getTipElement();
  3142. tip.classList.remove(CLASS_NAME_SHOW$2);
  3143. // If this is a touch-enabled device we remove the extra
  3144. // empty mouseover listeners we added for iOS support
  3145. if ('ontouchstart' in document.documentElement) {
  3146. for (const element of [].concat(...document.body.children)) {
  3147. EventHandler.off(element, 'mouseover', noop);
  3148. }
  3149. }
  3150. this._activeTrigger[TRIGGER_CLICK] = false;
  3151. this._activeTrigger[TRIGGER_FOCUS] = false;
  3152. this._activeTrigger[TRIGGER_HOVER] = false;
  3153. this._isHovered = null; // it is a trick to support manual triggering
  3154. const complete = () => {
  3155. if (this._isWithActiveTrigger()) {
  3156. return;
  3157. }
  3158. if (!this._isHovered) {
  3159. this._disposePopper();
  3160. }
  3161. this._element.removeAttribute('aria-describedby');
  3162. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
  3163. };
  3164. this._queueCallback(complete, this.tip, this._isAnimated());
  3165. }
  3166. update() {
  3167. if (this._popper) {
  3168. this._popper.update();
  3169. }
  3170. }
  3171. // Protected
  3172. _isWithContent() {
  3173. return Boolean(this._getTitle());
  3174. }
  3175. _getTipElement() {
  3176. if (!this.tip) {
  3177. this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
  3178. }
  3179. return this.tip;
  3180. }
  3181. _createTipElement(content) {
  3182. const tip = this._getTemplateFactory(content).toHtml();
  3183. // TODO: remove this check in v6
  3184. if (!tip) {
  3185. return null;
  3186. }
  3187. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
  3188. // TODO: v6 the following can be achieved with CSS only
  3189. tip.classList.add(`bs-${this.constructor.NAME}-auto`);
  3190. const tipId = getUID(this.constructor.NAME).toString();
  3191. tip.setAttribute('id', tipId);
  3192. if (this._isAnimated()) {
  3193. tip.classList.add(CLASS_NAME_FADE$2);
  3194. }
  3195. return tip;
  3196. }
  3197. setContent(content) {
  3198. this._newContent = content;
  3199. if (this._isShown()) {
  3200. this._disposePopper();
  3201. this.show();
  3202. }
  3203. }
  3204. _getTemplateFactory(content) {
  3205. if (this._templateFactory) {
  3206. this._templateFactory.changeContent(content);
  3207. } else {
  3208. this._templateFactory = new TemplateFactory({
  3209. ...this._config,
  3210. // the `content` var has to be after `this._config`
  3211. // to override config.content in case of popover
  3212. content,
  3213. extraClass: this._resolvePossibleFunction(this._config.customClass)
  3214. });
  3215. }
  3216. return this._templateFactory;
  3217. }
  3218. _getContentForTemplate() {
  3219. return {
  3220. [SELECTOR_TOOLTIP_INNER]: this._getTitle()
  3221. };
  3222. }
  3223. _getTitle() {
  3224. return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
  3225. }
  3226. // Private
  3227. _initializeOnDelegatedTarget(event) {
  3228. return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
  3229. }
  3230. _isAnimated() {
  3231. return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
  3232. }
  3233. _isShown() {
  3234. return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
  3235. }
  3236. _createPopper(tip) {
  3237. const placement = execute(this._config.placement, [this, tip, this._element]);
  3238. const attachment = AttachmentMap[placement.toUpperCase()];
  3239. return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
  3240. }
  3241. _getOffset() {
  3242. const {
  3243. offset
  3244. } = this._config;
  3245. if (typeof offset === 'string') {
  3246. return offset.split(',').map(value => Number.parseInt(value, 10));
  3247. }
  3248. if (typeof offset === 'function') {
  3249. return popperData => offset(popperData, this._element);
  3250. }
  3251. return offset;
  3252. }
  3253. _resolvePossibleFunction(arg) {
  3254. return execute(arg, [this._element, this._element]);
  3255. }
  3256. _getPopperConfig(attachment) {
  3257. const defaultBsPopperConfig = {
  3258. placement: attachment,
  3259. modifiers: [{
  3260. name: 'flip',
  3261. options: {
  3262. fallbackPlacements: this._config.fallbackPlacements
  3263. }
  3264. }, {
  3265. name: 'offset',
  3266. options: {
  3267. offset: this._getOffset()
  3268. }
  3269. }, {
  3270. name: 'preventOverflow',
  3271. options: {
  3272. boundary: this._config.boundary
  3273. }
  3274. }, {
  3275. name: 'arrow',
  3276. options: {
  3277. element: `.${this.constructor.NAME}-arrow`
  3278. }
  3279. }, {
  3280. name: 'preSetPlacement',
  3281. enabled: true,
  3282. phase: 'beforeMain',
  3283. fn: data => {
  3284. // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
  3285. // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
  3286. this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
  3287. }
  3288. }]
  3289. };
  3290. return {
  3291. ...defaultBsPopperConfig,
  3292. ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
  3293. };
  3294. }
  3295. _setListeners() {
  3296. const triggers = this._config.trigger.split(' ');
  3297. for (const trigger of triggers) {
  3298. if (trigger === 'click') {
  3299. EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => {
  3300. const context = this._initializeOnDelegatedTarget(event);
  3301. context._activeTrigger[TRIGGER_CLICK] = !(context._isShown() && context._activeTrigger[TRIGGER_CLICK]);
  3302. context.toggle();
  3303. });
  3304. } else if (trigger !== TRIGGER_MANUAL) {
  3305. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
  3306. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
  3307. EventHandler.on(this._element, eventIn, this._config.selector, event => {
  3308. const context = this._initializeOnDelegatedTarget(event);
  3309. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  3310. context._enter();
  3311. });
  3312. EventHandler.on(this._element, eventOut, this._config.selector, event => {
  3313. const context = this._initializeOnDelegatedTarget(event);
  3314. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  3315. context._leave();
  3316. });
  3317. }
  3318. }
  3319. this._hideModalHandler = () => {
  3320. if (this._element) {
  3321. this.hide();
  3322. }
  3323. };
  3324. EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3325. }
  3326. _fixTitle() {
  3327. const title = this._element.getAttribute('title');
  3328. if (!title) {
  3329. return;
  3330. }
  3331. if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
  3332. this._element.setAttribute('aria-label', title);
  3333. }
  3334. this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
  3335. this._element.removeAttribute('title');
  3336. }
  3337. _enter() {
  3338. if (this._isShown() || this._isHovered) {
  3339. this._isHovered = true;
  3340. return;
  3341. }
  3342. this._isHovered = true;
  3343. this._setTimeout(() => {
  3344. if (this._isHovered) {
  3345. this.show();
  3346. }
  3347. }, this._config.delay.show);
  3348. }
  3349. _leave() {
  3350. if (this._isWithActiveTrigger()) {
  3351. return;
  3352. }
  3353. this._isHovered = false;
  3354. this._setTimeout(() => {
  3355. if (!this._isHovered) {
  3356. this.hide();
  3357. }
  3358. }, this._config.delay.hide);
  3359. }
  3360. _setTimeout(handler, timeout) {
  3361. clearTimeout(this._timeout);
  3362. this._timeout = setTimeout(handler, timeout);
  3363. }
  3364. _isWithActiveTrigger() {
  3365. return Object.values(this._activeTrigger).includes(true);
  3366. }
  3367. _getConfig(config) {
  3368. const dataAttributes = Manipulator.getDataAttributes(this._element);
  3369. for (const dataAttribute of Object.keys(dataAttributes)) {
  3370. if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
  3371. delete dataAttributes[dataAttribute];
  3372. }
  3373. }
  3374. config = {
  3375. ...dataAttributes,
  3376. ...(typeof config === 'object' && config ? config : {})
  3377. };
  3378. config = this._mergeConfigObj(config);
  3379. config = this._configAfterMerge(config);
  3380. this._typeCheckConfig(config);
  3381. return config;
  3382. }
  3383. _configAfterMerge(config) {
  3384. config.container = config.container === false ? document.body : getElement(config.container);
  3385. if (typeof config.delay === 'number') {
  3386. config.delay = {
  3387. show: config.delay,
  3388. hide: config.delay
  3389. };
  3390. }
  3391. if (typeof config.title === 'number') {
  3392. config.title = config.title.toString();
  3393. }
  3394. if (typeof config.content === 'number') {
  3395. config.content = config.content.toString();
  3396. }
  3397. return config;
  3398. }
  3399. _getDelegateConfig() {
  3400. const config = {};
  3401. for (const [key, value] of Object.entries(this._config)) {
  3402. if (this.constructor.Default[key] !== value) {
  3403. config[key] = value;
  3404. }
  3405. }
  3406. config.selector = false;
  3407. config.trigger = 'manual';
  3408. // In the future can be replaced with:
  3409. // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
  3410. // `Object.fromEntries(keysWithDifferentValues)`
  3411. return config;
  3412. }
  3413. _disposePopper() {
  3414. if (this._popper) {
  3415. this._popper.destroy();
  3416. this._popper = null;
  3417. }
  3418. if (this.tip) {
  3419. this.tip.remove();
  3420. this.tip = null;
  3421. }
  3422. }
  3423. // Static
  3424. static jQueryInterface(config) {
  3425. return this.each(function () {
  3426. const data = Tooltip.getOrCreateInstance(this, config);
  3427. if (typeof config !== 'string') {
  3428. return;
  3429. }
  3430. if (typeof data[config] === 'undefined') {
  3431. throw new TypeError(`No method named "${config}"`);
  3432. }
  3433. data[config]();
  3434. });
  3435. }
  3436. }
  3437. /**
  3438. * jQuery
  3439. */
  3440. defineJQueryPlugin(Tooltip);
  3441. /**
  3442. * --------------------------------------------------------------------------
  3443. * Bootstrap popover.js
  3444. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3445. * --------------------------------------------------------------------------
  3446. */
  3447. /**
  3448. * Constants
  3449. */
  3450. const NAME$3 = 'popover';
  3451. const SELECTOR_TITLE = '.popover-header';
  3452. const SELECTOR_CONTENT = '.popover-body';
  3453. const Default$2 = {
  3454. ...Tooltip.Default,
  3455. content: '',
  3456. offset: [0, 8],
  3457. placement: 'right',
  3458. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
  3459. trigger: 'click'
  3460. };
  3461. const DefaultType$2 = {
  3462. ...Tooltip.DefaultType,
  3463. content: '(null|string|element|function)'
  3464. };
  3465. /**
  3466. * Class definition
  3467. */
  3468. class Popover extends Tooltip {
  3469. // Getters
  3470. static get Default() {
  3471. return Default$2;
  3472. }
  3473. static get DefaultType() {
  3474. return DefaultType$2;
  3475. }
  3476. static get NAME() {
  3477. return NAME$3;
  3478. }
  3479. // Overrides
  3480. _isWithContent() {
  3481. return this._getTitle() || this._getContent();
  3482. }
  3483. // Private
  3484. _getContentForTemplate() {
  3485. return {
  3486. [SELECTOR_TITLE]: this._getTitle(),
  3487. [SELECTOR_CONTENT]: this._getContent()
  3488. };
  3489. }
  3490. _getContent() {
  3491. return this._resolvePossibleFunction(this._config.content);
  3492. }
  3493. // Static
  3494. static jQueryInterface(config) {
  3495. return this.each(function () {
  3496. const data = Popover.getOrCreateInstance(this, config);
  3497. if (typeof config !== 'string') {
  3498. return;
  3499. }
  3500. if (typeof data[config] === 'undefined') {
  3501. throw new TypeError(`No method named "${config}"`);
  3502. }
  3503. data[config]();
  3504. });
  3505. }
  3506. }
  3507. /**
  3508. * jQuery
  3509. */
  3510. defineJQueryPlugin(Popover);
  3511. /**
  3512. * --------------------------------------------------------------------------
  3513. * Bootstrap scrollspy.js
  3514. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3515. * --------------------------------------------------------------------------
  3516. */
  3517. /**
  3518. * Constants
  3519. */
  3520. const NAME$2 = 'scrollspy';
  3521. const DATA_KEY$2 = 'bs.scrollspy';
  3522. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  3523. const DATA_API_KEY = '.data-api';
  3524. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  3525. const EVENT_CLICK = `click${EVENT_KEY$2}`;
  3526. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
  3527. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  3528. const CLASS_NAME_ACTIVE$1 = 'active';
  3529. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  3530. const SELECTOR_TARGET_LINKS = '[href]';
  3531. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  3532. const SELECTOR_NAV_LINKS = '.nav-link';
  3533. const SELECTOR_NAV_ITEMS = '.nav-item';
  3534. const SELECTOR_LIST_ITEMS = '.list-group-item';
  3535. const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
  3536. const SELECTOR_DROPDOWN = '.dropdown';
  3537. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  3538. const Default$1 = {
  3539. offset: null,
  3540. // TODO: v6 @deprecated, keep it for backwards compatibility reasons
  3541. rootMargin: '0px 0px -25%',
  3542. smoothScroll: false,
  3543. target: null,
  3544. threshold: [0.1, 0.5, 1]
  3545. };
  3546. const DefaultType$1 = {
  3547. offset: '(number|null)',
  3548. // TODO v6 @deprecated, keep it for backwards compatibility reasons
  3549. rootMargin: 'string',
  3550. smoothScroll: 'boolean',
  3551. target: 'element',
  3552. threshold: 'array'
  3553. };
  3554. /**
  3555. * Class definition
  3556. */
  3557. class ScrollSpy extends BaseComponent {
  3558. constructor(element, config) {
  3559. super(element, config);
  3560. // this._element is the observablesContainer and config.target the menu links wrapper
  3561. this._targetLinks = new Map();
  3562. this._observableSections = new Map();
  3563. this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
  3564. this._activeTarget = null;
  3565. this._observer = null;
  3566. this._previousScrollData = {
  3567. visibleEntryTop: 0,
  3568. parentScrollTop: 0
  3569. };
  3570. this.refresh(); // initialize
  3571. }
  3572. // Getters
  3573. static get Default() {
  3574. return Default$1;
  3575. }
  3576. static get DefaultType() {
  3577. return DefaultType$1;
  3578. }
  3579. static get NAME() {
  3580. return NAME$2;
  3581. }
  3582. // Public
  3583. refresh() {
  3584. this._initializeTargetsAndObservables();
  3585. this._maybeEnableSmoothScroll();
  3586. if (this._observer) {
  3587. this._observer.disconnect();
  3588. } else {
  3589. this._observer = this._getNewObserver();
  3590. }
  3591. for (const section of this._observableSections.values()) {
  3592. this._observer.observe(section);
  3593. }
  3594. }
  3595. dispose() {
  3596. this._observer.disconnect();
  3597. super.dispose();
  3598. }
  3599. // Private
  3600. _configAfterMerge(config) {
  3601. // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
  3602. config.target = getElement(config.target) || document.body;
  3603. // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
  3604. config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
  3605. if (typeof config.threshold === 'string') {
  3606. config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
  3607. }
  3608. return config;
  3609. }
  3610. _maybeEnableSmoothScroll() {
  3611. if (!this._config.smoothScroll) {
  3612. return;
  3613. }
  3614. // unregister any previous listeners
  3615. EventHandler.off(this._config.target, EVENT_CLICK);
  3616. EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
  3617. const observableSection = this._observableSections.get(event.target.hash);
  3618. if (observableSection) {
  3619. event.preventDefault();
  3620. const root = this._rootElement || window;
  3621. const height = observableSection.offsetTop - this._element.offsetTop;
  3622. if (root.scrollTo) {
  3623. root.scrollTo({
  3624. top: height,
  3625. behavior: 'smooth'
  3626. });
  3627. return;
  3628. }
  3629. // Chrome 60 doesn't support `scrollTo`
  3630. root.scrollTop = height;
  3631. }
  3632. });
  3633. }
  3634. _getNewObserver() {
  3635. const options = {
  3636. root: this._rootElement,
  3637. threshold: this._config.threshold,
  3638. rootMargin: this._config.rootMargin
  3639. };
  3640. return new IntersectionObserver(entries => this._observerCallback(entries), options);
  3641. }
  3642. // The logic of selection
  3643. _observerCallback(entries) {
  3644. const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
  3645. const activate = entry => {
  3646. this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
  3647. this._process(targetElement(entry));
  3648. };
  3649. const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
  3650. const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
  3651. this._previousScrollData.parentScrollTop = parentScrollTop;
  3652. for (const entry of entries) {
  3653. if (!entry.isIntersecting) {
  3654. this._activeTarget = null;
  3655. this._clearActiveClass(targetElement(entry));
  3656. continue;
  3657. }
  3658. const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
  3659. // if we are scrolling down, pick the bigger offsetTop
  3660. if (userScrollsDown && entryIsLowerThanPrevious) {
  3661. activate(entry);
  3662. // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
  3663. if (!parentScrollTop) {
  3664. return;
  3665. }
  3666. continue;
  3667. }
  3668. // if we are scrolling up, pick the smallest offsetTop
  3669. if (!userScrollsDown && !entryIsLowerThanPrevious) {
  3670. activate(entry);
  3671. }
  3672. }
  3673. }
  3674. _initializeTargetsAndObservables() {
  3675. this._targetLinks = new Map();
  3676. this._observableSections = new Map();
  3677. const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
  3678. for (const anchor of targetLinks) {
  3679. // ensure that the anchor has an id and is not disabled
  3680. if (!anchor.hash || isDisabled(anchor)) {
  3681. continue;
  3682. }
  3683. const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
  3684. // ensure that the observableSection exists & is visible
  3685. if (isVisible(observableSection)) {
  3686. this._targetLinks.set(decodeURI(anchor.hash), anchor);
  3687. this._observableSections.set(anchor.hash, observableSection);
  3688. }
  3689. }
  3690. }
  3691. _process(target) {
  3692. if (this._activeTarget === target) {
  3693. return;
  3694. }
  3695. this._clearActiveClass(this._config.target);
  3696. this._activeTarget = target;
  3697. target.classList.add(CLASS_NAME_ACTIVE$1);
  3698. this._activateParents(target);
  3699. EventHandler.trigger(this._element, EVENT_ACTIVATE, {
  3700. relatedTarget: target
  3701. });
  3702. }
  3703. _activateParents(target) {
  3704. // Activate dropdown parents
  3705. if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  3706. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
  3707. return;
  3708. }
  3709. for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
  3710. // Set triggered links parents as active
  3711. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  3712. for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
  3713. item.classList.add(CLASS_NAME_ACTIVE$1);
  3714. }
  3715. }
  3716. }
  3717. _clearActiveClass(parent) {
  3718. parent.classList.remove(CLASS_NAME_ACTIVE$1);
  3719. const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
  3720. for (const node of activeNodes) {
  3721. node.classList.remove(CLASS_NAME_ACTIVE$1);
  3722. }
  3723. }
  3724. // Static
  3725. static jQueryInterface(config) {
  3726. return this.each(function () {
  3727. const data = ScrollSpy.getOrCreateInstance(this, config);
  3728. if (typeof config !== 'string') {
  3729. return;
  3730. }
  3731. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3732. throw new TypeError(`No method named "${config}"`);
  3733. }
  3734. data[config]();
  3735. });
  3736. }
  3737. }
  3738. /**
  3739. * Data API implementation
  3740. */
  3741. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
  3742. for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
  3743. ScrollSpy.getOrCreateInstance(spy);
  3744. }
  3745. });
  3746. /**
  3747. * jQuery
  3748. */
  3749. defineJQueryPlugin(ScrollSpy);
  3750. /**
  3751. * --------------------------------------------------------------------------
  3752. * Bootstrap tab.js
  3753. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3754. * --------------------------------------------------------------------------
  3755. */
  3756. /**
  3757. * Constants
  3758. */
  3759. const NAME$1 = 'tab';
  3760. const DATA_KEY$1 = 'bs.tab';
  3761. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  3762. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  3763. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  3764. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  3765. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  3766. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
  3767. const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
  3768. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
  3769. const ARROW_LEFT_KEY = 'ArrowLeft';
  3770. const ARROW_RIGHT_KEY = 'ArrowRight';
  3771. const ARROW_UP_KEY = 'ArrowUp';
  3772. const ARROW_DOWN_KEY = 'ArrowDown';
  3773. const HOME_KEY = 'Home';
  3774. const END_KEY = 'End';
  3775. const CLASS_NAME_ACTIVE = 'active';
  3776. const CLASS_NAME_FADE$1 = 'fade';
  3777. const CLASS_NAME_SHOW$1 = 'show';
  3778. const CLASS_DROPDOWN = 'dropdown';
  3779. const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  3780. const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
  3781. const NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`;
  3782. const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
  3783. const SELECTOR_OUTER = '.nav-item, .list-group-item';
  3784. const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
  3785. const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // TODO: could only be `tab` in v6
  3786. const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
  3787. 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"]`;
  3788. /**
  3789. * Class definition
  3790. */
  3791. class Tab extends BaseComponent {
  3792. constructor(element) {
  3793. super(element);
  3794. this._parent = this._element.closest(SELECTOR_TAB_PANEL);
  3795. if (!this._parent) {
  3796. return;
  3797. // TODO: should throw exception in v6
  3798. // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
  3799. }
  3800. // Set up initial aria attributes
  3801. this._setInitialAttributes(this._parent, this._getChildren());
  3802. EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
  3803. }
  3804. // Getters
  3805. static get NAME() {
  3806. return NAME$1;
  3807. }
  3808. // Public
  3809. show() {
  3810. // Shows this elem and deactivate the active sibling if exists
  3811. const innerElem = this._element;
  3812. if (this._elemIsActive(innerElem)) {
  3813. return;
  3814. }
  3815. // Search for active tab on same parent to deactivate it
  3816. const active = this._getActiveElem();
  3817. const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
  3818. relatedTarget: innerElem
  3819. }) : null;
  3820. const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
  3821. relatedTarget: active
  3822. });
  3823. if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
  3824. return;
  3825. }
  3826. this._deactivate(active, innerElem);
  3827. this._activate(innerElem, active);
  3828. }
  3829. // Private
  3830. _activate(element, relatedElem) {
  3831. if (!element) {
  3832. return;
  3833. }
  3834. element.classList.add(CLASS_NAME_ACTIVE);
  3835. this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section
  3836. const complete = () => {
  3837. if (element.getAttribute('role') !== 'tab') {
  3838. element.classList.add(CLASS_NAME_SHOW$1);
  3839. return;
  3840. }
  3841. element.removeAttribute('tabindex');
  3842. element.setAttribute('aria-selected', true);
  3843. this._toggleDropDown(element, true);
  3844. EventHandler.trigger(element, EVENT_SHOWN$1, {
  3845. relatedTarget: relatedElem
  3846. });
  3847. };
  3848. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  3849. }
  3850. _deactivate(element, relatedElem) {
  3851. if (!element) {
  3852. return;
  3853. }
  3854. element.classList.remove(CLASS_NAME_ACTIVE);
  3855. element.blur();
  3856. this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too
  3857. const complete = () => {
  3858. if (element.getAttribute('role') !== 'tab') {
  3859. element.classList.remove(CLASS_NAME_SHOW$1);
  3860. return;
  3861. }
  3862. element.setAttribute('aria-selected', false);
  3863. element.setAttribute('tabindex', '-1');
  3864. this._toggleDropDown(element, false);
  3865. EventHandler.trigger(element, EVENT_HIDDEN$1, {
  3866. relatedTarget: relatedElem
  3867. });
  3868. };
  3869. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  3870. }
  3871. _keydown(event) {
  3872. if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
  3873. return;
  3874. }
  3875. event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
  3876. event.preventDefault();
  3877. const children = this._getChildren().filter(element => !isDisabled(element));
  3878. let nextActiveElement;
  3879. if ([HOME_KEY, END_KEY].includes(event.key)) {
  3880. nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
  3881. } else {
  3882. const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
  3883. nextActiveElement = getNextActiveElement(children, event.target, isNext, true);
  3884. }
  3885. if (nextActiveElement) {
  3886. nextActiveElement.focus({
  3887. preventScroll: true
  3888. });
  3889. Tab.getOrCreateInstance(nextActiveElement).show();
  3890. }
  3891. }
  3892. _getChildren() {
  3893. // collection of inner elements
  3894. return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
  3895. }
  3896. _getActiveElem() {
  3897. return this._getChildren().find(child => this._elemIsActive(child)) || null;
  3898. }
  3899. _setInitialAttributes(parent, children) {
  3900. this._setAttributeIfNotExists(parent, 'role', 'tablist');
  3901. for (const child of children) {
  3902. this._setInitialAttributesOnChild(child);
  3903. }
  3904. }
  3905. _setInitialAttributesOnChild(child) {
  3906. child = this._getInnerElement(child);
  3907. const isActive = this._elemIsActive(child);
  3908. const outerElem = this._getOuterElement(child);
  3909. child.setAttribute('aria-selected', isActive);
  3910. if (outerElem !== child) {
  3911. this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
  3912. }
  3913. if (!isActive) {
  3914. child.setAttribute('tabindex', '-1');
  3915. }
  3916. this._setAttributeIfNotExists(child, 'role', 'tab');
  3917. // set attributes to the related panel too
  3918. this._setInitialAttributesOnTargetPanel(child);
  3919. }
  3920. _setInitialAttributesOnTargetPanel(child) {
  3921. const target = SelectorEngine.getElementFromSelector(child);
  3922. if (!target) {
  3923. return;
  3924. }
  3925. this._setAttributeIfNotExists(target, 'role', 'tabpanel');
  3926. if (child.id) {
  3927. this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`);
  3928. }
  3929. }
  3930. _toggleDropDown(element, open) {
  3931. const outerElem = this._getOuterElement(element);
  3932. if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
  3933. return;
  3934. }
  3935. const toggle = (selector, className) => {
  3936. const element = SelectorEngine.findOne(selector, outerElem);
  3937. if (element) {
  3938. element.classList.toggle(className, open);
  3939. }
  3940. };
  3941. toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
  3942. toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
  3943. outerElem.setAttribute('aria-expanded', open);
  3944. }
  3945. _setAttributeIfNotExists(element, attribute, value) {
  3946. if (!element.hasAttribute(attribute)) {
  3947. element.setAttribute(attribute, value);
  3948. }
  3949. }
  3950. _elemIsActive(elem) {
  3951. return elem.classList.contains(CLASS_NAME_ACTIVE);
  3952. }
  3953. // Try to get the inner element (usually the .nav-link)
  3954. _getInnerElement(elem) {
  3955. return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
  3956. }
  3957. // Try to get the outer element (usually the .nav-item)
  3958. _getOuterElement(elem) {
  3959. return elem.closest(SELECTOR_OUTER) || elem;
  3960. }
  3961. // Static
  3962. static jQueryInterface(config) {
  3963. return this.each(function () {
  3964. const data = Tab.getOrCreateInstance(this);
  3965. if (typeof config !== 'string') {
  3966. return;
  3967. }
  3968. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3969. throw new TypeError(`No method named "${config}"`);
  3970. }
  3971. data[config]();
  3972. });
  3973. }
  3974. }
  3975. /**
  3976. * Data API implementation
  3977. */
  3978. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  3979. if (['A', 'AREA'].includes(this.tagName)) {
  3980. event.preventDefault();
  3981. }
  3982. if (isDisabled(this)) {
  3983. return;
  3984. }
  3985. Tab.getOrCreateInstance(this).show();
  3986. });
  3987. /**
  3988. * Initialize on focus
  3989. */
  3990. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  3991. for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
  3992. Tab.getOrCreateInstance(element);
  3993. }
  3994. });
  3995. /**
  3996. * jQuery
  3997. */
  3998. defineJQueryPlugin(Tab);
  3999. /**
  4000. * --------------------------------------------------------------------------
  4001. * Bootstrap toast.js
  4002. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4003. * --------------------------------------------------------------------------
  4004. */
  4005. /**
  4006. * Constants
  4007. */
  4008. const NAME = 'toast';
  4009. const DATA_KEY = 'bs.toast';
  4010. const EVENT_KEY = `.${DATA_KEY}`;
  4011. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  4012. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  4013. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  4014. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  4015. const EVENT_HIDE = `hide${EVENT_KEY}`;
  4016. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  4017. const EVENT_SHOW = `show${EVENT_KEY}`;
  4018. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  4019. const CLASS_NAME_FADE = 'fade';
  4020. const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
  4021. const CLASS_NAME_SHOW = 'show';
  4022. const CLASS_NAME_SHOWING = 'showing';
  4023. const DefaultType = {
  4024. animation: 'boolean',
  4025. autohide: 'boolean',
  4026. delay: 'number'
  4027. };
  4028. const Default = {
  4029. animation: true,
  4030. autohide: true,
  4031. delay: 5000
  4032. };
  4033. /**
  4034. * Class definition
  4035. */
  4036. class Toast extends BaseComponent {
  4037. constructor(element, config) {
  4038. super(element, config);
  4039. this._timeout = null;
  4040. this._hasMouseInteraction = false;
  4041. this._hasKeyboardInteraction = false;
  4042. this._setListeners();
  4043. }
  4044. // Getters
  4045. static get Default() {
  4046. return Default;
  4047. }
  4048. static get DefaultType() {
  4049. return DefaultType;
  4050. }
  4051. static get NAME() {
  4052. return NAME;
  4053. }
  4054. // Public
  4055. show() {
  4056. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  4057. if (showEvent.defaultPrevented) {
  4058. return;
  4059. }
  4060. this._clearTimeout();
  4061. if (this._config.animation) {
  4062. this._element.classList.add(CLASS_NAME_FADE);
  4063. }
  4064. const complete = () => {
  4065. this._element.classList.remove(CLASS_NAME_SHOWING);
  4066. EventHandler.trigger(this._element, EVENT_SHOWN);
  4067. this._maybeScheduleHide();
  4068. };
  4069. this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
  4070. reflow(this._element);
  4071. this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
  4072. this._queueCallback(complete, this._element, this._config.animation);
  4073. }
  4074. hide() {
  4075. if (!this.isShown()) {
  4076. return;
  4077. }
  4078. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  4079. if (hideEvent.defaultPrevented) {
  4080. return;
  4081. }
  4082. const complete = () => {
  4083. this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
  4084. this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
  4085. EventHandler.trigger(this._element, EVENT_HIDDEN);
  4086. };
  4087. this._element.classList.add(CLASS_NAME_SHOWING);
  4088. this._queueCallback(complete, this._element, this._config.animation);
  4089. }
  4090. dispose() {
  4091. this._clearTimeout();
  4092. if (this.isShown()) {
  4093. this._element.classList.remove(CLASS_NAME_SHOW);
  4094. }
  4095. super.dispose();
  4096. }
  4097. isShown() {
  4098. return this._element.classList.contains(CLASS_NAME_SHOW);
  4099. }
  4100. // Private
  4101. _maybeScheduleHide() {
  4102. if (!this._config.autohide) {
  4103. return;
  4104. }
  4105. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  4106. return;
  4107. }
  4108. this._timeout = setTimeout(() => {
  4109. this.hide();
  4110. }, this._config.delay);
  4111. }
  4112. _onInteraction(event, isInteracting) {
  4113. switch (event.type) {
  4114. case 'mouseover':
  4115. case 'mouseout':
  4116. {
  4117. this._hasMouseInteraction = isInteracting;
  4118. break;
  4119. }
  4120. case 'focusin':
  4121. case 'focusout':
  4122. {
  4123. this._hasKeyboardInteraction = isInteracting;
  4124. break;
  4125. }
  4126. }
  4127. if (isInteracting) {
  4128. this._clearTimeout();
  4129. return;
  4130. }
  4131. const nextElement = event.relatedTarget;
  4132. if (this._element === nextElement || this._element.contains(nextElement)) {
  4133. return;
  4134. }
  4135. this._maybeScheduleHide();
  4136. }
  4137. _setListeners() {
  4138. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  4139. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  4140. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  4141. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  4142. }
  4143. _clearTimeout() {
  4144. clearTimeout(this._timeout);
  4145. this._timeout = null;
  4146. }
  4147. // Static
  4148. static jQueryInterface(config) {
  4149. return this.each(function () {
  4150. const data = Toast.getOrCreateInstance(this, config);
  4151. if (typeof config === 'string') {
  4152. if (typeof data[config] === 'undefined') {
  4153. throw new TypeError(`No method named "${config}"`);
  4154. }
  4155. data[config](this);
  4156. }
  4157. });
  4158. }
  4159. }
  4160. /**
  4161. * Data API implementation
  4162. */
  4163. enableDismissTrigger(Toast);
  4164. /**
  4165. * jQuery
  4166. */
  4167. defineJQueryPlugin(Toast);
  4168. /**
  4169. * --------------------------------------------------------------------------
  4170. * Bootstrap index.umd.js
  4171. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4172. * --------------------------------------------------------------------------
  4173. */
  4174. const index_umd = {
  4175. Alert,
  4176. Button,
  4177. Carousel,
  4178. Collapse,
  4179. Dropdown,
  4180. Modal,
  4181. Offcanvas,
  4182. Popover,
  4183. ScrollSpy,
  4184. Tab,
  4185. Toast,
  4186. Tooltip
  4187. };
  4188. return index_umd;
  4189. }));
  4190. //# sourceMappingURL=bootstrap.js.map