@btst/stack 1.1.1 → 1.1.3

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