bootstrap.esm.js 133 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422
  1. /*!
  2. * Bootstrap v5.3.0-alpha1 (https://getbootstrap.com/)
  3. * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. import * as Popper from '@popperjs/core';
  7. /**
  8. * --------------------------------------------------------------------------
  9. * Bootstrap (v5.3.0-alpha1): util/index.js
  10. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  11. * --------------------------------------------------------------------------
  12. */
  13. const MAX_UID = 1000000;
  14. const MILLISECONDS_MULTIPLIER = 1000;
  15. const TRANSITION_END = 'transitionend';
  16. /**
  17. * Properly escape IDs selectors to handle weird IDs
  18. * @param {string} selector
  19. * @returns {string}
  20. */
  21. const parseSelector = selector => {
  22. if (selector && window.CSS && window.CSS.escape) {
  23. // document.querySelector needs escaping to handle IDs (html5+) containing for instance /
  24. selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
  25. }
  26. return selector;
  27. };
  28. // Shout-out Angus Croll (https://goo.gl/pxwQGp)
  29. const toType = object => {
  30. if (object === null || object === undefined) {
  31. return `${object}`;
  32. }
  33. return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
  34. };
  35. /**
  36. * Public Util API
  37. */
  38. const getUID = prefix => {
  39. do {
  40. prefix += Math.floor(Math.random() * MAX_UID);
  41. } while (document.getElementById(prefix));
  42. return prefix;
  43. };
  44. const getTransitionDurationFromElement = element => {
  45. if (!element) {
  46. return 0;
  47. }
  48. // Get transition-duration of the element
  49. let {
  50. transitionDuration,
  51. transitionDelay
  52. } = window.getComputedStyle(element);
  53. const floatTransitionDuration = Number.parseFloat(transitionDuration);
  54. const floatTransitionDelay = Number.parseFloat(transitionDelay);
  55. // Return 0 if element or transition duration is not found
  56. if (!floatTransitionDuration && !floatTransitionDelay) {
  57. return 0;
  58. }
  59. // If multiple durations are defined, take the first
  60. transitionDuration = transitionDuration.split(',')[0];
  61. transitionDelay = transitionDelay.split(',')[0];
  62. return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  63. };
  64. const triggerTransitionEnd = element => {
  65. element.dispatchEvent(new Event(TRANSITION_END));
  66. };
  67. const isElement = object => {
  68. if (!object || typeof object !== 'object') {
  69. return false;
  70. }
  71. if (typeof object.jquery !== 'undefined') {
  72. object = object[0];
  73. }
  74. return typeof object.nodeType !== 'undefined';
  75. };
  76. const getElement = object => {
  77. // it's a jQuery object or a node element
  78. if (isElement(object)) {
  79. return object.jquery ? object[0] : object;
  80. }
  81. if (typeof object === 'string' && object.length > 0) {
  82. return document.querySelector(parseSelector(object));
  83. }
  84. return null;
  85. };
  86. const isVisible = element => {
  87. if (!isElement(element) || element.getClientRects().length === 0) {
  88. return false;
  89. }
  90. const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
  91. // Handle `details` element as its content may falsie appear visible when it is closed
  92. const closedDetails = element.closest('details:not([open])');
  93. if (!closedDetails) {
  94. return elementIsVisible;
  95. }
  96. if (closedDetails !== element) {
  97. const summary = element.closest('summary');
  98. if (summary && summary.parentNode !== closedDetails) {
  99. return false;
  100. }
  101. if (summary === null) {
  102. return false;
  103. }
  104. }
  105. return elementIsVisible;
  106. };
  107. const isDisabled = element => {
  108. if (!element || element.nodeType !== Node.ELEMENT_NODE) {
  109. return true;
  110. }
  111. if (element.classList.contains('disabled')) {
  112. return true;
  113. }
  114. if (typeof element.disabled !== 'undefined') {
  115. return element.disabled;
  116. }
  117. return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
  118. };
  119. const findShadowRoot = element => {
  120. if (!document.documentElement.attachShadow) {
  121. return null;
  122. }
  123. // Can find the shadow root otherwise it'll return the document
  124. if (typeof element.getRootNode === 'function') {
  125. const root = element.getRootNode();
  126. return root instanceof ShadowRoot ? root : null;
  127. }
  128. if (element instanceof ShadowRoot) {
  129. return element;
  130. }
  131. // when we don't find a shadow root
  132. if (!element.parentNode) {
  133. return null;
  134. }
  135. return findShadowRoot(element.parentNode);
  136. };
  137. const noop = () => {};
  138. /**
  139. * Trick to restart an element's animation
  140. *
  141. * @param {HTMLElement} element
  142. * @return void
  143. *
  144. * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
  145. */
  146. const reflow = element => {
  147. element.offsetHeight; // eslint-disable-line no-unused-expressions
  148. };
  149. const getjQuery = () => {
  150. if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
  151. return window.jQuery;
  152. }
  153. return null;
  154. };
  155. const DOMContentLoadedCallbacks = [];
  156. const onDOMContentLoaded = callback => {
  157. if (document.readyState === 'loading') {
  158. // add listener on the first call when the document is in loading state
  159. if (!DOMContentLoadedCallbacks.length) {
  160. document.addEventListener('DOMContentLoaded', () => {
  161. for (const callback of DOMContentLoadedCallbacks) {
  162. callback();
  163. }
  164. });
  165. }
  166. DOMContentLoadedCallbacks.push(callback);
  167. } else {
  168. callback();
  169. }
  170. };
  171. const isRTL = () => document.documentElement.dir === 'rtl';
  172. const defineJQueryPlugin = plugin => {
  173. onDOMContentLoaded(() => {
  174. const $ = getjQuery();
  175. /* istanbul ignore if */
  176. if ($) {
  177. const name = plugin.NAME;
  178. const JQUERY_NO_CONFLICT = $.fn[name];
  179. $.fn[name] = plugin.jQueryInterface;
  180. $.fn[name].Constructor = plugin;
  181. $.fn[name].noConflict = () => {
  182. $.fn[name] = JQUERY_NO_CONFLICT;
  183. return plugin.jQueryInterface;
  184. };
  185. }
  186. });
  187. };
  188. const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
  189. return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue;
  190. };
  191. const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
  192. if (!waitForTransition) {
  193. execute(callback);
  194. return;
  195. }
  196. const durationPadding = 5;
  197. const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
  198. let called = false;
  199. const handler = ({
  200. target
  201. }) => {
  202. if (target !== transitionElement) {
  203. return;
  204. }
  205. called = true;
  206. transitionElement.removeEventListener(TRANSITION_END, handler);
  207. execute(callback);
  208. };
  209. transitionElement.addEventListener(TRANSITION_END, handler);
  210. setTimeout(() => {
  211. if (!called) {
  212. triggerTransitionEnd(transitionElement);
  213. }
  214. }, emulatedDuration);
  215. };
  216. /**
  217. * Return the previous/next element of a list.
  218. *
  219. * @param {array} list The list of elements
  220. * @param activeElement The active element
  221. * @param shouldGetNext Choose to get next or previous element
  222. * @param isCycleAllowed
  223. * @return {Element|elem} The proper element
  224. */
  225. const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
  226. const listLength = list.length;
  227. let index = list.indexOf(activeElement);
  228. // if the element does not exist in the list return an element
  229. // depending on the direction and if cycle is allowed
  230. if (index === -1) {
  231. return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
  232. }
  233. index += shouldGetNext ? 1 : -1;
  234. if (isCycleAllowed) {
  235. index = (index + listLength) % listLength;
  236. }
  237. return list[Math.max(0, Math.min(index, listLength - 1))];
  238. };
  239. /**
  240. * --------------------------------------------------------------------------
  241. * Bootstrap (v5.3.0-alpha1): dom/event-handler.js
  242. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  243. * --------------------------------------------------------------------------
  244. */
  245. /**
  246. * Constants
  247. */
  248. const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  249. const stripNameRegex = /\..*/;
  250. const stripUidRegex = /::\d+$/;
  251. const eventRegistry = {}; // Events storage
  252. let uidEvent = 1;
  253. const customEvents = {
  254. mouseenter: 'mouseover',
  255. mouseleave: 'mouseout'
  256. };
  257. 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']);
  258. /**
  259. * Private methods
  260. */
  261. function makeEventUid(element, uid) {
  262. return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
  263. }
  264. function getElementEvents(element) {
  265. const uid = makeEventUid(element);
  266. element.uidEvent = uid;
  267. eventRegistry[uid] = eventRegistry[uid] || {};
  268. return eventRegistry[uid];
  269. }
  270. function bootstrapHandler(element, fn) {
  271. return function handler(event) {
  272. hydrateObj(event, {
  273. delegateTarget: element
  274. });
  275. if (handler.oneOff) {
  276. EventHandler.off(element, event.type, fn);
  277. }
  278. return fn.apply(element, [event]);
  279. };
  280. }
  281. function bootstrapDelegationHandler(element, selector, fn) {
  282. return function handler(event) {
  283. const domElements = element.querySelectorAll(selector);
  284. for (let {
  285. target
  286. } = event; target && target !== this; target = target.parentNode) {
  287. for (const domElement of domElements) {
  288. if (domElement !== target) {
  289. continue;
  290. }
  291. hydrateObj(event, {
  292. delegateTarget: target
  293. });
  294. if (handler.oneOff) {
  295. EventHandler.off(element, event.type, selector, fn);
  296. }
  297. return fn.apply(target, [event]);
  298. }
  299. }
  300. };
  301. }
  302. function findHandler(events, callable, delegationSelector = null) {
  303. return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
  304. }
  305. function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
  306. const isDelegated = typeof handler === 'string';
  307. // todo: tooltip passes `false` instead of selector, so we need to check
  308. const callable = isDelegated ? delegationFunction : handler || delegationFunction;
  309. let typeEvent = getTypeEvent(originalTypeEvent);
  310. if (!nativeEvents.has(typeEvent)) {
  311. typeEvent = originalTypeEvent;
  312. }
  313. return [isDelegated, callable, typeEvent];
  314. }
  315. function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
  316. if (typeof originalTypeEvent !== 'string' || !element) {
  317. return;
  318. }
  319. let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
  320. // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
  321. // this prevents the handler from being dispatched the same way as mouseover or mouseout does
  322. if (originalTypeEvent in customEvents) {
  323. const wrapFunction = fn => {
  324. return function (event) {
  325. if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
  326. return fn.call(this, event);
  327. }
  328. };
  329. };
  330. callable = wrapFunction(callable);
  331. }
  332. const events = getElementEvents(element);
  333. const handlers = events[typeEvent] || (events[typeEvent] = {});
  334. const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
  335. if (previousFunction) {
  336. previousFunction.oneOff = previousFunction.oneOff && oneOff;
  337. return;
  338. }
  339. const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
  340. const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
  341. fn.delegationSelector = isDelegated ? handler : null;
  342. fn.callable = callable;
  343. fn.oneOff = oneOff;
  344. fn.uidEvent = uid;
  345. handlers[uid] = fn;
  346. element.addEventListener(typeEvent, fn, isDelegated);
  347. }
  348. function removeHandler(element, events, typeEvent, handler, delegationSelector) {
  349. const fn = findHandler(events[typeEvent], handler, delegationSelector);
  350. if (!fn) {
  351. return;
  352. }
  353. element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
  354. delete events[typeEvent][fn.uidEvent];
  355. }
  356. function removeNamespacedHandlers(element, events, typeEvent, namespace) {
  357. const storeElementEvent = events[typeEvent] || {};
  358. for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
  359. if (handlerKey.includes(namespace)) {
  360. removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
  361. }
  362. }
  363. }
  364. function getTypeEvent(event) {
  365. // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
  366. event = event.replace(stripNameRegex, '');
  367. return customEvents[event] || event;
  368. }
  369. const EventHandler = {
  370. on(element, event, handler, delegationFunction) {
  371. addHandler(element, event, handler, delegationFunction, false);
  372. },
  373. one(element, event, handler, delegationFunction) {
  374. addHandler(element, event, handler, delegationFunction, true);
  375. },
  376. off(element, originalTypeEvent, handler, delegationFunction) {
  377. if (typeof originalTypeEvent !== 'string' || !element) {
  378. return;
  379. }
  380. const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
  381. const inNamespace = typeEvent !== originalTypeEvent;
  382. const events = getElementEvents(element);
  383. const storeElementEvent = events[typeEvent] || {};
  384. const isNamespace = originalTypeEvent.startsWith('.');
  385. if (typeof callable !== 'undefined') {
  386. // Simplest case: handler is passed, remove that listener ONLY.
  387. if (!Object.keys(storeElementEvent).length) {
  388. return;
  389. }
  390. removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
  391. return;
  392. }
  393. if (isNamespace) {
  394. for (const elementEvent of Object.keys(events)) {
  395. removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
  396. }
  397. }
  398. for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
  399. const handlerKey = keyHandlers.replace(stripUidRegex, '');
  400. if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
  401. removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
  402. }
  403. }
  404. },
  405. trigger(element, event, args) {
  406. if (typeof event !== 'string' || !element) {
  407. return null;
  408. }
  409. const $ = getjQuery();
  410. const typeEvent = getTypeEvent(event);
  411. const inNamespace = event !== typeEvent;
  412. let jQueryEvent = null;
  413. let bubbles = true;
  414. let nativeDispatch = true;
  415. let defaultPrevented = false;
  416. if (inNamespace && $) {
  417. jQueryEvent = $.Event(event, args);
  418. $(element).trigger(jQueryEvent);
  419. bubbles = !jQueryEvent.isPropagationStopped();
  420. nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
  421. defaultPrevented = jQueryEvent.isDefaultPrevented();
  422. }
  423. let evt = new Event(event, {
  424. bubbles,
  425. cancelable: true
  426. });
  427. evt = hydrateObj(evt, args);
  428. if (defaultPrevented) {
  429. evt.preventDefault();
  430. }
  431. if (nativeDispatch) {
  432. element.dispatchEvent(evt);
  433. }
  434. if (evt.defaultPrevented && jQueryEvent) {
  435. jQueryEvent.preventDefault();
  436. }
  437. return evt;
  438. }
  439. };
  440. function hydrateObj(obj, meta = {}) {
  441. for (const [key, value] of Object.entries(meta)) {
  442. try {
  443. obj[key] = value;
  444. } catch (_unused) {
  445. Object.defineProperty(obj, key, {
  446. configurable: true,
  447. get() {
  448. return value;
  449. }
  450. });
  451. }
  452. }
  453. return obj;
  454. }
  455. /**
  456. * --------------------------------------------------------------------------
  457. * Bootstrap (v5.3.0-alpha1): dom/data.js
  458. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  459. * --------------------------------------------------------------------------
  460. */
  461. /**
  462. * Constants
  463. */
  464. const elementMap = new Map();
  465. const Data = {
  466. set(element, key, instance) {
  467. if (!elementMap.has(element)) {
  468. elementMap.set(element, new Map());
  469. }
  470. const instanceMap = elementMap.get(element);
  471. // make it clear we only want one instance per element
  472. // can be removed later when multiple key/instances are fine to be used
  473. if (!instanceMap.has(key) && instanceMap.size !== 0) {
  474. // eslint-disable-next-line no-console
  475. console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
  476. return;
  477. }
  478. instanceMap.set(key, instance);
  479. },
  480. get(element, key) {
  481. if (elementMap.has(element)) {
  482. return elementMap.get(element).get(key) || null;
  483. }
  484. return null;
  485. },
  486. remove(element, key) {
  487. if (!elementMap.has(element)) {
  488. return;
  489. }
  490. const instanceMap = elementMap.get(element);
  491. instanceMap.delete(key);
  492. // free up element references if there are no instances left for an element
  493. if (instanceMap.size === 0) {
  494. elementMap.delete(element);
  495. }
  496. }
  497. };
  498. /**
  499. * --------------------------------------------------------------------------
  500. * Bootstrap (v5.3.0-alpha1): dom/manipulator.js
  501. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  502. * --------------------------------------------------------------------------
  503. */
  504. function normalizeData(value) {
  505. if (value === 'true') {
  506. return true;
  507. }
  508. if (value === 'false') {
  509. return false;
  510. }
  511. if (value === Number(value).toString()) {
  512. return Number(value);
  513. }
  514. if (value === '' || value === 'null') {
  515. return null;
  516. }
  517. if (typeof value !== 'string') {
  518. return value;
  519. }
  520. try {
  521. return JSON.parse(decodeURIComponent(value));
  522. } catch (_unused) {
  523. return value;
  524. }
  525. }
  526. function normalizeDataKey(key) {
  527. return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
  528. }
  529. const Manipulator = {
  530. setDataAttribute(element, key, value) {
  531. element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
  532. },
  533. removeDataAttribute(element, key) {
  534. element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
  535. },
  536. getDataAttributes(element) {
  537. if (!element) {
  538. return {};
  539. }
  540. const attributes = {};
  541. const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
  542. for (const key of bsKeys) {
  543. let pureKey = key.replace(/^bs/, '');
  544. pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
  545. attributes[pureKey] = normalizeData(element.dataset[key]);
  546. }
  547. return attributes;
  548. },
  549. getDataAttribute(element, key) {
  550. return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
  551. }
  552. };
  553. /**
  554. * --------------------------------------------------------------------------
  555. * Bootstrap (v5.3.0-alpha1): util/config.js
  556. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  557. * --------------------------------------------------------------------------
  558. */
  559. /**
  560. * Class definition
  561. */
  562. class Config {
  563. // Getters
  564. static get Default() {
  565. return {};
  566. }
  567. static get DefaultType() {
  568. return {};
  569. }
  570. static get NAME() {
  571. throw new Error('You have to implement the static method "NAME", for each component!');
  572. }
  573. _getConfig(config) {
  574. config = this._mergeConfigObj(config);
  575. config = this._configAfterMerge(config);
  576. this._typeCheckConfig(config);
  577. return config;
  578. }
  579. _configAfterMerge(config) {
  580. return config;
  581. }
  582. _mergeConfigObj(config, element) {
  583. const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
  584. return {
  585. ...this.constructor.Default,
  586. ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
  587. ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
  588. ...(typeof config === 'object' ? config : {})
  589. };
  590. }
  591. _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
  592. for (const [property, expectedTypes] of Object.entries(configTypes)) {
  593. const value = config[property];
  594. const valueType = isElement(value) ? 'element' : toType(value);
  595. if (!new RegExp(expectedTypes).test(valueType)) {
  596. throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
  597. }
  598. }
  599. }
  600. }
  601. /**
  602. * --------------------------------------------------------------------------
  603. * Bootstrap (v5.3.0-alpha1): base-component.js
  604. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  605. * --------------------------------------------------------------------------
  606. */
  607. /**
  608. * Constants
  609. */
  610. const VERSION = '5.3.0-alpha1';
  611. /**
  612. * Class definition
  613. */
  614. class BaseComponent extends Config {
  615. constructor(element, config) {
  616. super();
  617. element = getElement(element);
  618. if (!element) {
  619. return;
  620. }
  621. this._element = element;
  622. this._config = this._getConfig(config);
  623. Data.set(this._element, this.constructor.DATA_KEY, this);
  624. }
  625. // Public
  626. dispose() {
  627. Data.remove(this._element, this.constructor.DATA_KEY);
  628. EventHandler.off(this._element, this.constructor.EVENT_KEY);
  629. for (const propertyName of Object.getOwnPropertyNames(this)) {
  630. this[propertyName] = null;
  631. }
  632. }
  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 (v5.3.0-alpha1): 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 parseSelector(selector);
  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 (v5.3.0-alpha1): 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 (v5.3.0-alpha1): 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 (v5.3.0-alpha1): 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 (v5.3.0-alpha1): 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 (v5.3.0-alpha1): 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 (v5.3.0-alpha1): 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. _isShown(element = this._element) {
  1496. return element.classList.contains(CLASS_NAME_SHOW$7);
  1497. }
  1498. // Private
  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 (v5.3.0-alpha1): 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)');
  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, [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 (v5.3.0-alpha1): util/scrollBar.js
  1916. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1917. * --------------------------------------------------------------------------
  1918. */
  1919. /**
  1920. * Constants
  1921. */
  1922. const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  1923. const SELECTOR_STICKY_CONTENT = '.sticky-top';
  1924. const PROPERTY_PADDING = 'padding-right';
  1925. const PROPERTY_MARGIN = 'margin-right';
  1926. /**
  1927. * Class definition
  1928. */
  1929. class ScrollBarHelper {
  1930. constructor() {
  1931. this._element = document.body;
  1932. }
  1933. // Public
  1934. getWidth() {
  1935. // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
  1936. const documentWidth = document.documentElement.clientWidth;
  1937. return Math.abs(window.innerWidth - documentWidth);
  1938. }
  1939. hide() {
  1940. const width = this.getWidth();
  1941. this._disableOverFlow();
  1942. // give padding to element to balance the hidden scrollbar width
  1943. this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
  1944. // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
  1945. this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
  1946. this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
  1947. }
  1948. reset() {
  1949. this._resetElementAttributes(this._element, 'overflow');
  1950. this._resetElementAttributes(this._element, PROPERTY_PADDING);
  1951. this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
  1952. this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
  1953. }
  1954. isOverflowing() {
  1955. return this.getWidth() > 0;
  1956. }
  1957. // Private
  1958. _disableOverFlow() {
  1959. this._saveInitialAttribute(this._element, 'overflow');
  1960. this._element.style.overflow = 'hidden';
  1961. }
  1962. _setElementAttributes(selector, styleProperty, callback) {
  1963. const scrollbarWidth = this.getWidth();
  1964. const manipulationCallBack = element => {
  1965. if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
  1966. return;
  1967. }
  1968. this._saveInitialAttribute(element, styleProperty);
  1969. const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
  1970. element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
  1971. };
  1972. this._applyManipulationCallback(selector, manipulationCallBack);
  1973. }
  1974. _saveInitialAttribute(element, styleProperty) {
  1975. const actualValue = element.style.getPropertyValue(styleProperty);
  1976. if (actualValue) {
  1977. Manipulator.setDataAttribute(element, styleProperty, actualValue);
  1978. }
  1979. }
  1980. _resetElementAttributes(selector, styleProperty) {
  1981. const manipulationCallBack = element => {
  1982. const value = Manipulator.getDataAttribute(element, styleProperty);
  1983. // We only want to remove the property if the value is `null`; the value can also be zero
  1984. if (value === null) {
  1985. element.style.removeProperty(styleProperty);
  1986. return;
  1987. }
  1988. Manipulator.removeDataAttribute(element, styleProperty);
  1989. element.style.setProperty(styleProperty, value);
  1990. };
  1991. this._applyManipulationCallback(selector, manipulationCallBack);
  1992. }
  1993. _applyManipulationCallback(selector, callBack) {
  1994. if (isElement(selector)) {
  1995. callBack(selector);
  1996. return;
  1997. }
  1998. for (const sel of SelectorEngine.find(selector, this._element)) {
  1999. callBack(sel);
  2000. }
  2001. }
  2002. }
  2003. /**
  2004. * --------------------------------------------------------------------------
  2005. * Bootstrap (v5.3.0-alpha1): util/backdrop.js
  2006. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2007. * --------------------------------------------------------------------------
  2008. */
  2009. /**
  2010. * Constants
  2011. */
  2012. const NAME$9 = 'backdrop';
  2013. const CLASS_NAME_FADE$4 = 'fade';
  2014. const CLASS_NAME_SHOW$5 = 'show';
  2015. const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
  2016. const Default$8 = {
  2017. className: 'modal-backdrop',
  2018. clickCallback: null,
  2019. isAnimated: false,
  2020. isVisible: true,
  2021. // if false, we use the backdrop helper without adding any element to the dom
  2022. rootElement: 'body' // give the choice to place backdrop under different elements
  2023. };
  2024. const DefaultType$8 = {
  2025. className: 'string',
  2026. clickCallback: '(function|null)',
  2027. isAnimated: 'boolean',
  2028. isVisible: 'boolean',
  2029. rootElement: '(element|string)'
  2030. };
  2031. /**
  2032. * Class definition
  2033. */
  2034. class Backdrop extends Config {
  2035. constructor(config) {
  2036. super();
  2037. this._config = this._getConfig(config);
  2038. this._isAppended = false;
  2039. this._element = null;
  2040. }
  2041. // Getters
  2042. static get Default() {
  2043. return Default$8;
  2044. }
  2045. static get DefaultType() {
  2046. return DefaultType$8;
  2047. }
  2048. static get NAME() {
  2049. return NAME$9;
  2050. }
  2051. // Public
  2052. show(callback) {
  2053. if (!this._config.isVisible) {
  2054. execute(callback);
  2055. return;
  2056. }
  2057. this._append();
  2058. const element = this._getElement();
  2059. if (this._config.isAnimated) {
  2060. reflow(element);
  2061. }
  2062. element.classList.add(CLASS_NAME_SHOW$5);
  2063. this._emulateAnimation(() => {
  2064. execute(callback);
  2065. });
  2066. }
  2067. hide(callback) {
  2068. if (!this._config.isVisible) {
  2069. execute(callback);
  2070. return;
  2071. }
  2072. this._getElement().classList.remove(CLASS_NAME_SHOW$5);
  2073. this._emulateAnimation(() => {
  2074. this.dispose();
  2075. execute(callback);
  2076. });
  2077. }
  2078. dispose() {
  2079. if (!this._isAppended) {
  2080. return;
  2081. }
  2082. EventHandler.off(this._element, EVENT_MOUSEDOWN);
  2083. this._element.remove();
  2084. this._isAppended = false;
  2085. }
  2086. // Private
  2087. _getElement() {
  2088. if (!this._element) {
  2089. const backdrop = document.createElement('div');
  2090. backdrop.className = this._config.className;
  2091. if (this._config.isAnimated) {
  2092. backdrop.classList.add(CLASS_NAME_FADE$4);
  2093. }
  2094. this._element = backdrop;
  2095. }
  2096. return this._element;
  2097. }
  2098. _configAfterMerge(config) {
  2099. // use getElement() with the default "body" to get a fresh Element on each instantiation
  2100. config.rootElement = getElement(config.rootElement);
  2101. return config;
  2102. }
  2103. _append() {
  2104. if (this._isAppended) {
  2105. return;
  2106. }
  2107. const element = this._getElement();
  2108. this._config.rootElement.append(element);
  2109. EventHandler.on(element, EVENT_MOUSEDOWN, () => {
  2110. execute(this._config.clickCallback);
  2111. });
  2112. this._isAppended = true;
  2113. }
  2114. _emulateAnimation(callback) {
  2115. executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
  2116. }
  2117. }
  2118. /**
  2119. * --------------------------------------------------------------------------
  2120. * Bootstrap (v5.3.0-alpha1): util/focustrap.js
  2121. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2122. * --------------------------------------------------------------------------
  2123. */
  2124. /**
  2125. * Constants
  2126. */
  2127. const NAME$8 = 'focustrap';
  2128. const DATA_KEY$5 = 'bs.focustrap';
  2129. const EVENT_KEY$5 = `.${DATA_KEY$5}`;
  2130. const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
  2131. const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
  2132. const TAB_KEY = 'Tab';
  2133. const TAB_NAV_FORWARD = 'forward';
  2134. const TAB_NAV_BACKWARD = 'backward';
  2135. const Default$7 = {
  2136. autofocus: true,
  2137. trapElement: null // The element to trap focus inside of
  2138. };
  2139. const DefaultType$7 = {
  2140. autofocus: 'boolean',
  2141. trapElement: 'element'
  2142. };
  2143. /**
  2144. * Class definition
  2145. */
  2146. class FocusTrap extends Config {
  2147. constructor(config) {
  2148. super();
  2149. this._config = this._getConfig(config);
  2150. this._isActive = false;
  2151. this._lastTabNavDirection = null;
  2152. }
  2153. // Getters
  2154. static get Default() {
  2155. return Default$7;
  2156. }
  2157. static get DefaultType() {
  2158. return DefaultType$7;
  2159. }
  2160. static get NAME() {
  2161. return NAME$8;
  2162. }
  2163. // Public
  2164. activate() {
  2165. if (this._isActive) {
  2166. return;
  2167. }
  2168. if (this._config.autofocus) {
  2169. this._config.trapElement.focus();
  2170. }
  2171. EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop
  2172. EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event));
  2173. EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
  2174. this._isActive = true;
  2175. }
  2176. deactivate() {
  2177. if (!this._isActive) {
  2178. return;
  2179. }
  2180. this._isActive = false;
  2181. EventHandler.off(document, EVENT_KEY$5);
  2182. }
  2183. // Private
  2184. _handleFocusin(event) {
  2185. const {
  2186. trapElement
  2187. } = this._config;
  2188. if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
  2189. return;
  2190. }
  2191. const elements = SelectorEngine.focusableChildren(trapElement);
  2192. if (elements.length === 0) {
  2193. trapElement.focus();
  2194. } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
  2195. elements[elements.length - 1].focus();
  2196. } else {
  2197. elements[0].focus();
  2198. }
  2199. }
  2200. _handleKeydown(event) {
  2201. if (event.key !== TAB_KEY) {
  2202. return;
  2203. }
  2204. this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
  2205. }
  2206. }
  2207. /**
  2208. * --------------------------------------------------------------------------
  2209. * Bootstrap (v5.3.0-alpha1): 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. for (const htmlElement of [window, this._dialog]) {
  2310. EventHandler.off(htmlElement, EVENT_KEY$4);
  2311. }
  2312. this._backdrop.dispose();
  2313. this._focustrap.deactivate();
  2314. super.dispose();
  2315. }
  2316. handleUpdate() {
  2317. this._adjustDialog();
  2318. }
  2319. // Private
  2320. _initializeBackDrop() {
  2321. return new Backdrop({
  2322. isVisible: Boolean(this._config.backdrop),
  2323. // 'static' option will be translated to true, and booleans will keep their value,
  2324. isAnimated: this._isAnimated()
  2325. });
  2326. }
  2327. _initializeFocusTrap() {
  2328. return new FocusTrap({
  2329. trapElement: this._element
  2330. });
  2331. }
  2332. _showElement(relatedTarget) {
  2333. // try to append dynamic modal
  2334. if (!document.body.contains(this._element)) {
  2335. document.body.append(this._element);
  2336. }
  2337. this._element.style.display = 'block';
  2338. this._element.removeAttribute('aria-hidden');
  2339. this._element.setAttribute('aria-modal', true);
  2340. this._element.setAttribute('role', 'dialog');
  2341. this._element.scrollTop = 0;
  2342. const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
  2343. if (modalBody) {
  2344. modalBody.scrollTop = 0;
  2345. }
  2346. reflow(this._element);
  2347. this._element.classList.add(CLASS_NAME_SHOW$4);
  2348. const transitionComplete = () => {
  2349. if (this._config.focus) {
  2350. this._focustrap.activate();
  2351. }
  2352. this._isTransitioning = false;
  2353. EventHandler.trigger(this._element, EVENT_SHOWN$4, {
  2354. relatedTarget
  2355. });
  2356. };
  2357. this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
  2358. }
  2359. _addEventListeners() {
  2360. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
  2361. if (event.key !== ESCAPE_KEY$1) {
  2362. return;
  2363. }
  2364. if (this._config.keyboard) {
  2365. event.preventDefault();
  2366. this.hide();
  2367. return;
  2368. }
  2369. this._triggerBackdropTransition();
  2370. });
  2371. EventHandler.on(window, EVENT_RESIZE$1, () => {
  2372. if (this._isShown && !this._isTransitioning) {
  2373. this._adjustDialog();
  2374. }
  2375. });
  2376. EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
  2377. // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
  2378. EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
  2379. if (this._element !== event.target || this._element !== event2.target) {
  2380. return;
  2381. }
  2382. if (this._config.backdrop === 'static') {
  2383. this._triggerBackdropTransition();
  2384. return;
  2385. }
  2386. if (this._config.backdrop) {
  2387. this.hide();
  2388. }
  2389. });
  2390. });
  2391. }
  2392. _hideModal() {
  2393. this._element.style.display = 'none';
  2394. this._element.setAttribute('aria-hidden', true);
  2395. this._element.removeAttribute('aria-modal');
  2396. this._element.removeAttribute('role');
  2397. this._isTransitioning = false;
  2398. this._backdrop.hide(() => {
  2399. document.body.classList.remove(CLASS_NAME_OPEN);
  2400. this._resetAdjustments();
  2401. this._scrollBar.reset();
  2402. EventHandler.trigger(this._element, EVENT_HIDDEN$4);
  2403. });
  2404. }
  2405. _isAnimated() {
  2406. return this._element.classList.contains(CLASS_NAME_FADE$3);
  2407. }
  2408. _triggerBackdropTransition() {
  2409. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
  2410. if (hideEvent.defaultPrevented) {
  2411. return;
  2412. }
  2413. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2414. const initialOverflowY = this._element.style.overflowY;
  2415. // return if the following background transition hasn't yet completed
  2416. if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
  2417. return;
  2418. }
  2419. if (!isModalOverflowing) {
  2420. this._element.style.overflowY = 'hidden';
  2421. }
  2422. this._element.classList.add(CLASS_NAME_STATIC);
  2423. this._queueCallback(() => {
  2424. this._element.classList.remove(CLASS_NAME_STATIC);
  2425. this._queueCallback(() => {
  2426. this._element.style.overflowY = initialOverflowY;
  2427. }, this._dialog);
  2428. }, this._dialog);
  2429. this._element.focus();
  2430. }
  2431. /**
  2432. * The following methods are used to handle overflowing modals
  2433. */
  2434. _adjustDialog() {
  2435. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2436. const scrollbarWidth = this._scrollBar.getWidth();
  2437. const isBodyOverflowing = scrollbarWidth > 0;
  2438. if (isBodyOverflowing && !isModalOverflowing) {
  2439. const property = isRTL() ? 'paddingLeft' : 'paddingRight';
  2440. this._element.style[property] = `${scrollbarWidth}px`;
  2441. }
  2442. if (!isBodyOverflowing && isModalOverflowing) {
  2443. const property = isRTL() ? 'paddingRight' : 'paddingLeft';
  2444. this._element.style[property] = `${scrollbarWidth}px`;
  2445. }
  2446. }
  2447. _resetAdjustments() {
  2448. this._element.style.paddingLeft = '';
  2449. this._element.style.paddingRight = '';
  2450. }
  2451. // Static
  2452. static jQueryInterface(config, relatedTarget) {
  2453. return this.each(function () {
  2454. const data = Modal.getOrCreateInstance(this, config);
  2455. if (typeof config !== 'string') {
  2456. return;
  2457. }
  2458. if (typeof data[config] === 'undefined') {
  2459. throw new TypeError(`No method named "${config}"`);
  2460. }
  2461. data[config](relatedTarget);
  2462. });
  2463. }
  2464. }
  2465. /**
  2466. * Data API implementation
  2467. */
  2468. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  2469. const target = SelectorEngine.getElementFromSelector(this);
  2470. if (['A', 'AREA'].includes(this.tagName)) {
  2471. event.preventDefault();
  2472. }
  2473. EventHandler.one(target, EVENT_SHOW$4, showEvent => {
  2474. if (showEvent.defaultPrevented) {
  2475. // only register focus restorer if modal will actually get shown
  2476. return;
  2477. }
  2478. EventHandler.one(target, EVENT_HIDDEN$4, () => {
  2479. if (isVisible(this)) {
  2480. this.focus();
  2481. }
  2482. });
  2483. });
  2484. // avoid conflict when clicking modal toggler while another one is open
  2485. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
  2486. if (alreadyOpen) {
  2487. Modal.getInstance(alreadyOpen).hide();
  2488. }
  2489. const data = Modal.getOrCreateInstance(target);
  2490. data.toggle(this);
  2491. });
  2492. enableDismissTrigger(Modal);
  2493. /**
  2494. * jQuery
  2495. */
  2496. defineJQueryPlugin(Modal);
  2497. /**
  2498. * --------------------------------------------------------------------------
  2499. * Bootstrap (v5.3.0-alpha1): offcanvas.js
  2500. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2501. * --------------------------------------------------------------------------
  2502. */
  2503. /**
  2504. * Constants
  2505. */
  2506. const NAME$6 = 'offcanvas';
  2507. const DATA_KEY$3 = 'bs.offcanvas';
  2508. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  2509. const DATA_API_KEY$1 = '.data-api';
  2510. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2511. const ESCAPE_KEY = 'Escape';
  2512. const CLASS_NAME_SHOW$3 = 'show';
  2513. const CLASS_NAME_SHOWING$1 = 'showing';
  2514. const CLASS_NAME_HIDING = 'hiding';
  2515. const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
  2516. const OPEN_SELECTOR = '.offcanvas.show';
  2517. const EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
  2518. const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
  2519. const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
  2520. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
  2521. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
  2522. const EVENT_RESIZE = `resize${EVENT_KEY$3}`;
  2523. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2524. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
  2525. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  2526. const Default$5 = {
  2527. backdrop: true,
  2528. keyboard: true,
  2529. scroll: false
  2530. };
  2531. const DefaultType$5 = {
  2532. backdrop: '(boolean|string)',
  2533. keyboard: 'boolean',
  2534. scroll: 'boolean'
  2535. };
  2536. /**
  2537. * Class definition
  2538. */
  2539. class Offcanvas extends BaseComponent {
  2540. constructor(element, config) {
  2541. super(element, config);
  2542. this._isShown = false;
  2543. this._backdrop = this._initializeBackDrop();
  2544. this._focustrap = this._initializeFocusTrap();
  2545. this._addEventListeners();
  2546. }
  2547. // Getters
  2548. static get Default() {
  2549. return Default$5;
  2550. }
  2551. static get DefaultType() {
  2552. return DefaultType$5;
  2553. }
  2554. static get NAME() {
  2555. return NAME$6;
  2556. }
  2557. // Public
  2558. toggle(relatedTarget) {
  2559. return this._isShown ? this.hide() : this.show(relatedTarget);
  2560. }
  2561. show(relatedTarget) {
  2562. if (this._isShown) {
  2563. return;
  2564. }
  2565. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  2566. relatedTarget
  2567. });
  2568. if (showEvent.defaultPrevented) {
  2569. return;
  2570. }
  2571. this._isShown = true;
  2572. this._backdrop.show();
  2573. if (!this._config.scroll) {
  2574. new ScrollBarHelper().hide();
  2575. }
  2576. this._element.setAttribute('aria-modal', true);
  2577. this._element.setAttribute('role', 'dialog');
  2578. this._element.classList.add(CLASS_NAME_SHOWING$1);
  2579. const completeCallBack = () => {
  2580. if (!this._config.scroll || this._config.backdrop) {
  2581. this._focustrap.activate();
  2582. }
  2583. this._element.classList.add(CLASS_NAME_SHOW$3);
  2584. this._element.classList.remove(CLASS_NAME_SHOWING$1);
  2585. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  2586. relatedTarget
  2587. });
  2588. };
  2589. this._queueCallback(completeCallBack, this._element, true);
  2590. }
  2591. hide() {
  2592. if (!this._isShown) {
  2593. return;
  2594. }
  2595. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  2596. if (hideEvent.defaultPrevented) {
  2597. return;
  2598. }
  2599. this._focustrap.deactivate();
  2600. this._element.blur();
  2601. this._isShown = false;
  2602. this._element.classList.add(CLASS_NAME_HIDING);
  2603. this._backdrop.hide();
  2604. const completeCallback = () => {
  2605. this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
  2606. this._element.removeAttribute('aria-modal');
  2607. this._element.removeAttribute('role');
  2608. if (!this._config.scroll) {
  2609. new ScrollBarHelper().reset();
  2610. }
  2611. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  2612. };
  2613. this._queueCallback(completeCallback, this._element, true);
  2614. }
  2615. dispose() {
  2616. this._backdrop.dispose();
  2617. this._focustrap.deactivate();
  2618. super.dispose();
  2619. }
  2620. // Private
  2621. _initializeBackDrop() {
  2622. const clickCallback = () => {
  2623. if (this._config.backdrop === 'static') {
  2624. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2625. return;
  2626. }
  2627. this.hide();
  2628. };
  2629. // 'static' option will be translated to true, and booleans will keep their value
  2630. const isVisible = Boolean(this._config.backdrop);
  2631. return new Backdrop({
  2632. className: CLASS_NAME_BACKDROP,
  2633. isVisible,
  2634. isAnimated: true,
  2635. rootElement: this._element.parentNode,
  2636. clickCallback: isVisible ? clickCallback : null
  2637. });
  2638. }
  2639. _initializeFocusTrap() {
  2640. return new FocusTrap({
  2641. trapElement: this._element
  2642. });
  2643. }
  2644. _addEventListeners() {
  2645. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  2646. if (event.key !== ESCAPE_KEY) {
  2647. return;
  2648. }
  2649. if (!this._config.keyboard) {
  2650. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2651. return;
  2652. }
  2653. this.hide();
  2654. });
  2655. }
  2656. // Static
  2657. static jQueryInterface(config) {
  2658. return this.each(function () {
  2659. const data = Offcanvas.getOrCreateInstance(this, config);
  2660. if (typeof config !== 'string') {
  2661. return;
  2662. }
  2663. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  2664. throw new TypeError(`No method named "${config}"`);
  2665. }
  2666. data[config](this);
  2667. });
  2668. }
  2669. }
  2670. /**
  2671. * Data API implementation
  2672. */
  2673. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  2674. const target = SelectorEngine.getElementFromSelector(this);
  2675. if (['A', 'AREA'].includes(this.tagName)) {
  2676. event.preventDefault();
  2677. }
  2678. if (isDisabled(this)) {
  2679. return;
  2680. }
  2681. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  2682. // focus on trigger when it is closed
  2683. if (isVisible(this)) {
  2684. this.focus();
  2685. }
  2686. });
  2687. // avoid conflict when clicking a toggler of an offcanvas, while another is open
  2688. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  2689. if (alreadyOpen && alreadyOpen !== target) {
  2690. Offcanvas.getInstance(alreadyOpen).hide();
  2691. }
  2692. const data = Offcanvas.getOrCreateInstance(target);
  2693. data.toggle(this);
  2694. });
  2695. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  2696. for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
  2697. Offcanvas.getOrCreateInstance(selector).show();
  2698. }
  2699. });
  2700. EventHandler.on(window, EVENT_RESIZE, () => {
  2701. for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
  2702. if (getComputedStyle(element).position !== 'fixed') {
  2703. Offcanvas.getOrCreateInstance(element).hide();
  2704. }
  2705. }
  2706. });
  2707. enableDismissTrigger(Offcanvas);
  2708. /**
  2709. * jQuery
  2710. */
  2711. defineJQueryPlugin(Offcanvas);
  2712. /**
  2713. * --------------------------------------------------------------------------
  2714. * Bootstrap (v5.3.0-alpha1): util/sanitizer.js
  2715. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2716. * --------------------------------------------------------------------------
  2717. */
  2718. const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  2719. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  2720. /**
  2721. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  2722. *
  2723. * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2724. */
  2725. const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
  2726. /**
  2727. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  2728. *
  2729. * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2730. */
  2731. const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
  2732. const allowedAttribute = (attribute, allowedAttributeList) => {
  2733. const attributeName = attribute.nodeName.toLowerCase();
  2734. if (allowedAttributeList.includes(attributeName)) {
  2735. if (uriAttributes.has(attributeName)) {
  2736. return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
  2737. }
  2738. return true;
  2739. }
  2740. // Check if a regular expression validates the attribute.
  2741. return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
  2742. };
  2743. const DefaultAllowlist = {
  2744. // Global attributes allowed on any supplied element below.
  2745. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  2746. a: ['target', 'href', 'title', 'rel'],
  2747. area: [],
  2748. b: [],
  2749. br: [],
  2750. col: [],
  2751. code: [],
  2752. div: [],
  2753. em: [],
  2754. hr: [],
  2755. h1: [],
  2756. h2: [],
  2757. h3: [],
  2758. h4: [],
  2759. h5: [],
  2760. h6: [],
  2761. i: [],
  2762. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  2763. li: [],
  2764. ol: [],
  2765. p: [],
  2766. pre: [],
  2767. s: [],
  2768. small: [],
  2769. span: [],
  2770. sub: [],
  2771. sup: [],
  2772. strong: [],
  2773. u: [],
  2774. ul: []
  2775. };
  2776. function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
  2777. if (!unsafeHtml.length) {
  2778. return unsafeHtml;
  2779. }
  2780. if (sanitizeFunction && typeof sanitizeFunction === 'function') {
  2781. return sanitizeFunction(unsafeHtml);
  2782. }
  2783. const domParser = new window.DOMParser();
  2784. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  2785. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  2786. for (const element of elements) {
  2787. const elementName = element.nodeName.toLowerCase();
  2788. if (!Object.keys(allowList).includes(elementName)) {
  2789. element.remove();
  2790. continue;
  2791. }
  2792. const attributeList = [].concat(...element.attributes);
  2793. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
  2794. for (const attribute of attributeList) {
  2795. if (!allowedAttribute(attribute, allowedAttributes)) {
  2796. element.removeAttribute(attribute.nodeName);
  2797. }
  2798. }
  2799. }
  2800. return createdDocument.body.innerHTML;
  2801. }
  2802. /**
  2803. * --------------------------------------------------------------------------
  2804. * Bootstrap (v5.3.0-alpha1): util/template-factory.js
  2805. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2806. * --------------------------------------------------------------------------
  2807. */
  2808. /**
  2809. * Constants
  2810. */
  2811. const NAME$5 = 'TemplateFactory';
  2812. const Default$4 = {
  2813. allowList: DefaultAllowlist,
  2814. content: {},
  2815. // { selector : text , selector2 : text2 , }
  2816. extraClass: '',
  2817. html: false,
  2818. sanitize: true,
  2819. sanitizeFn: null,
  2820. template: '<div></div>'
  2821. };
  2822. const DefaultType$4 = {
  2823. allowList: 'object',
  2824. content: 'object',
  2825. extraClass: '(string|function)',
  2826. html: 'boolean',
  2827. sanitize: 'boolean',
  2828. sanitizeFn: '(null|function)',
  2829. template: 'string'
  2830. };
  2831. const DefaultContentType = {
  2832. entry: '(string|element|function|null)',
  2833. selector: '(string|element)'
  2834. };
  2835. /**
  2836. * Class definition
  2837. */
  2838. class TemplateFactory extends Config {
  2839. constructor(config) {
  2840. super();
  2841. this._config = this._getConfig(config);
  2842. }
  2843. // Getters
  2844. static get Default() {
  2845. return Default$4;
  2846. }
  2847. static get DefaultType() {
  2848. return DefaultType$4;
  2849. }
  2850. static get NAME() {
  2851. return NAME$5;
  2852. }
  2853. // Public
  2854. getContent() {
  2855. return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
  2856. }
  2857. hasContent() {
  2858. return this.getContent().length > 0;
  2859. }
  2860. changeContent(content) {
  2861. this._checkContent(content);
  2862. this._config.content = {
  2863. ...this._config.content,
  2864. ...content
  2865. };
  2866. return this;
  2867. }
  2868. toHtml() {
  2869. const templateWrapper = document.createElement('div');
  2870. templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
  2871. for (const [selector, text] of Object.entries(this._config.content)) {
  2872. this._setContent(templateWrapper, text, selector);
  2873. }
  2874. const template = templateWrapper.children[0];
  2875. const extraClass = this._resolvePossibleFunction(this._config.extraClass);
  2876. if (extraClass) {
  2877. template.classList.add(...extraClass.split(' '));
  2878. }
  2879. return template;
  2880. }
  2881. // Private
  2882. _typeCheckConfig(config) {
  2883. super._typeCheckConfig(config);
  2884. this._checkContent(config.content);
  2885. }
  2886. _checkContent(arg) {
  2887. for (const [selector, content] of Object.entries(arg)) {
  2888. super._typeCheckConfig({
  2889. selector,
  2890. entry: content
  2891. }, DefaultContentType);
  2892. }
  2893. }
  2894. _setContent(template, content, selector) {
  2895. const templateElement = SelectorEngine.findOne(selector, template);
  2896. if (!templateElement) {
  2897. return;
  2898. }
  2899. content = this._resolvePossibleFunction(content);
  2900. if (!content) {
  2901. templateElement.remove();
  2902. return;
  2903. }
  2904. if (isElement(content)) {
  2905. this._putElementInTemplate(getElement(content), templateElement);
  2906. return;
  2907. }
  2908. if (this._config.html) {
  2909. templateElement.innerHTML = this._maybeSanitize(content);
  2910. return;
  2911. }
  2912. templateElement.textContent = content;
  2913. }
  2914. _maybeSanitize(arg) {
  2915. return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
  2916. }
  2917. _resolvePossibleFunction(arg) {
  2918. return execute(arg, [this]);
  2919. }
  2920. _putElementInTemplate(element, templateElement) {
  2921. if (this._config.html) {
  2922. templateElement.innerHTML = '';
  2923. templateElement.append(element);
  2924. return;
  2925. }
  2926. templateElement.textContent = element.textContent;
  2927. }
  2928. }
  2929. /**
  2930. * --------------------------------------------------------------------------
  2931. * Bootstrap (v5.3.0-alpha1): tooltip.js
  2932. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2933. * --------------------------------------------------------------------------
  2934. */
  2935. /**
  2936. * Constants
  2937. */
  2938. const NAME$4 = 'tooltip';
  2939. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  2940. const CLASS_NAME_FADE$2 = 'fade';
  2941. const CLASS_NAME_MODAL = 'modal';
  2942. const CLASS_NAME_SHOW$2 = 'show';
  2943. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  2944. const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
  2945. const EVENT_MODAL_HIDE = 'hide.bs.modal';
  2946. const TRIGGER_HOVER = 'hover';
  2947. const TRIGGER_FOCUS = 'focus';
  2948. const TRIGGER_CLICK = 'click';
  2949. const TRIGGER_MANUAL = 'manual';
  2950. const EVENT_HIDE$2 = 'hide';
  2951. const EVENT_HIDDEN$2 = 'hidden';
  2952. const EVENT_SHOW$2 = 'show';
  2953. const EVENT_SHOWN$2 = 'shown';
  2954. const EVENT_INSERTED = 'inserted';
  2955. const EVENT_CLICK$1 = 'click';
  2956. const EVENT_FOCUSIN$1 = 'focusin';
  2957. const EVENT_FOCUSOUT$1 = 'focusout';
  2958. const EVENT_MOUSEENTER = 'mouseenter';
  2959. const EVENT_MOUSELEAVE = 'mouseleave';
  2960. const AttachmentMap = {
  2961. AUTO: 'auto',
  2962. TOP: 'top',
  2963. RIGHT: isRTL() ? 'left' : 'right',
  2964. BOTTOM: 'bottom',
  2965. LEFT: isRTL() ? 'right' : 'left'
  2966. };
  2967. const Default$3 = {
  2968. allowList: DefaultAllowlist,
  2969. animation: true,
  2970. boundary: 'clippingParents',
  2971. container: false,
  2972. customClass: '',
  2973. delay: 0,
  2974. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  2975. html: false,
  2976. offset: [0, 0],
  2977. placement: 'top',
  2978. popperConfig: null,
  2979. sanitize: true,
  2980. sanitizeFn: null,
  2981. selector: false,
  2982. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  2983. title: '',
  2984. trigger: 'hover focus'
  2985. };
  2986. const DefaultType$3 = {
  2987. allowList: 'object',
  2988. animation: 'boolean',
  2989. boundary: '(string|element)',
  2990. container: '(string|element|boolean)',
  2991. customClass: '(string|function)',
  2992. delay: '(number|object)',
  2993. fallbackPlacements: 'array',
  2994. html: 'boolean',
  2995. offset: '(array|string|function)',
  2996. placement: '(string|function)',
  2997. popperConfig: '(null|object|function)',
  2998. sanitize: 'boolean',
  2999. sanitizeFn: '(null|function)',
  3000. selector: '(string|boolean)',
  3001. template: 'string',
  3002. title: '(string|element|function)',
  3003. trigger: 'string'
  3004. };
  3005. /**
  3006. * Class definition
  3007. */
  3008. class Tooltip extends BaseComponent {
  3009. constructor(element, config) {
  3010. if (typeof Popper === 'undefined') {
  3011. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
  3012. }
  3013. super(element, config);
  3014. // Private
  3015. this._isEnabled = true;
  3016. this._timeout = 0;
  3017. this._isHovered = null;
  3018. this._activeTrigger = {};
  3019. this._popper = null;
  3020. this._templateFactory = null;
  3021. this._newContent = null;
  3022. // Protected
  3023. this.tip = null;
  3024. this._setListeners();
  3025. if (!this._config.selector) {
  3026. this._fixTitle();
  3027. }
  3028. }
  3029. // Getters
  3030. static get Default() {
  3031. return Default$3;
  3032. }
  3033. static get DefaultType() {
  3034. return DefaultType$3;
  3035. }
  3036. static get NAME() {
  3037. return NAME$4;
  3038. }
  3039. // Public
  3040. enable() {
  3041. this._isEnabled = true;
  3042. }
  3043. disable() {
  3044. this._isEnabled = false;
  3045. }
  3046. toggleEnabled() {
  3047. this._isEnabled = !this._isEnabled;
  3048. }
  3049. toggle() {
  3050. if (!this._isEnabled) {
  3051. return;
  3052. }
  3053. this._activeTrigger.click = !this._activeTrigger.click;
  3054. if (this._isShown()) {
  3055. this._leave();
  3056. return;
  3057. }
  3058. this._enter();
  3059. }
  3060. dispose() {
  3061. clearTimeout(this._timeout);
  3062. EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3063. if (this._element.getAttribute('data-bs-original-title')) {
  3064. this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
  3065. }
  3066. this._disposePopper();
  3067. super.dispose();
  3068. }
  3069. show() {
  3070. if (this._element.style.display === 'none') {
  3071. throw new Error('Please use show on visible elements');
  3072. }
  3073. if (!(this._isWithContent() && this._isEnabled)) {
  3074. return;
  3075. }
  3076. const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
  3077. const shadowRoot = findShadowRoot(this._element);
  3078. const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
  3079. if (showEvent.defaultPrevented || !isInTheDom) {
  3080. return;
  3081. }
  3082. // todo v6 remove this OR make it optional
  3083. this._disposePopper();
  3084. const tip = this._getTipElement();
  3085. this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
  3086. const {
  3087. container
  3088. } = this._config;
  3089. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  3090. container.append(tip);
  3091. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
  3092. }
  3093. this._popper = this._createPopper(tip);
  3094. tip.classList.add(CLASS_NAME_SHOW$2);
  3095. // If this is a touch-enabled device we add extra
  3096. // empty mouseover listeners to the body's immediate children;
  3097. // only needed because of broken event delegation on iOS
  3098. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3099. if ('ontouchstart' in document.documentElement) {
  3100. for (const element of [].concat(...document.body.children)) {
  3101. EventHandler.on(element, 'mouseover', noop);
  3102. }
  3103. }
  3104. const complete = () => {
  3105. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
  3106. if (this._isHovered === false) {
  3107. this._leave();
  3108. }
  3109. this._isHovered = false;
  3110. };
  3111. this._queueCallback(complete, this.tip, this._isAnimated());
  3112. }
  3113. hide() {
  3114. if (!this._isShown()) {
  3115. return;
  3116. }
  3117. const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
  3118. if (hideEvent.defaultPrevented) {
  3119. return;
  3120. }
  3121. const tip = this._getTipElement();
  3122. tip.classList.remove(CLASS_NAME_SHOW$2);
  3123. // If this is a touch-enabled device we remove the extra
  3124. // empty mouseover listeners we added for iOS support
  3125. if ('ontouchstart' in document.documentElement) {
  3126. for (const element of [].concat(...document.body.children)) {
  3127. EventHandler.off(element, 'mouseover', noop);
  3128. }
  3129. }
  3130. this._activeTrigger[TRIGGER_CLICK] = false;
  3131. this._activeTrigger[TRIGGER_FOCUS] = false;
  3132. this._activeTrigger[TRIGGER_HOVER] = false;
  3133. this._isHovered = null; // it is a trick to support manual triggering
  3134. const complete = () => {
  3135. if (this._isWithActiveTrigger()) {
  3136. return;
  3137. }
  3138. if (!this._isHovered) {
  3139. this._disposePopper();
  3140. }
  3141. this._element.removeAttribute('aria-describedby');
  3142. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
  3143. };
  3144. this._queueCallback(complete, this.tip, this._isAnimated());
  3145. }
  3146. update() {
  3147. if (this._popper) {
  3148. this._popper.update();
  3149. }
  3150. }
  3151. // Protected
  3152. _isWithContent() {
  3153. return Boolean(this._getTitle());
  3154. }
  3155. _getTipElement() {
  3156. if (!this.tip) {
  3157. this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
  3158. }
  3159. return this.tip;
  3160. }
  3161. _createTipElement(content) {
  3162. const tip = this._getTemplateFactory(content).toHtml();
  3163. // todo: remove this check on v6
  3164. if (!tip) {
  3165. return null;
  3166. }
  3167. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
  3168. // todo: on v6 the following can be achieved with CSS only
  3169. tip.classList.add(`bs-${this.constructor.NAME}-auto`);
  3170. const tipId = getUID(this.constructor.NAME).toString();
  3171. tip.setAttribute('id', tipId);
  3172. if (this._isAnimated()) {
  3173. tip.classList.add(CLASS_NAME_FADE$2);
  3174. }
  3175. return tip;
  3176. }
  3177. setContent(content) {
  3178. this._newContent = content;
  3179. if (this._isShown()) {
  3180. this._disposePopper();
  3181. this.show();
  3182. }
  3183. }
  3184. _getTemplateFactory(content) {
  3185. if (this._templateFactory) {
  3186. this._templateFactory.changeContent(content);
  3187. } else {
  3188. this._templateFactory = new TemplateFactory({
  3189. ...this._config,
  3190. // the `content` var has to be after `this._config`
  3191. // to override config.content in case of popover
  3192. content,
  3193. extraClass: this._resolvePossibleFunction(this._config.customClass)
  3194. });
  3195. }
  3196. return this._templateFactory;
  3197. }
  3198. _getContentForTemplate() {
  3199. return {
  3200. [SELECTOR_TOOLTIP_INNER]: this._getTitle()
  3201. };
  3202. }
  3203. _getTitle() {
  3204. return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
  3205. }
  3206. // Private
  3207. _initializeOnDelegatedTarget(event) {
  3208. return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
  3209. }
  3210. _isAnimated() {
  3211. return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
  3212. }
  3213. _isShown() {
  3214. return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
  3215. }
  3216. _createPopper(tip) {
  3217. const placement = execute(this._config.placement, [this, tip, this._element]);
  3218. const attachment = AttachmentMap[placement.toUpperCase()];
  3219. return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
  3220. }
  3221. _getOffset() {
  3222. const {
  3223. offset
  3224. } = this._config;
  3225. if (typeof offset === 'string') {
  3226. return offset.split(',').map(value => Number.parseInt(value, 10));
  3227. }
  3228. if (typeof offset === 'function') {
  3229. return popperData => offset(popperData, this._element);
  3230. }
  3231. return offset;
  3232. }
  3233. _resolvePossibleFunction(arg) {
  3234. return execute(arg, [this._element]);
  3235. }
  3236. _getPopperConfig(attachment) {
  3237. const defaultBsPopperConfig = {
  3238. placement: attachment,
  3239. modifiers: [{
  3240. name: 'flip',
  3241. options: {
  3242. fallbackPlacements: this._config.fallbackPlacements
  3243. }
  3244. }, {
  3245. name: 'offset',
  3246. options: {
  3247. offset: this._getOffset()
  3248. }
  3249. }, {
  3250. name: 'preventOverflow',
  3251. options: {
  3252. boundary: this._config.boundary
  3253. }
  3254. }, {
  3255. name: 'arrow',
  3256. options: {
  3257. element: `.${this.constructor.NAME}-arrow`
  3258. }
  3259. }, {
  3260. name: 'preSetPlacement',
  3261. enabled: true,
  3262. phase: 'beforeMain',
  3263. fn: data => {
  3264. // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
  3265. // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
  3266. this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
  3267. }
  3268. }]
  3269. };
  3270. return {
  3271. ...defaultBsPopperConfig,
  3272. ...execute(this._config.popperConfig, [defaultBsPopperConfig])
  3273. };
  3274. }
  3275. _setListeners() {
  3276. const triggers = this._config.trigger.split(' ');
  3277. for (const trigger of triggers) {
  3278. if (trigger === 'click') {
  3279. EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => {
  3280. const context = this._initializeOnDelegatedTarget(event);
  3281. context.toggle();
  3282. });
  3283. } else if (trigger !== TRIGGER_MANUAL) {
  3284. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
  3285. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
  3286. EventHandler.on(this._element, eventIn, this._config.selector, event => {
  3287. const context = this._initializeOnDelegatedTarget(event);
  3288. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  3289. context._enter();
  3290. });
  3291. EventHandler.on(this._element, eventOut, this._config.selector, event => {
  3292. const context = this._initializeOnDelegatedTarget(event);
  3293. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  3294. context._leave();
  3295. });
  3296. }
  3297. }
  3298. this._hideModalHandler = () => {
  3299. if (this._element) {
  3300. this.hide();
  3301. }
  3302. };
  3303. EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3304. }
  3305. _fixTitle() {
  3306. const title = this._element.getAttribute('title');
  3307. if (!title) {
  3308. return;
  3309. }
  3310. if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
  3311. this._element.setAttribute('aria-label', title);
  3312. }
  3313. this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
  3314. this._element.removeAttribute('title');
  3315. }
  3316. _enter() {
  3317. if (this._isShown() || this._isHovered) {
  3318. this._isHovered = true;
  3319. return;
  3320. }
  3321. this._isHovered = true;
  3322. this._setTimeout(() => {
  3323. if (this._isHovered) {
  3324. this.show();
  3325. }
  3326. }, this._config.delay.show);
  3327. }
  3328. _leave() {
  3329. if (this._isWithActiveTrigger()) {
  3330. return;
  3331. }
  3332. this._isHovered = false;
  3333. this._setTimeout(() => {
  3334. if (!this._isHovered) {
  3335. this.hide();
  3336. }
  3337. }, this._config.delay.hide);
  3338. }
  3339. _setTimeout(handler, timeout) {
  3340. clearTimeout(this._timeout);
  3341. this._timeout = setTimeout(handler, timeout);
  3342. }
  3343. _isWithActiveTrigger() {
  3344. return Object.values(this._activeTrigger).includes(true);
  3345. }
  3346. _getConfig(config) {
  3347. const dataAttributes = Manipulator.getDataAttributes(this._element);
  3348. for (const dataAttribute of Object.keys(dataAttributes)) {
  3349. if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
  3350. delete dataAttributes[dataAttribute];
  3351. }
  3352. }
  3353. config = {
  3354. ...dataAttributes,
  3355. ...(typeof config === 'object' && config ? config : {})
  3356. };
  3357. config = this._mergeConfigObj(config);
  3358. config = this._configAfterMerge(config);
  3359. this._typeCheckConfig(config);
  3360. return config;
  3361. }
  3362. _configAfterMerge(config) {
  3363. config.container = config.container === false ? document.body : getElement(config.container);
  3364. if (typeof config.delay === 'number') {
  3365. config.delay = {
  3366. show: config.delay,
  3367. hide: config.delay
  3368. };
  3369. }
  3370. if (typeof config.title === 'number') {
  3371. config.title = config.title.toString();
  3372. }
  3373. if (typeof config.content === 'number') {
  3374. config.content = config.content.toString();
  3375. }
  3376. return config;
  3377. }
  3378. _getDelegateConfig() {
  3379. const config = {};
  3380. for (const [key, value] of Object.entries(this._config)) {
  3381. if (this.constructor.Default[key] !== value) {
  3382. config[key] = value;
  3383. }
  3384. }
  3385. config.selector = false;
  3386. config.trigger = 'manual';
  3387. // In the future can be replaced with:
  3388. // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
  3389. // `Object.fromEntries(keysWithDifferentValues)`
  3390. return config;
  3391. }
  3392. _disposePopper() {
  3393. if (this._popper) {
  3394. this._popper.destroy();
  3395. this._popper = null;
  3396. }
  3397. if (this.tip) {
  3398. this.tip.remove();
  3399. this.tip = null;
  3400. }
  3401. }
  3402. // Static
  3403. static jQueryInterface(config) {
  3404. return this.each(function () {
  3405. const data = Tooltip.getOrCreateInstance(this, config);
  3406. if (typeof config !== 'string') {
  3407. return;
  3408. }
  3409. if (typeof data[config] === 'undefined') {
  3410. throw new TypeError(`No method named "${config}"`);
  3411. }
  3412. data[config]();
  3413. });
  3414. }
  3415. }
  3416. /**
  3417. * jQuery
  3418. */
  3419. defineJQueryPlugin(Tooltip);
  3420. /**
  3421. * --------------------------------------------------------------------------
  3422. * Bootstrap (v5.3.0-alpha1): popover.js
  3423. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3424. * --------------------------------------------------------------------------
  3425. */
  3426. /**
  3427. * Constants
  3428. */
  3429. const NAME$3 = 'popover';
  3430. const SELECTOR_TITLE = '.popover-header';
  3431. const SELECTOR_CONTENT = '.popover-body';
  3432. const Default$2 = {
  3433. ...Tooltip.Default,
  3434. content: '',
  3435. offset: [0, 8],
  3436. placement: 'right',
  3437. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
  3438. trigger: 'click'
  3439. };
  3440. const DefaultType$2 = {
  3441. ...Tooltip.DefaultType,
  3442. content: '(null|string|element|function)'
  3443. };
  3444. /**
  3445. * Class definition
  3446. */
  3447. class Popover extends Tooltip {
  3448. // Getters
  3449. static get Default() {
  3450. return Default$2;
  3451. }
  3452. static get DefaultType() {
  3453. return DefaultType$2;
  3454. }
  3455. static get NAME() {
  3456. return NAME$3;
  3457. }
  3458. // Overrides
  3459. _isWithContent() {
  3460. return this._getTitle() || this._getContent();
  3461. }
  3462. // Private
  3463. _getContentForTemplate() {
  3464. return {
  3465. [SELECTOR_TITLE]: this._getTitle(),
  3466. [SELECTOR_CONTENT]: this._getContent()
  3467. };
  3468. }
  3469. _getContent() {
  3470. return this._resolvePossibleFunction(this._config.content);
  3471. }
  3472. // Static
  3473. static jQueryInterface(config) {
  3474. return this.each(function () {
  3475. const data = Popover.getOrCreateInstance(this, config);
  3476. if (typeof config !== 'string') {
  3477. return;
  3478. }
  3479. if (typeof data[config] === 'undefined') {
  3480. throw new TypeError(`No method named "${config}"`);
  3481. }
  3482. data[config]();
  3483. });
  3484. }
  3485. }
  3486. /**
  3487. * jQuery
  3488. */
  3489. defineJQueryPlugin(Popover);
  3490. /**
  3491. * --------------------------------------------------------------------------
  3492. * Bootstrap (v5.3.0-alpha1): scrollspy.js
  3493. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3494. * --------------------------------------------------------------------------
  3495. */
  3496. /**
  3497. * Constants
  3498. */
  3499. const NAME$2 = 'scrollspy';
  3500. const DATA_KEY$2 = 'bs.scrollspy';
  3501. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  3502. const DATA_API_KEY = '.data-api';
  3503. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  3504. const EVENT_CLICK = `click${EVENT_KEY$2}`;
  3505. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
  3506. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  3507. const CLASS_NAME_ACTIVE$1 = 'active';
  3508. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  3509. const SELECTOR_TARGET_LINKS = '[href]';
  3510. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  3511. const SELECTOR_NAV_LINKS = '.nav-link';
  3512. const SELECTOR_NAV_ITEMS = '.nav-item';
  3513. const SELECTOR_LIST_ITEMS = '.list-group-item';
  3514. const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
  3515. const SELECTOR_DROPDOWN = '.dropdown';
  3516. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  3517. const Default$1 = {
  3518. offset: null,
  3519. // TODO: v6 @deprecated, keep it for backwards compatibility reasons
  3520. rootMargin: '0px 0px -25%',
  3521. smoothScroll: false,
  3522. target: null,
  3523. threshold: [0.1, 0.5, 1]
  3524. };
  3525. const DefaultType$1 = {
  3526. offset: '(number|null)',
  3527. // TODO v6 @deprecated, keep it for backwards compatibility reasons
  3528. rootMargin: 'string',
  3529. smoothScroll: 'boolean',
  3530. target: 'element',
  3531. threshold: 'array'
  3532. };
  3533. /**
  3534. * Class definition
  3535. */
  3536. class ScrollSpy extends BaseComponent {
  3537. constructor(element, config) {
  3538. super(element, config);
  3539. // this._element is the observablesContainer and config.target the menu links wrapper
  3540. this._targetLinks = new Map();
  3541. this._observableSections = new Map();
  3542. this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
  3543. this._activeTarget = null;
  3544. this._observer = null;
  3545. this._previousScrollData = {
  3546. visibleEntryTop: 0,
  3547. parentScrollTop: 0
  3548. };
  3549. this.refresh(); // initialize
  3550. }
  3551. // Getters
  3552. static get Default() {
  3553. return Default$1;
  3554. }
  3555. static get DefaultType() {
  3556. return DefaultType$1;
  3557. }
  3558. static get NAME() {
  3559. return NAME$2;
  3560. }
  3561. // Public
  3562. refresh() {
  3563. this._initializeTargetsAndObservables();
  3564. this._maybeEnableSmoothScroll();
  3565. if (this._observer) {
  3566. this._observer.disconnect();
  3567. } else {
  3568. this._observer = this._getNewObserver();
  3569. }
  3570. for (const section of this._observableSections.values()) {
  3571. this._observer.observe(section);
  3572. }
  3573. }
  3574. dispose() {
  3575. this._observer.disconnect();
  3576. super.dispose();
  3577. }
  3578. // Private
  3579. _configAfterMerge(config) {
  3580. // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
  3581. config.target = getElement(config.target) || document.body;
  3582. // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
  3583. config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
  3584. if (typeof config.threshold === 'string') {
  3585. config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
  3586. }
  3587. return config;
  3588. }
  3589. _maybeEnableSmoothScroll() {
  3590. if (!this._config.smoothScroll) {
  3591. return;
  3592. }
  3593. // unregister any previous listeners
  3594. EventHandler.off(this._config.target, EVENT_CLICK);
  3595. EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
  3596. const observableSection = this._observableSections.get(event.target.hash);
  3597. if (observableSection) {
  3598. event.preventDefault();
  3599. const root = this._rootElement || window;
  3600. const height = observableSection.offsetTop - this._element.offsetTop;
  3601. if (root.scrollTo) {
  3602. root.scrollTo({
  3603. top: height,
  3604. behavior: 'smooth'
  3605. });
  3606. return;
  3607. }
  3608. // Chrome 60 doesn't support `scrollTo`
  3609. root.scrollTop = height;
  3610. }
  3611. });
  3612. }
  3613. _getNewObserver() {
  3614. const options = {
  3615. root: this._rootElement,
  3616. threshold: this._config.threshold,
  3617. rootMargin: this._config.rootMargin
  3618. };
  3619. return new IntersectionObserver(entries => this._observerCallback(entries), options);
  3620. }
  3621. // The logic of selection
  3622. _observerCallback(entries) {
  3623. const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
  3624. const activate = entry => {
  3625. this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
  3626. this._process(targetElement(entry));
  3627. };
  3628. const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
  3629. const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
  3630. this._previousScrollData.parentScrollTop = parentScrollTop;
  3631. for (const entry of entries) {
  3632. if (!entry.isIntersecting) {
  3633. this._activeTarget = null;
  3634. this._clearActiveClass(targetElement(entry));
  3635. continue;
  3636. }
  3637. const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
  3638. // if we are scrolling down, pick the bigger offsetTop
  3639. if (userScrollsDown && entryIsLowerThanPrevious) {
  3640. activate(entry);
  3641. // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
  3642. if (!parentScrollTop) {
  3643. return;
  3644. }
  3645. continue;
  3646. }
  3647. // if we are scrolling up, pick the smallest offsetTop
  3648. if (!userScrollsDown && !entryIsLowerThanPrevious) {
  3649. activate(entry);
  3650. }
  3651. }
  3652. }
  3653. _initializeTargetsAndObservables() {
  3654. this._targetLinks = new Map();
  3655. this._observableSections = new Map();
  3656. const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
  3657. for (const anchor of targetLinks) {
  3658. // ensure that the anchor has an id and is not disabled
  3659. if (!anchor.hash || isDisabled(anchor)) {
  3660. continue;
  3661. }
  3662. const observableSection = SelectorEngine.findOne(anchor.hash, this._element);
  3663. // ensure that the observableSection exists & is visible
  3664. if (isVisible(observableSection)) {
  3665. this._targetLinks.set(anchor.hash, anchor);
  3666. this._observableSections.set(anchor.hash, observableSection);
  3667. }
  3668. }
  3669. }
  3670. _process(target) {
  3671. if (this._activeTarget === target) {
  3672. return;
  3673. }
  3674. this._clearActiveClass(this._config.target);
  3675. this._activeTarget = target;
  3676. target.classList.add(CLASS_NAME_ACTIVE$1);
  3677. this._activateParents(target);
  3678. EventHandler.trigger(this._element, EVENT_ACTIVATE, {
  3679. relatedTarget: target
  3680. });
  3681. }
  3682. _activateParents(target) {
  3683. // Activate dropdown parents
  3684. if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  3685. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
  3686. return;
  3687. }
  3688. for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
  3689. // Set triggered links parents as active
  3690. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  3691. for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
  3692. item.classList.add(CLASS_NAME_ACTIVE$1);
  3693. }
  3694. }
  3695. }
  3696. _clearActiveClass(parent) {
  3697. parent.classList.remove(CLASS_NAME_ACTIVE$1);
  3698. const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
  3699. for (const node of activeNodes) {
  3700. node.classList.remove(CLASS_NAME_ACTIVE$1);
  3701. }
  3702. }
  3703. // Static
  3704. static jQueryInterface(config) {
  3705. return this.each(function () {
  3706. const data = ScrollSpy.getOrCreateInstance(this, config);
  3707. if (typeof config !== 'string') {
  3708. return;
  3709. }
  3710. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3711. throw new TypeError(`No method named "${config}"`);
  3712. }
  3713. data[config]();
  3714. });
  3715. }
  3716. }
  3717. /**
  3718. * Data API implementation
  3719. */
  3720. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
  3721. for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
  3722. ScrollSpy.getOrCreateInstance(spy);
  3723. }
  3724. });
  3725. /**
  3726. * jQuery
  3727. */
  3728. defineJQueryPlugin(ScrollSpy);
  3729. /**
  3730. * --------------------------------------------------------------------------
  3731. * Bootstrap (v5.3.0-alpha1): tab.js
  3732. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3733. * --------------------------------------------------------------------------
  3734. */
  3735. /**
  3736. * Constants
  3737. */
  3738. const NAME$1 = 'tab';
  3739. const DATA_KEY$1 = 'bs.tab';
  3740. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  3741. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  3742. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  3743. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  3744. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  3745. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
  3746. const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
  3747. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
  3748. const ARROW_LEFT_KEY = 'ArrowLeft';
  3749. const ARROW_RIGHT_KEY = 'ArrowRight';
  3750. const ARROW_UP_KEY = 'ArrowUp';
  3751. const ARROW_DOWN_KEY = 'ArrowDown';
  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(.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:v6: could be only `tab`
  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 on 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].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 isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
  3855. const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
  3856. if (nextActiveElement) {
  3857. nextActiveElement.focus({
  3858. preventScroll: true
  3859. });
  3860. Tab.getOrCreateInstance(nextActiveElement).show();
  3861. }
  3862. }
  3863. _getChildren() {
  3864. // collection of inner elements
  3865. return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
  3866. }
  3867. _getActiveElem() {
  3868. return this._getChildren().find(child => this._elemIsActive(child)) || null;
  3869. }
  3870. _setInitialAttributes(parent, children) {
  3871. this._setAttributeIfNotExists(parent, 'role', 'tablist');
  3872. for (const child of children) {
  3873. this._setInitialAttributesOnChild(child);
  3874. }
  3875. }
  3876. _setInitialAttributesOnChild(child) {
  3877. child = this._getInnerElement(child);
  3878. const isActive = this._elemIsActive(child);
  3879. const outerElem = this._getOuterElement(child);
  3880. child.setAttribute('aria-selected', isActive);
  3881. if (outerElem !== child) {
  3882. this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
  3883. }
  3884. if (!isActive) {
  3885. child.setAttribute('tabindex', '-1');
  3886. }
  3887. this._setAttributeIfNotExists(child, 'role', 'tab');
  3888. // set attributes to the related panel too
  3889. this._setInitialAttributesOnTargetPanel(child);
  3890. }
  3891. _setInitialAttributesOnTargetPanel(child) {
  3892. const target = SelectorEngine.getElementFromSelector(child);
  3893. if (!target) {
  3894. return;
  3895. }
  3896. this._setAttributeIfNotExists(target, 'role', 'tabpanel');
  3897. if (child.id) {
  3898. this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`);
  3899. }
  3900. }
  3901. _toggleDropDown(element, open) {
  3902. const outerElem = this._getOuterElement(element);
  3903. if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
  3904. return;
  3905. }
  3906. const toggle = (selector, className) => {
  3907. const element = SelectorEngine.findOne(selector, outerElem);
  3908. if (element) {
  3909. element.classList.toggle(className, open);
  3910. }
  3911. };
  3912. toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
  3913. toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
  3914. outerElem.setAttribute('aria-expanded', open);
  3915. }
  3916. _setAttributeIfNotExists(element, attribute, value) {
  3917. if (!element.hasAttribute(attribute)) {
  3918. element.setAttribute(attribute, value);
  3919. }
  3920. }
  3921. _elemIsActive(elem) {
  3922. return elem.classList.contains(CLASS_NAME_ACTIVE);
  3923. }
  3924. // Try to get the inner element (usually the .nav-link)
  3925. _getInnerElement(elem) {
  3926. return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
  3927. }
  3928. // Try to get the outer element (usually the .nav-item)
  3929. _getOuterElement(elem) {
  3930. return elem.closest(SELECTOR_OUTER) || elem;
  3931. }
  3932. // Static
  3933. static jQueryInterface(config) {
  3934. return this.each(function () {
  3935. const data = Tab.getOrCreateInstance(this);
  3936. if (typeof config !== 'string') {
  3937. return;
  3938. }
  3939. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3940. throw new TypeError(`No method named "${config}"`);
  3941. }
  3942. data[config]();
  3943. });
  3944. }
  3945. }
  3946. /**
  3947. * Data API implementation
  3948. */
  3949. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  3950. if (['A', 'AREA'].includes(this.tagName)) {
  3951. event.preventDefault();
  3952. }
  3953. if (isDisabled(this)) {
  3954. return;
  3955. }
  3956. Tab.getOrCreateInstance(this).show();
  3957. });
  3958. /**
  3959. * Initialize on focus
  3960. */
  3961. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  3962. for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
  3963. Tab.getOrCreateInstance(element);
  3964. }
  3965. });
  3966. /**
  3967. * jQuery
  3968. */
  3969. defineJQueryPlugin(Tab);
  3970. /**
  3971. * --------------------------------------------------------------------------
  3972. * Bootstrap (v5.3.0-alpha1): toast.js
  3973. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3974. * --------------------------------------------------------------------------
  3975. */
  3976. /**
  3977. * Constants
  3978. */
  3979. const NAME = 'toast';
  3980. const DATA_KEY = 'bs.toast';
  3981. const EVENT_KEY = `.${DATA_KEY}`;
  3982. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  3983. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  3984. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  3985. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  3986. const EVENT_HIDE = `hide${EVENT_KEY}`;
  3987. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  3988. const EVENT_SHOW = `show${EVENT_KEY}`;
  3989. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  3990. const CLASS_NAME_FADE = 'fade';
  3991. const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
  3992. const CLASS_NAME_SHOW = 'show';
  3993. const CLASS_NAME_SHOWING = 'showing';
  3994. const DefaultType = {
  3995. animation: 'boolean',
  3996. autohide: 'boolean',
  3997. delay: 'number'
  3998. };
  3999. const Default = {
  4000. animation: true,
  4001. autohide: true,
  4002. delay: 5000
  4003. };
  4004. /**
  4005. * Class definition
  4006. */
  4007. class Toast extends BaseComponent {
  4008. constructor(element, config) {
  4009. super(element, config);
  4010. this._timeout = null;
  4011. this._hasMouseInteraction = false;
  4012. this._hasKeyboardInteraction = false;
  4013. this._setListeners();
  4014. }
  4015. // Getters
  4016. static get Default() {
  4017. return Default;
  4018. }
  4019. static get DefaultType() {
  4020. return DefaultType;
  4021. }
  4022. static get NAME() {
  4023. return NAME;
  4024. }
  4025. // Public
  4026. show() {
  4027. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  4028. if (showEvent.defaultPrevented) {
  4029. return;
  4030. }
  4031. this._clearTimeout();
  4032. if (this._config.animation) {
  4033. this._element.classList.add(CLASS_NAME_FADE);
  4034. }
  4035. const complete = () => {
  4036. this._element.classList.remove(CLASS_NAME_SHOWING);
  4037. EventHandler.trigger(this._element, EVENT_SHOWN);
  4038. this._maybeScheduleHide();
  4039. };
  4040. this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
  4041. reflow(this._element);
  4042. this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
  4043. this._queueCallback(complete, this._element, this._config.animation);
  4044. }
  4045. hide() {
  4046. if (!this.isShown()) {
  4047. return;
  4048. }
  4049. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  4050. if (hideEvent.defaultPrevented) {
  4051. return;
  4052. }
  4053. const complete = () => {
  4054. this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
  4055. this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
  4056. EventHandler.trigger(this._element, EVENT_HIDDEN);
  4057. };
  4058. this._element.classList.add(CLASS_NAME_SHOWING);
  4059. this._queueCallback(complete, this._element, this._config.animation);
  4060. }
  4061. dispose() {
  4062. this._clearTimeout();
  4063. if (this.isShown()) {
  4064. this._element.classList.remove(CLASS_NAME_SHOW);
  4065. }
  4066. super.dispose();
  4067. }
  4068. isShown() {
  4069. return this._element.classList.contains(CLASS_NAME_SHOW);
  4070. }
  4071. // Private
  4072. _maybeScheduleHide() {
  4073. if (!this._config.autohide) {
  4074. return;
  4075. }
  4076. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  4077. return;
  4078. }
  4079. this._timeout = setTimeout(() => {
  4080. this.hide();
  4081. }, this._config.delay);
  4082. }
  4083. _onInteraction(event, isInteracting) {
  4084. switch (event.type) {
  4085. case 'mouseover':
  4086. case 'mouseout':
  4087. {
  4088. this._hasMouseInteraction = isInteracting;
  4089. break;
  4090. }
  4091. case 'focusin':
  4092. case 'focusout':
  4093. {
  4094. this._hasKeyboardInteraction = isInteracting;
  4095. break;
  4096. }
  4097. }
  4098. if (isInteracting) {
  4099. this._clearTimeout();
  4100. return;
  4101. }
  4102. const nextElement = event.relatedTarget;
  4103. if (this._element === nextElement || this._element.contains(nextElement)) {
  4104. return;
  4105. }
  4106. this._maybeScheduleHide();
  4107. }
  4108. _setListeners() {
  4109. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  4110. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  4111. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  4112. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  4113. }
  4114. _clearTimeout() {
  4115. clearTimeout(this._timeout);
  4116. this._timeout = null;
  4117. }
  4118. // Static
  4119. static jQueryInterface(config) {
  4120. return this.each(function () {
  4121. const data = Toast.getOrCreateInstance(this, config);
  4122. if (typeof config === 'string') {
  4123. if (typeof data[config] === 'undefined') {
  4124. throw new TypeError(`No method named "${config}"`);
  4125. }
  4126. data[config](this);
  4127. }
  4128. });
  4129. }
  4130. }
  4131. /**
  4132. * Data API implementation
  4133. */
  4134. enableDismissTrigger(Toast);
  4135. /**
  4136. * jQuery
  4137. */
  4138. defineJQueryPlugin(Toast);
  4139. export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Offcanvas, Popover, ScrollSpy, Tab, Toast, Tooltip };
  4140. //# sourceMappingURL=bootstrap.esm.js.map