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

bootstrap.esm.js 133KB

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