bootstrap.js 145 KB

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