1import { 2 require_react 3} from "/@fs/home/runner/workspace/node_modules/.vite/deps/chunk-3TFVT2CW.js?v=9ce4103e"; 4import { 5 __toESM 6} from "/@fs/home/runner/workspace/node_modules/.vite/deps/chunk-4MBMRILA.js?v=9ce4103e"; 7
vendor: 115 bytes, lines 8-10
8// node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js 9var import_react = __toESM(require_react()); 10
vendor: 1,620 bytes, lines 11-48
11// node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js 12function isObject(subject) { 13 return Object.prototype.toString.call(subject) === "[object Object]"; 14} 15function isRecord(subject) { 16 return isObject(subject) || Array.isArray(subject); 17} 18function canUseDOM() { 19 return !!(typeof window !== "undefined" && window.document && window.document.createElement); 20} 21function areOptionsEqual(optionsA, optionsB) { 22 const optionsAKeys = Object.keys(optionsA); 23 const optionsBKeys = Object.keys(optionsB); 24 if (optionsAKeys.length !== optionsBKeys.length) return false; 25 const breakpointsA = JSON.stringify(Object.keys(optionsA.breakpoints || {})); 26 const breakpointsB = JSON.stringify(Object.keys(optionsB.breakpoints || {})); 27 if (breakpointsA !== breakpointsB) return false; 28 return optionsAKeys.every((key) => { 29 const valueA = optionsA[key]; 30 const valueB = optionsB[key]; 31 if (typeof valueA === "function") return `${valueA}` === `${valueB}`; 32 if (!isRecord(valueA) || !isRecord(valueB)) return valueA === valueB; 33 return areOptionsEqual(valueA, valueB); 34 }); 35} 36function sortAndMapPluginToOptions(plugins) { 37 return plugins.concat().sort((a, b) => a.name > b.name ? 1 : -1).map((plugin) => plugin.options); 38} 39function arePluginsEqual(pluginsA, pluginsB) { 40 if (pluginsA.length !== pluginsB.length) return false; 41 const optionsA = sortAndMapPluginToOptions(pluginsA); 42 const optionsB = sortAndMapPluginToOptions(pluginsB); 43 return optionsA.every((optionA, index) => { 44 const optionB = optionsB[index]; 45 return areOptionsEqual(optionA, optionB); 46 }); 47} 48
vendor: 47,883 bytes, lines 49-1665
49// node_modules/embla-carousel/esm/embla-carousel.esm.js 50function isNumber(subject) { 51 return typeof subject === "number"; 52} 53function isString(subject) { 54 return typeof subject === "string"; 55} 56function isBoolean(subject) { 57 return typeof subject === "boolean"; 58} 59function isObject2(subject) { 60 return Object.prototype.toString.call(subject) === "[object Object]"; 61} 62function mathAbs(n) { 63 return Math.abs(n); 64} 65function mathSign(n) { 66 return Math.sign(n); 67} 68function deltaAbs(valueB, valueA) { 69 return mathAbs(valueB - valueA); 70} 71function factorAbs(valueB, valueA) { 72 if (valueB === 0 || valueA === 0) return 0; 73 if (mathAbs(valueB) <= mathAbs(valueA)) return 0; 74 const diff = deltaAbs(mathAbs(valueB), mathAbs(valueA)); 75 return mathAbs(diff / valueB); 76} 77function arrayKeys(array) { 78 return objectKeys(array).map(Number); 79} 80function arrayLast(array) { 81 return array[arrayLastIndex(array)]; 82} 83function arrayLastIndex(array) { 84 return Math.max(0, array.length - 1); 85} 86function arrayIsLastIndex(array, index) { 87 return index === arrayLastIndex(array); 88} 89function arrayFromNumber(n, startAt = 0) { 90 return Array.from(Array(n), (_, i) => startAt + i); 91} 92function objectKeys(object) { 93 return Object.keys(object); 94} 95function objectsMergeDeep(objectA, objectB) { 96 return [objectA, objectB].reduce((mergedObjects, currentObject) => { 97 objectKeys(currentObject).forEach((key) => { 98 const valueA = mergedObjects[key]; 99 const valueB = currentObject[key]; 100 const areObjects = isObject2(valueA) && isObject2(valueB); 101 mergedObjects[key] = areObjects ? objectsMergeDeep(valueA, valueB) : valueB; 102 }); 103 return mergedObjects; 104 }, {}); 105} 106function isMouseEvent(evt, ownerWindow) { 107 return typeof ownerWindow.MouseEvent !== "undefined" && evt instanceof ownerWindow.MouseEvent; 108} 109function Alignment(align, viewSize) { 110 const predefined = { 111 start, 112 center, 113 end 114 }; 115 function start() { 116 return 0; 117 } 118 function center(n) { 119 return end(n) / 2; 120 } 121 function end(n) { 122 return viewSize - n; 123 } 124 function measure(n, index) { 125 if (isString(align)) return predefined[align](n); 126 return align(viewSize, n, index); 127 } 128 const self = { 129 measure 130 }; 131 return self; 132} 133function EventStore() { 134 let listeners = []; 135 function add(node, type, handler, options = { 136 passive: true 137 }) { 138 let removeListener; 139 if ("addEventListener" in node) { 140 node.addEventListener(type, handler, options); 141 removeListener = () => node.removeEventListener(type, handler, options); 142 } else { 143 const legacyMediaQueryList = node; 144 legacyMediaQueryList.addListener(handler); 145 removeListener = () => legacyMediaQueryList.removeListener(handler); 146 } 147 listeners.push(removeListener); 148 return self; 149 } 150 function clear() { 151 listeners = listeners.filter((remove) => remove()); 152 } 153 const self = { 154 add, 155 clear 156 }; 157 return self; 158} 159function Animations(ownerDocument, ownerWindow, update, render) { 160 const documentVisibleHandler = EventStore(); 161 const timeStep = 1e3 / 60; 162 let lastTimeStamp = null; 163 let lag = 0; 164 let animationFrame = 0; 165 function init() { 166 documentVisibleHandler.add(ownerDocument, "visibilitychange", () => { 167 if (ownerDocument.hidden) reset(); 168 }); 169 } 170 function destroy() { 171 stop(); 172 documentVisibleHandler.clear(); 173 } 174 function animate(timeStamp) { 175 if (!animationFrame) return; 176 if (!lastTimeStamp) lastTimeStamp = timeStamp; 177 const elapsed = timeStamp - lastTimeStamp; 178 lastTimeStamp = timeStamp; 179 lag += elapsed; 180 while (lag >= timeStep) { 181 update(timeStep); 182 lag -= timeStep; 183 } 184 const lagOffset = lag / timeStep; 185 render(lagOffset); 186 if (animationFrame) ownerWindow.requestAnimationFrame(animate); 187 } 188 function start() { 189 if (animationFrame) return; 190 animationFrame = ownerWindow.requestAnimationFrame(animate); 191 } 192 function stop() { 193 ownerWindow.cancelAnimationFrame(animationFrame); 194 lastTimeStamp = null; 195 lag = 0; 196 animationFrame = 0; 197 } 198 function reset() { 199 lastTimeStamp = null; 200 lag = 0; 201 } 202 const self = { 203 init, 204 destroy, 205 start, 206 stop, 207 update: () => update(timeStep), 208 render 209 }; 210 return self; 211} 212function Axis(axis, contentDirection) { 213 const isRightToLeft = contentDirection === "rtl"; 214 const isVertical = axis === "y"; 215 const scroll = isVertical ? "y" : "x"; 216 const cross = isVertical ? "x" : "y"; 217 const sign = !isVertical && isRightToLeft ? -1 : 1; 218 const startEdge = getStartEdge(); 219 const endEdge = getEndEdge(); 220 function measureSize(nodeRect) { 221 const { 222 height, 223 width 224 } = nodeRect; 225 return isVertical ? height : width; 226 } 227 function getStartEdge() { 228 if (isVertical) return "top"; 229 return isRightToLeft ? "right" : "left"; 230 } 231 function getEndEdge() { 232 if (isVertical) return "bottom"; 233 return isRightToLeft ? "left" : "right"; 234 } 235 function direction(n) { 236 return n * sign; 237 } 238 const self = { 239 scroll, 240 cross, 241 startEdge, 242 endEdge, 243 measureSize, 244 direction 245 }; 246 return self; 247} 248function Limit(min = 0, max = 0) { 249 const length = mathAbs(min - max); 250 function reachedMin(n) { 251 return n < min; 252 } 253 function reachedMax(n) { 254 return n > max; 255 } 256 function reachedAny(n) { 257 return reachedMin(n) || reachedMax(n); 258 } 259 function constrain(n) { 260 if (!reachedAny(n)) return n; 261 return reachedMin(n) ? min : max; 262 } 263 function removeOffset(n) { 264 if (!length) return n; 265 return n - length * Math.ceil((n - max) / length); 266 } 267 const self = { 268 length, 269 max, 270 min, 271 constrain, 272 reachedAny, 273 reachedMax, 274 reachedMin, 275 removeOffset 276 }; 277 return self; 278} 279function Counter(max, start, loop) { 280 const { 281 constrain 282 } = Limit(0, max); 283 const loopEnd = max + 1; 284 let counter = withinLimit(start); 285 function withinLimit(n) { 286 return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd); 287 } 288 function get() { 289 return counter; 290 } 291 function set(n) { 292 counter = withinLimit(n); 293 return self; 294 } 295 function add(n) { 296 return clone().set(get() + n); 297 } 298 function clone() { 299 return Counter(max, get(), loop); 300 } 301 const self = { 302 get, 303 set, 304 add, 305 clone 306 }; 307 return self; 308} 309function DragHandler(axis, rootNode, ownerDocument, ownerWindow, target, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, baseFriction, watchDrag) { 310 const { 311 cross: crossAxis, 312 direction 313 } = axis; 314 const focusNodes = ["INPUT", "SELECT", "TEXTAREA"]; 315 const nonPassiveEvent = { 316 passive: false 317 }; 318 const initEvents = EventStore(); 319 const dragEvents = EventStore(); 320 const goToNextThreshold = Limit(50, 225).constrain(percentOfView.measure(20)); 321 const snapForceBoost = { 322 mouse: 300, 323 touch: 400 324 }; 325 const freeForceBoost = { 326 mouse: 500, 327 touch: 600 328 }; 329 const baseSpeed = dragFree ? 43 : 25; 330 let isMoving = false; 331 let startScroll = 0; 332 let startCross = 0; 333 let pointerIsDown = false; 334 let preventScroll = false; 335 let preventClick = false; 336 let isMouse = false; 337 function init(emblaApi) { 338 if (!watchDrag) return; 339 function downIfAllowed(evt) { 340 if (isBoolean(watchDrag) || watchDrag(emblaApi, evt)) down(evt); 341 } 342 const node = rootNode; 343 initEvents.add(node, "dragstart", (evt) => evt.preventDefault(), nonPassiveEvent).add(node, "touchmove", () => void 0, nonPassiveEvent).add(node, "touchend", () => void 0).add(node, "touchstart", downIfAllowed).add(node, "mousedown", downIfAllowed).add(node, "touchcancel", up).add(node, "contextmenu", up).add(node, "click", click, true); 344 } 345 function destroy() { 346 initEvents.clear(); 347 dragEvents.clear(); 348 } 349 function addDragEvents() { 350 const node = isMouse ? ownerDocument : rootNode; 351 dragEvents.add(node, "touchmove", move, nonPassiveEvent).add(node, "touchend", up).add(node, "mousemove", move, nonPassiveEvent).add(node, "mouseup", up); 352 } 353 function isFocusNode(node) { 354 const nodeName = node.nodeName || ""; 355 return focusNodes.includes(nodeName); 356 } 357 function forceBoost() { 358 const boost = dragFree ? freeForceBoost : snapForceBoost; 359 const type = isMouse ? "mouse" : "touch"; 360 return boost[type]; 361 } 362 function allowedForce(force, targetChanged) { 363 const next = index.add(mathSign(force) * -1); 364 const baseForce = scrollTarget.byDistance(force, !dragFree).distance; 365 if (dragFree || mathAbs(force) < goToNextThreshold) return baseForce; 366 if (skipSnaps && targetChanged) return baseForce * 0.5; 367 return scrollTarget.byIndex(next.get(), 0).distance; 368 } 369 function down(evt) { 370 const isMouseEvt = isMouseEvent(evt, ownerWindow); 371 isMouse = isMouseEvt; 372 preventClick = dragFree && isMouseEvt && !evt.buttons && isMoving; 373 isMoving = deltaAbs(target.get(), location.get()) >= 2; 374 if (isMouseEvt && evt.button !== 0) return; 375 if (isFocusNode(evt.target)) return; 376 pointerIsDown = true; 377 dragTracker.pointerDown(evt); 378 scrollBody.useFriction(0).useDuration(0); 379 target.set(location); 380 addDragEvents(); 381 startScroll = dragTracker.readPoint(evt); 382 startCross = dragTracker.readPoint(evt, crossAxis); 383 eventHandler.emit("pointerDown"); 384 } 385 function move(evt) { 386 const isTouchEvt = !isMouseEvent(evt, ownerWindow); 387 if (isTouchEvt && evt.touches.length >= 2) return up(evt); 388 const lastScroll = dragTracker.readPoint(evt); 389 const lastCross = dragTracker.readPoint(evt, crossAxis); 390 const diffScroll = deltaAbs(lastScroll, startScroll); 391 const diffCross = deltaAbs(lastCross, startCross); 392 if (!preventScroll && !isMouse) { 393 if (!evt.cancelable) return up(evt); 394 preventScroll = diffScroll > diffCross; 395 if (!preventScroll) return up(evt); 396 } 397 const diff = dragTracker.pointerMove(evt); 398 if (diffScroll > dragThreshold) preventClick = true; 399 scrollBody.useFriction(0.3).useDuration(0.75); 400 animation.start(); 401 target.add(direction(diff)); 402 evt.preventDefault(); 403 } 404 function up(evt) { 405 const currentLocation = scrollTarget.byDistance(0, false); 406 const targetChanged = currentLocation.index !== index.get(); 407 const rawForce = dragTracker.pointerUp(evt) * forceBoost(); 408 const force = allowedForce(direction(rawForce), targetChanged); 409 const forceFactor = factorAbs(rawForce, force); 410 const speed = baseSpeed - 10 * forceFactor; 411 const friction = baseFriction + forceFactor / 50; 412 preventScroll = false; 413 pointerIsDown = false; 414 dragEvents.clear(); 415 scrollBody.useDuration(speed).useFriction(friction); 416 scrollTo.distance(force, !dragFree); 417 isMouse = false; 418 eventHandler.emit("pointerUp"); 419 } 420 function click(evt) { 421 if (preventClick) { 422 evt.stopPropagation(); 423 evt.preventDefault(); 424 preventClick = false; 425 } 426 } 427 function pointerDown() { 428 return pointerIsDown; 429 } 430 const self = { 431 init, 432 destroy, 433 pointerDown 434 }; 435 return self; 436} 437function DragTracker(axis, ownerWindow) { 438 const logInterval = 170; 439 let startEvent; 440 let lastEvent; 441 function readTime(evt) { 442 return evt.timeStamp; 443 } 444 function readPoint(evt, evtAxis) { 445 const property = evtAxis || axis.scroll; 446 const coord = `client${property === "x" ? "X" : "Y"}`; 447 return (isMouseEvent(evt, ownerWindow) ? evt : evt.touches[0])[coord]; 448 } 449 function pointerDown(evt) { 450 startEvent = evt; 451 lastEvent = evt; 452 return readPoint(evt); 453 } 454 function pointerMove(evt) { 455 const diff = readPoint(evt) - readPoint(lastEvent); 456 const expired = readTime(evt) - readTime(startEvent) > logInterval; 457 lastEvent = evt; 458 if (expired) startEvent = evt; 459 return diff; 460 } 461 function pointerUp(evt) { 462 if (!startEvent || !lastEvent) return 0; 463 const diffDrag = readPoint(lastEvent) - readPoint(startEvent); 464 const diffTime = readTime(evt) - readTime(startEvent); 465 const expired = readTime(evt) - readTime(lastEvent) > logInterval; 466 const force = diffDrag / diffTime; 467 const isFlick = diffTime && !expired && mathAbs(force) > 0.1; 468 return isFlick ? force : 0; 469 } 470 const self = { 471 pointerDown, 472 pointerMove, 473 pointerUp, 474 readPoint 475 }; 476 return self; 477} 478function NodeRects() { 479 function measure(node) { 480 const { 481 offsetTop, 482 offsetLeft, 483 offsetWidth, 484 offsetHeight 485 } = node; 486 const offset = { 487 top: offsetTop, 488 right: offsetLeft + offsetWidth, 489 bottom: offsetTop + offsetHeight, 490 left: offsetLeft, 491 width: offsetWidth, 492 height: offsetHeight 493 }; 494 return offset; 495 } 496 const self = { 497 measure 498 }; 499 return self; 500} 501function PercentOfView(viewSize) { 502 function measure(n) { 503 return viewSize * (n / 100); 504 } 505 const self = { 506 measure 507 }; 508 return self; 509} 510function ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects) { 511 const observeNodes = [container].concat(slides); 512 let resizeObserver; 513 let containerSize; 514 let slideSizes = []; 515 let destroyed = false; 516 function readSize(node) { 517 return axis.measureSize(nodeRects.measure(node)); 518 } 519 function init(emblaApi) { 520 if (!watchResize) return; 521 containerSize = readSize(container); 522 slideSizes = slides.map(readSize); 523 function defaultCallback(entries) { 524 for (const entry of entries) { 525 if (destroyed) return; 526 const isContainer = entry.target === container; 527 const slideIndex = slides.indexOf(entry.target); 528 const lastSize = isContainer ? containerSize : slideSizes[slideIndex]; 529 const newSize = readSize(isContainer ? container : slides[slideIndex]); 530 const diffSize = mathAbs(newSize - lastSize); 531 if (diffSize >= 0.5) { 532 emblaApi.reInit(); 533 eventHandler.emit("resize"); 534 break; 535 } 536 } 537 } 538 resizeObserver = new ResizeObserver((entries) => { 539 if (isBoolean(watchResize) || watchResize(emblaApi, entries)) { 540 defaultCallback(entries); 541 } 542 }); 543 ownerWindow.requestAnimationFrame(() => { 544 observeNodes.forEach((node) => resizeObserver.observe(node)); 545 }); 546 } 547 function destroy() { 548 destroyed = true; 549 if (resizeObserver) resizeObserver.disconnect(); 550 } 551 const self = { 552 init, 553 destroy 554 }; 555 return self; 556} 557function ScrollBody(location, offsetLocation, previousLocation, target, baseDuration, baseFriction) { 558 let bodyVelocity = 0; 559 let scrollDirection = 0; 560 let scrollDuration = baseDuration; 561 let scrollFriction = baseFriction; 562 let rawLocation = location.get(); 563 let rawLocationPrevious = 0; 564 function seek(timeStep) { 565 const fixedDeltaTimeSeconds = timeStep / 1e3; 566 const duration2 = scrollDuration * fixedDeltaTimeSeconds; 567 const diff = target.get() - location.get(); 568 const isInstant = !scrollDuration; 569 let directionDiff = 0; 570 if (isInstant) { 571 bodyVelocity = 0; 572 previousLocation.set(target); 573 location.set(target); 574 directionDiff = diff; 575 } else { 576 previousLocation.set(location); 577 bodyVelocity += diff / duration2; 578 bodyVelocity *= scrollFriction; 579 rawLocation += bodyVelocity; 580 location.add(bodyVelocity * fixedDeltaTimeSeconds); 581 directionDiff = rawLocation - rawLocationPrevious; 582 } 583 scrollDirection = mathSign(directionDiff); 584 rawLocationPrevious = rawLocation; 585 return self; 586 } 587 function settled() { 588 const diff = target.get() - offsetLocation.get(); 589 return mathAbs(diff) < 1e-3; 590 } 591 function duration() { 592 return scrollDuration; 593 } 594 function direction() { 595 return scrollDirection; 596 } 597 function velocity() { 598 return bodyVelocity; 599 } 600 function useBaseDuration() { 601 return useDuration(baseDuration); 602 } 603 function useBaseFriction() { 604 return useFriction(baseFriction); 605 } 606 function useDuration(n) { 607 scrollDuration = n; 608 return self; 609 } 610 function useFriction(n) { 611 scrollFriction = n; 612 return self; 613 } 614 const self = { 615 direction, 616 duration, 617 velocity, 618 seek, 619 settled, 620 useBaseFriction, 621 useBaseDuration, 622 useFriction, 623 useDuration 624 }; 625 return self; 626} 627function ScrollBounds(limit, location, target, scrollBody, percentOfView) { 628 const pullBackThreshold = percentOfView.measure(10); 629 const edgeOffsetTolerance = percentOfView.measure(50); 630 const frictionLimit = Limit(0.1, 0.99); 631 let disabled = false; 632 function shouldConstrain() { 633 if (disabled) return false; 634 if (!limit.reachedAny(target.get())) return false; 635 if (!limit.reachedAny(location.get())) return false; 636 return true; 637 } 638 function constrain(pointerDown) { 639 if (!shouldConstrain()) return; 640 const edge = limit.reachedMin(location.get()) ? "min" : "max"; 641 const diffToEdge = mathAbs(limit[edge] - location.get()); 642 const diffToTarget = target.get() - location.get(); 643 const friction = frictionLimit.constrain(diffToEdge / edgeOffsetTolerance); 644 target.subtract(diffToTarget * friction); 645 if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) { 646 target.set(limit.constrain(target.get())); 647 scrollBody.useDuration(25).useBaseFriction(); 648 } 649 } 650 function toggleActive(active) { 651 disabled = !active; 652 } 653 const self = { 654 shouldConstrain, 655 constrain, 656 toggleActive 657 }; 658 return self; 659} 660function ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance) { 661 const scrollBounds = Limit(-contentSize + viewSize, 0); 662 const snapsBounded = measureBounded(); 663 const scrollContainLimit = findScrollContainLimit(); 664 const snapsContained = measureContained(); 665 function usePixelTolerance(bound, snap) { 666 return deltaAbs(bound, snap) < 1; 667 } 668 function findScrollContainLimit() { 669 const startSnap = snapsBounded[0]; 670 const endSnap = arrayLast(snapsBounded); 671 const min = snapsBounded.lastIndexOf(startSnap); 672 const max = snapsBounded.indexOf(endSnap) + 1; 673 return Limit(min, max); 674 } 675 function measureBounded() { 676 return snapsAligned.map((snapAligned, index) => { 677 const { 678 min, 679 max 680 } = scrollBounds; 681 const snap = scrollBounds.constrain(snapAligned); 682 const isFirst = !index; 683 const isLast = arrayIsLastIndex(snapsAligned, index); 684 if (isFirst) return max; 685 if (isLast) return min; 686 if (usePixelTolerance(min, snap)) return min; 687 if (usePixelTolerance(max, snap)) return max; 688 return snap; 689 }).map((scrollBound) => parseFloat(scrollBound.toFixed(3))); 690 } 691 function measureContained() { 692 if (contentSize <= viewSize + pixelTolerance) return [scrollBounds.max]; 693 if (containScroll === "keepSnaps") return snapsBounded; 694 const { 695 min, 696 max 697 } = scrollContainLimit; 698 return snapsBounded.slice(min, max); 699 } 700 const self = { 701 snapsContained, 702 scrollContainLimit 703 }; 704 return self; 705} 706function ScrollLimit(contentSize, scrollSnaps, loop) { 707 const max = scrollSnaps[0]; 708 const min = loop ? max - contentSize : arrayLast(scrollSnaps); 709 const limit = Limit(min, max); 710 const self = { 711 limit 712 }; 713 return self; 714} 715function ScrollLooper(contentSize, limit, location, vectors) { 716 const jointSafety = 0.1; 717 const min = limit.min + jointSafety; 718 const max = limit.max + jointSafety; 719 const { 720 reachedMin, 721 reachedMax 722 } = Limit(min, max); 723 function shouldLoop(direction) { 724 if (direction === 1) return reachedMax(location.get()); 725 if (direction === -1) return reachedMin(location.get()); 726 return false; 727 } 728 function loop(direction) { 729 if (!shouldLoop(direction)) return; 730 const loopDistance = contentSize * (direction * -1); 731 vectors.forEach((v) => v.add(loopDistance)); 732 } 733 const self = { 734 loop 735 }; 736 return self; 737} 738function ScrollProgress(limit) { 739 const { 740 max, 741 length 742 } = limit; 743 function get(n) { 744 const currentLocation = n - max; 745 return length ? currentLocation / -length : 0; 746 } 747 const self = { 748 get 749 }; 750 return self; 751} 752function ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll) { 753 const { 754 startEdge, 755 endEdge 756 } = axis; 757 const { 758 groupSlides 759 } = slidesToScroll; 760 const alignments = measureSizes().map(alignment.measure); 761 const snaps = measureUnaligned(); 762 const snapsAligned = measureAligned(); 763 function measureSizes() { 764 return groupSlides(slideRects).map((rects) => arrayLast(rects)[endEdge] - rects[0][startEdge]).map(mathAbs); 765 } 766 function measureUnaligned() { 767 return slideRects.map((rect) => containerRect[startEdge] - rect[startEdge]).map((snap) => -mathAbs(snap)); 768 } 769 function measureAligned() { 770 return groupSlides(snaps).map((g) => g[0]).map((snap, index) => snap + alignments[index]); 771 } 772 const self = { 773 snaps, 774 snapsAligned 775 }; 776 return self; 777} 778function SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes) { 779 const { 780 groupSlides 781 } = slidesToScroll; 782 const { 783 min, 784 max 785 } = scrollContainLimit; 786 const slideRegistry = createSlideRegistry(); 787 function createSlideRegistry() { 788 const groupedSlideIndexes = groupSlides(slideIndexes); 789 const doNotContain = !containSnaps || containScroll === "keepSnaps"; 790 if (scrollSnaps.length === 1) return [slideIndexes]; 791 if (doNotContain) return groupedSlideIndexes; 792 return groupedSlideIndexes.slice(min, max).map((group, index, groups) => { 793 const isFirst = !index; 794 const isLast = arrayIsLastIndex(groups, index); 795 if (isFirst) { 796 const range = arrayLast(groups[0]) + 1; 797 return arrayFromNumber(range); 798 } 799 if (isLast) { 800 const range = arrayLastIndex(slideIndexes) - arrayLast(groups)[0] + 1; 801 return arrayFromNumber(range, arrayLast(groups)[0]); 802 } 803 return group; 804 }); 805 } 806 const self = { 807 slideRegistry 808 }; 809 return self; 810} 811function ScrollTarget(loop, scrollSnaps, contentSize, limit, targetVector) { 812 const { 813 reachedAny, 814 removeOffset, 815 constrain 816 } = limit; 817 function minDistance(distances) { 818 return distances.concat().sort((a, b) => mathAbs(a) - mathAbs(b))[0]; 819 } 820 function findTargetSnap(target) { 821 const distance = loop ? removeOffset(target) : constrain(target); 822 const ascDiffsToSnaps = scrollSnaps.map((snap, index2) => ({ 823 diff: shortcut(snap - distance, 0), 824 index: index2 825 })).sort((d1, d2) => mathAbs(d1.diff) - mathAbs(d2.diff)); 826 const { 827 index 828 } = ascDiffsToSnaps[0]; 829 return { 830 index, 831 distance 832 }; 833 } 834 function shortcut(target, direction) { 835 const targets = [target, target + contentSize, target - contentSize]; 836 if (!loop) return target; 837 if (!direction) return minDistance(targets); 838 const matchingTargets = targets.filter((t) => mathSign(t) === direction); 839 if (matchingTargets.length) return minDistance(matchingTargets); 840 return arrayLast(targets) - contentSize; 841 } 842 function byIndex(index, direction) { 843 const diffToSnap = scrollSnaps[index] - targetVector.get(); 844 const distance = shortcut(diffToSnap, direction); 845 return { 846 index, 847 distance 848 }; 849 } 850 function byDistance(distance, snap) { 851 const target = targetVector.get() + distance; 852 const { 853 index, 854 distance: targetSnapDistance 855 } = findTargetSnap(target); 856 const reachedBound = !loop && reachedAny(target); 857 if (!snap || reachedBound) return { 858 index, 859 distance 860 }; 861 const diffToSnap = scrollSnaps[index] - targetSnapDistance; 862 const snapDistance = distance + shortcut(diffToSnap, 0); 863 return { 864 index, 865 distance: snapDistance 866 }; 867 } 868 const self = { 869 byDistance, 870 byIndex, 871 shortcut 872 }; 873 return self; 874} 875function ScrollTo(animation, indexCurrent, indexPrevious, scrollBody, scrollTarget, targetVector, eventHandler) { 876 function scrollTo(target) { 877 const distanceDiff = target.distance; 878 const indexDiff = target.index !== indexCurrent.get(); 879 targetVector.add(distanceDiff); 880 if (distanceDiff) { 881 if (scrollBody.duration()) { 882 animation.start(); 883 } else { 884 animation.update(); 885 animation.render(1); 886 animation.update(); 887 } 888 } 889 if (indexDiff) { 890 indexPrevious.set(indexCurrent.get()); 891 indexCurrent.set(target.index); 892 eventHandler.emit("select"); 893 } 894 } 895 function distance(n, snap) { 896 const target = scrollTarget.byDistance(n, snap); 897 scrollTo(target); 898 } 899 function index(n, direction) { 900 const targetIndex = indexCurrent.clone().set(n); 901 const target = scrollTarget.byIndex(targetIndex.get(), direction); 902 scrollTo(target); 903 } 904 const self = { 905 distance, 906 index 907 }; 908 return self; 909} 910function SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus) { 911 const focusListenerOptions = { 912 passive: true, 913 capture: true 914 }; 915 let lastTabPressTime = 0; 916 function init(emblaApi) { 917 if (!watchFocus) return; 918 function defaultCallback(index) { 919 const nowTime = (/* @__PURE__ */ new Date()).getTime(); 920 const diffTime = nowTime - lastTabPressTime; 921 if (diffTime > 10) return; 922 eventHandler.emit("slideFocusStart"); 923 root.scrollLeft = 0; 924 const group = slideRegistry.findIndex((group2) => group2.includes(index)); 925 if (!isNumber(group)) return; 926 scrollBody.useDuration(0); 927 scrollTo.index(group, 0); 928 eventHandler.emit("slideFocus"); 929 } 930 eventStore.add(document, "keydown", registerTabPress, false); 931 slides.forEach((slide, slideIndex) => { 932 eventStore.add(slide, "focus", (evt) => { 933 if (isBoolean(watchFocus) || watchFocus(emblaApi, evt)) { 934 defaultCallback(slideIndex); 935 } 936 }, focusListenerOptions); 937 }); 938 } 939 function registerTabPress(event) { 940 if (event.code === "Tab") lastTabPressTime = (/* @__PURE__ */ new Date()).getTime(); 941 } 942 const self = { 943 init 944 }; 945 return self; 946} 947function Vector1D(initialValue) { 948 let value = initialValue; 949 function get() { 950 return value; 951 } 952 function set(n) { 953 value = normalizeInput(n); 954 } 955 function add(n) { 956 value += normalizeInput(n); 957 } 958 function subtract(n) { 959 value -= normalizeInput(n); 960 } 961 function normalizeInput(n) { 962 return isNumber(n) ? n : n.get(); 963 } 964 const self = { 965 get, 966 set, 967 add, 968 subtract 969 }; 970 return self; 971} 972function Translate(axis, container) { 973 const translate = axis.scroll === "x" ? x : y; 974 const containerStyle = container.style; 975 let disabled = false; 976 function x(n) { 977 return `translate3d(${n}px,0px,0px)`; 978 } 979 function y(n) { 980 return `translate3d(0px,${n}px,0px)`; 981 } 982 function to(target) { 983 if (disabled) return; 984 containerStyle.transform = translate(axis.direction(target)); 985 } 986 function toggleActive(active) { 987 disabled = !active; 988 } 989 function clear() { 990 if (disabled) return; 991 containerStyle.transform = ""; 992 if (!container.getAttribute("style")) container.removeAttribute("style"); 993 } 994 const self = { 995 clear, 996 to, 997 toggleActive 998 }; 999 return self; 1000} 1001function SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, location, slides) { 1002 const roundingSafety = 0.5; 1003 const ascItems = arrayKeys(slideSizesWithGaps); 1004 const descItems = arrayKeys(slideSizesWithGaps).reverse(); 1005 const loopPoints = startPoints().concat(endPoints()); 1006 function removeSlideSizes(indexes, from) { 1007 return indexes.reduce((a, i) => { 1008 return a - slideSizesWithGaps[i]; 1009 }, from); 1010 } 1011 function slidesInGap(indexes, gap) { 1012 return indexes.reduce((a, i) => { 1013 const remainingGap = removeSlideSizes(a, gap); 1014 return remainingGap > 0 ? a.concat([i]) : a; 1015 }, []); 1016 } 1017 function findSlideBounds(offset) { 1018 return snaps.map((snap, index) => ({ 1019 start: snap - slideSizes[index] + roundingSafety + offset, 1020 end: snap + viewSize - roundingSafety + offset 1021 })); 1022 } 1023 function findLoopPoints(indexes, offset, isEndEdge) { 1024 const slideBounds = findSlideBounds(offset); 1025 return indexes.map((index) => { 1026 const initial = isEndEdge ? 0 : -contentSize; 1027 const altered = isEndEdge ? contentSize : 0; 1028 const boundEdge = isEndEdge ? "end" : "start"; 1029 const loopPoint = slideBounds[index][boundEdge]; 1030 return { 1031 index, 1032 loopPoint, 1033 slideLocation: Vector1D(-1), 1034 translate: Translate(axis, slides[index]), 1035 target: () => location.get() > loopPoint ? initial : altered 1036 }; 1037 }); 1038 } 1039 function startPoints() { 1040 const gap = scrollSnaps[0]; 1041 const indexes = slidesInGap(descItems, gap); 1042 return findLoopPoints(indexes, contentSize, false); 1043 } 1044 function endPoints() { 1045 const gap = viewSize - scrollSnaps[0] - 1; 1046 const indexes = slidesInGap(ascItems, gap); 1047 return findLoopPoints(indexes, -contentSize, true); 1048 } 1049 function canLoop() { 1050 return loopPoints.every(({ 1051 index 1052 }) => { 1053 const otherIndexes = ascItems.filter((i) => i !== index); 1054 return removeSlideSizes(otherIndexes, viewSize) <= 0.1; 1055 }); 1056 } 1057 function loop() { 1058 loopPoints.forEach((loopPoint) => { 1059 const { 1060 target, 1061 translate, 1062 slideLocation 1063 } = loopPoint; 1064 const shiftLocation = target(); 1065 if (shiftLocation === slideLocation.get()) return; 1066 translate.to(shiftLocation); 1067 slideLocation.set(shiftLocation); 1068 }); 1069 } 1070 function clear() { 1071 loopPoints.forEach((loopPoint) => loopPoint.translate.clear()); 1072 } 1073 const self = { 1074 canLoop, 1075 clear, 1076 loop, 1077 loopPoints 1078 }; 1079 return self; 1080} 1081function SlidesHandler(container, eventHandler, watchSlides) { 1082 let mutationObserver; 1083 let destroyed = false; 1084 function init(emblaApi) { 1085 if (!watchSlides) return; 1086 function defaultCallback(mutations) { 1087 for (const mutation of mutations) { 1088 if (mutation.type === "childList") { 1089 emblaApi.reInit(); 1090 eventHandler.emit("slidesChanged"); 1091 break; 1092 } 1093 } 1094 } 1095 mutationObserver = new MutationObserver((mutations) => { 1096 if (destroyed) return; 1097 if (isBoolean(watchSlides) || watchSlides(emblaApi, mutations)) { 1098 defaultCallback(mutations); 1099 } 1100 }); 1101 mutationObserver.observe(container, { 1102 childList: true 1103 }); 1104 } 1105 function destroy() { 1106 if (mutationObserver) mutationObserver.disconnect(); 1107 destroyed = true; 1108 } 1109 const self = { 1110 init, 1111 destroy 1112 }; 1113 return self; 1114} 1115function SlidesInView(container, slides, eventHandler, threshold) { 1116 const intersectionEntryMap = {}; 1117 let inViewCache = null; 1118 let notInViewCache = null; 1119 let intersectionObserver; 1120 let destroyed = false; 1121 function init() { 1122 intersectionObserver = new IntersectionObserver((entries) => { 1123 if (destroyed) return; 1124 entries.forEach((entry) => { 1125 const index = slides.indexOf(entry.target); 1126 intersectionEntryMap[index] = entry; 1127 }); 1128 inViewCache = null; 1129 notInViewCache = null; 1130 eventHandler.emit("slidesInView"); 1131 }, { 1132 root: container.parentElement, 1133 threshold 1134 }); 1135 slides.forEach((slide) => intersectionObserver.observe(slide)); 1136 } 1137 function destroy() { 1138 if (intersectionObserver) intersectionObserver.disconnect(); 1139 destroyed = true; 1140 } 1141 function createInViewList(inView) { 1142 return objectKeys(intersectionEntryMap).reduce((list, slideIndex) => { 1143 const index = parseInt(slideIndex); 1144 const { 1145 isIntersecting 1146 } = intersectionEntryMap[index]; 1147 const inViewMatch = inView && isIntersecting; 1148 const notInViewMatch = !inView && !isIntersecting; 1149 if (inViewMatch || notInViewMatch) list.push(index); 1150 return list; 1151 }, []); 1152 } 1153 function get(inView = true) { 1154 if (inView && inViewCache) return inViewCache; 1155 if (!inView && notInViewCache) return notInViewCache; 1156 const slideIndexes = createInViewList(inView); 1157 if (inView) inViewCache = slideIndexes; 1158 if (!inView) notInViewCache = slideIndexes; 1159 return slideIndexes; 1160 } 1161 const self = { 1162 init, 1163 destroy, 1164 get 1165 }; 1166 return self; 1167} 1168function SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow) { 1169 const { 1170 measureSize, 1171 startEdge, 1172 endEdge 1173 } = axis; 1174 const withEdgeGap = slideRects[0] && readEdgeGap; 1175 const startGap = measureStartGap(); 1176 const endGap = measureEndGap(); 1177 const slideSizes = slideRects.map(measureSize); 1178 const slideSizesWithGaps = measureWithGaps(); 1179 function measureStartGap() { 1180 if (!withEdgeGap) return 0; 1181 const slideRect = slideRects[0]; 1182 return mathAbs(containerRect[startEdge] - slideRect[startEdge]); 1183 } 1184 function measureEndGap() { 1185 if (!withEdgeGap) return 0; 1186 const style = ownerWindow.getComputedStyle(arrayLast(slides)); 1187 return parseFloat(style.getPropertyValue(`margin-${endEdge}`)); 1188 } 1189 function measureWithGaps() { 1190 return slideRects.map((rect, index, rects) => { 1191 const isFirst = !index; 1192 const isLast = arrayIsLastIndex(rects, index); 1193 if (isFirst) return slideSizes[index] + startGap; 1194 if (isLast) return slideSizes[index] + endGap; 1195 return rects[index + 1][startEdge] - rect[startEdge]; 1196 }).map(mathAbs); 1197 } 1198 const self = { 1199 slideSizes, 1200 slideSizesWithGaps, 1201 startGap, 1202 endGap 1203 }; 1204 return self; 1205} 1206function SlidesToScroll(axis, viewSize, slidesToScroll, loop, containerRect, slideRects, startGap, endGap, pixelTolerance) { 1207 const { 1208 startEdge, 1209 endEdge, 1210 direction 1211 } = axis; 1212 const groupByNumber = isNumber(slidesToScroll); 1213 function byNumber(array, groupSize) { 1214 return arrayKeys(array).filter((i) => i % groupSize === 0).map((i) => array.slice(i, i + groupSize)); 1215 } 1216 function bySize(array) { 1217 if (!array.length) return []; 1218 return arrayKeys(array).reduce((groups, rectB, index) => { 1219 const rectA = arrayLast(groups) || 0; 1220 const isFirst = rectA === 0; 1221 const isLast = rectB === arrayLastIndex(array); 1222 const edgeA = containerRect[startEdge] - slideRects[rectA][startEdge]; 1223 const edgeB = containerRect[startEdge] - slideRects[rectB][endEdge]; 1224 const gapA = !loop && isFirst ? direction(startGap) : 0; 1225 const gapB = !loop && isLast ? direction(endGap) : 0; 1226 const chunkSize = mathAbs(edgeB - gapB - (edgeA + gapA)); 1227 if (index && chunkSize > viewSize + pixelTolerance) groups.push(rectB); 1228 if (isLast) groups.push(array.length); 1229 return groups; 1230 }, []).map((currentSize, index, groups) => { 1231 const previousSize = Math.max(groups[index - 1] || 0); 1232 return array.slice(previousSize, currentSize); 1233 }); 1234 } 1235 function groupSlides(array) { 1236 return groupByNumber ? byNumber(array, slidesToScroll) : bySize(array); 1237 } 1238 const self = { 1239 groupSlides 1240 }; 1241 return self; 1242} 1243function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler) { 1244 const { 1245 align, 1246 axis: scrollAxis, 1247 direction, 1248 startIndex, 1249 loop, 1250 duration, 1251 dragFree, 1252 dragThreshold, 1253 inViewThreshold, 1254 slidesToScroll: groupSlides, 1255 skipSnaps, 1256 containScroll, 1257 watchResize, 1258 watchSlides, 1259 watchDrag, 1260 watchFocus 1261 } = options; 1262 const pixelTolerance = 2; 1263 const nodeRects = NodeRects(); 1264 const containerRect = nodeRects.measure(container); 1265 const slideRects = slides.map(nodeRects.measure); 1266 const axis = Axis(scrollAxis, direction); 1267 const viewSize = axis.measureSize(containerRect); 1268 const percentOfView = PercentOfView(viewSize); 1269 const alignment = Alignment(align, viewSize); 1270 const containSnaps = !loop && !!containScroll; 1271 const readEdgeGap = loop || !!containScroll; 1272 const { 1273 slideSizes, 1274 slideSizesWithGaps, 1275 startGap, 1276 endGap 1277 } = SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow); 1278 const slidesToScroll = SlidesToScroll(axis, viewSize, groupSlides, loop, containerRect, slideRects, startGap, endGap, pixelTolerance); 1279 const { 1280 snaps, 1281 snapsAligned 1282 } = ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll); 1283 const contentSize = -arrayLast(snaps) + arrayLast(slideSizesWithGaps); 1284 const { 1285 snapsContained, 1286 scrollContainLimit 1287 } = ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance); 1288 const scrollSnaps = containSnaps ? snapsContained : snapsAligned; 1289 const { 1290 limit 1291 } = ScrollLimit(contentSize, scrollSnaps, loop); 1292 const index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop); 1293 const indexPrevious = index.clone(); 1294 const slideIndexes = arrayKeys(slides); 1295 const update = ({ 1296 dragHandler, 1297 scrollBody: scrollBody2, 1298 scrollBounds, 1299 options: { 1300 loop: loop2 1301 } 1302 }, timeStep) => { 1303 if (!loop2) scrollBounds.constrain(dragHandler.pointerDown()); 1304 scrollBody2.seek(timeStep); 1305 }; 1306 const render = ({ 1307 scrollBody: scrollBody2, 1308 translate, 1309 location: location2, 1310 offsetLocation: offsetLocation2, 1311 scrollLooper, 1312 slideLooper, 1313 dragHandler, 1314 animation: animation2, 1315 eventHandler: eventHandler2, 1316 scrollBounds, 1317 options: { 1318 loop: loop2 1319 } 1320 }, lagOffset) => { 1321 const shouldSettle = scrollBody2.settled(); 1322 const withinBounds = !scrollBounds.shouldConstrain(); 1323 const hasSettled = loop2 ? shouldSettle : shouldSettle && withinBounds; 1324 if (hasSettled && !dragHandler.pointerDown()) { 1325 animation2.stop(); 1326 eventHandler2.emit("settle"); 1327 } 1328 if (!hasSettled) eventHandler2.emit("scroll"); 1329 const interpolatedLocation = location2.get() * lagOffset + previousLocation.get() * (1 - lagOffset); 1330 offsetLocation2.set(interpolatedLocation); 1331 if (loop2) { 1332 scrollLooper.loop(scrollBody2.direction()); 1333 slideLooper.loop(); 1334 } 1335 translate.to(offsetLocation2.get()); 1336 }; 1337 const animation = Animations(ownerDocument, ownerWindow, (timeStep) => update(engine, timeStep), (lagOffset) => render(engine, lagOffset)); 1338 const friction = 0.68; 1339 const startLocation = scrollSnaps[index.get()]; 1340 const location = Vector1D(startLocation); 1341 const previousLocation = Vector1D(startLocation); 1342 const offsetLocation = Vector1D(startLocation); 1343 const target = Vector1D(startLocation); 1344 const scrollBody = ScrollBody(location, offsetLocation, previousLocation, target, duration, friction); 1345 const scrollTarget = ScrollTarget(loop, scrollSnaps, contentSize, limit, target); 1346 const scrollTo = ScrollTo(animation, index, indexPrevious, scrollBody, scrollTarget, target, eventHandler); 1347 const scrollProgress = ScrollProgress(limit); 1348 const eventStore = EventStore(); 1349 const slidesInView = SlidesInView(container, slides, eventHandler, inViewThreshold); 1350 const { 1351 slideRegistry 1352 } = SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes); 1353 const slideFocus = SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus); 1354 const engine = { 1355 ownerDocument, 1356 ownerWindow, 1357 eventHandler, 1358 containerRect, 1359 slideRects, 1360 animation, 1361 axis, 1362 dragHandler: DragHandler(axis, root, ownerDocument, ownerWindow, target, DragTracker(axis, ownerWindow), location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, friction, watchDrag), 1363 eventStore, 1364 percentOfView, 1365 index, 1366 indexPrevious, 1367 limit, 1368 location, 1369 offsetLocation, 1370 previousLocation, 1371 options, 1372 resizeHandler: ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects), 1373 scrollBody, 1374 scrollBounds: ScrollBounds(limit, offsetLocation, target, scrollBody, percentOfView), 1375 scrollLooper: ScrollLooper(contentSize, limit, offsetLocation, [location, offsetLocation, previousLocation, target]), 1376 scrollProgress, 1377 scrollSnapList: scrollSnaps.map(scrollProgress.get), 1378 scrollSnaps, 1379 scrollTarget, 1380 scrollTo, 1381 slideLooper: SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, offsetLocation, slides), 1382 slideFocus, 1383 slidesHandler: SlidesHandler(container, eventHandler, watchSlides), 1384 slidesInView, 1385 slideIndexes, 1386 slideRegistry, 1387 slidesToScroll, 1388 target, 1389 translate: Translate(axis, container) 1390 }; 1391 return engine; 1392} 1393function EventHandler() { 1394 let listeners = {}; 1395 let api; 1396 function init(emblaApi) { 1397 api = emblaApi; 1398 } 1399 function getListeners(evt) { 1400 return listeners[evt] || []; 1401 } 1402 function emit(evt) { 1403 getListeners(evt).forEach((e) => e(api, evt)); 1404 return self; 1405 } 1406 function on(evt, cb) { 1407 listeners[evt] = getListeners(evt).concat([cb]); 1408 return self; 1409 } 1410 function off(evt, cb) { 1411 listeners[evt] = getListeners(evt).filter((e) => e !== cb); 1412 return self; 1413 } 1414 function clear() { 1415 listeners = {}; 1416 } 1417 const self = { 1418 init, 1419 emit, 1420 off, 1421 on, 1422 clear 1423 }; 1424 return self; 1425} 1426var defaultOptions = { 1427 align: "center", 1428 axis: "x", 1429 container: null, 1430 slides: null, 1431 containScroll: "trimSnaps", 1432 direction: "ltr", 1433 slidesToScroll: 1, 1434 inViewThreshold: 0, 1435 breakpoints: {}, 1436 dragFree: false, 1437 dragThreshold: 10, 1438 loop: false, 1439 skipSnaps: false, 1440 duration: 25, 1441 startIndex: 0, 1442 active: true, 1443 watchDrag: true, 1444 watchResize: true, 1445 watchSlides: true, 1446 watchFocus: true 1447}; 1448function OptionsHandler(ownerWindow) { 1449 function mergeOptions(optionsA, optionsB) { 1450 return objectsMergeDeep(optionsA, optionsB || {}); 1451 } 1452 function optionsAtMedia(options) { 1453 const optionsAtMedia2 = options.breakpoints || {}; 1454 const matchedMediaOptions = objectKeys(optionsAtMedia2).filter((media) => ownerWindow.matchMedia(media).matches).map((media) => optionsAtMedia2[media]).reduce((a, mediaOption) => mergeOptions(a, mediaOption), {}); 1455 return mergeOptions(options, matchedMediaOptions); 1456 } 1457 function optionsMediaQueries(optionsList) { 1458 return optionsList.map((options) => objectKeys(options.breakpoints || {})).reduce((acc, mediaQueries) => acc.concat(mediaQueries), []).map(ownerWindow.matchMedia); 1459 } 1460 const self = { 1461 mergeOptions, 1462 optionsAtMedia, 1463 optionsMediaQueries 1464 }; 1465 return self; 1466} 1467function PluginsHandler(optionsHandler) { 1468 let activePlugins = []; 1469 function init(emblaApi, plugins) { 1470 activePlugins = plugins.filter(({ 1471 options 1472 }) => optionsHandler.optionsAtMedia(options).active !== false); 1473 activePlugins.forEach((plugin) => plugin.init(emblaApi, optionsHandler)); 1474 return plugins.reduce((map, plugin) => Object.assign(map, { 1475 [plugin.name]: plugin 1476 }), {}); 1477 } 1478 function destroy() { 1479 activePlugins = activePlugins.filter((plugin) => plugin.destroy()); 1480 } 1481 const self = { 1482 init, 1483 destroy 1484 }; 1485 return self; 1486} 1487function EmblaCarousel(root, userOptions, userPlugins) { 1488 const ownerDocument = root.ownerDocument; 1489 const ownerWindow = ownerDocument.defaultView; 1490 const optionsHandler = OptionsHandler(ownerWindow); 1491 const pluginsHandler = PluginsHandler(optionsHandler); 1492 const mediaHandlers = EventStore(); 1493 const eventHandler = EventHandler(); 1494 const { 1495 mergeOptions, 1496 optionsAtMedia, 1497 optionsMediaQueries 1498 } = optionsHandler; 1499 const { 1500 on, 1501 off, 1502 emit 1503 } = eventHandler; 1504 const reInit = reActivate; 1505 let destroyed = false; 1506 let engine; 1507 let optionsBase = mergeOptions(defaultOptions, EmblaCarousel.globalOptions); 1508 let options = mergeOptions(optionsBase); 1509 let pluginList = []; 1510 let pluginApis; 1511 let container; 1512 let slides; 1513 function storeElements() { 1514 const { 1515 container: userContainer, 1516 slides: userSlides 1517 } = options; 1518 const customContainer = isString(userContainer) ? root.querySelector(userContainer) : userContainer; 1519 container = customContainer || root.children[0]; 1520 const customSlides = isString(userSlides) ? container.querySelectorAll(userSlides) : userSlides; 1521 slides = [].slice.call(customSlides || container.children); 1522 } 1523 function createEngine(options2) { 1524 const engine2 = Engine(root, container, slides, ownerDocument, ownerWindow, options2, eventHandler); 1525 if (options2.loop && !engine2.slideLooper.canLoop()) { 1526 const optionsWithoutLoop = Object.assign({}, options2, { 1527 loop: false 1528 }); 1529 return createEngine(optionsWithoutLoop); 1530 } 1531 return engine2; 1532 } 1533 function activate(withOptions, withPlugins) { 1534 if (destroyed) return; 1535 optionsBase = mergeOptions(optionsBase, withOptions); 1536 options = optionsAtMedia(optionsBase); 1537 pluginList = withPlugins || pluginList; 1538 storeElements(); 1539 engine = createEngine(options); 1540 optionsMediaQueries([optionsBase, ...pluginList.map(({ 1541 options: options2 1542 }) => options2)]).forEach((query) => mediaHandlers.add(query, "change", reActivate)); 1543 if (!options.active) return; 1544 engine.translate.to(engine.location.get()); 1545 engine.animation.init(); 1546 engine.slidesInView.init(); 1547 engine.slideFocus.init(self); 1548 engine.eventHandler.init(self); 1549 engine.resizeHandler.init(self); 1550 engine.slidesHandler.init(self); 1551 if (engine.options.loop) engine.slideLooper.loop(); 1552 if (container.offsetParent && slides.length) engine.dragHandler.init(self); 1553 pluginApis = pluginsHandler.init(self, pluginList); 1554 } 1555 function reActivate(withOptions, withPlugins) { 1556 const startIndex = selectedScrollSnap(); 1557 deActivate(); 1558 activate(mergeOptions({ 1559 startIndex 1560 }, withOptions), withPlugins); 1561 eventHandler.emit("reInit"); 1562 } 1563 function deActivate() { 1564 engine.dragHandler.destroy(); 1565 engine.eventStore.clear(); 1566 engine.translate.clear(); 1567 engine.slideLooper.clear(); 1568 engine.resizeHandler.destroy(); 1569 engine.slidesHandler.destroy(); 1570 engine.slidesInView.destroy(); 1571 engine.animation.destroy(); 1572 pluginsHandler.destroy(); 1573 mediaHandlers.clear(); 1574 } 1575 function destroy() { 1576 if (destroyed) return; 1577 destroyed = true; 1578 mediaHandlers.clear(); 1579 deActivate(); 1580 eventHandler.emit("destroy"); 1581 eventHandler.clear(); 1582 } 1583 function scrollTo(index, jump, direction) { 1584 if (!options.active || destroyed) return; 1585 engine.scrollBody.useBaseFriction().useDuration(jump === true ? 0 : options.duration); 1586 engine.scrollTo.index(index, direction || 0); 1587 } 1588 function scrollNext(jump) { 1589 const next = engine.index.add(1).get(); 1590 scrollTo(next, jump, -1); 1591 } 1592 function scrollPrev(jump) { 1593 const prev = engine.index.add(-1).get(); 1594 scrollTo(prev, jump, 1); 1595 } 1596 function canScrollNext() { 1597 const next = engine.index.add(1).get(); 1598 return next !== selectedScrollSnap(); 1599 } 1600 function canScrollPrev() { 1601 const prev = engine.index.add(-1).get(); 1602 return prev !== selectedScrollSnap(); 1603 } 1604 function scrollSnapList() { 1605 return engine.scrollSnapList; 1606 } 1607 function scrollProgress() { 1608 return engine.scrollProgress.get(engine.location.get()); 1609 } 1610 function selectedScrollSnap() { 1611 return engine.index.get(); 1612 } 1613 function previousScrollSnap() { 1614 return engine.indexPrevious.get(); 1615 } 1616 function slidesInView() { 1617 return engine.slidesInView.get(); 1618 } 1619 function slidesNotInView() { 1620 return engine.slidesInView.get(false); 1621 } 1622 function plugins() { 1623 return pluginApis; 1624 } 1625 function internalEngine() { 1626 return engine; 1627 } 1628 function rootNode() { 1629 return root; 1630 } 1631 function containerNode() { 1632 return container; 1633 } 1634 function slideNodes() { 1635 return slides; 1636 } 1637 const self = { 1638 canScrollNext, 1639 canScrollPrev, 1640 containerNode, 1641 internalEngine, 1642 destroy, 1643 off, 1644 on, 1645 emit, 1646 plugins, 1647 previousScrollSnap, 1648 reInit, 1649 rootNode, 1650 scrollNext, 1651 scrollPrev, 1652 scrollProgress, 1653 scrollSnapList, 1654 scrollTo, 1655 selectedScrollSnap, 1656 slideNodes, 1657 slidesInView, 1658 slidesNotInView 1659 }; 1660 activate(userOptions, userPlugins); 1661 setTimeout(() => eventHandler.emit("init"), 0); 1662 return self; 1663} 1664EmblaCarousel.globalOptions = void 0; 1665
vendor: 1,440 bytes, lines 1666-1701
1666// node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js 1667function useEmblaCarousel(options = {}, plugins = []) { 1668 const storedOptions = (0, import_react.useRef)(options); 1669 const storedPlugins = (0, import_react.useRef)(plugins); 1670 const [emblaApi, setEmblaApi] = (0, import_react.useState)(); 1671 const [viewport, setViewport] = (0, import_react.useState)(); 1672 const reInit = (0, import_react.useCallback)(() => { 1673 if (emblaApi) emblaApi.reInit(storedOptions.current, storedPlugins.current); 1674 }, [emblaApi]); 1675 (0, import_react.useEffect)(() => { 1676 if (areOptionsEqual(storedOptions.current, options)) return; 1677 storedOptions.current = options; 1678 reInit(); 1679 }, [options, reInit]); 1680 (0, import_react.useEffect)(() => { 1681 if (arePluginsEqual(storedPlugins.current, plugins)) return; 1682 storedPlugins.current = plugins; 1683 reInit(); 1684 }, [plugins, reInit]); 1685 (0, import_react.useEffect)(() => { 1686 if (canUseDOM() && viewport) { 1687 EmblaCarousel.globalOptions = useEmblaCarousel.globalOptions; 1688 const newEmblaApi = EmblaCarousel(viewport, storedOptions.current, storedPlugins.current); 1689 setEmblaApi(newEmblaApi); 1690 return () => newEmblaApi.destroy(); 1691 } else { 1692 setEmblaApi(void 0); 1693 } 1694 }, [viewport, setEmblaApi]); 1695 return [setViewport, emblaApi]; 1696} 1697useEmblaCarousel.globalOptions = void 0; 1698export { 1699 useEmblaCarousel as default 1700}; 1701//# sourceMappingURL=embla-carousel-react.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.