bootstrap.js 145 KB

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