slider.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
  1. /*!
  2. * Bootstrap v5.0.2 (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 (t, e) {
  7. "object" == typeof exports && "undefined" != typeof module
  8. ? (module.exports = e(require("@popperjs/core")))
  9. : "function" == typeof define && define.amd
  10. ? define(["@popperjs/core"], e)
  11. : ((t =
  12. "undefined" != typeof globalThis ? globalThis : t || self).bootstrap =
  13. e(t.Popper));
  14. })(this, function (t) {
  15. "use strict";
  16. function e(t) {
  17. if (t && t.__esModule) return t;
  18. var e = Object.create(null);
  19. return (
  20. t &&
  21. Object.keys(t).forEach(function (s) {
  22. if ("default" !== s) {
  23. var i = Object.getOwnPropertyDescriptor(t, s);
  24. Object.defineProperty(
  25. e,
  26. s,
  27. i.get
  28. ? i
  29. : {
  30. enumerable: !0,
  31. get: function () {
  32. return t[s];
  33. },
  34. }
  35. );
  36. }
  37. }),
  38. (e.default = t),
  39. Object.freeze(e)
  40. );
  41. }
  42. var s = e(t);
  43. const i = {
  44. find: (t, e = document.documentElement) =>
  45. [].concat(...Element.prototype.querySelectorAll.call(e, t)),
  46. findOne: (t, e = document.documentElement) =>
  47. Element.prototype.querySelector.call(e, t),
  48. children: (t, e) => [].concat(...t.children).filter((t) => t.matches(e)),
  49. parents(t, e) {
  50. const s = [];
  51. let i = t.parentNode;
  52. for (; i && i.nodeType === Node.ELEMENT_NODE && 3 !== i.nodeType; )
  53. i.matches(e) && s.push(i), (i = i.parentNode);
  54. return s;
  55. },
  56. prev(t, e) {
  57. let s = t.previousElementSibling;
  58. for (; s; ) {
  59. if (s.matches(e)) return [s];
  60. s = s.previousElementSibling;
  61. }
  62. return [];
  63. },
  64. next(t, e) {
  65. let s = t.nextElementSibling;
  66. for (; s; ) {
  67. if (s.matches(e)) return [s];
  68. s = s.nextElementSibling;
  69. }
  70. return [];
  71. },
  72. },
  73. n = (t) => {
  74. do {
  75. t += Math.floor(1e6 * Math.random());
  76. } while (document.getElementById(t));
  77. return t;
  78. },
  79. o = (t) => {
  80. let e = t.getAttribute("data-bs-target");
  81. if (!e || "#" === e) {
  82. let s = t.getAttribute("href");
  83. if (!s || (!s.includes("#") && !s.startsWith("."))) return null;
  84. s.includes("#") && !s.startsWith("#") && (s = "#" + s.split("#")[1]),
  85. (e = s && "#" !== s ? s.trim() : null);
  86. }
  87. return e;
  88. },
  89. r = (t) => {
  90. const e = o(t);
  91. return e && document.querySelector(e) ? e : null;
  92. },
  93. a = (t) => {
  94. const e = o(t);
  95. return e ? document.querySelector(e) : null;
  96. },
  97. l = (t) => {
  98. t.dispatchEvent(new Event("transitionend"));
  99. },
  100. c = (t) =>
  101. !(!t || "object" != typeof t) &&
  102. (void 0 !== t.jquery && (t = t[0]), void 0 !== t.nodeType),
  103. h = (t) =>
  104. c(t)
  105. ? t.jquery
  106. ? t[0]
  107. : t
  108. : "string" == typeof t && t.length > 0
  109. ? i.findOne(t)
  110. : null,
  111. d = (t, e, s) => {
  112. Object.keys(s).forEach((i) => {
  113. const n = s[i],
  114. o = e[i],
  115. r =
  116. o && c(o)
  117. ? "element"
  118. : null == (a = o)
  119. ? "" + a
  120. : {}.toString
  121. .call(a)
  122. .match(/\s([a-z]+)/i)[1]
  123. .toLowerCase();
  124. var a;
  125. if (!new RegExp(n).test(r))
  126. throw new TypeError(
  127. `${t.toUpperCase()}: Option "${i}" provided type "${r}" but expected type "${n}".`
  128. );
  129. });
  130. },
  131. u = (t) =>
  132. !(!c(t) || 0 === t.getClientRects().length) &&
  133. "visible" === getComputedStyle(t).getPropertyValue("visibility"),
  134. g = (t) =>
  135. !t ||
  136. t.nodeType !== Node.ELEMENT_NODE ||
  137. !!t.classList.contains("disabled") ||
  138. (void 0 !== t.disabled
  139. ? t.disabled
  140. : t.hasAttribute("disabled") && "false" !== t.getAttribute("disabled")),
  141. p = (t) => {
  142. if (!document.documentElement.attachShadow) return null;
  143. if ("function" == typeof t.getRootNode) {
  144. const e = t.getRootNode();
  145. return e instanceof ShadowRoot ? e : null;
  146. }
  147. return t instanceof ShadowRoot
  148. ? t
  149. : t.parentNode
  150. ? p(t.parentNode)
  151. : null;
  152. },
  153. f = () => {},
  154. m = (t) => t.offsetHeight,
  155. _ = () => {
  156. const { jQuery: t } = window;
  157. return t && !document.body.hasAttribute("data-bs-no-jquery") ? t : null;
  158. },
  159. b = [],
  160. v = () => "rtl" === document.documentElement.dir,
  161. y = (t) => {
  162. var e;
  163. (e = () => {
  164. const e = _();
  165. if (e) {
  166. const s = t.NAME,
  167. i = e.fn[s];
  168. (e.fn[s] = t.jQueryInterface),
  169. (e.fn[s].Constructor = t),
  170. (e.fn[s].noConflict = () => ((e.fn[s] = i), t.jQueryInterface));
  171. }
  172. }),
  173. "loading" === document.readyState
  174. ? (b.length ||
  175. document.addEventListener("DOMContentLoaded", () => {
  176. b.forEach((t) => t());
  177. }),
  178. b.push(e))
  179. : e();
  180. },
  181. w = (t) => {
  182. "function" == typeof t && t();
  183. },
  184. E = (t, e, s = !0) => {
  185. if (!s) return void w(t);
  186. const i =
  187. ((t) => {
  188. if (!t) return 0;
  189. let { transitionDuration: e, transitionDelay: s } =
  190. window.getComputedStyle(t);
  191. const i = Number.parseFloat(e),
  192. n = Number.parseFloat(s);
  193. return i || n
  194. ? ((e = e.split(",")[0]),
  195. (s = s.split(",")[0]),
  196. 1e3 * (Number.parseFloat(e) + Number.parseFloat(s)))
  197. : 0;
  198. })(e) + 5;
  199. let n = !1;
  200. const o = ({ target: s }) => {
  201. s === e && ((n = !0), e.removeEventListener("transitionend", o), w(t));
  202. };
  203. e.addEventListener("transitionend", o),
  204. setTimeout(() => {
  205. n || l(e);
  206. }, i);
  207. },
  208. A = (t, e, s, i) => {
  209. let n = t.indexOf(e);
  210. if (-1 === n) return t[!s && i ? t.length - 1 : 0];
  211. const o = t.length;
  212. return (
  213. (n += s ? 1 : -1),
  214. i && (n = (n + o) % o),
  215. t[Math.max(0, Math.min(n, o - 1))]
  216. );
  217. },
  218. T = /[^.]*(?=\..*)\.|.*/,
  219. C = /\..*/,
  220. k = /::\d+$/,
  221. L = {};
  222. let O = 1;
  223. const D = { mouseenter: "mouseover", mouseleave: "mouseout" },
  224. I = /^(mouseenter|mouseleave)/i,
  225. N = new Set([
  226. "click",
  227. "dblclick",
  228. "mouseup",
  229. "mousedown",
  230. "contextmenu",
  231. "mousewheel",
  232. "DOMMouseScroll",
  233. "mouseover",
  234. "mouseout",
  235. "mousemove",
  236. "selectstart",
  237. "selectend",
  238. "keydown",
  239. "keypress",
  240. "keyup",
  241. "orientationchange",
  242. "touchstart",
  243. "touchmove",
  244. "touchend",
  245. "touchcancel",
  246. "pointerdown",
  247. "pointermove",
  248. "pointerup",
  249. "pointerleave",
  250. "pointercancel",
  251. "gesturestart",
  252. "gesturechange",
  253. "gestureend",
  254. "focus",
  255. "blur",
  256. "change",
  257. "reset",
  258. "select",
  259. "submit",
  260. "focusin",
  261. "focusout",
  262. "load",
  263. "unload",
  264. "beforeunload",
  265. "resize",
  266. "move",
  267. "DOMContentLoaded",
  268. "readystatechange",
  269. "error",
  270. "abort",
  271. "scroll",
  272. ]);
  273. function S(t, e) {
  274. return (e && `${e}::${O++}`) || t.uidEvent || O++;
  275. }
  276. function x(t) {
  277. const e = S(t);
  278. return (t.uidEvent = e), (L[e] = L[e] || {}), L[e];
  279. }
  280. function M(t, e, s = null) {
  281. const i = Object.keys(t);
  282. for (let n = 0, o = i.length; n < o; n++) {
  283. const o = t[i[n]];
  284. if (o.originalHandler === e && o.delegationSelector === s) return o;
  285. }
  286. return null;
  287. }
  288. function P(t, e, s) {
  289. const i = "string" == typeof e,
  290. n = i ? s : e;
  291. let o = R(t);
  292. return N.has(o) || (o = t), [i, n, o];
  293. }
  294. function j(t, e, s, i, n) {
  295. if ("string" != typeof e || !t) return;
  296. if ((s || ((s = i), (i = null)), I.test(e))) {
  297. const t = (t) =>
  298. function (e) {
  299. if (
  300. !e.relatedTarget ||
  301. (e.relatedTarget !== e.delegateTarget &&
  302. !e.delegateTarget.contains(e.relatedTarget))
  303. )
  304. return t.call(this, e);
  305. };
  306. i ? (i = t(i)) : (s = t(s));
  307. }
  308. const [o, r, a] = P(e, s, i),
  309. l = x(t),
  310. c = l[a] || (l[a] = {}),
  311. h = M(c, r, o ? s : null);
  312. if (h) return void (h.oneOff = h.oneOff && n);
  313. const d = S(r, e.replace(T, "")),
  314. u = o
  315. ? (function (t, e, s) {
  316. return function i(n) {
  317. const o = t.querySelectorAll(e);
  318. for (let { target: r } = n; r && r !== this; r = r.parentNode)
  319. for (let a = o.length; a--; )
  320. if (o[a] === r)
  321. return (
  322. (n.delegateTarget = r),
  323. i.oneOff && B.off(t, n.type, e, s),
  324. s.apply(r, [n])
  325. );
  326. return null;
  327. };
  328. })(t, s, i)
  329. : (function (t, e) {
  330. return function s(i) {
  331. return (
  332. (i.delegateTarget = t),
  333. s.oneOff && B.off(t, i.type, e),
  334. e.apply(t, [i])
  335. );
  336. };
  337. })(t, s);
  338. (u.delegationSelector = o ? s : null),
  339. (u.originalHandler = r),
  340. (u.oneOff = n),
  341. (u.uidEvent = d),
  342. (c[d] = u),
  343. t.addEventListener(a, u, o);
  344. }
  345. function H(t, e, s, i, n) {
  346. const o = M(e[s], i, n);
  347. o && (t.removeEventListener(s, o, Boolean(n)), delete e[s][o.uidEvent]);
  348. }
  349. function R(t) {
  350. return (t = t.replace(C, "")), D[t] || t;
  351. }
  352. const B = {
  353. on(t, e, s, i) {
  354. j(t, e, s, i, !1);
  355. },
  356. one(t, e, s, i) {
  357. j(t, e, s, i, !0);
  358. },
  359. off(t, e, s, i) {
  360. if ("string" != typeof e || !t) return;
  361. const [n, o, r] = P(e, s, i),
  362. a = r !== e,
  363. l = x(t),
  364. c = e.startsWith(".");
  365. if (void 0 !== o) {
  366. if (!l || !l[r]) return;
  367. return void H(t, l, r, o, n ? s : null);
  368. }
  369. c &&
  370. Object.keys(l).forEach((s) => {
  371. !(function (t, e, s, i) {
  372. const n = e[s] || {};
  373. Object.keys(n).forEach((o) => {
  374. if (o.includes(i)) {
  375. const i = n[o];
  376. H(t, e, s, i.originalHandler, i.delegationSelector);
  377. }
  378. });
  379. })(t, l, s, e.slice(1));
  380. });
  381. const h = l[r] || {};
  382. Object.keys(h).forEach((s) => {
  383. const i = s.replace(k, "");
  384. if (!a || e.includes(i)) {
  385. const e = h[s];
  386. H(t, l, r, e.originalHandler, e.delegationSelector);
  387. }
  388. });
  389. },
  390. trigger(t, e, s) {
  391. if ("string" != typeof e || !t) return null;
  392. const i = _(),
  393. n = R(e),
  394. o = e !== n,
  395. r = N.has(n);
  396. let a,
  397. l = !0,
  398. c = !0,
  399. h = !1,
  400. d = null;
  401. return (
  402. o &&
  403. i &&
  404. ((a = i.Event(e, s)),
  405. i(t).trigger(a),
  406. (l = !a.isPropagationStopped()),
  407. (c = !a.isImmediatePropagationStopped()),
  408. (h = a.isDefaultPrevented())),
  409. r
  410. ? ((d = document.createEvent("HTMLEvents")), d.initEvent(n, l, !0))
  411. : (d = new CustomEvent(e, { bubbles: l, cancelable: !0 })),
  412. void 0 !== s &&
  413. Object.keys(s).forEach((t) => {
  414. Object.defineProperty(d, t, { get: () => s[t] });
  415. }),
  416. h && d.preventDefault(),
  417. c && t.dispatchEvent(d),
  418. d.defaultPrevented && void 0 !== a && a.preventDefault(),
  419. d
  420. );
  421. },
  422. },
  423. $ = new Map();
  424. var W = {
  425. set(t, e, s) {
  426. $.has(t) || $.set(t, new Map());
  427. const i = $.get(t);
  428. i.has(e) || 0 === i.size
  429. ? i.set(e, s)
  430. : console.error(
  431. `Bootstrap doesn't allow more than one instance per element. Bound instance: ${
  432. Array.from(i.keys())[0]
  433. }.`
  434. );
  435. },
  436. get: (t, e) => ($.has(t) && $.get(t).get(e)) || null,
  437. remove(t, e) {
  438. if (!$.has(t)) return;
  439. const s = $.get(t);
  440. s.delete(e), 0 === s.size && $.delete(t);
  441. },
  442. };
  443. class q {
  444. constructor(t) {
  445. (t = h(t)) &&
  446. ((this._element = t),
  447. W.set(this._element, this.constructor.DATA_KEY, this));
  448. }
  449. dispose() {
  450. W.remove(this._element, this.constructor.DATA_KEY),
  451. B.off(this._element, this.constructor.EVENT_KEY),
  452. Object.getOwnPropertyNames(this).forEach((t) => {
  453. this[t] = null;
  454. });
  455. }
  456. _queueCallback(t, e, s = !0) {
  457. E(t, e, s);
  458. }
  459. static getInstance(t) {
  460. return W.get(t, this.DATA_KEY);
  461. }
  462. static getOrCreateInstance(t, e = {}) {
  463. return (
  464. this.getInstance(t) || new this(t, "object" == typeof e ? e : null)
  465. );
  466. }
  467. static get VERSION() {
  468. return "5.0.2";
  469. }
  470. static get NAME() {
  471. throw new Error(
  472. 'You have to implement the static method "NAME", for each component!'
  473. );
  474. }
  475. static get DATA_KEY() {
  476. return "bs." + this.NAME;
  477. }
  478. static get EVENT_KEY() {
  479. return "." + this.DATA_KEY;
  480. }
  481. }
  482. class z extends q {
  483. static get NAME() {
  484. return "alert";
  485. }
  486. close(t) {
  487. const e = t ? this._getRootElement(t) : this._element,
  488. s = this._triggerCloseEvent(e);
  489. null === s || s.defaultPrevented || this._removeElement(e);
  490. }
  491. _getRootElement(t) {
  492. return a(t) || t.closest(".alert");
  493. }
  494. _triggerCloseEvent(t) {
  495. return B.trigger(t, "close.bs.alert");
  496. }
  497. _removeElement(t) {
  498. t.classList.remove("show");
  499. const e = t.classList.contains("fade");
  500. this._queueCallback(() => this._destroyElement(t), t, e);
  501. }
  502. _destroyElement(t) {
  503. t.remove(), B.trigger(t, "closed.bs.alert");
  504. }
  505. static jQueryInterface(t) {
  506. return this.each(function () {
  507. const e = z.getOrCreateInstance(this);
  508. "close" === t && e[t](this);
  509. });
  510. }
  511. static handleDismiss(t) {
  512. return function (e) {
  513. e && e.preventDefault(), t.close(this);
  514. };
  515. }
  516. }
  517. B.on(
  518. document,
  519. "click.bs.alert.data-api",
  520. '[data-bs-dismiss="alert"]',
  521. z.handleDismiss(new z())
  522. ),
  523. y(z);
  524. class F extends q {
  525. static get NAME() {
  526. return "button";
  527. }
  528. toggle() {
  529. this._element.setAttribute(
  530. "aria-pressed",
  531. this._element.classList.toggle("active")
  532. );
  533. }
  534. static jQueryInterface(t) {
  535. return this.each(function () {
  536. const e = F.getOrCreateInstance(this);
  537. "toggle" === t && e[t]();
  538. });
  539. }
  540. }
  541. function U(t) {
  542. return (
  543. "true" === t ||
  544. ("false" !== t &&
  545. (t === Number(t).toString()
  546. ? Number(t)
  547. : "" === t || "null" === t
  548. ? null
  549. : t))
  550. );
  551. }
  552. function K(t) {
  553. return t.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
  554. }
  555. B.on(
  556. document,
  557. "click.bs.button.data-api",
  558. '[data-bs-toggle="button"]',
  559. (t) => {
  560. t.preventDefault();
  561. const e = t.target.closest('[data-bs-toggle="button"]');
  562. F.getOrCreateInstance(e).toggle();
  563. }
  564. ),
  565. y(F);
  566. const V = {
  567. setDataAttribute(t, e, s) {
  568. t.setAttribute("data-bs-" + K(e), s);
  569. },
  570. removeDataAttribute(t, e) {
  571. t.removeAttribute("data-bs-" + K(e));
  572. },
  573. getDataAttributes(t) {
  574. if (!t) return {};
  575. const e = {};
  576. return (
  577. Object.keys(t.dataset)
  578. .filter((t) => t.startsWith("bs"))
  579. .forEach((s) => {
  580. let i = s.replace(/^bs/, "");
  581. (i = i.charAt(0).toLowerCase() + i.slice(1, i.length)),
  582. (e[i] = U(t.dataset[s]));
  583. }),
  584. e
  585. );
  586. },
  587. getDataAttribute: (t, e) => U(t.getAttribute("data-bs-" + K(e))),
  588. offset(t) {
  589. const e = t.getBoundingClientRect();
  590. return {
  591. top: e.top + document.body.scrollTop,
  592. left: e.left + document.body.scrollLeft,
  593. };
  594. },
  595. position: (t) => ({ top: t.offsetTop, left: t.offsetLeft }),
  596. },
  597. Q = {
  598. interval: 5e3,
  599. keyboard: !0,
  600. slide: !1,
  601. pause: "hover",
  602. wrap: !0,
  603. touch: !0,
  604. },
  605. X = {
  606. interval: "(number|boolean)",
  607. keyboard: "boolean",
  608. slide: "(boolean|string)",
  609. pause: "(string|boolean)",
  610. wrap: "boolean",
  611. touch: "boolean",
  612. },
  613. Y = "next",
  614. G = "prev",
  615. Z = "left",
  616. J = "right",
  617. tt = { ArrowLeft: J, ArrowRight: Z };
  618. class et extends q {
  619. constructor(t, e) {
  620. super(t),
  621. (this._items = null),
  622. (this._interval = null),
  623. (this._activeElement = null),
  624. (this._isPaused = !1),
  625. (this._isSliding = !1),
  626. (this.touchTimeout = null),
  627. (this.touchStartX = 0),
  628. (this.touchDeltaX = 0),
  629. (this._config = this._getConfig(e)),
  630. (this._indicatorsElement = i.findOne(
  631. ".carousel-indicators",
  632. this._element
  633. )),
  634. (this._touchSupported =
  635. "ontouchstart" in document.documentElement ||
  636. navigator.maxTouchPoints > 0),
  637. (this._pointerEvent = Boolean(window.PointerEvent)),
  638. this._addEventListeners();
  639. }
  640. static get Default() {
  641. return Q;
  642. }
  643. static get NAME() {
  644. return "carousel";
  645. }
  646. next() {
  647. this._slide(Y);
  648. }
  649. nextWhenVisible() {
  650. !document.hidden && u(this._element) && this.next();
  651. }
  652. prev() {
  653. this._slide(G);
  654. }
  655. pause(t) {
  656. t || (this._isPaused = !0),
  657. i.findOne(".carousel-item-next, .carousel-item-prev", this._element) &&
  658. (l(this._element), this.cycle(!0)),
  659. clearInterval(this._interval),
  660. (this._interval = null);
  661. }
  662. cycle(t) {
  663. t || (this._isPaused = !1),
  664. this._interval &&
  665. (clearInterval(this._interval), (this._interval = null)),
  666. this._config &&
  667. this._config.interval &&
  668. !this._isPaused &&
  669. (this._updateInterval(),
  670. (this._interval = setInterval(
  671. (document.visibilityState ? this.nextWhenVisible : this.next).bind(
  672. this
  673. ),
  674. this._config.interval
  675. )));
  676. }
  677. to(t) {
  678. this._activeElement = i.findOne(".active.carousel-item", this._element);
  679. const e = this._getItemIndex(this._activeElement);
  680. if (t > this._items.length - 1 || t < 0) return;
  681. if (this._isSliding)
  682. return void B.one(this._element, "slid.bs.carousel", () => this.to(t));
  683. if (e === t) return this.pause(), void this.cycle();
  684. const s = t > e ? Y : G;
  685. this._slide(s, this._items[t]);
  686. }
  687. _getConfig(t) {
  688. return (
  689. (t = {
  690. ...Q,
  691. ...V.getDataAttributes(this._element),
  692. ...("object" == typeof t ? t : {}),
  693. }),
  694. d("carousel", t, X),
  695. t
  696. );
  697. }
  698. _handleSwipe() {
  699. const t = Math.abs(this.touchDeltaX);
  700. if (t <= 40) return;
  701. const e = t / this.touchDeltaX;
  702. (this.touchDeltaX = 0), e && this._slide(e > 0 ? J : Z);
  703. }
  704. _addEventListeners() {
  705. this._config.keyboard &&
  706. B.on(this._element, "keydown.bs.carousel", (t) => this._keydown(t)),
  707. "hover" === this._config.pause &&
  708. (B.on(this._element, "mouseenter.bs.carousel", (t) => this.pause(t)),
  709. B.on(this._element, "mouseleave.bs.carousel", (t) => this.cycle(t))),
  710. this._config.touch &&
  711. this._touchSupported &&
  712. this._addTouchEventListeners();
  713. }
  714. _addTouchEventListeners() {
  715. const t = (t) => {
  716. !this._pointerEvent ||
  717. ("pen" !== t.pointerType && "touch" !== t.pointerType)
  718. ? this._pointerEvent || (this.touchStartX = t.touches[0].clientX)
  719. : (this.touchStartX = t.clientX);
  720. },
  721. e = (t) => {
  722. this.touchDeltaX =
  723. t.touches && t.touches.length > 1
  724. ? 0
  725. : t.touches[0].clientX - this.touchStartX;
  726. },
  727. s = (t) => {
  728. !this._pointerEvent ||
  729. ("pen" !== t.pointerType && "touch" !== t.pointerType) ||
  730. (this.touchDeltaX = t.clientX - this.touchStartX),
  731. this._handleSwipe(),
  732. "hover" === this._config.pause &&
  733. (this.pause(),
  734. this.touchTimeout && clearTimeout(this.touchTimeout),
  735. (this.touchTimeout = setTimeout(
  736. (t) => this.cycle(t),
  737. 500 + this._config.interval
  738. )));
  739. };
  740. i.find(".carousel-item img", this._element).forEach((t) => {
  741. B.on(t, "dragstart.bs.carousel", (t) => t.preventDefault());
  742. }),
  743. this._pointerEvent
  744. ? (B.on(this._element, "pointerdown.bs.carousel", (e) => t(e)),
  745. B.on(this._element, "pointerup.bs.carousel", (t) => s(t)),
  746. this._element.classList.add("pointer-event"))
  747. : (B.on(this._element, "touchstart.bs.carousel", (e) => t(e)),
  748. B.on(this._element, "touchmove.bs.carousel", (t) => e(t)),
  749. B.on(this._element, "touchend.bs.carousel", (t) => s(t)));
  750. }
  751. _keydown(t) {
  752. if (/input|textarea/i.test(t.target.tagName)) return;
  753. const e = tt[t.key];
  754. e && (t.preventDefault(), this._slide(e));
  755. }
  756. _getItemIndex(t) {
  757. return (
  758. (this._items =
  759. t && t.parentNode ? i.find(".carousel-item", t.parentNode) : []),
  760. this._items.indexOf(t)
  761. );
  762. }
  763. _getItemByOrder(t, e) {
  764. const s = t === Y;
  765. return A(this._items, e, s, this._config.wrap);
  766. }
  767. _triggerSlideEvent(t, e) {
  768. const s = this._getItemIndex(t),
  769. n = this._getItemIndex(
  770. i.findOne(".active.carousel-item", this._element)
  771. );
  772. return B.trigger(this._element, "slide.bs.carousel", {
  773. relatedTarget: t,
  774. direction: e,
  775. from: n,
  776. to: s,
  777. });
  778. }
  779. _setActiveIndicatorElement(t) {
  780. if (this._indicatorsElement) {
  781. const e = i.findOne(".active", this._indicatorsElement);
  782. e.classList.remove("active"), e.removeAttribute("aria-current");
  783. const s = i.find("[data-bs-target]", this._indicatorsElement);
  784. for (let e = 0; e < s.length; e++)
  785. if (
  786. Number.parseInt(s[e].getAttribute("data-bs-slide-to"), 10) ===
  787. this._getItemIndex(t)
  788. ) {
  789. s[e].classList.add("active"),
  790. s[e].setAttribute("aria-current", "true");
  791. break;
  792. }
  793. }
  794. }
  795. _updateInterval() {
  796. const t =
  797. this._activeElement ||
  798. i.findOne(".active.carousel-item", this._element);
  799. if (!t) return;
  800. const e = Number.parseInt(t.getAttribute("data-bs-interval"), 10);
  801. e
  802. ? ((this._config.defaultInterval =
  803. this._config.defaultInterval || this._config.interval),
  804. (this._config.interval = e))
  805. : (this._config.interval =
  806. this._config.defaultInterval || this._config.interval);
  807. }
  808. _slide(t, e) {
  809. const s = this._directionToOrder(t),
  810. n = i.findOne(".active.carousel-item", this._element),
  811. o = this._getItemIndex(n),
  812. r = e || this._getItemByOrder(s, n),
  813. a = this._getItemIndex(r),
  814. l = Boolean(this._interval),
  815. c = s === Y,
  816. h = c ? "carousel-item-start" : "carousel-item-end",
  817. d = c ? "carousel-item-next" : "carousel-item-prev",
  818. u = this._orderToDirection(s);
  819. if (r && r.classList.contains("active"))
  820. return void (this._isSliding = !1);
  821. if (this._isSliding) return;
  822. if (this._triggerSlideEvent(r, u).defaultPrevented) return;
  823. if (!n || !r) return;
  824. (this._isSliding = !0),
  825. l && this.pause(),
  826. this._setActiveIndicatorElement(r),
  827. (this._activeElement = r);
  828. const g = () => {
  829. B.trigger(this._element, "slid.bs.carousel", {
  830. relatedTarget: r,
  831. direction: u,
  832. from: o,
  833. to: a,
  834. });
  835. };
  836. if (this._element.classList.contains("slide")) {
  837. r.classList.add(d), m(r), n.classList.add(h), r.classList.add(h);
  838. const t = () => {
  839. r.classList.remove(h, d),
  840. r.classList.add("active"),
  841. n.classList.remove("active", d, h),
  842. (this._isSliding = !1),
  843. setTimeout(g, 0);
  844. };
  845. this._queueCallback(t, n, !0);
  846. } else n.classList.remove("active"), r.classList.add("active"), (this._isSliding = !1), g();
  847. l && this.cycle();
  848. }
  849. _directionToOrder(t) {
  850. return [J, Z].includes(t)
  851. ? v()
  852. ? t === Z
  853. ? G
  854. : Y
  855. : t === Z
  856. ? Y
  857. : G
  858. : t;
  859. }
  860. _orderToDirection(t) {
  861. return [Y, G].includes(t)
  862. ? v()
  863. ? t === G
  864. ? Z
  865. : J
  866. : t === G
  867. ? J
  868. : Z
  869. : t;
  870. }
  871. static carouselInterface(t, e) {
  872. const s = et.getOrCreateInstance(t, e);
  873. let { _config: i } = s;
  874. "object" == typeof e && (i = { ...i, ...e });
  875. const n = "string" == typeof e ? e : i.slide;
  876. if ("number" == typeof e) s.to(e);
  877. else if ("string" == typeof n) {
  878. if (void 0 === s[n]) throw new TypeError(`No method named "${n}"`);
  879. s[n]();
  880. } else i.interval && i.ride && (s.pause(), s.cycle());
  881. }
  882. static jQueryInterface(t) {
  883. return this.each(function () {
  884. et.carouselInterface(this, t);
  885. });
  886. }
  887. static dataApiClickHandler(t) {
  888. const e = a(this);
  889. if (!e || !e.classList.contains("carousel")) return;
  890. const s = { ...V.getDataAttributes(e), ...V.getDataAttributes(this) },
  891. i = this.getAttribute("data-bs-slide-to");
  892. i && (s.interval = !1),
  893. et.carouselInterface(e, s),
  894. i && et.getInstance(e).to(i),
  895. t.preventDefault();
  896. }
  897. }
  898. B.on(
  899. document,
  900. "click.bs.carousel.data-api",
  901. "[data-bs-slide], [data-bs-slide-to]",
  902. et.dataApiClickHandler
  903. ),
  904. B.on(window, "load.bs.carousel.data-api", () => {
  905. const t = i.find('[data-bs-ride="carousel"]');
  906. for (let e = 0, s = t.length; e < s; e++)
  907. et.carouselInterface(t[e], et.getInstance(t[e]));
  908. }),
  909. y(et);
  910. return (
  911. y(Qt),
  912. {
  913. Alert: z,
  914. Button: F,
  915. Carousel: et,
  916. Collapse: nt,
  917. Dropdown: pt,
  918. Modal: wt,
  919. Offcanvas: Tt,
  920. Popover: Wt,
  921. ScrollSpy: Ft,
  922. Tab: Ut,
  923. Toast: Qt,
  924. Tooltip: jt,
  925. }
  926. );
  927. });
  928. //# sourceMappingURL=bootstrap.min.js.map