Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Storefront importmaps (#12376)

Damian Kaczmarczyk495d6303de0b
diff --git a/.rubocop.yml b/.rubocop.yml
index a4c8f7ca76..e66aca1b47 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -54,7 +54,7 @@ Metrics/BlockLength:
- '**/lib/**/testing_support/**/*'
Metrics/AbcSize:
- Max: 45
+ Max: 45
Style/StringLiterals:
EnforcedStyle: single_quotes
@@ -189,10 +189,7 @@ RSpec/NamedSubject:
RSpec/MultipleExpectations:
Enabled: false
-RSpec/SpecFilePathFormat:
- Enabled: false
-
-RSpec/SpecFilePathSuffix:
+RSpec/FilePath:
Enabled: false
RSpec/LetSetup:
diff --git a/admin/app/javascript/spree/admin/application.js b/admin/app/javascript/spree/admin/application.js
index c32e6c79c9..be4c824dfa 100644
--- a/admin/app/javascript/spree/admin/application.js
+++ b/admin/app/javascript/spree/admin/application.js
@@ -75,11 +75,9 @@ import StoreFormController from 'spree/admin/controllers/store_form_controller'
import UnitSystemController from 'spree/admin/controllers/unit_system_controller'
import VariantsFormController from 'spree/admin/controllers/variants_form_controller'
import WebhooksSubscriberEventsController from 'spree/admin/controllers/webhook_subscriber_events_controller'
-
-// These controllers are shared between storefront/admin
-import AddressAutocompleteController from 'spree/admin/controllers/address_autocomplete_controller'
-import AddressFormController from 'spree/admin/controllers/address_form_controller'
-import EnableButtonController from 'spree/admin/controllers/enable_button_controller'
+import AddressAutocompleteController from 'spree/core/controllers/address_autocomplete_controller'
+import AddressFormController from 'spree/core/controllers/address_form_controller'
+import EnableButtonController from 'spree/core/controllers/enable_button_controller'
application.register('active-storage-upload', ActiveStorageUpload)
diff --git a/admin/app/javascript/spree/admin/helpers/bootstrap.js b/admin/app/javascript/spree/admin/helpers/bootstrap.js
index b6aa2bc29b..f15a71a17e 100644
--- a/admin/app/javascript/spree/admin/helpers/bootstrap.js
+++ b/admin/app/javascript/spree/admin/helpers/bootstrap.js
@@ -1,6 +1,6 @@
import 'jquery'
import 'bootstrap'
-import { lockScroll, unlockScroll } from 'spree/admin/helpers/scroll_lock'
+import { lockScroll, unlockScroll } from 'spree/core/helpers/scroll_lock'
const initTooltips = () => {
diff --git a/admin/config/importmap.rb b/admin/config/importmap.rb
index ac3ec64e46..27dd67d68a 100644
--- a/admin/config/importmap.rb
+++ b/admin/config/importmap.rb
@@ -1,105 +1,136 @@
-pin "application-spree-admin", to: "spree/admin/application.js"
+pin 'application-spree-admin', to: 'spree/admin/application.js', preload: false
-pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: ["application-spree-admin"]
-pin "@rails/actioncable", to: "actioncable.esm.js", preload: ["application-spree-admin"]
-pin "@hotwired/stimulus", to: "@hotwired--stimulus.js" # @3.2.2
-pin "@rails/activestorage", to: "activestorage.esm.js", preload: ["application-spree-admin"]
-pin "@rails/actiontext", to: "@rails--actiontext--app--assets--javascripts--actiontext.js.js", preload: ["application-spree-admin"]
+pin '@rails/actioncable', to: 'actioncable.esm.js', preload: ['application-spree-admin']
+pin '@rails/activestorage', to: 'activestorage.esm.js', preload: ['application-spree-admin']
+pin '@rails/actiontext', to: '@rails--actiontext--app--assets--javascripts--actiontext.js.js', preload: ['application-spree-admin']
-pin "@rails/request.js", to: "@rails--request.js.js" # @0.0.8
-pin "sortablejs", preload: ["application-spree-admin"] # @1.15.6
-pin "chartkick", to: "chartkick.js", preload: ["application-spree-admin"]
-pin "Chart.bundle", to: "Chart.bundle.js", preload: ["application-spree-admin"]
-pin "local-time", preload: ["application-spree-admin"] # @3.0.2
-pin "mapkick/bundle", to: "mapkick.bundle.js", preload: ["application-spree-admin"]
-pin 'jquery', to: 'jquery3.min.js', preload: ["application-spree-admin"]
-pin "bootstrap", to: "bootstrap--dist--js--bootstrap.bundle.min.js.js", preload: ["application-spree-admin"] # @4.6.1
-pin "dompurify", preload: ["application-spree-admin"] # @3.2.3
+pin '@rails/request.js', to: '@rails--request.js.js', preload: ['application-spree-admin'] # @0.0.8
+pin 'sortablejs', preload: ['application-spree-admin'] # @1.15.6
+pin 'chartkick', to: 'chartkick.js', preload: ['application-spree-admin']
+pin 'Chart.bundle', to: 'Chart.bundle.js', preload: ['application-spree-admin']
+pin 'local-time', preload: ['application-spree-admin'] # @3.0.2
+pin 'mapkick/bundle', to: 'mapkick.bundle.js', preload: ['application-spree-admin']
+pin 'jquery', to: 'jquery3.min.js', preload: ['application-spree-admin']
+pin 'bootstrap', to: 'bootstrap--dist--js--bootstrap.bundle.min.js.js', preload: ['application-spree-admin'] # @4.6.1
+pin 'dompurify', preload: ['application-spree-admin'] # @3.2.3
# Stimulus components
-pin "@stimulus-components/auto-submit", to: "@stimulus-components--auto-submit.js", preload: ["application-spree-admin"] # @6.0.0
-pin "@stimulus-components/rails-nested-form", to: "@stimulus-components--rails-nested-form.js", preload: ["application-spree-admin"] # @5.0.0
-pin "stimulus-notification", preload: ["application-spree-admin"] # @2.2.0
-pin "stimulus-password-visibility", preload: ["application-spree-admin"] # @2.1.1
-pin "stimulus-reveal-controller", preload: ["application-spree-admin"] # @4.1.0
-pin "stimulus-sortable", preload: ["application-spree-admin"] # @4.1.1
-pin "stimulus-textarea-autogrow", preload: ["application-spree-admin"] # @4.1.0
-pin "tailwindcss-stimulus-components", preload: ["application-spree-admin"] # @6.1.3
-pin "hotkeys-js", preload: ["application-spree-admin"] # @3.13.9
-pin "stimulus-use", preload: ["application-spree-admin"] # @0.51.3
-pin "stimulus-checkbox-select-all", preload: ["application-spree-admin"] # @5.3.0
-pin "stimulus-clipboard", preload: ["application-spree-admin"] # @4.0.1
+pin '@stimulus-components/auto-submit', to: '@stimulus-components--auto-submit.js', preload: ['application-spree-admin'] # @6.0.0
+pin '@stimulus-components/rails-nested-form', to: '@stimulus-components--rails-nested-form.js', preload: ['application-spree-admin'] # @5.0.0
+pin 'stimulus-notification', preload: ['application-spree-admin'] # @2.2.0
+pin 'stimulus-password-visibility', preload: ['application-spree-admin'] # @2.1.1
+pin 'stimulus-sortable', preload: ['application-spree-admin'] # @4.1.1
+pin 'stimulus-textarea-autogrow', preload: ['application-spree-admin'] # @4.1.0
+pin 'hotkeys-js', preload: ['application-spree-admin'] # @3.13.9
+pin 'stimulus-use', preload: ['application-spree-admin'] # @0.51.3
+pin 'stimulus-checkbox-select-all', preload: ['application-spree-admin'] # @5.3.0
+pin 'stimulus-clipboard', preload: ['application-spree-admin'] # @4.0.1
#
# Uppy
# Uppy can't be downloaded, it has many relative imports in the code, and importmaps don't handle them, leaving us with broken imports.
-pin "@uppy/core", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@uppy/dashboard", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@uppy/image-editor", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@transloadit/prettier-bytes", to: "https://ga.jspm.io/npm:@transloadit/[email protected]/dist/prettierBytes.js",preload: false
-pin "@uppy/informer", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@uppy/provider-views", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@uppy/status-bar", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@uppy/store-default", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@uppy/thumbnail-generator", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js",preload: false
-pin "@uppy/utils/lib/FOCUSABLE_ELEMENTS", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/FOCUSABLE_ELEMENTS.js",preload: false
-pin "@uppy/utils/lib/Translator", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/Translator.js",preload: false
-pin "@uppy/utils/lib/VirtualList", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/VirtualList.js",preload: false
-pin "@uppy/utils/lib/dataURItoBlob", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/dataURItoBlob.js",preload: false
-pin "@uppy/utils/lib/emaFilter", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/emaFilter.js",preload: false
-pin "@uppy/utils/lib/findAllDOMElements", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/findAllDOMElements.js",preload: false
-pin "@uppy/utils/lib/findDOMElement", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/findDOMElement.js",preload: false
-pin "@uppy/utils/lib/generateFileID", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/generateFileID.js",preload: false
-pin "@uppy/utils/lib/getDroppedFiles", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/getDroppedFiles/index.js",preload: false
-pin "@uppy/utils/lib/getFileNameAndExtension", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/getFileNameAndExtension.js",preload: false
-pin "@uppy/utils/lib/getFileType", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/getFileType.js",preload: false
-pin "@uppy/utils/lib/getTextDirection", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/getTextDirection.js",preload: false
-pin "@uppy/utils/lib/getTimeStamp", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/getTimeStamp.js",preload: false
-pin "@uppy/utils/lib/isDragDropSupported", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/isDragDropSupported.js",preload: false
-pin "@uppy/utils/lib/isObjectURL", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/isObjectURL.js",preload: false
-pin "@uppy/utils/lib/isPreviewSupported", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/isPreviewSupported.js",preload: false
-pin "@uppy/utils/lib/prettyETA", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/prettyETA.js",preload: false
-pin "@uppy/utils/lib/remoteFileObjToLocal", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/remoteFileObjToLocal.js",preload: false
-pin "@uppy/utils/lib/toArray", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/toArray.js",preload: false
-pin "@uppy/utils/lib/truncateString", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/truncateString.js",preload: false
-pin "classnames", to: "https://ga.jspm.io/npm:[email protected]/index.js",preload: false
-pin "cropperjs", to: "https://ga.jspm.io/npm:[email protected]/dist/cropper.js",preload: false
-pin "eventemitter3", to: "https://ga.jspm.io/npm:[email protected]/index.mjs",preload: false
-pin "exifr/dist/mini.esm.mjs", to: "https://ga.jspm.io/npm:[email protected]/dist/mini.esm.mjs",preload: false
-pin "lodash/", to: "https://ga.jspm.io/npm:[email protected]/",preload: false
-pin "memoize-one", to: "https://ga.jspm.io/npm:[email protected]/dist/memoize-one.esm.js",preload: false
-pin "mime-match", to: "https://ga.jspm.io/npm:[email protected]/index.js",preload: false
-pin "namespace-emitter", to: "https://ga.jspm.io/npm:[email protected]/index.js",preload: false
-pin "nanoid/non-secure", to: "https://ga.jspm.io/npm:[email protected]/non-secure/index.js",preload: false
-pin "p-queue", to: "https://ga.jspm.io/npm:[email protected]/dist/index.js",preload: false
-pin "p-timeout", to: "https://ga.jspm.io/npm:[email protected]/index.js",preload: false
-pin "preact", to: "https://ga.jspm.io/npm:[email protected]/dist/preact.module.js",preload: false
-pin "preact/hooks", to: "https://ga.jspm.io/npm:[email protected]/hooks/dist/hooks.module.js",preload: false
-pin "shallow-equal", to: "https://ga.jspm.io/npm:[email protected]/dist/index.modern.mjs",preload: false
-pin "wildcard", to: "https://ga.jspm.io/npm:[email protected]/index.js", preload: false
-pin "@paralleldrive/cuid2", to: "https://ga.jspm.io/npm:@paralleldrive/[email protected]/index.js", preload: false
-pin "@uppy/core/lib/BasePlugin.js", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/BasePlugin.js", preload: false
-pin "@uppy/utils/lib/RateLimitedQueue", to: "https://ga.jspm.io/npm:@uppy/[email protected]/lib/RateLimitedQueue.js", preload: false
-pin "@noble/hashes/crypto", to: "https://ga.jspm.io/npm:@noble/[email protected]/crypto.js", preload: false
-pin "@noble/hashes/sha3", to: "https://ga.jspm.io/npm:@noble/[email protected]/sha3.js", preload: false
-#
+pin '@uppy/core', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@uppy/dashboard', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@uppy/image-editor', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@transloadit/prettier-bytes',
+ to: 'https://ga.jspm.io/npm:@transloadit/[email protected]/dist/prettierBytes.js',
+ preload: ['application-spree-admin']
+pin '@uppy/informer', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@uppy/provider-views', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@uppy/status-bar', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@uppy/store-default', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@uppy/thumbnail-generator', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/index.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/FOCUSABLE_ELEMENTS', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/FOCUSABLE_ELEMENTS.js',
+ preload: ['application-spree-admin']
+pin '@uppy/utils/lib/Translator', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/Translator.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/VirtualList', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/VirtualList.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/dataURItoBlob', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/dataURItoBlob.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/emaFilter', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/emaFilter.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/findAllDOMElements',
+ to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/findAllDOMElements.js',
+ preload: ['application-spree-admin']
+pin '@uppy/utils/lib/findDOMElement', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/findDOMElement.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/generateFileID', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/generateFileID.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/getDroppedFiles',
+ to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/getDroppedFiles/index.js',
+ preload: ['application-spree-admin']
+pin '@uppy/utils/lib/getFileNameAndExtension',
+ to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/getFileNameAndExtension.js',
+ preload: ['application-spree-admin']
+pin '@uppy/utils/lib/getFileType', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/getFileType.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/getTextDirection', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/getTextDirection.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/getTimeStamp', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/getTimeStamp.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/isDragDropSupported',
+ to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/isDragDropSupported.js',
+ preload: ['application-spree-admin']
+pin '@uppy/utils/lib/isObjectURL', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/isObjectURL.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/isPreviewSupported',
+ to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/isPreviewSupported.js',
+ preload: ['application-spree-admin']
+pin '@uppy/utils/lib/prettyETA', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/prettyETA.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/remoteFileObjToLocal',
+ to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/remoteFileObjToLocal.js',
+ preload: ['application-spree-admin']
+pin '@uppy/utils/lib/toArray', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/toArray.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/truncateString', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/truncateString.js', preload: ['application-spree-admin']
+pin 'classnames', to: 'https://ga.jspm.io/npm:[email protected]/index.js', preload: ['application-spree-admin']
+pin 'cropperjs', to: 'https://ga.jspm.io/npm:[email protected]/dist/cropper.js', preload: ['application-spree-admin']
+pin 'eventemitter3', to: 'https://ga.jspm.io/npm:[email protected]/index.mjs', preload: ['application-spree-admin']
+pin 'exifr/dist/mini.esm.mjs', to: 'https://ga.jspm.io/npm:[email protected]/dist/mini.esm.mjs', preload: ['application-spree-admin']
+pin 'lodash/', to: 'https://ga.jspm.io/npm:[email protected]/', preload: ['application-spree-admin']
+pin 'memoize-one', to: 'https://ga.jspm.io/npm:[email protected]/dist/memoize-one.esm.js', preload: ['application-spree-admin']
+pin 'mime-match', to: 'https://ga.jspm.io/npm:[email protected]/index.js', preload: ['application-spree-admin']
+pin 'namespace-emitter', to: 'https://ga.jspm.io/npm:[email protected]/index.js', preload: ['application-spree-admin']
+pin 'nanoid/non-secure', to: 'https://ga.jspm.io/npm:[email protected]/non-secure/index.js', preload: ['application-spree-admin']
+pin 'p-queue', to: 'https://ga.jspm.io/npm:[email protected]/dist/index.js', preload: ['application-spree-admin']
+pin 'p-timeout', to: 'https://ga.jspm.io/npm:[email protected]/index.js', preload: ['application-spree-admin']
+pin 'preact', to: 'https://ga.jspm.io/npm:[email protected]/dist/preact.module.js', preload: ['application-spree-admin']
+pin 'preact/hooks', to: 'https://ga.jspm.io/npm:[email protected]/hooks/dist/hooks.module.js', preload: ['application-spree-admin']
+pin 'shallow-equal', to: 'https://ga.jspm.io/npm:[email protected]/dist/index.modern.mjs', preload: ['application-spree-admin']
+pin 'wildcard', to: 'https://ga.jspm.io/npm:[email protected]/index.js', preload: ['application-spree-admin']
+pin '@paralleldrive/cuid2', to: 'https://ga.jspm.io/npm:@paralleldrive/[email protected]/index.js', preload: ['application-spree-admin']
+pin '@uppy/core/lib/BasePlugin.js', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/BasePlugin.js', preload: ['application-spree-admin']
+pin '@uppy/utils/lib/RateLimitedQueue', to: 'https://ga.jspm.io/npm:@uppy/[email protected]/lib/RateLimitedQueue.js', preload: ['application-spree-admin']
+pin '@noble/hashes/crypto', to: 'https://ga.jspm.io/npm:@noble/[email protected]/crypto.js', preload: ['application-spree-admin']
+pin '@noble/hashes/sha3', to: 'https://ga.jspm.io/npm:@noble/[email protected]/sha3.js', preload: ['application-spree-admin']
# Tom Select
# Same as Uppy, Tom Select can't be downloaded, it has many relative imports in the code, and importmaps don't handle them, leaving us with broken imports.
-pin "tom-select/dist/esm/tom-select.complete.js", to: "https://ga.jspm.io/npm:[email protected]/dist/esm/tom-select.complete.js",preload: false
-pin "@orchidjs/sifter", to: "https://ga.jspm.io/npm:@orchidjs/[email protected]/dist/esm/sifter.js", preload: false
-pin "@orchidjs/unicode-variants", to: "https://ga.jspm.io/npm:@orchidjs/[email protected]/dist/esm/index.js", preload: false
-#
+pin 'tom-select/dist/esm/tom-select.complete.js',
+ to: 'https://ga.jspm.io/npm:[email protected]/dist/esm/tom-select.complete.js',
+ preload: ['application-spree-admin']
+pin '@orchidjs/sifter', to: 'https://ga.jspm.io/npm:@orchidjs/[email protected]/dist/esm/sifter.js', preload: ['application-spree-admin']
+pin '@orchidjs/unicode-variants',
+ to: 'https://ga.jspm.io/npm:@orchidjs/[email protected]/dist/esm/index.js',
+ preload: ['application-spree-admin']
# Easepick
-pin "@easepick/core", to: "@easepick--core.js" # @1.2.1
-pin "@easepick/preset-plugin", to: "@easepick--preset-plugin.js" # @1.2.1
-pin "@easepick/range-plugin", to: "@easepick--range-plugin.js" # @1.2.1
-pin "@easepick/base-plugin", to: "@easepick--base-plugin.js" # @1.2.1
-pin "@easepick/datetime", to: "@easepick--datetime.js" # @1.2.1
+pin '@easepick/core',
+ to: '@easepick--core.js',
+ preload: ['application-spree-admin'] # @1.2.1
+pin '@easepick/preset-plugin',
+ to: '@easepick--preset-plugin.js',
+ preload: ['application-spree-admin'] # @1.2.1
+pin '@easepick/range-plugin',
+ to: '@easepick--range-plugin.js',
+ preload: ['application-spree-admin'] # @1.2.1
+pin '@easepick/base-plugin',
+ to: '@easepick--base-plugin.js',
+ preload: ['application-spree-admin'] # @1.2.1
+pin '@easepick/datetime',
+ to: '@easepick--datetime.js',
+ preload: ['application-spree-admin'] # @1.2.1
#
-pin "@simonwep/pickr", to: "@simonwep--pickr.js" # @1.9.1
+pin '@simonwep/pickr',
+ to: '@simonwep--pickr.js',
+ preload: ['application-spree-admin'] # @1.9.1
-pin_all_from Spree::Admin::Engine.root.join("app/javascript/spree/admin/controllers"), under: "spree/admin/controllers", to: "spree/admin/controllers", preload: ["application-spree-admin"]
-pin_all_from Spree::Admin::Engine.root.join("app/javascript/spree/admin/helpers"), under: "spree/admin/helpers", to: "spree/admin/helpers", preload: ["application-spree-admin"]
+pin_all_from Spree::Admin::Engine.root.join('app/javascript/spree/admin/controllers'),
+ under: 'spree/admin/controllers',
+ to: 'spree/admin/controllers',
+ preload: ['application-spree-admin']
+pin_all_from Spree::Admin::Engine.root.join('app/javascript/spree/admin/helpers'),
+ under: 'spree/admin/helpers',
+ to: 'spree/admin/helpers',
+ preload: ['application-spree-admin']
diff --git a/admin/vendor/javascript/@hotwired--stimulus.js b/admin/vendor/javascript/@hotwired--stimulus.js
deleted file mode 100644
index 07dd4a6cc3..0000000000
--- a/admin/vendor/javascript/@hotwired--stimulus.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// @hotwired/[email protected] downloaded from https://ga.jspm.io/npm:@hotwired/[email protected]/dist/stimulus.js
-
-class EventListener{constructor(e,t,r){this.eventTarget=e;this.eventName=t;this.eventOptions=r;this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){const t=extendEvent(e);for(const e of this.bindings){if(t.immediatePropagationStopped)break;e.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((e,t)=>{const r=e.index,s=t.index;return r<s?-1:r>s?1:0}))}}function extendEvent(e){if("immediatePropagationStopped"in e)return e;{const{stopImmediatePropagation:t}=e;return Object.assign(e,{immediatePropagationStopped:false,stopImmediatePropagation(){this.immediatePropagationStopped=true;t.call(this)}})}}class Dispatcher{constructor(e){this.application=e;this.eventListenerMaps=new Map;this.started=false}start(){if(!this.started){this.started=true;this.eventListeners.forEach((e=>e.connect()))}}stop(){if(this.started){this.started=false;this.eventListeners.forEach((e=>e.disconnect()))}}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((e,t)=>e.concat(Array.from(t.values()))),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=false){this.fetchEventListenerForBinding(e).bindingDisconnected(e);t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){const t=this.fetchEventListenerForBinding(e);if(!t.hasBindings()){t.disconnect();this.removeMappedEventListenerFor(e)}}removeMappedEventListenerFor(e){const{eventTarget:t,eventName:r,eventOptions:s}=e;const n=this.fetchEventListenerMapForEventTarget(t);const i=this.cacheKey(r,s);n.delete(i);0==n.size&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){const{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){const s=this.fetchEventListenerMapForEventTarget(e);const n=this.cacheKey(t,r);let i=s.get(n);if(!i){i=this.createEventListener(e,t,r);s.set(n,i)}return i}createEventListener(e,t,r){const s=new EventListener(e,t,r);this.started&&s.connect();return s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);if(!t){t=new Map;this.eventListenerMaps.set(e,t)}return t}cacheKey(e,t){const r=[e];Object.keys(t).sort().forEach((e=>{r.push(`${t[e]?"":"!"}${e}`)}));return r.join(":")}}const e={stop({event:e,value:t}){t&&e.stopPropagation();return true},prevent({event:e,value:t}){t&&e.preventDefault();return true},self({event:e,value:t,element:r}){return!t||r===e.target}};const t=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function parseActionDescriptorString(e){const r=e.trim();const s=r.match(t)||[];let n=s[2];let i=s[3];if(i&&!["keydown","keyup","keypress"].includes(n)){n+=`.${i}`;i=""}return{eventTarget:parseEventTarget(s[4]),eventName:n,eventOptions:s[7]?parseEventOptions(s[7]):{},identifier:s[5],methodName:s[6],keyFilter:s[1]||i}}function parseEventTarget(e){return"window"==e?window:"document"==e?document:void 0}function parseEventOptions(e){return e.split(":").reduce(((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)})),{})}function stringifyEventTarget(e){return e==window?"window":e==document?"document":void 0}function camelize(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function namespaceCamelize(e){return camelize(e.replace(/--/g,"-").replace(/__/g,"_"))}function capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}function dasherize(e){return e.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`))}function tokenize(e){return e.match(/[^\s]+/g)||[]}function isSomething(e){return null!==e&&void 0!==e}function hasProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const r=["meta","ctrl","alt","shift"];class Action{constructor(e,t,r,s){this.element=e;this.index=t;this.eventTarget=r.eventTarget||e;this.eventName=r.eventName||getDefaultEventNameForElement(e)||error("missing event name");this.eventOptions=r.eventOptions||{};this.identifier=r.identifier||error("missing identifier");this.methodName=r.methodName||error("missing method name");this.keyFilter=r.keyFilter||"";this.schema=s}static forToken(e,t){return new this(e.element,e.index,parseActionDescriptorString(e.content),t)}toString(){const e=this.keyFilter?`.${this.keyFilter}`:"";const t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return false;const t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return true;const s=t.filter((e=>!r.includes(e)))[0];if(!s)return false;hasProperty(this.keyMappings,s)||error(`contains unknown key filter: ${this.keyFilter}`);return this.keyMappings[s].toLowerCase()!==e.key.toLowerCase()}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return false;const t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){const e={};const t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(const{name:r,value:s}of Array.from(this.element.attributes)){const n=r.match(t);const i=n&&n[1];i&&(e[camelize(i)]=typecast(s))}return e}get eventTargetName(){return stringifyEventTarget(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){const[s,n,i,o]=r.map((e=>t.includes(e)));return e.metaKey!==s||e.ctrlKey!==n||e.altKey!==i||e.shiftKey!==o}}const s={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:e=>"submit"==e.getAttribute("type")?"click":"input",select:()=>"change",textarea:()=>"input"};function getDefaultEventNameForElement(e){const t=e.tagName.toLowerCase();if(t in s)return s[t](e)}function error(e){throw new Error(e)}function typecast(e){try{return JSON.parse(e)}catch(t){return e}}class Binding{constructor(e,t){this.context=e;this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){const t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){const e=this.controller[this.methodName];if("function"==typeof e)return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){const{element:t}=this.action;const{actionDescriptorFilters:r}=this.context.application;const{controller:s}=this.context;let n=true;for(const[i,o]of Object.entries(this.eventOptions))if(i in r){const c=r[i];n=n&&c({name:i,value:o,event:e,element:t,controller:s})}return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){const{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e);this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(t){const{identifier:r,controller:s,element:n,index:i}=this;const o={identifier:r,controller:s,element:n,index:i,event:e};this.context.handleError(t,`invoking action "${this.action}"`,o)}}willBeInvokedByEvent(e){const t=e.target;return!(e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e))&&(!(e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e))&&(this.element===t||(t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element))))}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}}class ElementObserver{constructor(e,t){this.mutationObserverInit={attributes:true,childList:true,subtree:true};this.element=e;this.started=false;this.delegate=t;this.elements=new Set;this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){if(!this.started){this.started=true;this.mutationObserver.observe(this.element,this.mutationObserverInit);this.refresh()}}pause(e){if(this.started){this.mutationObserver.disconnect();this.started=false}e();if(!this.started){this.mutationObserver.observe(this.element,this.mutationObserverInit);this.started=true}}stop(){if(this.started){this.mutationObserver.takeRecords();this.mutationObserver.disconnect();this.started=false}}refresh(){if(this.started){const e=new Set(this.matchElementsInTree());for(const t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(const t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){if("attributes"==e.type)this.processAttributeChange(e.target,e.attributeName);else if("childList"==e.type){this.processRemovedNodes(e.removedNodes);this.processAddedNodes(e.addedNodes)}}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.processTree(e,this.removeElement)}}processAddedNodes(e){for(const t of Array.from(e)){const e=this.elementFromNode(t);e&&this.elementIsActive(e)&&this.processTree(e,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(const r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected==this.element.isConnected&&this.element.contains(e)}addElement(e){if(!this.elements.has(e)&&this.elementIsActive(e)){this.elements.add(e);this.delegate.elementMatched&&this.delegate.elementMatched(e)}}removeElement(e){if(this.elements.has(e)){this.elements.delete(e);this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e)}}}class AttributeObserver{constructor(e,t,r){this.attributeName=t;this.delegate=r;this.elementObserver=new ElementObserver(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){const t=this.matchElement(e)?[e]:[];const r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}}function add(e,t,r){fetch(e,t).add(r)}function del(e,t,r){fetch(e,t).delete(r);prune(e,t)}function fetch(e,t){let r=e.get(t);if(!r){r=new Set;e.set(t,r)}return r}function prune(e,t){const r=e.get(t);null!=r&&0==r.size&&e.delete(t)}class Multimap{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){const e=Array.from(this.valuesByKey.values());return e.reduce(((e,t)=>e.concat(Array.from(t))),[])}get size(){const e=Array.from(this.valuesByKey.values());return e.reduce(((e,t)=>e+t.size),0)}add(e,t){add(this.valuesByKey,e,t)}delete(e,t){del(this.valuesByKey,e,t)}has(e,t){const r=this.valuesByKey.get(e);return null!=r&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){const t=Array.from(this.valuesByKey.values());return t.some((t=>t.has(e)))}getValuesForKey(e){const t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter((([t,r])=>r.has(e))).map((([e,t])=>e))}}class IndexedMultimap extends Multimap{constructor(){super();this.keysByValue=new Map}get values(){return Array.from(this.keysByValue.keys())}add(e,t){super.add(e,t);add(this.keysByValue,t,e)}delete(e,t){super.delete(e,t);del(this.keysByValue,t,e)}hasValue(e){return this.keysByValue.has(e)}getKeysForValue(e){const t=this.keysByValue.get(e);return t?Array.from(t):[]}}class SelectorObserver{constructor(e,t,r,s){this._selector=t;this.details=s;this.elementObserver=new ElementObserver(e,this);this.delegate=r;this.matchesByElement=new Multimap}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e;this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){const{selector:t}=this;if(t){const r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}return false}matchElementsInTree(e){const{selector:t}=this;if(t){const r=this.matchElement(e)?[e]:[];const s=Array.from(e.querySelectorAll(t)).filter((e=>this.matchElement(e)));return r.concat(s)}return[]}elementMatched(e){const{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){const t=this.matchesByElement.getKeysForValue(e);for(const r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){const{selector:r}=this;if(r){const t=this.matchElement(e);const s=this.matchesByElement.has(r,e);t&&!s?this.selectorMatched(e,r):!t&&s&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details);this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details);this.matchesByElement.delete(t,e)}}class StringMapObserver{constructor(e,t){this.element=e;this.delegate=t;this.started=false;this.stringMap=new Map;this.mutationObserver=new MutationObserver((e=>this.processMutations(e)))}start(){if(!this.started){this.started=true;this.mutationObserver.observe(this.element,{attributes:true,attributeOldValue:true});this.refresh()}}stop(){if(this.started){this.mutationObserver.takeRecords();this.mutationObserver.disconnect();this.started=false}}refresh(){if(this.started)for(const e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(const t of e)this.processMutation(t)}processMutation(e){const t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){const r=this.delegate.getStringMapKeyForAttribute(e);if(null!=r){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);const s=this.element.getAttribute(e);this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t);if(null==s){const t=this.stringMap.get(e);this.stringMap.delete(e);t&&this.stringMapKeyRemoved(r,e,t)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map((e=>e.name))}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}}class TokenListObserver{constructor(e,t,r){this.attributeObserver=new AttributeObserver(e,t,this);this.delegate=r;this.tokensByElement=new Multimap}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){const[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t);this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach((e=>this.tokenMatched(e)))}tokensUnmatched(e){e.forEach((e=>this.tokenUnmatched(e)))}tokenMatched(e){this.delegate.tokenMatched(e);this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e);this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){const t=this.tokensByElement.getValuesForKey(e);const r=this.readTokensForElement(e);const s=zip(t,r).findIndex((([e,t])=>!tokensAreEqual(e,t)));return-1==s?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){const t=this.attributeName;const r=e.getAttribute(t)||"";return parseTokenString(r,e,t)}}function parseTokenString(e,t,r){return e.trim().split(/\s+/).filter((e=>e.length)).map(((e,s)=>({element:t,attributeName:r,content:e,index:s})))}function zip(e,t){const r=Math.max(e.length,t.length);return Array.from({length:r},((r,s)=>[e[s],t[s]]))}function tokensAreEqual(e,t){return e&&t&&e.index==t.index&&e.content==t.content}class ValueListObserver{constructor(e,t,r){this.tokenListObserver=new TokenListObserver(e,t,this);this.delegate=r;this.parseResultsByToken=new WeakMap;this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){const{element:t}=e;const{value:r}=this.fetchParseResultForToken(e);if(r){this.fetchValuesByTokenForElement(t).set(e,r);this.delegate.elementMatchedValue(t,r)}}tokenUnmatched(e){const{element:t}=e;const{value:r}=this.fetchParseResultForToken(e);if(r){this.fetchValuesByTokenForElement(t).delete(e);this.delegate.elementUnmatchedValue(t,r)}}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);if(!t){t=this.parseToken(e);this.parseResultsByToken.set(e,t)}return t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);if(!t){t=new Map;this.valuesByTokenByElement.set(e,t)}return t}parseToken(e){try{const t=this.delegate.parseValueForToken(e);return{value:t}}catch(e){return{error:e}}}}class BindingObserver{constructor(e,t){this.context=e;this.delegate=t;this.bindingsByAction=new Map}start(){if(!this.valueListObserver){this.valueListObserver=new ValueListObserver(this.element,this.actionAttribute,this);this.valueListObserver.start()}}stop(){if(this.valueListObserver){this.valueListObserver.stop();delete this.valueListObserver;this.disconnectAllActions()}}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){const t=new Binding(this.context,e);this.bindingsByAction.set(e,t);this.delegate.bindingConnected(t)}disconnectAction(e){const t=this.bindingsByAction.get(e);if(t){this.bindingsByAction.delete(e);this.delegate.bindingDisconnected(t)}}disconnectAllActions(){this.bindings.forEach((e=>this.delegate.bindingDisconnected(e,true)));this.bindingsByAction.clear()}parseValueForToken(e){const t=Action.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}}class ValueObserver{constructor(e,t){this.context=e;this.receiver=t;this.stringMapObserver=new StringMapObserver(this.element,this);this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start();this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){const r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){const s=this.valueDescriptorNameMap[t];if(null!==e){null===r&&(r=s.writer(s.defaultValue));this.invokeChangedCallback(t,e,r)}}stringMapKeyRemoved(e,t,r){const s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(const{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)void 0==r||this.controller.data.has(e)||this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){const s=`${e}Changed`;const n=this.receiver[s];if("function"==typeof n){const s=this.valueDescriptorNameMap[e];try{const e=s.reader(t);let i=r;r&&(i=s.reader(r));n.call(this.receiver,e,i)}catch(e){e instanceof TypeError&&(e.message=`Stimulus Value "${this.context.identifier}.${s.name}" - ${e.message}`);throw e}}}get valueDescriptors(){const{valueDescriptorMap:e}=this;return Object.keys(e).map((t=>e[t]))}get valueDescriptorNameMap(){const e={};Object.keys(this.valueDescriptorMap).forEach((t=>{const r=this.valueDescriptorMap[t];e[r.name]=r}));return e}hasValue(e){const t=this.valueDescriptorNameMap[e];const r=`has${capitalize(t.name)}`;return this.receiver[r]}}class TargetObserver{constructor(e,t){this.context=e;this.delegate=t;this.targetsByName=new Multimap}start(){if(!this.tokenListObserver){this.tokenListObserver=new TokenListObserver(this.element,this.attributeName,this);this.tokenListObserver.start()}}stop(){if(this.tokenListObserver){this.disconnectAllTargets();this.tokenListObserver.stop();delete this.tokenListObserver}}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;if(!this.targetsByName.has(t,e)){this.targetsByName.add(t,e);null===(r=this.tokenListObserver)||void 0===r?void 0:r.pause((()=>this.delegate.targetConnected(e,t)))}}disconnectTarget(e,t){var r;if(this.targetsByName.has(t,e)){this.targetsByName.delete(t,e);null===(r=this.tokenListObserver)||void 0===r?void 0:r.pause((()=>this.delegate.targetDisconnected(e,t)))}}disconnectAllTargets(){for(const e of this.targetsByName.keys)for(const t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}}function readInheritableStaticArrayValues(e,t){const r=getAncestorsForConstructor(e);return Array.from(r.reduce(((e,r)=>{getOwnStaticArrayValues(r,t).forEach((t=>e.add(t)));return e}),new Set))}function readInheritableStaticObjectPairs(e,t){const r=getAncestorsForConstructor(e);return r.reduce(((e,r)=>{e.push(...getOwnStaticObjectPairs(r,t));return e}),[])}function getAncestorsForConstructor(e){const t=[];while(e){t.push(e);e=Object.getPrototypeOf(e)}return t.reverse()}function getOwnStaticArrayValues(e,t){const r=e[t];return Array.isArray(r)?r:[]}function getOwnStaticObjectPairs(e,t){const r=e[t];return r?Object.keys(r).map((e=>[e,r[e]])):[]}class OutletObserver{constructor(e,t){this.started=false;this.context=e;this.delegate=t;this.outletsByName=new Multimap;this.outletElementsByName=new Multimap;this.selectorObserverMap=new Map;this.attributeObserverMap=new Map}start(){if(!this.started){this.outletDefinitions.forEach((e=>{this.setupSelectorObserverForOutlet(e);this.setupAttributeObserverForOutlet(e)}));this.started=true;this.dependentContexts.forEach((e=>e.refresh()))}}refresh(){this.selectorObserverMap.forEach((e=>e.refresh()));this.attributeObserverMap.forEach((e=>e.refresh()))}stop(){if(this.started){this.started=false;this.disconnectAllOutlets();this.stopSelectorObservers();this.stopAttributeObservers()}}stopSelectorObservers(){if(this.selectorObserverMap.size>0){this.selectorObserverMap.forEach((e=>e.stop()));this.selectorObserverMap.clear()}}stopAttributeObservers(){if(this.attributeObserverMap.size>0){this.attributeObserverMap.forEach((e=>e.stop()));this.attributeObserverMap.clear()}}selectorMatched(e,t,{outletName:r}){const s=this.getOutlet(e,r);s&&this.connectOutlet(s,e,r)}selectorUnmatched(e,t,{outletName:r}){const s=this.getOutletFromMap(e,r);s&&this.disconnectOutlet(s,e,r)}selectorMatchElement(e,{outletName:t}){const r=this.selector(t);const s=this.hasOutlet(e,t);const n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return!!r&&(s&&n&&e.matches(r))}elementMatchedAttribute(e,t){const r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){const r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){const r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var s;if(!this.outletElementsByName.has(r,t)){this.outletsByName.add(r,e);this.outletElementsByName.add(r,t);null===(s=this.selectorObserverMap.get(r))||void 0===s?void 0:s.pause((()=>this.delegate.outletConnected(e,t,r)))}}disconnectOutlet(e,t,r){var s;if(this.outletElementsByName.has(r,t)){this.outletsByName.delete(r,e);this.outletElementsByName.delete(r,t);null===(s=this.selectorObserverMap.get(r))||void 0===s?void 0:s.pause((()=>this.delegate.outletDisconnected(e,t,r)))}}disconnectAllOutlets(){for(const e of this.outletElementsByName.keys)for(const t of this.outletElementsByName.getValuesForKey(e))for(const r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){const t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){const t=this.selector(e);const r=new SelectorObserver(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r);r.start()}setupAttributeObserverForOutlet(e){const t=this.attributeNameForOutletName(e);const r=new AttributeObserver(this.scope.element,t,this);this.attributeObserverMap.set(e,r);r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find((t=>this.attributeNameForOutletName(t)===e))}get outletDependencies(){const e=new Multimap;this.router.modules.forEach((t=>{const r=t.definition.controllerConstructor;const s=readInheritableStaticArrayValues(r,"outlets");s.forEach((r=>e.add(r,t.identifier)))}));return e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){const e=this.dependentControllerIdentifiers;return this.router.contexts.filter((t=>e.includes(t.identifier)))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find((t=>t.element===e))}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}}class Context{constructor(e,t){this.logDebugActivity=(e,t={})=>{const{identifier:r,controller:s,element:n}=this;t=Object.assign({identifier:r,controller:s,element:n},t);this.application.logDebugActivity(this.identifier,e,t)};this.module=e;this.scope=t;this.controller=new e.controllerConstructor(this);this.bindingObserver=new BindingObserver(this,this.dispatcher);this.valueObserver=new ValueObserver(this,this.controller);this.targetObserver=new TargetObserver(this,this);this.outletObserver=new OutletObserver(this,this);try{this.controller.initialize();this.logDebugActivity("initialize")}catch(e){this.handleError(e,"initializing controller")}}connect(){this.bindingObserver.start();this.valueObserver.start();this.targetObserver.start();this.outletObserver.start();try{this.controller.connect();this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect();this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop();this.targetObserver.stop();this.valueObserver.stop();this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){const{identifier:s,controller:n,element:i}=this;r=Object.assign({identifier:s,controller:n,element:i},r);this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${namespaceCamelize(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${namespaceCamelize(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){const r=this.controller;"function"==typeof r[e]&&r[e](...t)}}function bless(e){return shadow(e,getBlessedProperties(e))}function shadow(e,t){const r=i(e);const s=getShadowProperties(e.prototype,t);Object.defineProperties(r.prototype,s);return r}function getBlessedProperties(e){const t=readInheritableStaticArrayValues(e,"blessings");return t.reduce(((t,r)=>{const s=r(e);for(const e in s){const r=t[e]||{};t[e]=Object.assign(r,s[e])}return t}),{})}function getShadowProperties(e,t){return n(t).reduce(((r,s)=>{const n=getShadowedDescriptor(e,t,s);n&&Object.assign(r,{[s]:n});return r}),{})}function getShadowedDescriptor(e,t,r){const s=Object.getOwnPropertyDescriptor(e,r);const n=s&&"value"in s;if(!n){const e=Object.getOwnPropertyDescriptor(t,r).value;if(s){e.get=s.get||e.get;e.set=s.set||e.set}return e}}const n=(()=>"function"==typeof Object.getOwnPropertySymbols?e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)]:Object.getOwnPropertyNames)();const i=(()=>{function extendWithReflect(e){function extended(){return Reflect.construct(e,arguments,new.target)}extended.prototype=Object.create(e.prototype,{constructor:{value:extended}});Reflect.setPrototypeOf(extended,e);return extended}function testReflectExtension(){const a=function(){this.a.call(this)};const e=extendWithReflect(a);e.prototype.a=function(){};return new e}try{testReflectExtension();return extendWithReflect}catch(e){return e=>class extended extends e{}}})();function blessDefinition(e){return{identifier:e.identifier,controllerConstructor:bless(e.controllerConstructor)}}class Module{constructor(e,t){this.application=e;this.definition=blessDefinition(t);this.contextsByScope=new WeakMap;this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){const t=this.fetchContextForScope(e);this.connectedContexts.add(t);t.connect()}disconnectContextForScope(e){const t=this.contextsByScope.get(e);if(t){this.connectedContexts.delete(t);t.disconnect()}}fetchContextForScope(e){let t=this.contextsByScope.get(e);if(!t){t=new Context(this,e);this.contextsByScope.set(e,t)}return t}}class ClassMap{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){const t=this.data.get(this.getDataKey(e))||"";return tokenize(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}}class DataMap{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){const t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){const r=this.getAttributeNameForKey(e);this.element.setAttribute(r,t);return this.get(e)}has(e){const t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){const t=this.getAttributeNameForKey(e);this.element.removeAttribute(t);return true}return false}getAttributeNameForKey(e){return`data-${this.identifier}-${dasherize(e)}`}}class Guide{constructor(e){this.warnedKeysByObject=new WeakMap;this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);if(!s){s=new Set;this.warnedKeysByObject.set(e,s)}if(!s.has(t)){s.add(t);this.logger.warn(r,e)}}}function attributeValueContainsToken(e,t){return`[${e}~="${t}"]`}class TargetSet{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findTarget(t)||this.findLegacyTarget(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllTargets(t),...this.findAllLegacyTargets(t)]),[])}findTarget(e){const t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){const t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){const t=this.schema.targetAttributeForScope(this.identifier);return attributeValueContainsToken(t,e)}findLegacyTarget(e){const t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){const t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map((t=>this.deprecate(t,e)))}getLegacySelectorForTargetName(e){const t=`${this.identifier}.${e}`;return attributeValueContainsToken(this.schema.targetAttribute,t)}deprecate(e,t){if(e){const{identifier:r}=this;const s=this.schema.targetAttribute;const n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}}class OutletSet{constructor(e,t){this.scope=e;this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return null!=this.find(e)}find(...e){return e.reduce(((e,t)=>e||this.findOutlet(t)),void 0)}findAll(...e){return e.reduce(((e,t)=>[...e,...this.findAllOutlets(t)]),[])}getSelectorForOutletName(e){const t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){const t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){const t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){const r=this.scope.queryElements(e);return r.filter((r=>this.matchesElement(r,e,t)))[0]}findAllElements(e,t){const r=this.scope.queryElements(e);return r.filter((r=>this.matchesElement(r,e,t)))}matchesElement(e,t,r){const s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(r)}}class Scope{constructor(e,t,r,s){this.targets=new TargetSet(this);this.classes=new ClassMap(this);this.data=new DataMap(this);this.containsElement=e=>e.closest(this.controllerSelector)===this.element;this.schema=e;this.element=t;this.identifier=r;this.guide=new Guide(s);this.outlets=new OutletSet(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return attributeValueContainsToken(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new Scope(this.schema,document.documentElement,this.identifier,this.guide.logger)}}class ScopeObserver{constructor(e,t,r){this.element=e;this.schema=t;this.delegate=r;this.valueListObserver=new ValueListObserver(this.element,this.controllerAttribute,this);this.scopesByIdentifierByElement=new WeakMap;this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){const{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){const r=this.fetchScopesByIdentifierForElement(e);let s=r.get(t);if(!s){s=this.delegate.createScopeForElementAndIdentifier(e,t);r.set(t,s)}return s}elementMatchedValue(e,t){const r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r);1==r&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){const r=this.scopeReferenceCounts.get(t);if(r){this.scopeReferenceCounts.set(t,r-1);1==r&&this.delegate.scopeDisconnected(t)}}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);if(!t){t=new Map;this.scopesByIdentifierByElement.set(e,t)}return t}}class Router{constructor(e){this.application=e;this.scopeObserver=new ScopeObserver(this.element,this.schema,this);this.scopesByIdentifier=new Multimap;this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce(((e,t)=>e.concat(t.contexts)),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);const t=new Module(this.application,e);this.connectModule(t);const r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){const t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){const r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find((t=>t.element==e))}proposeToConnectScopeForElementAndIdentifier(e,t){const r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new Scope(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);const t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e);const t=this.scopesByIdentifier.getValuesForKey(e.identifier);t.forEach((t=>e.connectContextForScope(t)))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier);const t=this.scopesByIdentifier.getValuesForKey(e.identifier);t.forEach((t=>e.disconnectContextForScope(t)))}}const o={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:e=>`data-${e}-target`,outletAttributeForScope:(e,t)=>`data-${e}-${t}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},objectFromEntries("abcdefghijklmnopqrstuvwxyz".split("").map((e=>[e,e])))),objectFromEntries("0123456789".split("").map((e=>[e,e]))))};function objectFromEntries(e){return e.reduce(((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r})),{})}class Application{constructor(t=document.documentElement,r=o){this.logger=console;this.debug=false;this.logDebugActivity=(e,t,r={})=>{this.debug&&this.logFormattedMessage(e,t,r)};this.element=t;this.schema=r;this.dispatcher=new Dispatcher(this);this.router=new Router(this);this.actionDescriptorFilters=Object.assign({},e)}static start(e,t){const r=new this(e,t);r.start();return r}async start(){await domReady();this.logDebugActivity("application","starting");this.dispatcher.start();this.router.start();this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping");this.dispatcher.stop();this.router.stop();this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){const r=Array.isArray(e)?e:[e,...t];r.forEach((e=>{e.controllerConstructor.shouldLoad&&this.router.loadDefinition(e)}))}unload(e,...t){const r=Array.isArray(e)?e:[e,...t];r.forEach((e=>this.router.unloadIdentifier(e)))}get controllers(){return this.router.contexts.map((e=>e.controller))}getControllerForElementAndIdentifier(e,t){const r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error("%s\n\n%o\n\n%o",t,e,r);null===(s=window.onerror)||void 0===s?void 0:s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r);this.logger.groupCollapsed(`${e} #${t}`);this.logger.log("details:",Object.assign({},r));this.logger.groupEnd()}}function domReady(){return new Promise((e=>{"loading"==document.readyState?document.addEventListener("DOMContentLoaded",(()=>e())):e()}))}function ClassPropertiesBlessing(e){const t=readInheritableStaticArrayValues(e,"classes");return t.reduce(((e,t)=>Object.assign(e,propertiesForClassDefinition(t))),{})}function propertiesForClassDefinition(e){return{[`${e}Class`]:{get(){const{classes:t}=this;if(t.has(e))return t.get(e);{const r=t.getAttributeName(e);throw new Error(`Missing attribute "${r}"`)}}},[`${e}Classes`]:{get(){return this.classes.getAll(e)}},[`has${capitalize(e)}Class`]:{get(){return this.classes.has(e)}}}}function OutletPropertiesBlessing(e){const t=readInheritableStaticArrayValues(e,"outlets");return t.reduce(((e,t)=>Object.assign(e,propertiesForOutletDefinition(t))),{})}function getOutletController(e,t,r){return e.application.getControllerForElementAndIdentifier(t,r)}function getControllerAndEnsureConnectedScope(e,t,r){let s=getOutletController(e,t,r);if(s)return s;e.application.router.proposeToConnectScopeForElementAndIdentifier(t,r);s=getOutletController(e,t,r);return s||void 0}function propertiesForOutletDefinition(e){const t=namespaceCamelize(e);return{[`${t}Outlet`]:{get(){const t=this.outlets.find(e);const r=this.outlets.getSelectorForOutletName(e);if(t){const r=getControllerAndEnsureConnectedScope(this,t,e);if(r)return r;throw new Error(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${t}Outlets`]:{get(){const t=this.outlets.findAll(e);return t.length>0?t.map((t=>{const r=getControllerAndEnsureConnectedScope(this,t,e);if(r)return r;console.warn(`The provided outlet element is missing an outlet controller "${e}" instance for host controller "${this.identifier}"`,t)})).filter((e=>e)):[]}},[`${t}OutletElement`]:{get(){const t=this.outlets.find(e);const r=this.outlets.getSelectorForOutletName(e);if(t)return t;throw new Error(`Missing outlet element "${e}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${t}OutletElements`]:{get(){return this.outlets.findAll(e)}},[`has${capitalize(t)}Outlet`]:{get(){return this.outlets.has(e)}}}}function TargetPropertiesBlessing(e){const t=readInheritableStaticArrayValues(e,"targets");return t.reduce(((e,t)=>Object.assign(e,propertiesForTargetDefinition(t))),{})}function propertiesForTargetDefinition(e){return{[`${e}Target`]:{get(){const t=this.targets.find(e);if(t)return t;throw new Error(`Missing target element "${e}" for "${this.identifier}" controller`)}},[`${e}Targets`]:{get(){return this.targets.findAll(e)}},[`has${capitalize(e)}Target`]:{get(){return this.targets.has(e)}}}}function ValuePropertiesBlessing(e){const t=readInheritableStaticObjectPairs(e,"values");const r={valueDescriptorMap:{get(){return t.reduce(((e,t)=>{const r=parseValueDefinitionPair(t,this.identifier);const s=this.data.getAttributeNameForKey(r.key);return Object.assign(e,{[s]:r})}),{})}}};return t.reduce(((e,t)=>Object.assign(e,propertiesForValueDefinitionPair(t))),r)}function propertiesForValueDefinitionPair(e,t){const r=parseValueDefinitionPair(e,t);const{key:s,name:n,reader:i,writer:o}=r;return{[n]:{get(){const e=this.data.get(s);return null!==e?i(e):r.defaultValue},set(e){void 0===e?this.data.delete(s):this.data.set(s,o(e))}},[`has${capitalize(n)}`]:{get(){return this.data.has(s)||r.hasCustomDefaultValue}}}}function parseValueDefinitionPair([e,t],r){return valueDescriptorForTokenAndTypeDefinition({controller:r,token:e,typeDefinition:t})}function parseValueTypeConstant(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function parseValueTypeDefault(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}return Array.isArray(e)?"array":"[object Object]"===Object.prototype.toString.call(e)?"object":void 0}function parseValueTypeObject(e){const{controller:t,token:r,typeObject:s}=e;const n=isSomething(s.type);const i=isSomething(s.default);const o=n&&i;const c=n&&!i;const l=!n&&i;const h=parseValueTypeConstant(s.type);const u=parseValueTypeDefault(e.typeObject.default);if(c)return h;if(l)return u;if(h!==u){const e=t?`${t}.${r}`:r;throw new Error(`The specified default value for the Stimulus Value "${e}" must match the defined type "${h}". The provided default value of "${s.default}" is of type "${u}".`)}return o?h:void 0}function parseValueTypeDefinition(e){const{controller:t,token:r,typeDefinition:s}=e;const n={controller:t,token:r,typeObject:s};const i=parseValueTypeObject(n);const o=parseValueTypeDefault(s);const c=parseValueTypeConstant(s);const l=i||o||c;if(l)return l;const h=t?`${t}.${s}`:r;throw new Error(`Unknown value type "${h}" for "${r}" value`)}function defaultValueForDefinition(e){const t=parseValueTypeConstant(e);if(t)return c[t];const r=hasProperty(e,"default");const s=hasProperty(e,"type");const n=e;if(r)return n.default;if(s){const{type:e}=n;const t=parseValueTypeConstant(e);if(t)return c[t]}return e}function valueDescriptorForTokenAndTypeDefinition(e){const{token:t,typeDefinition:r}=e;const s=`${dasherize(t)}-value`;const n=parseValueTypeDefinition(e);return{type:n,key:s,name:camelize(s),get defaultValue(){return defaultValueForDefinition(r)},get hasCustomDefaultValue(){return void 0!==parseValueTypeDefault(r)},reader:l[n],writer:h[n]||h.default}}const c={get array(){return[]},boolean:false,number:0,get object(){return{}},string:""};const l={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError(`expected value of type "array" but instead got value "${e}" of type "${parseValueTypeDefault(t)}"`);return t},boolean(e){return!("0"==e||"false"==String(e).toLowerCase())},number(e){return Number(e.replace(/_/g,""))},object(e){const t=JSON.parse(e);if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`expected value of type "object" but instead got value "${e}" of type "${parseValueTypeDefault(t)}"`);return t},string(e){return e}};const h={default:writeString,array:writeJSON,object:writeJSON};function writeJSON(e){return JSON.stringify(e)}function writeString(e){return`${e}`}class Controller{constructor(e){this.context=e}static get shouldLoad(){return true}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=true,cancelable:i=true}={}){const o=s?`${s}:${e}`:e;const c=new CustomEvent(o,{detail:r,bubbles:n,cancelable:i});t.dispatchEvent(c);return c}}Controller.blessings=[ClassPropertiesBlessing,TargetPropertiesBlessing,ValuePropertiesBlessing,OutletPropertiesBlessing];Controller.targets=[];Controller.outlets=[];Controller.values={};export{Application,AttributeObserver,Context,Controller,ElementObserver,IndexedMultimap,Multimap,SelectorObserver,StringMapObserver,TokenListObserver,ValueListObserver,add,o as defaultSchema,del,fetch,prune};
-
diff --git a/core/app/assets/config/spree_core_manifest.js b/core/app/assets/config/spree_core_manifest.js
new file mode 100644
index 0000000000..c61e9b24d4
--- /dev/null
+++ b/core/app/assets/config/spree_core_manifest.js
@@ -0,0 +1,3 @@
+//= link_tree ../../javascript/spree/core/controllers .js
+//= link_tree ../../javascript/spree/core/helpers .js
+//= link_tree ../../../vendor/javascript .js
diff --git a/admin/app/javascript/spree/admin/controllers/address_autocomplete_controller.js b/core/app/javascript/spree/core/controllers/address_autocomplete_controller.js
similarity index 96%
rename from admin/app/javascript/spree/admin/controllers/address_autocomplete_controller.js
rename to core/app/javascript/spree/core/controllers/address_autocomplete_controller.js
index 85e859d8e3..21051ec7e4 100644
--- a/admin/app/javascript/spree/admin/controllers/address_autocomplete_controller.js
+++ b/core/app/javascript/spree/core/controllers/address_autocomplete_controller.js
@@ -1,6 +1,6 @@
import { Controller } from '@hotwired/stimulus'
-import debounce from 'spree/admin/helpers/debounce'
-import GooglePlacesSuggestionsProvider from 'spree/admin/helpers/address_autocomplete/google_places_suggestions_provider'
+import debounce from 'spree/core/helpers/debounce'
+import GooglePlacesSuggestionsProvider from 'spree/core/helpers/address_autocomplete/google_places_suggestions_provider'
export default class extends Controller {
static targets = [
@@ -90,7 +90,7 @@ export default class extends Controller {
event.preventDefault()
if (this.selectedIndex < this.suggestionsCount - 1) {
this.selectOption(this.selectedIndex + 1)
- } else {
+ } else if (this.suggestionsCount) {
this.selectOption(0)
}
break
@@ -98,7 +98,7 @@ export default class extends Controller {
event.preventDefault()
if (this.selectedIndex > 0) {
this.selectOption(this.selectedIndex - 1)
- } else {
+ } else if (this.suggestionsCount) {
this.selectOption(4)
}
break
diff --git a/core/app/javascript/spree/core/controllers/address_form_controller.js b/core/app/javascript/spree/core/controllers/address_form_controller.js
new file mode 100644
index 0000000000..e51c7b6509
--- /dev/null
+++ b/core/app/javascript/spree/core/controllers/address_form_controller.js
@@ -0,0 +1,98 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = [
+ 'country',
+ 'state',
+ 'stateName',
+ 'stateLabel',
+ 'stateArrow',
+ 'zipcode'
+ ]
+
+ static values = {
+ countries: Array,
+ states: Array,
+ currentStateId: String
+ }
+
+ constructor(...args) {
+ super(...args)
+ this.changeCountry()
+ }
+
+ get country() {
+ return this.countriesValue.find(
+ (country) => country.id == this.countryTarget.value
+ )
+ }
+
+ get state() {
+ return this.statesValue.find((state) => state[1] == this.stateTarget.value)
+ }
+
+ get states() {
+ return this.statesValue.filter(
+ (state) => state[0] == this.countryTarget.value
+ )
+ }
+
+ changeCountry(_event) {
+ var form = document.querySelector('.address-form')
+ this.stateTarget.required = this.country.states_required
+ this.stateTarget.value = ''
+ this.stateTarget.innerHTML = ''
+
+ var allStates = this.stateTarget.parentNode.parentNode
+ var stateName = this.stateNameTarget
+ var stateSelector = this.stateTarget
+
+ if (this.country.states_required) {
+ this.stateLabelTarget.parentNode.parentNode.classList.remove('hidden')
+ form.classList.toggle('cols-2', false)
+
+ allStates.classList.remove('hidden')
+ allStates.classList.add('flex')
+ if (this.states.length > 0) {
+ stateSelector.classList.remove('hidden')
+ stateName.classList.add('hidden')
+
+ this.states.map((state) => {
+ const option = document.createElement('option')
+ option.value = state[1]
+ option.dataset.abbr = state[2]
+ option.text = state[3]
+
+ if (option.value == this.currentStateIdValue) {
+ option.selected = true
+ }
+
+ this.stateTarget.add(option)
+ })
+ } else {
+ stateName.classList.remove('hidden')
+ stateSelector.classList.add('hidden')
+ }
+ } else {
+ form.classList.toggle('cols-2', true)
+ allStates.classList.add('hidden')
+ allStates.classList.remove('flex')
+ }
+
+ this.zipcodeTarget.required = this.country.zipcode_required
+ if (this.country.zipcode_required) {
+ form.classList.toggle('col-1', false)
+ this.zipcodeTarget.parentNode.classList.remove('hidden')
+ } else {
+ if (!this.country.states_required) {
+ form.classList.toggle('col-1', true)
+ form.classList.toggle('cols-2', false)
+ } else {
+ form.classList.toggle('col-1', false)
+ form.classList.toggle('cols-2', true)
+ }
+ this.zipcodeTarget.parentNode.classList.add('hidden')
+ this.zipcodeTarget.value = null
+ }
+ }
+}
diff --git a/core/app/javascript/spree/core/controllers/enable_button_controller.js b/core/app/javascript/spree/core/controllers/enable_button_controller.js
new file mode 100644
index 0000000000..8522acc76a
--- /dev/null
+++ b/core/app/javascript/spree/core/controllers/enable_button_controller.js
@@ -0,0 +1,29 @@
+import { Controller } from "@hotwired/stimulus"
+
+export default class extends Controller {
+ static targets = ["input", "button"];
+ static values = {
+ allowBlank: { type: Boolean, default: false },
+ disableWhenNotChanged: { type: Boolean, default: false },
+ }
+
+ connect() {
+ this.buttonTarget.setAttribute("disabled", true);
+
+ if (this.inputTargets.every((input) => input.value || input.checked || this.allowBlankValue) && !this.disableWhenNotChangedValue) {
+ this.buttonTarget.removeAttribute("disabled");
+ }
+
+ this.inputTargets.forEach((input) => {
+ input.addEventListener("input", (event) => this.handleChange(event));
+ });
+ }
+
+ handleChange(event) {
+ if (this.inputTargets.every((input) => event.target.value || event.target.checked || this.allowBlankValue)) {
+ this.buttonTarget.removeAttribute("disabled");
+ } else {
+ this.buttonTarget.setAttribute("disabled", true);
+ }
+ }
+}
diff --git a/admin/app/javascript/spree/admin/helpers/address_autocomplete/google_places_suggestions_provider.js b/core/app/javascript/spree/core/helpers/address_autocomplete/google_places_suggestions_provider.js
similarity index 100%
rename from admin/app/javascript/spree/admin/helpers/address_autocomplete/google_places_suggestions_provider.js
rename to core/app/javascript/spree/core/helpers/address_autocomplete/google_places_suggestions_provider.js
diff --git a/admin/app/javascript/spree/admin/helpers/debounce.js b/core/app/javascript/spree/core/helpers/debounce.js
similarity index 100%
rename from admin/app/javascript/spree/admin/helpers/debounce.js
rename to core/app/javascript/spree/core/helpers/debounce.js
diff --git a/admin/app/javascript/spree/admin/helpers/scroll_lock.js b/core/app/javascript/spree/core/helpers/scroll_lock.js
similarity index 100%
rename from admin/app/javascript/spree/admin/helpers/scroll_lock.js
rename to core/app/javascript/spree/core/helpers/scroll_lock.js
diff --git a/core/bin/importmap b/core/bin/importmap
new file mode 100755
index 0000000000..77a3b7e371
--- /dev/null
+++ b/core/bin/importmap
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+
+require 'rails'
+
+require 'importmap-rails'
+require 'importmap/commands'
diff --git a/core/config/importmap.rb b/core/config/importmap.rb
new file mode 100644
index 0000000000..b24d75445b
--- /dev/null
+++ b/core/config/importmap.rb
@@ -0,0 +1,12 @@
+# Shared dependencies between storefront and admin
+pin 'tailwindcss-stimulus-components', preload: ['application-spree-storefront', 'application-spree-admin'] # @3.0.4
+pin 'stimulus-reveal-controller', preload: ['application-spree-storefront', 'application-spree-admin'] # @4.1.0
+
+pin_all_from Spree::Core::Engine.root.join('app/javascript/spree/core/controllers'),
+ under: 'spree/core/controllers',
+ to: 'spree/core/controllers',
+ preload: ['application-spree-storefront', 'application-spree-admin']
+pin_all_from Spree::Core::Engine.root.join('app/javascript/spree/core/helpers'),
+ under: 'spree/core/helpers',
+ to: 'spree/core/helpers',
+ preload: ['application-spree-storefront', 'application-spree-admin']
diff --git a/core/lib/spree/core/engine.rb b/core/lib/spree/core/engine.rb
index b16d91293d..54b58f71a8 100644
--- a/core/lib/spree/core/engine.rb
+++ b/core/lib/spree/core/engine.rb
@@ -251,6 +251,22 @@ module Spree
Migrations.new(config, engine_name).check
end
+ initializer 'spree.core.assets' do |app|
+ if app.config.respond_to?(:assets)
+ app.config.assets.paths << root.join('app/javascript')
+ app.config.assets.paths << root.join('vendor/javascript')
+ app.config.assets.precompile += %w[spree_core_manifest]
+ end
+ end
+
+ initializer 'spree.core.importmap', before: 'importmap' do |app|
+ if app.config.respond_to?(:importmap)
+ app.config.importmap.paths << root.join('config/importmap.rb')
+ # https://github.com/rails/importmap-rails?tab=readme-ov-file#sweeping-the-cache-in-development-and-test
+ app.config.importmap.cache_sweepers << root.join('app/javascript')
+ end
+ end
+
config.to_prepare do
# Ensure spree locale paths are present before decorators
I18n.load_path.unshift(*(Dir.glob(
diff --git a/core/vendor/javascript/stimulus-reveal-controller.js b/core/vendor/javascript/stimulus-reveal-controller.js
new file mode 100644
index 0000000000..2020209f41
--- /dev/null
+++ b/core/vendor/javascript/stimulus-reveal-controller.js
@@ -0,0 +1,4 @@
+// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/stimulus-reveal-controller.mjs
+
+import{Controller as s}from"@hotwired/stimulus";class t extends s{connect(){this.class=this.hasHiddenClass?this.hiddenClass:"hidden"}toggle(){this.itemTargets.forEach((s=>{s.classList.toggle(this.class)}))}show(){this.itemTargets.forEach((s=>{s.classList.remove(this.class)}))}hide(){this.itemTargets.forEach((s=>{s.classList.add(this.class)}))}}t.targets=["item"];t.classes=["hidden"];export{t as default};
+
diff --git a/core/vendor/javascript/tailwindcss-stimulus-components.js b/core/vendor/javascript/tailwindcss-stimulus-components.js
new file mode 100644
index 0000000000..0fc1119dfd
--- /dev/null
+++ b/core/vendor/javascript/tailwindcss-stimulus-components.js
@@ -0,0 +1,4 @@
+// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/tailwindcss-stimulus-components.modern.js
+
+import{Controller as t}from"@hotwired/stimulus";class s extends t{initialize(){this.hide()}connect(){setTimeout((()=>{this.show()}),this.showDelayValue),this.hasDismissAfterValue&&setTimeout((()=>{this.close()}),this.dismissAfterValue)}close(){this.hide(),setTimeout((()=>{this.element.remove()}),this.removeDelayValue)}show(){this.element.classList.add(...this.showClasses),this.element.classList.remove(...this.hideClasses)}hide(){this.element.classList.add(...this.hideClasses),this.element.classList.remove(...this.showClasses)}}s.values={dismissAfter:Number,showDelay:{type:Number,default:200},removeDelay:{type:Number,default:1100}},s.classes=["show","hide"];class e extends t{connect(){this.timeout=null,this.duration=this.data.get("duration")||1e3}save(){clearTimeout(this.timeout),this.timeout=setTimeout((()=>{this.statusTarget.textContent="Saving...",Rails.fire(this.formTarget,"submit")}),this.duration)}success(){this.setStatus("Saved!")}error(){this.setStatus("Unable to save!")}setStatus(t){this.statusTarget.textContent=t,this.timeout=setTimeout((()=>{this.statusTarget.textContent=""}),2e3)}}e.targets=["form","status"];class i extends t{constructor(...t){super(...t),this._onMenuButtonKeydown=t=>{switch(t.keyCode){case 13:case 32:t.preventDefault(),this.toggle()}}}connect(){this.toggleClass=this.data.get("class")||"hidden",this.visibleClass=this.data.get("visibleClass")||null,this.invisibleClass=this.data.get("invisibleClass")||null,this.activeClass=this.data.get("activeClass")||null,this.enteringClass=this.data.get("enteringClass")||null,this.leavingClass=this.data.get("leavingClass")||null,this.hasButtonTarget&&this.buttonTarget.addEventListener("keydown",this._onMenuButtonKeydown),this.element.setAttribute("aria-haspopup","true")}disconnect(){this.hasButtonTarget&&this.buttonTarget.removeEventListener("keydown",this._onMenuButtonKeydown)}toggle(){this.openValue=!this.openValue}openValueChanged(){this.openValue?this._show():this._hide()}_show(t){setTimeout((()=>{this.menuTarget.classList.remove(this.toggleClass),this.element.setAttribute("aria-expanded","true"),this._enteringClassList[0].forEach((t=>{this.menuTarget.classList.add(t)}).bind(this)),this._activeClassList[0].forEach((t=>{this.activeTarget.classList.add(t)})),this._invisibleClassList[0].forEach((t=>this.menuTarget.classList.remove(t))),this._visibleClassList[0].forEach((t=>{this.menuTarget.classList.add(t)})),setTimeout((()=>{this._enteringClassList[0].forEach((t=>this.menuTarget.classList.remove(t)))}).bind(this),this.enterTimeout[0]),"function"==typeof t&&t()}).bind(this))}_hide(t){setTimeout((()=>{this.element.setAttribute("aria-expanded","false"),this._invisibleClassList[0].forEach((t=>this.menuTarget.classList.add(t))),this._visibleClassList[0].forEach((t=>this.menuTarget.classList.remove(t))),this._activeClassList[0].forEach((t=>this.activeTarget.classList.remove(t))),this._leavingClassList[0].forEach((t=>this.menuTarget.classList.add(t))),setTimeout((()=>{this._leavingClassList[0].forEach((t=>this.menuTarget.classList.remove(t))),"function"==typeof t&&t(),this.menuTarget.classList.add(this.toggleClass)}).bind(this),this.leaveTimeout[0])}).bind(this))}show(){this.openValue=!0}hide(t){!1===this.element.contains(t.target)&&this.openValue&&(this.openValue=!1)}get activeTarget(){return this.data.has("activeTarget")?document.querySelector(this.data.get("activeTarget")):this.element}get _activeClassList(){return this.activeClass?this.activeClass.split(",").map((t=>t.split(" "))):[[],[]]}get _visibleClassList(){return this.visibleClass?this.visibleClass.split(",").map((t=>t.split(" "))):[[],[]]}get _invisibleClassList(){return this.invisibleClass?this.invisibleClass.split(",").map((t=>t.split(" "))):[[],[]]}get _enteringClassList(){return this.enteringClass?this.enteringClass.split(",").map((t=>t.split(" "))):[[],[]]}get _leavingClassList(){return this.leavingClass?this.leavingClass.split(",").map((t=>t.split(" "))):[[],[]]}get enterTimeout(){return(this.data.get("enterTimeout")||"0,0").split(",").map((t=>parseInt(t)))}get leaveTimeout(){return(this.data.get("leaveTimeout")||"0,0").split(",").map((t=>parseInt(t)))}}i.targets=["menu","button"],i.values={open:Boolean};class a extends t{connect(){this.toggleClass=this.data.get("class")||"hidden",this.backgroundId=this.data.get("backgroundId")||"modal-background",this.backgroundHtml=this.data.get("backgroundHtml")||this._backgroundHTML(),this.allowBackgroundClose="true"===(this.data.get("allowBackgroundClose")||"true"),this.preventDefaultActionOpening="true"===(this.data.get("preventDefaultActionOpening")||"true"),this.preventDefaultActionClosing="true"===(this.data.get("preventDefaultActionClosing")||"true")}disconnect(){this.close()}open(t){this.preventDefaultActionOpening&&t.preventDefault(),t.target.blur&&t.target.blur(),this.lockScroll(),this.containerTarget.classList.remove(this.toggleClass),this.data.get("disable-backdrop")||(document.body.insertAdjacentHTML("beforeend",this.backgroundHtml),this.background=document.querySelector(`#${this.backgroundId}`))}close(t){t&&this.preventDefaultActionClosing&&t.preventDefault(),this.unlockScroll(),this.containerTarget.classList.add(this.toggleClass),this.background&&this.background.remove()}closeBackground(t){this.allowBackgroundClose&&t.target===this.containerTarget&&this.close(t)}closeWithKeyboard(t){27!==t.keyCode||this.containerTarget.classList.contains(this.toggleClass)||this.close(t)}_backgroundHTML(){return`<div id="${this.backgroundId}" class="fixed top-0 left-0 w-full h-full" style="background-color: ${this.backdropColorValue}; z-index: 9998;"></div>`}lockScroll(){const t=window.innerWidth-document.documentElement.clientWidth;document.body.style.paddingRight=`${t}px`,this.saveScrollPosition(),document.body.classList.add("fixed","inset-x-0","overflow-hidden"),document.body.style.top=`-${this.scrollPosition}px`}unlockScroll(){document.body.style.paddingRight=null,document.body.classList.remove("fixed","inset-x-0","overflow-hidden"),this.restoreScrollValue&&this.restoreScrollPosition(),document.body.style.top=null}saveScrollPosition(){this.scrollPosition=window.pageYOffset||document.body.scrollTop}restoreScrollPosition(){void 0!==this.scrollPosition&&(document.documentElement.scrollTop=this.scrollPosition)}}a.targets=["container"],a.values={backdropColor:{type:String,default:"rgba(0, 0, 0, 0.8)"},restoreScroll:{type:Boolean,default:!0}};class l extends t{connect(){this.activeTabClasses=(this.data.get("activeTab")||"active").split(" "),this.inactiveTabClasses=(this.data.get("inactiveTab")||"inactive").split(" "),this.anchor&&(this.index=this.tabTargets.findIndex((t=>t.id===this.anchor))),this.showTab()}change(t){t.preventDefault(),this.index=t.currentTarget.dataset.index?t.currentTarget.dataset.index:t.currentTarget.dataset.id?this.tabTargets.findIndex((d=>d.id==t.currentTarget.dataset.id)):this.tabTargets.indexOf(t.currentTarget),window.dispatchEvent(new CustomEvent("tsc:tab-change"))}showTab(){this.tabTargets.forEach(((t,d)=>{const c=this.panelTargets[d];d===this.index?(c.classList.remove("hidden"),t.classList.remove(...this.inactiveTabClasses),t.classList.add(...this.activeTabClasses),t.id&&(location.hash=t.id)):(c.classList.add("hidden"),t.classList.remove(...this.activeTabClasses),t.classList.add(...this.inactiveTabClasses))}))}get index(){return parseInt(this.data.get("index")||0)}set index(t){this.data.set("index",t>=0?t:0),this.showTab()}get anchor(){return document.URL.split("#").length>1?document.URL.split("#")[1]:null}}l.targets=["tab","panel"];class o extends t{connect(){this.toggleClass=this.data.get("class")||"hidden"}toggle(t){t.preventDefault(),this.openValue=!this.openValue}hide(t){t.preventDefault(),this.openValue=!1}show(t){t.preventDefault(),this.openValue=!0}openValueChanged(){this.toggleClass&&this.toggleableTargets.forEach((t=>{t.classList.toggle(this.toggleClass)}))}}o.targets=["toggleable"],o.values={open:Boolean};class n extends t{initialize(){this.contentTarget.setAttribute("style",`transform:translate(${this.data.get("translateX")}, ${this.data.get("translateY")});`)}mouseOver(){this.contentTarget.classList.remove("hidden")}mouseOut(){this.contentTarget.classList.add("hidden")}toggle(){this.contentTarget.classList.contains("hidden")?this.contentTarget.classList.remove("hidden"):this.contentTarget.classList.add("hidden")}}n.targets=["content"];class r extends i{_show(){this.overlayTarget.classList.remove(this.toggleClass),super._show((()=>{this._activeClassList[1].forEach((t=>this.overlayTarget.classList.add(t))),this._invisibleClassList[1].forEach((t=>this.overlayTarget.classList.remove(t))),this._visibleClassList[1].forEach((t=>this.overlayTarget.classList.add(t))),setTimeout((()=>{this._enteringClassList[1].forEach((t=>this.overlayTarget.classList.remove(t)))}).bind(this),this.enterTimeout[1])}).bind(this))}_hide(){this._leavingClassList[1].forEach((t=>this.overlayTarget.classList.add(t))),super._hide((()=>{setTimeout((()=>{this._visibleClassList[1].forEach((t=>this.overlayTarget.classList.remove(t))),this._invisibleClassList[1].forEach((t=>this.overlayTarget.classList.add(t))),this._activeClassList[1].forEach((t=>this.overlayTarget.classList.remove(t))),this._leavingClassList[1].forEach((t=>this.overlayTarget.classList.remove(t))),this.overlayTarget.classList.add(this.toggleClass)}).bind(this),this.leaveTimeout[1])}).bind(this))}}r.targets=["menu","overlay"];class h extends t{connect(){this.styleProperty=this.data.get("style")||"backgroundColor"}update(){this.preview=this.color}set preview(t){this.previewTarget.style[this.styleProperty]=t;const d=this._getContrastYIQ(t);"color"===this.styleProperty?this.previewTarget.style.backgroundColor=d:this.previewTarget.style.color=d}get color(){return this.colorTarget.value}_getContrastYIQ(t){return t=t.replace("#",""),(299*parseInt(t.substr(0,2),16)+587*parseInt(t.substr(2,2),16)+114*parseInt(t.substr(4,2),16))/1e3>=128?"#000":"#fff"}}h.targets=["preview","color"];export{s as Alert,e as Autosave,h as ColorPreview,i as Dropdown,a as Modal,n as Popover,r as Slideover,l as Tabs,o as Toggle};
+
diff --git a/storefront/app/assets/config/spree_storefront_manifest.js b/storefront/app/assets/config/spree_storefront_manifest.js
new file mode 100644
index 0000000000..80c45f2477
--- /dev/null
+++ b/storefront/app/assets/config/spree_storefront_manifest.js
@@ -0,0 +1,5 @@
+//= link spree/storefront/application.js
+//= link_tree ../../javascript/spree/storefront/controllers .js
+//= link_tree ../../javascript/spree/storefront/helpers .js
+//= link_tree ../../../vendor/javascript .js
+
diff --git a/storefront/app/javascript/spree/storefront/application.js b/storefront/app/javascript/spree/storefront/application.js
new file mode 100644
index 0000000000..fba4bd0cea
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/application.js
@@ -0,0 +1,171 @@
+import '@hotwired/turbo-rails'
+import { Application } from '@hotwired/stimulus'
+
+let application
+
+if (typeof window.Stimulus === "undefined") {
+ application = Application.start()
+ application.debug = false
+ window.Stimulus = application
+} else {
+ application = window.Stimulus
+}
+
+import AccordionController from 'spree/storefront/controllers/accordion_controller'
+import AccountNavController from 'spree/storefront/controllers/account_nav_controller'
+import AddressAutocompleteController from 'spree/core/controllers/address_autocomplete_controller'
+import AddressFormController from 'spree/core/controllers/address_form_controller'
+import AutoSubmit from '@stimulus-components/auto-submit'
+import CartController from 'spree/storefront/controllers/cart_controller'
+import CheckoutAddressBookController from 'spree/storefront/controllers/address_book_controller'
+import CheckoutDeliveryController from 'spree/storefront/controllers/delivery_controller'
+import CheckoutPromotionsController from 'spree/storefront/controllers/promotions_controller'
+import CheckoutSummaryController from 'spree/storefront/controllers/summary_controller'
+import ClearInputController from 'spree/storefront/controllers/clear_input_controller'
+import CopyInputController from 'spree/storefront/controllers/copy_input_controller'
+import DeliveryDatesController from 'spree/storefront/controllers/delivery_dates_controller'
+import DropdownController from 'spree/storefront/controllers/dropdown_controller'
+import EnableButtonController from 'spree/core/controllers/enable_button_controller'
+import HeaderController from 'spree/storefront/controllers/header_controller'
+import InfiniteScrollController from 'spree/storefront/controllers/infinite_scroll_controller'
+import LightboxController from 'spree/storefront/controllers/lightbox_controller'
+import MobileNavController from 'spree/storefront/controllers/mobile_nav_controller'
+import ModalController from 'spree/storefront/controllers/modal_controller'
+import NoUiSliderController from 'spree/storefront/controllers/no_ui_slider_controller'
+import PDPDesktopGallery from 'spree/storefront/controllers/pdp_desktop_gallery'
+import PlpVariantPickerController from 'spree/storefront/controllers/plp_variant_picker_controller'
+import ProductFormController from 'spree/storefront/controllers/product_form_controller'
+import QuantityPickerController from 'spree/storefront/controllers/quantity_picker_controller'
+import SearchableListController from 'spree/storefront/controllers/searchable_list_controller'
+import SearchSuggestionsController from 'spree/storefront/controllers/search_suggestions_controller'
+import SlideoverController from 'spree/storefront/controllers/slideover_controller'
+import StickyButtonController from 'spree/storefront/controllers/sticky_button_controller'
+import SwiperController from 'spree/storefront/controllers/swiper_controller'
+import ToggleMenuController from 'spree/storefront/controllers/toggle_menu_controller'
+import TurboStreamFormController from 'spree/storefront/controllers/turbo_stream_form_controller'
+import WishedItemController from 'spree/storefront/controllers/wished_item_controller'
+
+application.register('accordion', AccordionController)
+application.register('account-nav', AccountNavController)
+application.register('address-autocomplete', AddressAutocompleteController)
+application.register('address-form', AddressFormController)
+application.register('auto-submit', AutoSubmit)
+application.register('cart', CartController)
+application.register('checkout-address-book', CheckoutAddressBookController)
+application.register('checkout-delivery', CheckoutDeliveryController)
+application.register('checkout-promotions', CheckoutPromotionsController)
+application.register('clear-input', ClearInputController)
+application.register('copy-input', CopyInputController)
+application.register('delivery-dates', DeliveryDatesController)
+application.register('dropdown', DropdownController)
+application.register('enable-button', EnableButtonController)
+application.register('header', HeaderController)
+application.register('infinite-scroll', InfiniteScrollController)
+application.register('lightbox', LightboxController)
+application.register('mobile-nav', MobileNavController)
+application.register('modal', ModalController)
+application.register('no-ui-slider', NoUiSliderController)
+application.register('pdp-desktop-gallery', PDPDesktopGallery)
+application.register('plp-variant-picker', PlpVariantPickerController)
+application.register('product-form', ProductFormController)
+application.register('quantity-picker', QuantityPickerController)
+application.register('search-suggestions', SearchSuggestionsController)
+application.register('searchable-list', SearchableListController)
+application.register('slideover', SlideoverController)
+application.register('slideover-account', SlideoverController)
+application.register('sticky-button', StickyButtonController)
+application.register('checkout-summary', CheckoutSummaryController)
+application.register('carousel', SwiperController)
+application.register('toggle-menu', ToggleMenuController)
+application.register('turbo-stream-form', TurboStreamFormController)
+application.register('wished-item', WishedItemController)
+
+// Import and register all TailwindCSS Components
+import { Alert, Toggle } from 'tailwindcss-stimulus-components'
+application.register('alert', Alert)
+application.register('toggle', Toggle)
+
+import Reveal from 'stimulus-reveal-controller'
+application.register('reveal', Reveal)
+
+import ScrollTo from 'stimulus-scroll-to'
+application.register('scroll-to', ScrollTo)
+
+import ReadMore from 'stimulus-read-more'
+application.register('read-more', ReadMore)
+
+
+const scrollToOverlay = (overlay) => {
+ const { top, left } = overlay.getBoundingClientRect()
+
+ window.scroll({
+ behavior: 'smooth',
+ top: window.scrollY + top - window.innerHeight / 2 + overlay.offsetHeight / 2,
+ left: left + window.scrollX
+ })
+}
+
+// page builder UI
+const toggleHighlightEditorOverlay = (query) => {
+ const overlay = document.querySelector(query)
+
+ if (overlay) {
+ if (overlay.classList.contains('editor-overlay-hover')) {
+ overlay.classList.remove('editor-overlay-hover')
+ } else {
+ overlay.classList.add('editor-overlay-hover')
+
+ scrollToOverlay(overlay)
+ }
+ }
+}
+
+
+const makeOverlayActive = (id) => {
+ const overlay = document.querySelector(`.editor-overlay[data-editor-id="${id}"]`)
+
+ document.querySelectorAll('.editor-overlay-active').forEach((el) => {
+ el.classList.remove('editor-overlay-active')
+ })
+
+ if (overlay) {
+ overlay.classList.add('editor-overlay-active')
+ scrollToOverlay(overlay)
+ }
+}
+
+const toggleHighlightElement = (id) => {
+ toggleHighlightEditorOverlay(`.editor-overlay[data-editor-id="${id}"]`)
+}
+
+window.scrollToOverlay = scrollToOverlay
+window.toggleHighlightElement = toggleHighlightElement
+window.makeOverlayActive = makeOverlayActive
+
+document.addEventListener('turbo:submit-start', () => {
+ Turbo.navigator.delegate.adapter.progressBar.setValue(0)
+ Turbo.navigator.delegate.adapter.progressBar.show()
+})
+
+document.addEventListener('turbo:submit-end', () => {
+ Turbo.navigator.delegate.adapter.progressBar.setValue(100)
+ Turbo.navigator.delegate.adapter.progressBar.hide()
+})
+
+function replaceCsrfMetaTags() {
+ const csrfMetaTagsTemplate = document.querySelector('template#csrf_meta_tags')
+ if (!csrfMetaTagsTemplate) return
+
+ const csrfMetaTags = csrfMetaTagsTemplate.content.cloneNode(true)
+
+ document.head.querySelectorAll('meta[name="csrf-token"]').forEach((tag) => tag.remove())
+ document.head.querySelectorAll('meta[name="csrf-param"]').forEach((tag) => tag.remove())
+
+ document.head.appendChild(csrfMetaTags)
+}
+
+if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', replaceCsrfMetaTags)
+} else {
+ replaceCsrfMetaTags()
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/accordion_controller.js b/storefront/app/javascript/spree/storefront/controllers/accordion_controller.js
new file mode 100644
index 0000000000..05b739d9b3
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/accordion_controller.js
@@ -0,0 +1,25 @@
+import AccordionController from '@kanety/stimulus-accordion'
+
+export default class extends AccordionController {
+ static values = {
+ storeKey: String,
+ closeOthers: Boolean
+ }
+
+ toggle(e) {
+ const closeOthers = this.hasCloseOthersValue ? this.closeOthersValue : true
+ this.togglers.forEach((toggler) => {
+ if (toggler.contains(e.target)) {
+ if (this.isOpened(toggler)) {
+ this.close(toggler)
+ } else {
+ this.open(toggler)
+ }
+ } else if (this.isOpened(toggler) && closeOthers) {
+ this.close(toggler)
+ }
+ })
+
+ e.preventDefault()
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/account_nav_controller.js b/storefront/app/javascript/spree/storefront/controllers/account_nav_controller.js
new file mode 100644
index 0000000000..9f50d565dd
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/account_nav_controller.js
@@ -0,0 +1,10 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ connect() {
+ this.element.querySelector('[data-active=true]').scrollIntoView({
+ block: 'nearest',
+ inline: 'center'
+ })
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/address_book_controller.js b/storefront/app/javascript/spree/storefront/controllers/address_book_controller.js
new file mode 100644
index 0000000000..640fb22acc
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/address_book_controller.js
@@ -0,0 +1,28 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ["list", "newAddressForm", "addressId", "submit"]
+
+ select(event) {
+ const radio = event.target
+ if (radio.value == 0) {
+ this.newAddressFormTarget.classList.remove('hidden')
+ this.addressIdTarget.value = null
+ this.submitTarget.setAttribute('disabled', true)
+ } else {
+ this.newAddressFormTarget.classList.add('hidden')
+ this.addressIdTarget.value = radio.value
+ this.submitTarget.removeAttribute('disabled')
+ }
+
+ Array.from(document.getElementsByClassName('address-book-actions')).forEach(
+ (item) => item.classList.add('hidden')
+ )
+ const actions = Array.from(
+ radio.parentElement.getElementsByClassName('address-book-actions')
+ )
+ if (actions.length > 0) {
+ actions[0].classList.remove('hidden')
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/cart_controller.js b/storefront/app/javascript/spree/storefront/controllers/cart_controller.js
new file mode 100644
index 0000000000..8766543693
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/cart_controller.js
@@ -0,0 +1,10 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['container', 'spinner']
+
+ disableCart() {
+ this.containerTarget.classList.add('pointer-events-none', 'opacity-50')
+ this.spinnerTarget.classList.remove('hidden')
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/clear_input_controller.js b/storefront/app/javascript/spree/storefront/controllers/clear_input_controller.js
new file mode 100644
index 0000000000..43d821be32
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/clear_input_controller.js
@@ -0,0 +1,23 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['input', 'button']
+
+ connect() {
+ this.inputTarget.addEventListener('input', this.toggleButton)
+ }
+
+ clear() {
+ this.inputTarget.value = ''
+ this.inputTarget.focus()
+ this.toggleButton()
+ }
+
+ toggleButton = () => {
+ if (this.inputTarget.value.trim().length) {
+ this.buttonTarget.classList.remove('hidden')
+ } else {
+ this.buttonTarget.classList.add('hidden')
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/copy_input_controller.js b/storefront/app/javascript/spree/storefront/controllers/copy_input_controller.js
new file mode 100644
index 0000000000..635d1fedb0
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/copy_input_controller.js
@@ -0,0 +1,19 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['input', 'copyButton']
+
+ connect() {
+ this.copyButtonTarget.addEventListener('click', this.copyText.bind(this))
+ }
+
+ disconnect() {
+ this.copyButtonTarget.removeEventListener('click', this.copyText.bind(this))
+ }
+
+ async copyText() {
+ this.inputTarget.select()
+ this.inputTarget.setSelectionRange(0, 99999)
+ await navigator.clipboard.writeText(this.inputTarget.value)
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/delivery_controller.js b/storefront/app/javascript/spree/storefront/controllers/delivery_controller.js
new file mode 100644
index 0000000000..ed9971bdd6
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/delivery_controller.js
@@ -0,0 +1,39 @@
+import { Controller } from "@hotwired/stimulus"
+
+export default class extends Controller {
+ static targets = ['shippingList', 'shippingRate', 'submit']
+
+ connect() {
+ document.addEventListener('turbo:submit-end', _event => {
+ this.enableShippingRates();
+ this.submitTarget.disabled = false
+ });
+ }
+
+ update() {
+ this.disableShippingRates();
+ this.submitTarget.disabled = true
+
+ // https://discuss.hotwired.dev/t/form-submit-with-turbo-streams-response-without-redirect/3290
+ const oldAction = this.element.getAttribute("action")
+ this.element.action = this.element.action + '?do_not_advance=true'
+ Turbo.navigator.submitForm(this.element)
+ this.element.action = oldAction
+ }
+
+ enableShippingRates() {
+ this.shippingListTarget.classList.remove('opacity-50');
+ this.shippingListTarget.classList.remove('cursor-wait');
+ this.shippingRateTargets.forEach((shippingRate) => {
+ shippingRate.style.pointerEvents = 'auto';
+ });
+ }
+
+ disableShippingRates() {
+ this.shippingListTarget.classList.add('opacity-50');
+ this.shippingListTarget.classList.add('cursor-wait');
+ this.shippingRateTargets.forEach((shippingRate) => {
+ shippingRate.style.pointerEvents = 'none';
+ });
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/delivery_dates_controller.js b/storefront/app/javascript/spree/storefront/controllers/delivery_dates_controller.js
new file mode 100644
index 0000000000..586ac7f83d
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/delivery_dates_controller.js
@@ -0,0 +1,62 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static values = { start: Number, end: Number }
+
+ connect() {
+ this.element.innerHTML = this.totalDaysWithWeekends(this.startValue, this.endValue);
+ }
+
+ totalDaysWithWeekends(startAt, endAt) {
+ const startDate = new Date();
+ const endDate = endAt ? new Date() : null;
+
+ this.calculateDate(startDate, startAt);
+
+ if (endDate)
+ this.calculateDate(endDate, endAt);
+
+ const startDateFormat = this.formatDate(startDate)
+
+ if (endDate && startDate.getTime() !== endDate.getTime()) {
+ const endDateFormat = this.formatDate(endDate)
+ return `${startDateFormat} - ${endDateFormat}`;
+ } else {
+ return startDateFormat
+ }
+ }
+
+ calculateDate(date, daysToAdd) {
+ let addedDays = 0;
+ while (addedDays < daysToAdd) {
+ date.setDate(date.getDate() + 1);
+
+ if (date.getDay() !== 0 && date.getDay() !== 6) {
+ addedDays++;
+ }
+ }
+ }
+
+ formatDate(date) {
+ const day = date.getDate()
+ const dayOrdinal = this.getDayOrdinal(day)
+ const month = date.toLocaleString('default', { month: 'long' })
+
+ return `${day}${dayOrdinal} ${month}`;
+ }
+
+ getDayOrdinal(day) {
+ if (day > 3 && day < 21) return 'th';
+
+ switch (day % 10) {
+ case 1:
+ return 'st';
+ case 2:
+ return 'nd';
+ case 3:
+ return 'rd';
+ default:
+ return 'th';
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/dropdown_controller.js b/storefront/app/javascript/spree/storefront/controllers/dropdown_controller.js
new file mode 100644
index 0000000000..4fe4a05e4b
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/dropdown_controller.js
@@ -0,0 +1,14 @@
+import { Dropdown } from 'tailwindcss-stimulus-components'
+
+export default class extends Dropdown {
+ hide(event) {
+ let containsTarget = this.element.contains(event.target)
+ if (this.element.getRootNode() instanceof ShadowRoot) {
+ const trueTarget = event.composedPath()[0]
+ containsTarget = this.element.contains(trueTarget)
+ }
+ if (event.target.nodeType && containsTarget === false && this.openValue) {
+ this.openValue = false
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/header_controller.js b/storefront/app/javascript/spree/storefront/controllers/header_controller.js
new file mode 100644
index 0000000000..403faad840
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/header_controller.js
@@ -0,0 +1,33 @@
+import { Controller } from '@hotwired/stimulus'
+import Headroom from 'headroom.js'
+
+export default class extends Controller {
+ static targets = ['header']
+
+ connect() {
+ this.headroom = new Headroom(this.element, {
+ offset: 200,
+ onNotTop: () => {
+ if (this.element.classList.contains('header-logo-centered'))
+ this.element
+ .querySelector('body:not(.inside-page-builder) .header-nav-container #header-logo')
+ ?.classList?.add('lg:sr-only')
+ },
+ onTop: () => {
+ if (this.element.classList.contains('header-logo-centered'))
+ this.element
+ .querySelector('body:not(.inside-page-builder) .header-nav-container #header-logo')
+ ?.classList?.remove('lg:sr-only')
+ }
+ })
+ this.headroom.init()
+ }
+
+ freeze() {
+ this.headroom.freeze()
+ }
+
+ unfreeze() {
+ this.headroom.unfreeze()
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/infinite_scroll_controller.js b/storefront/app/javascript/spree/storefront/controllers/infinite_scroll_controller.js
new file mode 100644
index 0000000000..ca07a6277d
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/infinite_scroll_controller.js
@@ -0,0 +1,31 @@
+import { Controller } from '@hotwired/stimulus'
+import { get } from '@rails/request.js'
+
+export default class extends Controller {
+ static values = { offset: String }
+ initialize() {
+ this.intersectionObserver = new IntersectionObserver(this.checkIntersection, { rootMargin: this.offsetValue })
+ }
+
+ connect() {
+ this.intersectionObserver.observe(this.element)
+ }
+
+ disconnect() {
+ this.intersectionObserver.unobserve(this.element)
+ }
+
+ checkIntersection = async (entries) => {
+ for (const entry of entries) {
+ if (entry.isIntersecting) {
+ await this.loadMore()
+ break
+ }
+ }
+ }
+
+ async loadMore() {
+ this.element.disabled = true
+ await get(this.element.src, { responseKind: 'turbo-stream' })
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/lightbox_controller.js b/storefront/app/javascript/spree/storefront/controllers/lightbox_controller.js
new file mode 100644
index 0000000000..ae269852da
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/lightbox_controller.js
@@ -0,0 +1,123 @@
+import { Controller } from '@hotwired/stimulus'
+import PhotoSwipeLightbox from 'photoswipe/lightbox'
+
+const closeSVG = `
+<svg class="pswp__icn" width="24" height="24" viewBox="0 0 24 24" fill="none">
+ <path d="M3.00029 3L21 20.9688M3 21L20.9997 3.03115" stroke="black" stroke-width="1.5"/>
+</svg>`
+const arrowPrevSVG = `
+<svg class="pswp__icn" width="24" height="24" viewBox="0 0 32 32" fill="none">
+ <path d="M2 16H30M2 16L16 2M2 16L16 30" stroke="black" stroke-width="1.5"/>
+</svg>`
+const arrowNextSVG = `
+<svg class="pswp__icn" width="24" height="24" viewBox="0 0 32 32" fill="none">
+ <path d="M30 16H2M30 16L16 2M30 16L16 30" stroke="black" stroke-width="1.5"/>
+</svg>`
+
+function isTouchDevice() {
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0
+}
+export default class extends Controller {
+ connect() {
+ const lightbox = new PhotoSwipeLightbox({
+ gallery: this.element,
+ children: 'a',
+ bgOpacity: 1.0,
+ initialZoomLevel: 'fit',
+ secondaryZoomLevel: 1,
+ pswpModule: () => import('photoswipe'),
+ closeSVG,
+ arrowPrevSVG,
+ arrowNextSVG,
+ arrowPrev: true,
+ arrowNext: true,
+ preload: [1, 4] // https://photoswipe.com/options/#preload
+ })
+
+ lightbox.on('firstUpdate', () => {
+ if (isTouchDevice() && this.pinchToZoomEl) {
+ this.pinchToZoomEl.style.display = 'flex'
+ }
+ })
+
+ lightbox.on('pointerUp', () => {
+ if (this.pinchToZoomEl) this.pinchToZoomEl.style.display = 'none'
+ })
+
+ lightbox.on('uiRegister', function () {
+ lightbox.pswp.ui.registerElement({
+ name: 'bulletsIndicator',
+ className: 'pswp__bullets-indicator',
+ appendTo: 'wrapper',
+ onInit: (el, pswp) => {
+ const bullets = []
+ let bullet
+ let prevIndex = -1
+ const itemsCount = pswp.getNumItems()
+
+ if (itemsCount <= 1) {
+ return
+ }
+
+ for (let i = 0; i < itemsCount; i++) {
+ bullet = document.createElement('div')
+ bullet.className = 'pswp__bullet'
+ bullet.onclick = (e) => {
+ pswp.goTo(bullets.indexOf(e.target))
+ }
+ el.appendChild(bullet)
+ bullets.push(bullet)
+ }
+
+ pswp.on('change', () => {
+ if (prevIndex >= 0) {
+ bullets[prevIndex].classList.remove('pswp__bullet--active')
+ }
+ bullets[pswp.currIndex].classList.add('pswp__bullet--active')
+ prevIndex = pswp.currIndex
+ })
+ }
+ })
+
+ lightbox.pswp.ui.registerElement({
+ name: 'pagination',
+ className: 'pswp__pagination',
+ appendTo: 'wrapper',
+ onInit: (el, pswp) => {
+ const itemsCount = pswp.getNumItems()
+
+ if (itemsCount <= 1) {
+ return
+ }
+
+ const currentEl = document.createElement('span')
+ currentEl.className = 'pswp__pagination--current'
+ currentEl.innerHTML = String(pswp.currIndex + 1).padStart(2, '0')
+
+ const allEl = document.createElement('span')
+ allEl.className = 'pswp__pagination--all'
+ allEl.innerHTML = String(itemsCount).padStart(2, '0')
+
+ el.appendChild(currentEl)
+ el.appendChild(document.createTextNode('/'))
+ el.appendChild(allEl)
+
+ pswp.on('change', () => {
+ currentEl.innerHTML = String(pswp.currIndex + 1).padStart(2, '0')
+ })
+ }
+ })
+ })
+
+ lightbox.init()
+ }
+
+ get pinchToZoomEl() {
+ let pinchToZoom = document.querySelector('#pinch-to-zoom')
+ if (this.element.getRootNode() instanceof ShadowRoot) {
+ pinchToZoom = this.element.getRootNode().querySelector('#pinch-to-zoom')
+ }
+
+ return pinchToZoom
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/mobile_nav_controller.js b/storefront/app/javascript/spree/storefront/controllers/mobile_nav_controller.js
new file mode 100644
index 0000000000..02bacd3507
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/mobile_nav_controller.js
@@ -0,0 +1,17 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['submenuContainer']
+
+ openSubmenu(e) {
+ const template = e.target.querySelector('template')
+ if (template) {
+ this.submenuContainerTarget.innerHTML = template.innerHTML
+ this.element.style.setProperty('--tw-translate-x', '-100vw')
+ }
+ }
+
+ closeSubmenu() {
+ this.element.style.setProperty('--tw-translate-x', null)
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/modal_controller.js b/storefront/app/javascript/spree/storefront/controllers/modal_controller.js
new file mode 100644
index 0000000000..a0af5d3605
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/modal_controller.js
@@ -0,0 +1,15 @@
+import { Modal } from 'tailwindcss-stimulus-components'
+
+export default class extends Modal {
+ static values = {
+ opened: Boolean
+ }
+
+ connect() {
+ super.connect()
+
+ if (this.openedValue) {
+ super.open({preventDefault: () => {}, target: { blur: () => {}}})
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/no_ui_slider_controller.js b/storefront/app/javascript/spree/storefront/controllers/no_ui_slider_controller.js
new file mode 100644
index 0000000000..265ef6aa9f
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/no_ui_slider_controller.js
@@ -0,0 +1,55 @@
+import noUiSlider from 'nouislider'
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static values = {
+ range: Array,
+ start: Array
+ }
+
+ static targets = ['slider', 'minInput', 'maxInput']
+
+ connect() {
+ if (this.sliderTarget.noUiSlider) {
+ this.sliderTarget.noUiSlider.destroy()
+ }
+
+ const slider = noUiSlider.create(this.sliderTarget, {
+ start: this.startValue,
+ connect: true,
+ step: 1,
+ range: {
+ min: [this.rangeValue[0]],
+ max: [this.rangeValue[1]]
+ }
+ })
+ this.wasSliderChanged = Array(this.startValue.length).fill(false)
+
+ slider.on('update', (values, handle) => {
+ if (!this.wasSliderChanged[handle] && parseFloat(values[handle]) === this.rangeValue[handle]) {
+ this.wasSliderChanged[handle] = true
+ return
+ }
+
+ if (handle) {
+ this.maxInputTarget.value = parseFloat(values[handle]).toFixed(0)
+ } else {
+ this.minInputTarget.value = parseFloat(values[handle]).toFixed(0)
+ }
+ })
+
+ this.minInputTarget.addEventListener('change', (event) => {
+ slider.set([event.currentTarget.value, null])
+ })
+
+ this.maxInputTarget.addEventListener('change', (event) => {
+ slider.set([null, event.currentTarget.value])
+ })
+ }
+
+ disconnect() {
+ if (this.sliderTarget.noUiSlider) {
+ this.sliderTarget.noUiSlider.destroy()
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/pdp_desktop_gallery.js b/storefront/app/javascript/spree/storefront/controllers/pdp_desktop_gallery.js
new file mode 100644
index 0000000000..961ebaf574
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/pdp_desktop_gallery.js
@@ -0,0 +1,28 @@
+import { Controller } from '@hotwired/stimulus'
+import Swiper from 'swiper/bundle'
+
+export default class extends Controller {
+ static targets = ['imagesSlider', 'imagesSliderPagination', 'imagesThumbsSlider', 'prevArrow', 'nextArrow']
+ connect() {
+ const thumbsSwiper = new Swiper(this.imagesThumbsSliderTarget, {
+ spaceBetween: 4,
+ direction: 'vertical',
+ slidesPerView: 'auto',
+ freeMode: { enabled: true, sticky: true },
+ watchSlidesProgress: true,
+ watchOverflow: true
+ })
+ new Swiper(this.imagesSliderTarget, {
+ slidesPerView: 1,
+ pagination: {
+ el: this.hasImagesSliderPaginationTarget ? this.imagesSliderPaginationTarget : undefined
+ },
+ thumbs: { swiper: thumbsSwiper, autoScrollOffset: 2 },
+ watchOverflow: true,
+ navigation: {
+ prevEl: this.prevArrowTarget,
+ nextEl: this.nextArrowTarget
+ }
+ })
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/plp_variant_picker_controller.js b/storefront/app/javascript/spree/storefront/controllers/plp_variant_picker_controller.js
new file mode 100644
index 0000000000..f7268d2b1e
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/plp_variant_picker_controller.js
@@ -0,0 +1,151 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['featuredImageContainer', 'colorsContainer', 'priceContainer', 'link', 'addToWishlist']
+ connect() {
+ this.canPreview = false
+ this.resetSelectedValues()
+ if (this.hasColorsContainerTarget && this.hasFeaturedImageContainerTarget) {
+ this.saveOriginalPreview()
+ this.setFeaturedImageHeight() // Set the height of the featured image container to prevent layout shift
+ this.colorsContainerTarget.addEventListener('mouseleave', this.restoreOriginalPreview)
+ }
+ }
+
+ disconnect() {
+ this.canPreview = false
+ this.resetSelectedValues()
+ if (this.hasColorsContainerTarget && this.hasFeaturedImageContainerTarget) {
+ this.restoreOriginalPreview()
+ this.colorsContainerTarget.removeEventListener('mouseleave', this.restoreOriginalPreview)
+ }
+ }
+
+ resetSelectedValues() {
+ this.selectedVariantFeaturedImageHTML = null
+ this.selectedVariantPriceHTML = null
+ this.selectedAddToWishlistHTML = null
+ }
+
+ showMoreColors(e) {
+ e.preventDefault()
+
+ const colors = [...this.colorsContainerTarget.children]
+ colors.forEach((child) => {
+ child.style.display = 'flex'
+ })
+
+ e.target.style.display = 'none'
+ }
+
+ redirectToVariant(e) {
+ const el = e.target.closest('[data-variant-id]')
+ const url = new URL(this.linkTarget.href)
+ url.searchParams.set('variant_id', el.dataset.variantId)
+ Turbo.visit(url)
+ }
+
+ handlePreview(e) {
+ if (window.matchMedia('(pointer: coarse)').matches) return
+
+ this.preview(e.target)
+ }
+
+ preview(target) {
+ if (!this.canPreview) return
+
+ const featuredImageTemplate = target.querySelector('template[data-featured-image-template]')
+
+ if (featuredImageTemplate) {
+ this.setFeaturedImageHTML(featuredImageTemplate.innerHTML)
+ } else {
+ this.restoreOriginalImage()
+ }
+
+ const priceTemplate = target.querySelector('template[data-price-template]')
+ if (priceTemplate) {
+ this.setPriceHTML(priceTemplate.innerHTML)
+ } else {
+ this.restoreOriginalPrice()
+ }
+
+ const addToWishlistTemplate = target.querySelector('template[data-add-to-wishlist-template]')
+ if (addToWishlistTemplate) {
+ this.setAddToWishlistHTML(addToWishlistTemplate.innerHTML)
+ } else {
+ this.restoreOriginalAddToWishlist()
+ }
+ }
+
+ saveOriginalPreview() {
+ this.originalFeaturedImageHTML = this.featuredImageContainerTarget.innerHTML
+ this.originalPriceHTML = this.priceContainerTarget.innerHTML
+ this.originalAddToWishlistHTML = this.addToWishlistTarget.innerHTML
+ }
+
+ restoreOriginalPreview = () => {
+ if (this.selectedVariantFeaturedImageHTML) {
+ this.setFeaturedImageHTML(this.selectedVariantFeaturedImageHTML)
+ } else {
+ this.restoreOriginalImage()
+ }
+ if (this.selectedVariantPriceHTML) {
+ this.setPriceHTML(this.selectedVariantPriceHTML)
+ } else {
+ this.restoreOriginalPrice()
+ }
+ if (this.selectedAddToWishlistHTML) {
+ this.setAddToWishlistHTML(this.selectedAddToWishlistHTML)
+ } else {
+ this.restoreOriginalAddToWishlist()
+ }
+ }
+
+ restoreOriginalImage() {
+ this.setFeaturedImageHTML(this.originalFeaturedImageHTML)
+ }
+
+ restoreOriginalPrice() {
+ this.setPriceHTML(this.originalPriceHTML)
+ }
+
+ restoreOriginalAddToWishlist() {
+ this.setAddToWishlistHTML(this.originalAddToWishlistHTML)
+ }
+
+ setPriceHTML(html) {
+ if (this.priceContainerTarget.innerHTML !== html) {
+ this.priceContainerTarget.innerHTML = html
+ }
+ }
+
+ setFeaturedImageHTML(html) {
+ if (this.featuredImageContainerTarget.innerHTML !== html) {
+ this.featuredImageContainerTarget.innerHTML = html
+ }
+ }
+
+ setAddToWishlistHTML(html) {
+ if (this.addToWishlistTarget.innerHTML !== html) {
+ this.addToWishlistTarget.innerHTML = html
+ }
+ }
+
+ setFeaturedImageHeight() {
+ const featuredImage = this.featuredImageContainerTarget.querySelector('img')
+ if (featuredImage) {
+ if (featuredImage.complete) {
+ this.featuredImageContainerTarget.style.height = `${this.featuredImageContainerTarget.offsetHeight}px`
+ this.canPreview = true
+ } else {
+ featuredImage.onload = () => {
+ this.featuredImageContainerTarget.style.height = `${this.featuredImageContainerTarget.offsetHeight}px`
+ // Disable preview if the image is not loaded - this prevents layout shift
+ this.canPreview = true
+ }
+ }
+ } else {
+ this.canPreview = true
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/product_form_controller.js b/storefront/app/javascript/spree/storefront/controllers/product_form_controller.js
new file mode 100644
index 0000000000..ae788af0e8
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/product_form_controller.js
@@ -0,0 +1,135 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = [
+ 'submit',
+ 'option',
+ 'form',
+ 'addToWishlist',
+ 'desktopMediaGallery',
+ 'productDetails',
+ 'spinnerTemplate',
+ 'addToWaitlistForm'
+ ]
+ static values = {
+ noCache: Boolean,
+ frameName: String,
+ optionsParamName: String,
+ requiredOptions: Array,
+ selectedVariantDisabled: Boolean,
+ variantFromOptionsDisabled: Boolean,
+ keepOptionsOpen: Boolean,
+ url: String,
+ disabled: Boolean
+ }
+
+ initialize() {
+ this.submitTargetHTML = this.submitTarget.innerHTML
+ }
+
+ connect() {
+ const selectedOptions = new Set()
+ this.optionTargets.forEach((option) => {
+ if (option.checked) {
+ selectedOptions.add(option.dataset.optionId)
+ }
+ })
+ const requiredOptions = new Set(this.requiredOptionsValue)
+
+ this.notSelectedOptions = [...requiredOptions].filter((x) => !selectedOptions.has(x))
+ if (this.notSelectedOptions.length) {
+ this.submitTargets.forEach((button) => button.addEventListener('click', this.showNotSelectedOptions))
+ }
+ if (this.hasAddToWishlistTarget && this.variantFromOptionsDisabledValue && this.notSelectedOptions.length === 0) {
+ this.addToWishlistTarget.disabled = true
+ }
+
+ if (this.hasDesktopMediaGalleryTarget && this.hasProductDetailsTarget) {
+ if (this.desktopMediaGalleryTarget.offsetHeight > 800) {
+ this.productDetailsTarget.classList.add('sticky')
+ const navHeight = document.querySelector('header.sticky')?.offsetHeight || 0
+ this.productDetailsTarget.style.top = `${navHeight}px`
+ }
+ }
+
+ this.formTarget.addEventListener('submit', this.disableSubmitButton)
+ }
+
+ disconnect() {
+ this.submitTargets.forEach((button) => button.removeEventListener('click', this.showNotSelectedOptions))
+ }
+
+ showNotSelectedOptions = (e) => {
+ e.preventDefault()
+
+ this.notSelectedOptions.forEach((option, index) => {
+ const fieldSetElement = this.element.querySelector(`[data-option-id="${option}"]`)
+ if (index === 0) {
+ const toggleElement = fieldSetElement.querySelector('[data-controller="dropdown"]')
+ if (toggleElement) {
+ toggleElement.dataset.dropdownOpenValue = true
+ e.stopImmediatePropagation()
+ }
+ fieldSetElement.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' })
+ }
+ })
+
+ this.keepOptionsOpenValue = true
+ }
+
+ // reload turbo frame when option is selected
+ updateVariant(_event) {
+ this.submitTarget.disabled = true
+
+ const selectedOptions = []
+
+ this.optionTargets.forEach((option) => {
+ if (option.checked) {
+ selectedOptions.push(`${option.dataset.optionId}:${option.value}`)
+ }
+ })
+
+ const url = new URL(this.urlValue.length ? this.urlValue : window.location.href)
+ if (this.optionsParamNameValue?.length) {
+ url.searchParams.append(this.optionsParamNameValue, selectedOptions.join(','))
+ } else {
+ url.searchParams.append('options', selectedOptions.join(','))
+ }
+
+ if (this.noCacheValue) {
+ url.searchParams.append('no_cache', true)
+ }
+
+ if (this.frameNameValue?.length) {
+ Array.from(document.querySelectorAll(`turbo-frame#${this.frameNameValue}`)).forEach((frame) =>
+ frame.setAttribute('src', url)
+ )
+ } else {
+ window.Turbo.visit(url, { frame: 'main-product' })
+ }
+ }
+
+ disabledValueChanged() {
+ if (this.disabledValue) {
+ this.submitTarget.disabled = true
+ this.submitTarget.innerHTML = this.spinnerTemplateTarget.innerHTML
+ } else {
+ this.submitTarget.innerHTML = this.submitTargetHTML
+ this.submitTarget.disabled = false
+ }
+ }
+
+ disableSubmitButton = () => {
+ this.disabledValue = true
+ }
+
+ changeCartToken = (e) => {
+ if (this.tokenInput) {
+ this.tokenInput.value = e.detail.cartToken
+ }
+ }
+
+ enableForm = () => {
+ this.disabledValue = false
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/promotions_controller.js b/storefront/app/javascript/spree/storefront/controllers/promotions_controller.js
new file mode 100644
index 0000000000..078fa93b3a
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/promotions_controller.js
@@ -0,0 +1,28 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['promotionEmailField']
+
+ connect() {
+ this.element.addEventListener(
+ 'submit',
+ this.copyEmailFieldToForm.bind(this)
+ )
+ }
+
+ disconnect() {
+ this.element.removeEventListener(
+ 'submit',
+ this.copyEmailFieldToForm.bind(this)
+ )
+ }
+
+ copyEmailFieldToForm(e) {
+ const userEmailField = document.getElementById(
+ 'order_ship_address_attributes_email'
+ )
+ if (userEmailField) {
+ this.promotionEmailFieldTarget.value = userEmailField.value
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/quantity_picker_controller.js b/storefront/app/javascript/spree/storefront/controllers/quantity_picker_controller.js
new file mode 100644
index 0000000000..ecc1dec94a
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/quantity_picker_controller.js
@@ -0,0 +1,43 @@
+import { Controller } from "@hotwired/stimulus"
+
+export default class extends Controller {
+ static targets = [ 'quantity', 'increase', 'decrease' ]
+
+ connect() {
+ if (this.quantity <= 1) this.disableButton(this.decreaseTarget)
+ }
+
+ get quantity() {
+ return parseInt(this.quantityTarget.value) || 1
+ }
+
+ get maxQuantity() {
+ return parseInt(this.quantityTarget.max) || 9999
+ }
+
+ set quantity(value) {
+ this.quantityTarget.value = parseInt(value) || 1
+ }
+
+ increase() {
+ if (this.quantity < this.maxQuantity) this.quantity = this.quantity + 1
+ if (this.quantity > 1) this.enableButton(this.decreaseTarget)
+ if (this.quantity == this.maxQuantity && this.increaseTarget.type != 'submit') this.disableButton(this.increaseTarget)
+ }
+
+ decrease() {
+ if (this.quantity > 1) this.quantity = this.quantity - 1
+ if (this.quantity == 1 && this.decreaseTarget.type != 'submit') this.disableButton(this.decreaseTarget)
+ if (this.quantity < this.maxQuantity) this.enableButton(this.increaseTarget)
+ }
+
+ disableButton(button) {
+ button.setAttribute('disabled', 'disabled')
+ button.classList.add('opacity-50', 'cursor-not-allowed')
+ }
+
+ enableButton(button) {
+ button.removeAttribute('disabled')
+ button.classList.remove('opacity-50', 'cursor-not-allowed')
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/search_suggestions_controller.js b/storefront/app/javascript/spree/storefront/controllers/search_suggestions_controller.js
new file mode 100644
index 0000000000..ac71fe2986
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/search_suggestions_controller.js
@@ -0,0 +1,61 @@
+import { Controller } from '@hotwired/stimulus'
+import { get } from '@rails/request.js'
+import debounce from 'spree/core/helpers/debounce'
+
+export default class extends Controller {
+ static targets = ['input']
+ static values = {
+ url: String
+ }
+
+ connect() {
+ this.debouncedQuerySuggestions = debounce(this.querySuggestions)
+ this.inputTarget.addEventListener('input', this.debouncedQuerySuggestions)
+ this.openSearchButton = document.querySelector('#open-search')
+ this.openSearchButton.addEventListener('click', this.show)
+
+ this.searchSuggestionsContainer = document.querySelector('#search-suggestions')
+ this.searchSuggestionsContent = this.searchSuggestionsContainer.querySelector('#search-suggestions-content')
+ this.loadingHTML = this.searchSuggestionsContainer.querySelector('template#loading').innerHTML
+ Turbo.StreamActions[`search-suggestions:close`] = this.remoteClose(this)
+ }
+
+ remoteClose = (controller) => {
+ return function () {
+ controller.hide()
+ }
+ }
+ disconnect() {
+ delete Turbo.StreamActions[`search-suggestions:close`]
+ this.hide()
+ this.inputTarget.removeEventListener('input', this.debouncedQuerySuggestions)
+ this.openSearchButton.removeEventListener('click', this.show)
+ }
+ hide = () => {
+ this.searchSuggestionsContainer.style.display = 'none'
+ }
+ clear = () => {
+ this.searchSuggestionsContent.innerHTML = ''
+ this.searchSuggestionsContent.classList.remove(...this.searchSuggestionsContent.dataset.showClass.split(' '))
+ this.searchSuggestionsContent.classList.add('hidden')
+ this.element.classList.remove(...this.element.dataset.showClass.split(' '))
+ }
+ show = () => {
+ this.searchSuggestionsContainer.style.display = 'block'
+ this.inputTarget.focus()
+ const oldInputValue = this.inputTarget.value
+ this.inputTarget.value = ''
+ this.inputTarget.value = oldInputValue
+ }
+ querySuggestions = async () => {
+ if (this.inputTarget.value.length >= 3 && this.inputTarget.value.trim().length) {
+ this.searchSuggestionsContent.innerHTML = this.loadingHTML
+ this.searchSuggestionsContent.classList.remove('hidden')
+ this.searchSuggestionsContent.classList.add(...this.searchSuggestionsContent.dataset.showClass.split(' '))
+ this.element.classList.add(...this.element.dataset.showClass.split(' '))
+ await get(`${this.urlValue}?q=${this.inputTarget.value}`, {
+ responseKind: 'turbo-stream'
+ })
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/searchable_list_controller.js b/storefront/app/javascript/spree/storefront/controllers/searchable_list_controller.js
new file mode 100644
index 0000000000..c577136f6c
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/searchable_list_controller.js
@@ -0,0 +1,25 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['input', 'item']
+
+ connect() {
+ this.inputTarget.addEventListener('input', this.filter)
+ }
+
+ disconnect() {
+ this.inputTarget.removeEventListener('input', this.filter)
+ }
+
+ filter = () => {
+ const query = this.inputTarget.value.toLowerCase()
+ this.itemTargets.forEach((el) => {
+ const text = el.dataset.text.toLowerCase()
+ if (text.includes(query)) {
+ el.classList.remove('hidden')
+ } else {
+ el.classList.add('hidden')
+ }
+ })
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/slideover_controller.js b/storefront/app/javascript/spree/storefront/controllers/slideover_controller.js
new file mode 100644
index 0000000000..e7dec522bd
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/slideover_controller.js
@@ -0,0 +1,40 @@
+import { Slideover } from 'tailwindcss-stimulus-components'
+import { lockScroll, unlockScroll } from 'spree/core/helpers/scroll_lock'
+export default class extends Slideover {
+ connect() {
+ Turbo.StreamActions[`${this.identifier}:open`] = this.remoteOpen(this)
+ super.connect()
+ }
+
+ disconnect() {
+ super.disconnect()
+ delete Turbo.StreamActions[`${this.identifier}:open`]
+ }
+
+ remoteOpen(controller) {
+ return function () {
+ if (this.target === controller.overlayTarget.id) {
+ controller.openValue = true
+ }
+ }
+ }
+
+ _show() {
+ const headerController = this.application.getControllerForElementAndIdentifier(this.element, 'header')
+ headerController?.freeze() // If there is a header controller, freeze it, so it doesn't move when the slideover opens
+
+ super._show()
+
+ // Don't scroll the background when slideover is open
+ lockScroll()
+ }
+
+ _hide() {
+ const headerController = this.application.getControllerForElementAndIdentifier(this.element, 'header')
+ headerController?.unfreeze()
+
+ super._hide()
+ // Restore the background scroll
+ unlockScroll()
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/sticky_button_controller.js b/storefront/app/javascript/spree/storefront/controllers/sticky_button_controller.js
new file mode 100644
index 0000000000..d6dd8a8796
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/sticky_button_controller.js
@@ -0,0 +1,32 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = ['stickyButton', 'fixedButton']
+
+ connect() {
+ if (!this.hasFixedButtonTarget) return
+
+ this.handleScroll()
+
+ const header = document.querySelector('header.sticky')
+
+ this.navHeight = header ? header.offsetHeight : 0
+ window.addEventListener('scroll', this.handleScroll, true)
+ }
+
+ disconnect() {
+ window.removeEventListener('scroll', this.handleScroll)
+ }
+
+ handleScroll = () => {
+ const button = this.stickyButtonTarget
+ const top = button.getBoundingClientRect().top
+ const fixedButton = this.fixedButtonTarget
+
+ if (top < this.navHeight || top > window.innerHeight) {
+ fixedButton.classList.remove('hidden')
+ } else {
+ fixedButton.classList.add('hidden')
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/summary_controller.js b/storefront/app/javascript/spree/storefront/controllers/summary_controller.js
new file mode 100644
index 0000000000..eb0677ecf6
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/summary_controller.js
@@ -0,0 +1,46 @@
+import { Controller } from '@hotwired/stimulus'
+
+export default class extends Controller {
+ static targets = [
+ 'container',
+ 'content',
+ 'wrapper',
+ 'line_items',
+ 'coupon_area'
+ ]
+
+ onCouponResize() {
+ this.line_itemsTarget.style.maxHeight = `${window.innerHeight - this.coupon_areaTarget.offsetHeight - 20}px`
+ }
+
+ connect() {
+ var wrapper = this.wrapperTarget
+ var summary = this.containerTarget
+ var content = this.contentTarget
+ var couponArea = this.coupon_areaTarget
+
+ summary.style.height = content.offsetHeight + 'px'
+ wrapper.classList.toggle('summary-folded', true)
+
+ this.observer = new ResizeObserver(function () {
+ summary.style.height = content.offsetHeight + 'px'
+ })
+
+ this.couponObserver = new ResizeObserver(this.onCouponResize.bind(this))
+
+ window.addEventListener('resize', this.onCouponResize.bind(this))
+
+ this.observer.observe(content)
+ this.couponObserver.observe(couponArea)
+ }
+
+ disconnect() {
+ if (this.observer) {
+ this.observer.disconnect()
+ }
+ if (this.couponObserver) {
+ this.couponObserver.disconnect()
+ }
+ window.removeEventListener('resize', this.onCouponResize.bind(this))
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/swiper_controller.js b/storefront/app/javascript/spree/storefront/controllers/swiper_controller.js
new file mode 100644
index 0000000000..aa8956a6f6
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/swiper_controller.js
@@ -0,0 +1,44 @@
+import Carousel from '@stimulus-components/carousel'
+
+export default class extends Carousel {
+ static targets = ['pagination']
+
+ get defaultOptions() {
+ const setStyle = (el, display) => {
+ if (Array.isArray(el)) {
+ el.forEach((cEl) => (cEl.style.display = display))
+ } else {
+ el.style.display = display
+ }
+ }
+
+ return Object.assign(super.defaultOptions, {
+ pagination: {
+ el: this.hasPaginationTarget ? this.paginationTarget : undefined
+ },
+ on: {
+ // Hide the arrow buttons if there are not needed
+ init: function () {
+ if (this.navigation.prevEl && this.navigation.nextEl) {
+ if (!this.allowSlidePrev && !this.allowSlideNext) {
+ setStyle(this.navigation.prevEl, 'none')
+ setStyle(this.navigation.nextEl, 'none')
+ }
+ }
+ },
+ resize: function () {
+ if (this.navigation.prevEl && this.navigation.nextEl) {
+ if (!this.allowSlidePrev && !this.allowSlideNext) {
+ setStyle(this.navigation.prevEl, 'none')
+ setStyle(this.navigation.nextEl, 'none')
+ } else {
+ // Let class hide/show the arrows
+ setStyle(this.navigation.prevEl, null)
+ setStyle(this.navigation.nextEl, null)
+ }
+ }
+ }
+ }
+ })
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/toggle_menu_controller.js b/storefront/app/javascript/spree/storefront/controllers/toggle_menu_controller.js
new file mode 100644
index 0000000000..833ab513f7
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/toggle_menu_controller.js
@@ -0,0 +1,32 @@
+import { Toggle } from 'tailwindcss-stimulus-components'
+import { lockScroll, unlockScroll } from 'spree/core/helpers/scroll_lock'
+
+export default class ToggleMenu extends Toggle {
+ static targets = ['toggleable', 'content', 'button']
+ static values = ['open']
+
+ connect() {
+ super.connect()
+ }
+
+ hide(e) {
+ if (this.openValue) {
+ super.hide(e)
+ this.buttonTarget.classList.remove('menu-open')
+ }
+ }
+
+ toggle(e) {
+ this.contentTarget.style.paddingBottom = `${this.contentTarget.offsetTop}px`
+ super.toggle(e)
+ if (this.openValue) {
+ this.buttonTarget.classList.add('menu-open')
+ setTimeout(() => {
+ lockScroll()
+ }, 0)
+ } else {
+ this.buttonTarget.classList.remove('menu-open')
+ unlockScroll()
+ }
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/turbo_stream_form_controller.js b/storefront/app/javascript/spree/storefront/controllers/turbo_stream_form_controller.js
new file mode 100644
index 0000000000..296bd1817c
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/turbo_stream_form_controller.js
@@ -0,0 +1,48 @@
+import { Controller } from '@hotwired/stimulus'
+import { FetchRequest } from '@rails/request.js'
+
+// This controller is needed if you have many forms that are using turbo and can be submitted in rapid succession.
+// Turbo by default will cancel all the previous requests and only submit the last one,
+// but server side you will still receive all the requests and process them.
+// And since the request was cancelled, turbo will not process the response.
+// So this may lead to desync between the UI and the server.
+// GH issue: https://github.com/hotwired/turbo-rails/issues/310
+// Code that causes issue: https://github.com/hotwired/turbo/blob/main/src/core/drive/navigator.js#L32
+export default class extends Controller {
+ connect() {
+ this.element.addEventListener('submit', this.handleSubmit)
+ this.submitElements = this.element.querySelectorAll('[type="submit"]')
+ }
+
+ disconnect() {
+ this.element.removeEventListener('submit', this.handleSubmit)
+ }
+
+ handleSubmit = async (event) => {
+ event.preventDefault()
+
+ const form = event.target
+ const url = form.action
+ const method = form.method
+ const body = new FormData(form)
+ const headers = {}
+
+ const request = new FetchRequest(method, url, {
+ body: body,
+ headers: headers,
+ responseKind: 'turbo-stream'
+ })
+
+ this.submitElements.forEach((element) => {
+ element.disabled = true
+ })
+ form.ariaBusy = true
+
+ await request.perform()
+
+ this.submitElements.forEach((element) => {
+ element.disabled = false
+ })
+ form.ariaBusy = false
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/controllers/wished_item_controller.js b/storefront/app/javascript/spree/storefront/controllers/wished_item_controller.js
new file mode 100644
index 0000000000..fc79cd97aa
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/controllers/wished_item_controller.js
@@ -0,0 +1,69 @@
+// this is a super simple controller to control the state of the add to wishlist icon state
+
+import { Controller } from '@hotwired/stimulus'
+import { post, destroy } from '@rails/request.js'
+export default class extends Controller {
+ static targets = ['add', 'remove']
+ static values = {
+ variantId: String,
+ }
+
+ connect() {
+ const wishedVariantIds = window.wishedVariantIds || [];
+ const variantId = this.variantIdValue;
+
+ if (wishedVariantIds.includes(variantId)) {
+ this.showRemoveButton();
+ } else {
+ this.showAddButton();
+ }
+ }
+
+ add = async (event) => {
+ event.preventDefault()
+
+ const body = new FormData()
+ body.append('wished_item[variant_id]', this.variantIdValue)
+
+ const headers = {}
+
+ const response = await post('/account/wishlist/wished_items', {
+ body: body,
+ headers: headers,
+ responseKind: 'turbo-stream'
+ })
+ if (response.ok) {
+ this.showRemoveButton();
+ } else {
+ console.error('Error adding item to wishlist');
+ window.alert('Error adding item to wishlist');
+ }
+ }
+
+ remove = async (event) => {
+ event.preventDefault()
+
+ const headers = {}
+
+ const response = await destroy(`/account/wishlist/wished_items/${this.variantIdValue}`, {
+ headers: headers,
+ responseKind: 'turbo-stream'
+ })
+ if (response.ok) {
+ this.showAddButton();
+ } else {
+ console.error('Error removing item from wishlist');
+ window.alert('Error removing item from wishlist');
+ }
+ }
+
+ showAddButton() {
+ this.addTarget.classList.remove('hidden');
+ this.removeTarget.classList.add('hidden');
+ }
+
+ showRemoveButton() {
+ this.addTarget.classList.add('hidden');
+ this.removeTarget.classList.remove('hidden');
+ }
+}
diff --git a/storefront/app/javascript/spree/storefront/helpers/show_flash_message.js b/storefront/app/javascript/spree/storefront/helpers/show_flash_message.js
new file mode 100644
index 0000000000..5276e3bc67
--- /dev/null
+++ b/storefront/app/javascript/spree/storefront/helpers/show_flash_message.js
@@ -0,0 +1,25 @@
+const FLASH_CLASSES = {
+ notice: ['alert-notice'],
+ success: ['alert-success'],
+ error: ['alert-error']
+}
+
+export default function showFlashMessage(messageText, type = 'notice') {
+ const flashesContainer = document.querySelector('#flashes')
+ const flashTemplate = document.querySelector('#flashMessage')
+
+ // prevent alerts duplication
+ flashesContainer.querySelectorAll('.flash-message').forEach(el => {
+ if (el.textContent === messageText) {
+ el.closest('[data-controller="alert"]').querySelector('[data-action="alert#close"]').click()
+ }
+ })
+
+ const newFlash = flashTemplate.content.cloneNode(true)
+ newFlash.querySelector('.flash-message').textContent = messageText
+ newFlash
+ .querySelector('[data-controller="alert"]')
+ .classList.add(...FLASH_CLASSES[type])
+
+ flashesContainer.appendChild(newFlash)
+}
diff --git a/storefront/bin/importmap b/storefront/bin/importmap
new file mode 100755
index 0000000000..77a3b7e371
--- /dev/null
+++ b/storefront/bin/importmap
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+
+require 'rails'
+
+require 'importmap-rails'
+require 'importmap/commands'
diff --git a/storefront/config/importmap.rb b/storefront/config/importmap.rb
new file mode 100644
index 0000000000..b82985a45a
--- /dev/null
+++ b/storefront/config/importmap.rb
@@ -0,0 +1,20 @@
+pin 'application-spree-storefront', to: 'spree/storefront/application.js', preload: false
+
+pin 'stimulus-scroll-to', preload: ['application-spree-storefront'] # @4.1.0
+pin 'stimulus-read-more', preload: ['application-spree-storefront'] # @4.1.0
+pin '@kanety/stimulus-accordion', to: '@kanety--stimulus-accordion.js', preload: ['application-spree-storefront'] # @1.1.0
+pin 'headroom.js', preload: ['application-spree-storefront'] # @0.12.0
+pin 'photoswipe/lightbox', to: 'photoswipe--dist--photoswipe-lightbox.esm.js.js', preload: ['application-spree-storefront'] # @5.4.4
+pin 'nouislider', preload: ['application-spree-storefront'] # @15.8.1
+pin 'swiper/bundle', to: 'https://ga.jspm.io/npm:[email protected]/swiper-bundle.mjs', preload: ['application-spree-storefront'] # @11.2.2
+pin '@stimulus-components/carousel', to: '@stimulus-components--carousel.js', preload: ['application-spree-storefront'] # @6.0.0
+pin 'photoswipe', preload: false # @5.4.4
+
+pin_all_from Spree::Storefront::Engine.root.join('app/javascript/spree/storefront/controllers'),
+ under: 'spree/storefront/controllers',
+ to: 'spree/storefront/controllers',
+ preload: ['application-spree-storefront']
+pin_all_from Spree::Storefront::Engine.root.join('app/javascript/spree/storefront/helpers'),
+ under: 'spree/storefront/helpers',
+ to: 'spree/storefront/helpers',
+ preload: ['application-spree-storefront']
diff --git a/storefront/config/imprtmap.rb b/storefront/config/imprtmap.rb
deleted file mode 100644
index f25a79e2af..0000000000
--- a/storefront/config/imprtmap.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-pin "application-spree-storefront", to: "spree/storefront/application.js", preload: true
-pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
-pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
-pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
-pin "@rails/request.js", to: "requestjs.js", preload: true
-
-pin_all_from Spree::Storefront::Engine.root.join("app/javascript/spree/storefront/controllers"), under: "controllers", to: "spree/storefront/controllers"
-pin_all_from Spree::Storefront::Engine.root.join("app/javascript/spree/storefront/helpers"), under: "helpers", to: "spree/storefront/helpers"
diff --git a/storefront/lib/spree/storefront/engine.rb b/storefront/lib/spree/storefront/engine.rb
index 324492c470..82e5c90622 100644
--- a/storefront/lib/spree/storefront/engine.rb
+++ b/storefront/lib/spree/storefront/engine.rb
@@ -9,7 +9,8 @@ module Spree
initializer 'spree.storefront.assets' do |app|
app.config.assets.paths << root.join('app/javascript')
- app.config.assets.precompile += %w[ spree_storefront_manifest ]
+ app.config.assets.paths << root.join('vendor/javascript')
+ app.config.assets.precompile += %w[spree_storefront_manifest]
end
initializer 'spree.storefront.importmap', before: 'importmap' do |app|
diff --git a/storefront/vendor/javascript/@kanety--stimulus-accordion.js b/storefront/vendor/javascript/@kanety--stimulus-accordion.js
new file mode 100644
index 0000000000..ba07813368
--- /dev/null
+++ b/storefront/vendor/javascript/@kanety--stimulus-accordion.js
@@ -0,0 +1,4 @@
+// @kanety/[email protected] downloaded from https://ga.jspm.io/npm:@kanety/[email protected]/dist/index.module.js
+
+import{Controller as t}from"@hotwired/stimulus";class e{constructor(t){this.controller=t}get togglers(){return this.controller.togglers}get openedTogglers(){return this.controller.openedTogglers}get key(){return this.controller.storeKeyValue}load(){if(this.key){var t=this.constructor.load(this.key);if(t){var i=new Set(t);this.togglers.forEach((t=>{var o=this.controller.findContent(t);i.has(this.controller.getID(t))?this.controller.show(t,o):this.controller.hide(t,o)}))}}}save(){if(this.key){var t=this.openedTogglers.map((t=>this.controller.getID(t)));this.constructor.save(this.key,t)}}static load(t){var i=sessionStorage.getItem(t);try{return JSON.parse(i)}catch(t){return console.error(t),null}}static save(t,i){try{sessionStorage.setItem(t,JSON.stringify(i))}catch(t){return console.error(t),null}}}class s extends t{get togglers(){return this.context.bindingObserver.bindings.filter((t=>"toggle"==t.action.methodName)).map((t=>t.action.element))}get openedTogglers(){return this.togglers.filter((t=>this.isOpened(t)))}get contents(){return this.scope.findAllElements("[data-accordion-id]")}connect(){this.init(),this.store=new e(this),this.store.load()}init(){this.togglers.forEach((t=>{var i=this.findContent(t);this.isOpened(t)?this.show(t,i,!1):this.hide(t,i,!1)}))}toggle(t){this.togglers.forEach((i=>{i.contains(t.target)?this.isOpened(i)?this.close(i):this.open(i):this.isOpened(i)&&this.close(i)})),t.preventDefault()}open(t){var i=this.findContent(t);this.show(t,i),this.store.save(),this.dispatch("opened",{detail:{toggler:t,content:i}})}close(t){var i=this.findContent(t);this.hide(t,i),this.store.save(),this.dispatch("closed",{detail:{toggler:t,content:i}})}show(t,i,o){void 0===o&&(o=!0),o&&(i.style.height="0px",i.removeEventListener("transitionend",this.transitionEnd),i.addEventListener("transitionend",this.transitionEnd),setTimeout((()=>{i.style.height=i.scrollHeight+"px"}))),this.toggleClass(t,i,!0),this.toggleText(t,!0)}hide(t,i,o){void 0===o&&(o=!0),o&&(i.style.height=i.scrollHeight+"px",i.removeEventListener("transitionend",this.transitionEnd),i.addEventListener("transitionend",this.transitionEnd),setTimeout((()=>{i.style.height="0px"}))),this.toggleClass(t,i,!1),this.toggleText(t,!1)}transitionEnd(t){t.target.style.height=""}toggleClass(t,i,o){o?(t.classList.add("st-accordion__icon--opened"),i.classList.add("st-accordion__content--visible")):(t.classList.remove("st-accordion__icon--opened"),i.classList.remove("st-accordion__content--visible"))}toggleText(t,i){var o;(o=t.getAttribute(i?"data-accordion-opened-text-param":"data-accordion-closed-text-param"))&&(t.innerHTML=o)}isOpened(t){return t.matches(".st-accordion__icon--opened")}findContent(t){var i=this.getID(t);return this.scope.findElement('[data-accordion-id="'+i+'"]')}getID(t){return t.getAttribute("href").replace(/^#/,"")}}s.values={storeKey:String};export{s as default};
+
diff --git a/storefront/vendor/javascript/@stimulus-components--carousel.js b/storefront/vendor/javascript/@stimulus-components--carousel.js
new file mode 100644
index 0000000000..d84520c199
--- /dev/null
+++ b/storefront/vendor/javascript/@stimulus-components--carousel.js
@@ -0,0 +1,4 @@
+// @stimulus-components/[email protected] downloaded from https://ga.jspm.io/npm:@stimulus-components/[email protected]/dist/stimulus-carousel.mjs
+
+import{Controller as t}from"@hotwired/stimulus";import e from"swiper/bundle";const s=class _Carousel extends t{connect(){this.swiper=new e(this.element,{...this.defaultOptions,...this.optionsValue})}disconnect(){this.swiper.destroy(),this.swiper=void 0}get defaultOptions(){return{}}};s.values={options:Object};let i=s;export{i as default};
+
diff --git a/storefront/vendor/javascript/headroom.js.js b/storefront/vendor/javascript/headroom.js.js
new file mode 100644
index 0000000000..7d4438db76
--- /dev/null
+++ b/storefront/vendor/javascript/headroom.js.js
@@ -0,0 +1,19 @@
+// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/headroom.js
+
+var t="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:global;var e={};(function(t,o){e=o()})(e,(function(){function isBrowser(){return"undefined"!==typeof window}function passiveEventsSupported(){var t=false;try{var e={get passive(){t=true}};window.addEventListener("test",e,e);window.removeEventListener("test",e,e)}catch(e){t=false}return t}function isSupported(){return!!(isBrowser()&&function(){}.bind&&"classList"in document.documentElement&&Object.assign&&Object.keys&&requestAnimationFrame)}function isDocument(t){return 9===t.nodeType}function isWindow(t){return t&&t.document&&isDocument(t.document)}function windowScroller(t){var e=t.document;var o=e.body;var s=e.documentElement;return{scrollHeight:function(){return Math.max(o.scrollHeight,s.scrollHeight,o.offsetHeight,s.offsetHeight,o.clientHeight,s.clientHeight)},height:function(){return t.innerHeight||s.clientHeight||o.clientHeight},scrollY:function(){return void 0!==t.pageYOffset?t.pageYOffset:(s||o.parentNode||o).scrollTop}}}function elementScroller(t){return{scrollHeight:function(){return Math.max(t.scrollHeight,t.offsetHeight,t.clientHeight)},height:function(){return Math.max(t.offsetHeight,t.clientHeight)},scrollY:function(){return t.scrollTop}}}function createScroller(t){return isWindow(t)?windowScroller(t):elementScroller(t)}
+/**
+ * @param element EventTarget
+ */function trackScroll(t,e,o){var s=passiveEventsSupported();var n;var i=false;var r=createScroller(t);var a=r.scrollY();var l={};function update(){var t=Math.round(r.scrollY());var s=r.height();var n=r.scrollHeight();l.scrollY=t;l.lastScrollY=a;l.direction=t>a?"down":"up";l.distance=Math.abs(t-a);l.isOutOfBounds=t<0||t+s>n;l.top=t<=e.offset[l.direction];l.bottom=t+s>=n;l.toleranceExceeded=l.distance>e.tolerance[l.direction];o(l);a=t;i=false}function handleScroll(){if(!i){i=true;n=requestAnimationFrame(update)}}var c=!!s&&{passive:true,capture:false};t.addEventListener("scroll",handleScroll,c);update();return{destroy:function(){cancelAnimationFrame(n);t.removeEventListener("scroll",handleScroll,c)}}}function normalizeUpDown(t){return t===Object(t)?t:{down:t,up:t}}
+/**
+ * UI enhancement for fixed headers.
+ * Hides header when scrolling down
+ * Shows header when scrolling up
+ * @constructor
+ * @param {DOMElement} elem the header element
+ * @param {Object} options options for the widget
+ */function Headroom(e,o){o=o||{};Object.assign(this||t,Headroom.options,o);(this||t).classes=Object.assign({},Headroom.options.classes,o.classes);(this||t).elem=e;(this||t).tolerance=normalizeUpDown((this||t).tolerance);(this||t).offset=normalizeUpDown((this||t).offset);(this||t).initialised=false;(this||t).frozen=false}Headroom.prototype={constructor:Headroom,init:function(){if(Headroom.cutsTheMustard&&!(this||t).initialised){this.addClass("initial");(this||t).initialised=true;setTimeout((function(t){t.scrollTracker=trackScroll(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))}),100,this||t)}return this||t},destroy:function(){(this||t).initialised=false;Object.keys((this||t).classes).forEach((this||t).removeClass,this||t);(this||t).scrollTracker.destroy()},unpin:function(){if(this.hasClass("pinned")||!this.hasClass("unpinned")){this.addClass("unpinned");this.removeClass("pinned");(this||t).onUnpin&&(this||t).onUnpin.call(this||t)}},pin:function(){if(this.hasClass("unpinned")){this.addClass("pinned");this.removeClass("unpinned");(this||t).onPin&&(this||t).onPin.call(this||t)}},freeze:function(){(this||t).frozen=true;this.addClass("frozen")},unfreeze:function(){(this||t).frozen=false;this.removeClass("frozen")},top:function(){if(!this.hasClass("top")){this.addClass("top");this.removeClass("notTop");(this||t).onTop&&(this||t).onTop.call(this||t)}},notTop:function(){if(!this.hasClass("notTop")){this.addClass("notTop");this.removeClass("top");(this||t).onNotTop&&(this||t).onNotTop.call(this||t)}},bottom:function(){if(!this.hasClass("bottom")){this.addClass("bottom");this.removeClass("notBottom");(this||t).onBottom&&(this||t).onBottom.call(this||t)}},notBottom:function(){if(!this.hasClass("notBottom")){this.addClass("notBottom");this.removeClass("bottom");(this||t).onNotBottom&&(this||t).onNotBottom.call(this||t)}},shouldUnpin:function(t){var e="down"===t.direction;return e&&!t.top&&t.toleranceExceeded},shouldPin:function(t){var e="up"===t.direction;return e&&t.toleranceExceeded||t.top},addClass:function(e){(this||t).elem.classList.add.apply((this||t).elem.classList,(this||t).classes[e].split(" "))},removeClass:function(e){(this||t).elem.classList.remove.apply((this||t).elem.classList,(this||t).classes[e].split(" "))},hasClass:function(e){return(this||t).classes[e].split(" ").every((function(e){return(this||t).classList.contains(e)}),(this||t).elem)},update:function(e){if(!e.isOutOfBounds&&true!==(this||t).frozen){e.top?this.top():this.notTop();e.bottom?this.bottom():this.notBottom();this.shouldUnpin(e)?this.unpin():this.shouldPin(e)&&this.pin()}}};
+/**
+ * Default options
+ * @type {Object}
+ */Headroom.options={tolerance:{up:0,down:0},offset:0,scroller:isBrowser()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}};Headroom.cutsTheMustard=isSupported();return Headroom}));var o=e;export default o;
+
diff --git a/storefront/vendor/javascript/nouislider.js b/storefront/vendor/javascript/nouislider.js
new file mode 100644
index 0000000000..ae59e494b8
--- /dev/null
+++ b/storefront/vendor/javascript/nouislider.js
@@ -0,0 +1,4 @@
+// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/nouislider.mjs
+
+var e;(function(e){e.Range="range";e.Steps="steps";e.Positions="positions";e.Count="count";e.Values="values"})(e||(e={}));var t;(function(e){e[e.None=-1]="None";e[e.NoValue=0]="NoValue";e[e.LargeValue=1]="LargeValue";e[e.SmallValue=2]="SmallValue"})(t||(t={}));function isValidFormatter(e){return isValidPartialFormatter(e)&&typeof e.from==="function"}function isValidPartialFormatter(e){return typeof e==="object"&&typeof e.to==="function"}function removeElement(e){e.parentElement.removeChild(e)}function isSet(e){return e!==null&&e!==void 0}function preventDefault(e){e.preventDefault()}function unique(e){return e.filter((function(e){return!this[e]&&(this[e]=true)}),{})}function closest(e,t){return Math.round(e/t)*t}function offset(e,t){var r=e.getBoundingClientRect();var a=e.ownerDocument;var n=a.documentElement;var i=getPageOffset(a);/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(i.x=0);return t?r.top+i.y-n.clientTop:r.left+i.x-n.clientLeft}function isNumeric(e){return typeof e==="number"&&!isNaN(e)&&isFinite(e)}function addClassFor(e,t,r){if(r>0){addClass(e,t);setTimeout((function(){removeClass(e,t)}),r)}}function limit(e){return Math.max(Math.min(e,100),0)}function asArray(e){return Array.isArray(e)?e:[e]}function countDecimals(e){e=String(e);var t=e.split(".");return t.length>1?t[1].length:0}function addClass(e,t){e.classList&&!/\s/.test(t)?e.classList.add(t):e.className+=" "+t}function removeClass(e,t){e.classList&&!/\s/.test(t)?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function hasClass(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function getPageOffset(e){var t=window.pageXOffset!==void 0;var r=(e.compatMode||"")==="CSS1Compat";var a=t?window.pageXOffset:r?e.documentElement.scrollLeft:e.body.scrollLeft;var n=t?window.pageYOffset:r?e.documentElement.scrollTop:e.body.scrollTop;return{x:a,y:n}}function getActions(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function getSupportsPassive(){var e=false;try{var t=Object.defineProperty({},"passive",{get:function(){e=true}});window.addEventListener("test",null,t)}catch(e){}return e}function getSupportsTouchActionNone(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function subRangeRatio(e,t){return 100/(t-e)}function fromPercentage(e,t,r){return t*100/(e[r+1]-e[r])}function toPercentage(e,t){return fromPercentage(e,e[0]<0?t+Math.abs(e[0]):t-e[0],0)}function isPercentage(e,t){return t*(e[1]-e[0])/100+e[0]}function getJ(e,t){var r=1;while(e>=t[r])r+=1;return r}function toStepping(e,t,r){if(r>=e.slice(-1)[0])return 100;var a=getJ(r,e);var n=e[a-1];var i=e[a];var s=t[a-1];var o=t[a];return s+toPercentage([n,i],r)/subRangeRatio(s,o)}function fromStepping(e,t,r){if(r>=100)return e.slice(-1)[0];var a=getJ(r,t);var n=e[a-1];var i=e[a];var s=t[a-1];var o=t[a];return isPercentage([n,i],(r-s)*subRangeRatio(s,o))}function getStep(e,t,r,a){if(a===100)return a;var n=getJ(a,e);var i=e[n-1];var s=e[n];return r?a-i>(s-i)/2?s:i:t[n-1]?e[n-1]+closest(a-e[n-1],t[n-1]):a}var r=function(){function Spectrum(e,t,r){this.xPct=[];this.xVal=[];this.xSteps=[];this.xNumSteps=[];this.xHighestCompleteStep=[];this.xSteps=[r||false];this.xNumSteps=[false];this.snap=t;var a;var n=[];Object.keys(e).forEach((function(t){n.push([asArray(e[t]),t])}));n.sort((function(e,t){return e[0][0]-t[0][0]}));for(a=0;a<n.length;a++)this.handleEntryPoint(n[a][1],n[a][0]);this.xNumSteps=this.xSteps.slice(0);for(a=0;a<this.xNumSteps.length;a++)this.handleStepPoint(a,this.xNumSteps[a])}Spectrum.prototype.getDistance=function(e){var t=[];for(var r=0;r<this.xNumSteps.length-1;r++)t[r]=fromPercentage(this.xVal,e,r);return t};Spectrum.prototype.getAbsoluteDistance=function(e,t,r){var a=0;if(e<this.xPct[this.xPct.length-1])while(e>this.xPct[a+1])a++;else e===this.xPct[this.xPct.length-1]&&(a=this.xPct.length-2);r||e!==this.xPct[a+1]||a++;t===null&&(t=[]);var n;var i=1;var s=t[a];var o=0;var l=0;var u=0;var c=0;n=r?(e-this.xPct[a])/(this.xPct[a+1]-this.xPct[a]):(this.xPct[a+1]-e)/(this.xPct[a+1]-this.xPct[a]);while(s>0){o=this.xPct[a+1+c]-this.xPct[a+c];if(t[a+c]*i+100-n*100>100){l=o*n;i=(s-100*n)/t[a+c];n=1}else{l=t[a+c]*o/100*i;i=0}if(r){u-=l;this.xPct.length+c>=1&&c--}else{u+=l;this.xPct.length-c>=1&&c++}s=t[a+c]*i}return e+u};Spectrum.prototype.toStepping=function(e){e=toStepping(this.xVal,this.xPct,e);return e};Spectrum.prototype.fromStepping=function(e){return fromStepping(this.xVal,this.xPct,e)};Spectrum.prototype.getStep=function(e){e=getStep(this.xPct,this.xSteps,this.snap,e);return e};Spectrum.prototype.getDefaultStep=function(e,t,r){var a=getJ(e,this.xPct);(e===100||t&&e===this.xPct[a-1])&&(a=Math.max(a-1,1));return(this.xVal[a]-this.xVal[a-1])/r};Spectrum.prototype.getNearbySteps=function(e){var t=getJ(e,this.xPct);return{stepBefore:{startValue:this.xVal[t-2],step:this.xNumSteps[t-2],highestStep:this.xHighestCompleteStep[t-2]},thisStep:{startValue:this.xVal[t-1],step:this.xNumSteps[t-1],highestStep:this.xHighestCompleteStep[t-1]},stepAfter:{startValue:this.xVal[t],step:this.xNumSteps[t],highestStep:this.xHighestCompleteStep[t]}}};Spectrum.prototype.countStepDecimals=function(){var e=this.xNumSteps.map(countDecimals);return Math.max.apply(null,e)};Spectrum.prototype.hasNoSize=function(){return this.xVal[0]===this.xVal[this.xVal.length-1]};Spectrum.prototype.convert=function(e){return this.getStep(this.toStepping(e))};Spectrum.prototype.handleEntryPoint=function(e,t){var r;r=e==="min"?0:e==="max"?100:parseFloat(e);if(!isNumeric(r)||!isNumeric(t[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");this.xPct.push(r);this.xVal.push(t[0]);var a=Number(t[1]);r?this.xSteps.push(!isNaN(a)&&a):isNaN(a)||(this.xSteps[0]=a);this.xHighestCompleteStep.push(0)};Spectrum.prototype.handleStepPoint=function(e,t){if(t)if(this.xVal[e]!==this.xVal[e+1]){this.xSteps[e]=fromPercentage([this.xVal[e],this.xVal[e+1]],t,0)/subRangeRatio(this.xPct[e],this.xPct[e+1]);var r=(this.xVal[e+1]-this.xVal[e])/this.xNumSteps[e];var a=Math.ceil(Number(r.toFixed(3))-1);var n=this.xVal[e]+this.xNumSteps[e]*a;this.xHighestCompleteStep[e]=n}else this.xSteps[e]=this.xHighestCompleteStep[e]=this.xVal[e]};return Spectrum}();var a={to:function(e){return e===void 0?"":e.toFixed(2)},from:Number};var n={target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",touchArea:"touch-area",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",textDirectionLtr:"txt-dir-ltr",textDirectionRtl:"txt-dir-rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"};var i={tooltips:".__tooltips",aria:".__aria"};function testStep(e,t){if(!isNumeric(t))throw new Error("noUiSlider: 'step' is not numeric.");e.singleStep=t}function testKeyboardPageMultiplier(e,t){if(!isNumeric(t))throw new Error("noUiSlider: 'keyboardPageMultiplier' is not numeric.");e.keyboardPageMultiplier=t}function testKeyboardMultiplier(e,t){if(!isNumeric(t))throw new Error("noUiSlider: 'keyboardMultiplier' is not numeric.");e.keyboardMultiplier=t}function testKeyboardDefaultStep(e,t){if(!isNumeric(t))throw new Error("noUiSlider: 'keyboardDefaultStep' is not numeric.");e.keyboardDefaultStep=t}function testRange(e,t){if(typeof t!=="object"||Array.isArray(t))throw new Error("noUiSlider: 'range' is not an object.");if(t.min===void 0||t.max===void 0)throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");e.spectrum=new r(t,e.snap||false,e.singleStep)}function testStart(e,t){t=asArray(t);if(!Array.isArray(t)||!t.length)throw new Error("noUiSlider: 'start' option is incorrect.");e.handles=t.length;e.start=t}function testSnap(e,t){if(typeof t!=="boolean")throw new Error("noUiSlider: 'snap' option must be a boolean.");e.snap=t}function testAnimate(e,t){if(typeof t!=="boolean")throw new Error("noUiSlider: 'animate' option must be a boolean.");e.animate=t}function testAnimationDuration(e,t){if(typeof t!=="number")throw new Error("noUiSlider: 'animationDuration' option must be a number.");e.animationDuration=t}function testConnect(e,t){var r=[false];var a;t==="lower"?t=[true,false]:t==="upper"&&(t=[false,true]);if(t===true||t===false){for(a=1;a<e.handles;a++)r.push(t);r.push(false)}else{if(!Array.isArray(t)||!t.length||t.length!==e.handles+1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");r=t}e.connect=r}function testOrientation(e,t){switch(t){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invalid.")}}function testMargin(e,t){if(!isNumeric(t))throw new Error("noUiSlider: 'margin' option must be numeric.");t!==0&&(e.margin=e.spectrum.getDistance(t))}function testLimit(e,t){if(!isNumeric(t))throw new Error("noUiSlider: 'limit' option must be numeric.");e.limit=e.spectrum.getDistance(t);if(!e.limit||e.handles<2)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders with 2 or more handles.")}function testPadding(e,t){var r;if(!isNumeric(t)&&!Array.isArray(t))throw new Error("noUiSlider: 'padding' option must be numeric or array of exactly 2 numbers.");if(Array.isArray(t)&&!(t.length===2||isNumeric(t[0])||isNumeric(t[1])))throw new Error("noUiSlider: 'padding' option must be numeric or array of exactly 2 numbers.");if(t!==0){Array.isArray(t)||(t=[t,t]);e.padding=[e.spectrum.getDistance(t[0]),e.spectrum.getDistance(t[1])];for(r=0;r<e.spectrum.xNumSteps.length-1;r++)if(e.padding[0][r]<0||e.padding[1][r]<0)throw new Error("noUiSlider: 'padding' option must be a positive number(s).");var a=t[0]+t[1];var n=e.spectrum.xVal[0];var i=e.spectrum.xVal[e.spectrum.xVal.length-1];if(a/(i-n)>1)throw new Error("noUiSlider: 'padding' option must not exceed 100% of the range.")}}function testDirection(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1;break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function testBehaviour(e,t){if(typeof t!=="string")throw new Error("noUiSlider: 'behaviour' must be a string containing options.");var r=t.indexOf("tap")>=0;var a=t.indexOf("drag")>=0;var n=t.indexOf("fixed")>=0;var i=t.indexOf("snap")>=0;var s=t.indexOf("hover")>=0;var o=t.indexOf("unconstrained")>=0;var l=t.indexOf("invert-connects")>=0;var u=t.indexOf("drag-all")>=0;var c=t.indexOf("smooth-steps")>=0;if(n){if(e.handles!==2)throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");testMargin(e,e.start[1]-e.start[0])}if(l&&e.handles!==2)throw new Error("noUiSlider: 'invert-connects' behaviour must be used with 2 handles");if(o&&(e.margin||e.limit))throw new Error("noUiSlider: 'unconstrained' behaviour cannot be used with margin or limit");e.events={tap:r||i,drag:a,dragAll:u,smoothSteps:c,fixed:n,snap:i,hover:s,unconstrained:o,invertConnects:l}}function testTooltips(e,t){if(t!==false)if(t===true||isValidPartialFormatter(t)){e.tooltips=[];for(var r=0;r<e.handles;r++)e.tooltips.push(t)}else{t=asArray(t);if(t.length!==e.handles)throw new Error("noUiSlider: must pass a formatter for all handles.");t.forEach((function(e){if(typeof e!=="boolean"&&!isValidPartialFormatter(e))throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.")}));e.tooltips=t}}function testHandleAttributes(e,t){if(t.length!==e.handles)throw new Error("noUiSlider: must pass a attributes for all handles.");e.handleAttributes=t}function testAriaFormat(e,t){if(!isValidPartialFormatter(t))throw new Error("noUiSlider: 'ariaFormat' requires 'to' method.");e.ariaFormat=t}function testFormat(e,t){if(!isValidFormatter(t))throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.");e.format=t}function testKeyboardSupport(e,t){if(typeof t!=="boolean")throw new Error("noUiSlider: 'keyboardSupport' option must be a boolean.");e.keyboardSupport=t}function testDocumentElement(e,t){e.documentElement=t}function testCssPrefix(e,t){if(typeof t!=="string"&&t!==false)throw new Error("noUiSlider: 'cssPrefix' must be a string or `false`.");e.cssPrefix=t}function testCssClasses(e,t){if(typeof t!=="object")throw new Error("noUiSlider: 'cssClasses' must be an object.");if(typeof e.cssPrefix==="string"){e.cssClasses={};Object.keys(t).forEach((function(r){e.cssClasses[r]=e.cssPrefix+t[r]}))}else e.cssClasses=t}function testOptions(e){var t={margin:null,limit:null,padding:null,animate:true,animationDuration:300,ariaFormat:a,format:a};var r={step:{r:false,t:testStep},keyboardPageMultiplier:{r:false,t:testKeyboardPageMultiplier},keyboardMultiplier:{r:false,t:testKeyboardMultiplier},keyboardDefaultStep:{r:false,t:testKeyboardDefaultStep},start:{r:true,t:testStart},connect:{r:true,t:testConnect},direction:{r:true,t:testDirection},snap:{r:false,t:testSnap},animate:{r:false,t:testAnimate},animationDuration:{r:false,t:testAnimationDuration},range:{r:true,t:testRange},orientation:{r:false,t:testOrientation},margin:{r:false,t:testMargin},limit:{r:false,t:testLimit},padding:{r:false,t:testPadding},behaviour:{r:true,t:testBehaviour},ariaFormat:{r:false,t:testAriaFormat},format:{r:false,t:testFormat},tooltips:{r:false,t:testTooltips},keyboardSupport:{r:true,t:testKeyboardSupport},documentElement:{r:false,t:testDocumentElement},cssPrefix:{r:true,t:testCssPrefix},cssClasses:{r:true,t:testCssClasses},handleAttributes:{r:false,t:testHandleAttributes}};var i={connect:false,direction:"ltr",behaviour:"tap",orientation:"horizontal",keyboardSupport:true,cssPrefix:"noUi-",cssClasses:n,keyboardPageMultiplier:5,keyboardMultiplier:1,keyboardDefaultStep:10};e.format&&!e.ariaFormat&&(e.ariaFormat=e.format);Object.keys(r).forEach((function(a){if(isSet(e[a])||i[a]!==void 0)r[a].t(t,isSet(e[a])?e[a]:i[a]);else if(r[a].r)throw new Error("noUiSlider: '"+a+"' is required.")}));t.pips=e.pips;var s=document.createElement("div");var o=s.style.msTransform!==void 0;var l=s.style.transform!==void 0;t.transformRule=l?"transform":o?"msTransform":"webkitTransform";var u=[["left","top"],["right","bottom"]];t.style=u[t.dir][t.ort];return t}function scope(r,a,n){var s=getActions();var o=getSupportsTouchActionNone();var l=o&&getSupportsPassive();var u=r;var c;var f;var d;var p;var v;var h;var m=a.spectrum;var g=[];var S=[];var b=[];var x=0;var E={};var y=false;var C=r.ownerDocument;var w=a.documentElement||C.documentElement;var N=C.body;var P=C.dir==="rtl"||a.ort===1?0:100;function addNodeTo(e,t){var r=C.createElement("div");t&&addClass(r,t);e.appendChild(r);return r}function addOrigin(e,t){var r=addNodeTo(e,a.cssClasses.origin);var n=addNodeTo(r,a.cssClasses.handle);addNodeTo(n,a.cssClasses.touchArea);n.setAttribute("data-handle",String(t));if(a.keyboardSupport){n.setAttribute("tabindex","0");n.addEventListener("keydown",(function(e){return eventKeydown(e,t)}))}if(a.handleAttributes!==void 0){var i=a.handleAttributes[t];Object.keys(i).forEach((function(e){n.setAttribute(e,i[e])}))}n.setAttribute("role","slider");n.setAttribute("aria-orientation",a.ort?"vertical":"horizontal");t===0?addClass(n,a.cssClasses.handleLower):t===a.handles-1&&addClass(n,a.cssClasses.handleUpper);r.handle=n;return r}function addConnect(e,t){return!!t&&addNodeTo(e,a.cssClasses.connect)}function addElements(e,t){f=addNodeTo(t,a.cssClasses.connects);d=[];p=[];p.push(addConnect(f,e[0]));for(var r=0;r<a.handles;r++){d.push(addOrigin(t,r));b[r]=r;p.push(addConnect(f,e[r+1]))}}function addSlider(e){addClass(e,a.cssClasses.target);a.dir===0?addClass(e,a.cssClasses.ltr):addClass(e,a.cssClasses.rtl);a.ort===0?addClass(e,a.cssClasses.horizontal):addClass(e,a.cssClasses.vertical);var t=getComputedStyle(e).direction;addClass(e,t==="rtl"?a.cssClasses.textDirectionRtl:a.cssClasses.textDirectionLtr);return addNodeTo(e,a.cssClasses.base)}function addTooltip(e,t){return!(!a.tooltips||!a.tooltips[t])&&addNodeTo(e.firstChild,a.cssClasses.tooltip)}function isSliderDisabled(){return u.hasAttribute("disabled")}function isHandleDisabled(e){var t=d[e];return t.hasAttribute("disabled")}function disable(e){if(e!==null&&e!==void 0){d[e].setAttribute("disabled","");d[e].handle.removeAttribute("tabindex")}else{u.setAttribute("disabled","");d.forEach((function(e){e.handle.removeAttribute("tabindex")}))}}function enable(e){if(e!==null&&e!==void 0){d[e].removeAttribute("disabled");d[e].handle.setAttribute("tabindex","0")}else{u.removeAttribute("disabled");d.forEach((function(e){e.removeAttribute("disabled");e.handle.setAttribute("tabindex","0")}))}}function removeTooltips(){if(h){removeEvent("update"+i.tooltips);h.forEach((function(e){e&&removeElement(e)}));h=null}}function tooltips(){removeTooltips();h=d.map(addTooltip);bindEvent("update"+i.tooltips,(function(e,t,r){if(h&&a.tooltips&&h[t]!==false){var n=e[t];a.tooltips[t]!==true&&(n=a.tooltips[t].to(r[t]));h[t].innerHTML=n}}))}function aria(){removeEvent("update"+i.aria);bindEvent("update"+i.aria,(function(e,t,r,n,i){b.forEach((function(e){var t=d[e];var n=checkHandlePosition(S,e,0,true,true,true);var s=checkHandlePosition(S,e,100,true,true,true);var o=i[e];var l=String(a.ariaFormat.to(r[e]));n=m.fromStepping(n).toFixed(1);s=m.fromStepping(s).toFixed(1);o=m.fromStepping(o).toFixed(1);t.children[0].setAttribute("aria-valuemin",n);t.children[0].setAttribute("aria-valuemax",s);t.children[0].setAttribute("aria-valuenow",o);t.children[0].setAttribute("aria-valuetext",l)}))}))}function getGroup(t){if(t.mode===e.Range||t.mode===e.Steps)return m.xVal;if(t.mode===e.Count){if(t.values<2)throw new Error("noUiSlider: 'values' (>= 2) required for mode 'count'.");var r=t.values-1;var a=100/r;var n=[];while(r--)n[r]=r*a;n.push(100);return mapToRange(n,t.stepped)}return t.mode===e.Positions?mapToRange(t.values,t.stepped):t.mode===e.Values?t.stepped?t.values.map((function(e){return m.fromStepping(m.getStep(m.toStepping(e)))})):t.values:[]}function mapToRange(e,t){return e.map((function(e){return m.fromStepping(t?m.getStep(e):e)}))}function generateSpread(r){function safeIncrement(e,t){return Number((e+t).toFixed(7))}var a=getGroup(r);var n={};var i=m.xVal[0];var s=m.xVal[m.xVal.length-1];var o=false;var l=false;var u=0;a=unique(a.slice().sort((function(e,t){return e-t})));if(a[0]!==i){a.unshift(i);o=true}if(a[a.length-1]!==s){a.push(s);l=true}a.forEach((function(i,s){var c;var f;var d;var p=i;var v=a[s+1];var h;var g;var S;var b;var x;var E;var y;var C=r.mode===e.Steps;C&&(c=m.xNumSteps[s]);c||(c=v-p);v===void 0&&(v=p);c=Math.max(c,1e-7);for(f=p;f<=v;f=safeIncrement(f,c)){h=m.toStepping(f);g=h-u;x=g/(r.density||1);E=Math.round(x);y=g/E;for(d=1;d<=E;d+=1){S=u+d*y;n[S.toFixed(5)]=[m.fromStepping(S),0]}b=a.indexOf(f)>-1?t.LargeValue:C?t.SmallValue:t.NoValue;!s&&o&&f!==v&&(b=0);f===v&&l||(n[h.toFixed(5)]=[f,b]);u=h}}));return n}function addMarking(e,r,n){var i,s;var o=C.createElement("div");var l=(i={},i[t.None]="",i[t.NoValue]=a.cssClasses.valueNormal,i[t.LargeValue]=a.cssClasses.valueLarge,i[t.SmallValue]=a.cssClasses.valueSub,i);var u=(s={},s[t.None]="",s[t.NoValue]=a.cssClasses.markerNormal,s[t.LargeValue]=a.cssClasses.markerLarge,s[t.SmallValue]=a.cssClasses.markerSub,s);var c=[a.cssClasses.valueHorizontal,a.cssClasses.valueVertical];var f=[a.cssClasses.markerHorizontal,a.cssClasses.markerVertical];addClass(o,a.cssClasses.pips);addClass(o,a.ort===0?a.cssClasses.pipsHorizontal:a.cssClasses.pipsVertical);function getClasses(e,t){var r=t===a.cssClasses.value;var n=r?c:f;var i=r?l:u;return t+" "+n[a.ort]+" "+i[e]}function addSpread(e,i,s){s=r?r(i,s):s;if(s!==t.None){var l=addNodeTo(o,false);l.className=getClasses(s,a.cssClasses.marker);l.style[a.style]=e+"%";if(s>t.NoValue){l=addNodeTo(o,false);l.className=getClasses(s,a.cssClasses.value);l.setAttribute("data-value",String(i));l.style[a.style]=e+"%";l.innerHTML=String(n.to(i))}}}Object.keys(e).forEach((function(t){addSpread(t,e[t][0],e[t][1])}));return o}function removePips(){if(v){removeElement(v);v=null}}function pips(e){removePips();var t=generateSpread(e);var r=e.filter;var a=e.format||{to:function(e){return String(Math.round(e))}};v=u.appendChild(addMarking(t,r,a));return v}function baseSize(){var e=c.getBoundingClientRect();var t="offset"+["Width","Height"][a.ort];return a.ort===0?e.width||c[t]:e.height||c[t]}function attachEvent(e,t,r,n){var method=function(i){var o=fixEvent(i,n.pageOffset,n.target||t);if(!o)return false;if(isSliderDisabled()&&!n.doNotReject)return false;if(hasClass(u,a.cssClasses.tap)&&!n.doNotReject)return false;if(e===s.start&&o.buttons!==void 0&&o.buttons>1)return false;if(n.hover&&o.buttons)return false;l||o.preventDefault();o.calcPoint=o.points[a.ort];r(o,n)};var i=[];e.split(" ").forEach((function(e){t.addEventListener(e,method,!!l&&{passive:true});i.push([e,method])}));return i}function fixEvent(e,t,r){var a=e.type.indexOf("touch")===0;var n=e.type.indexOf("mouse")===0;var i=e.type.indexOf("pointer")===0;var s=0;var o=0;e.type.indexOf("MSPointer")===0&&(i=true);if(e.type==="mousedown"&&!e.buttons&&!e.touches)return false;if(a){var isTouchOnTarget=function(t){var a=t.target;return a===r||r.contains(a)||e.composed&&e.composedPath().shift()===r};if(e.type==="touchstart"){var l=Array.prototype.filter.call(e.touches,isTouchOnTarget);if(l.length>1)return false;s=l[0].pageX;o=l[0].pageY}else{var u=Array.prototype.find.call(e.changedTouches,isTouchOnTarget);if(!u)return false;s=u.pageX;o=u.pageY}}t=t||getPageOffset(C);if(n||i){s=e.clientX+t.x;o=e.clientY+t.y}e.pageOffset=t;e.points=[s,o];e.cursor=n||i;return e}function calcPointToPercentage(e){var t=e-offset(c,a.ort);var r=t*100/baseSize();r=limit(r);return a.dir?100-r:r}function getClosestHandle(e){var t=100;var r=false;d.forEach((function(a,n){if(!isHandleDisabled(n)){var i=S[n];var s=Math.abs(i-e);var o=s===100&&t===100;var l=s<t;var u=s<=t&&e>i;if(l||u||o){r=n;t=s}}}));return r}function documentLeave(e,t){e.type==="mouseout"&&e.target.nodeName==="HTML"&&e.relatedTarget===null&&eventEnd(e,t)}function eventMove(e,t){if(navigator.appVersion.indexOf("MSIE 9")===-1&&e.buttons===0&&t.buttonsProperty!==0)return eventEnd(e,t);var r=(a.dir?-1:1)*(e.calcPoint-t.startCalcPoint);var n=r*100/t.baseSize;moveHandles(r>0,n,t.locations,t.handleNumbers,t.connect)}function eventEnd(e,t){if(t.handle){removeClass(t.handle,a.cssClasses.active);x-=1}t.listeners.forEach((function(e){w.removeEventListener(e[0],e[1])}));if(x===0){removeClass(u,a.cssClasses.drag);setZindex();if(e.cursor){N.style.cursor="";N.removeEventListener("selectstart",preventDefault)}}if(a.events.smoothSteps){t.handleNumbers.forEach((function(e){setHandle(e,S[e],true,true,false,false)}));t.handleNumbers.forEach((function(e){fireEvent("update",e)}))}t.handleNumbers.forEach((function(e){fireEvent("change",e);fireEvent("set",e);fireEvent("end",e)}))}function eventStart(e,t){if(!t.handleNumbers.some(isHandleDisabled)){var r;if(t.handleNumbers.length===1){var n=d[t.handleNumbers[0]];r=n.children[0];x+=1;addClass(r,a.cssClasses.active)}e.stopPropagation();var i=[];var o=attachEvent(s.move,w,eventMove,{target:e.target,handle:r,connect:t.connect,listeners:i,startCalcPoint:e.calcPoint,baseSize:baseSize(),pageOffset:e.pageOffset,handleNumbers:t.handleNumbers,buttonsProperty:e.buttons,locations:S.slice()});var l=attachEvent(s.end,w,eventEnd,{target:e.target,handle:r,listeners:i,doNotReject:true,handleNumbers:t.handleNumbers});var c=attachEvent("mouseout",w,documentLeave,{target:e.target,handle:r,listeners:i,doNotReject:true,handleNumbers:t.handleNumbers});i.push.apply(i,o.concat(l,c));if(e.cursor){N.style.cursor=getComputedStyle(e.target).cursor;d.length>1&&addClass(u,a.cssClasses.drag);N.addEventListener("selectstart",preventDefault,false)}t.handleNumbers.forEach((function(e){fireEvent("start",e)}))}}function eventTap(e){e.stopPropagation();var t=calcPointToPercentage(e.calcPoint);var r=getClosestHandle(t);if(r!==false){a.events.snap||addClassFor(u,a.cssClasses.tap,a.animationDuration);setHandle(r,t,true,true);setZindex();fireEvent("slide",r,true);fireEvent("update",r,true);if(a.events.snap)eventStart(e,{handleNumbers:[r]});else{fireEvent("change",r,true);fireEvent("set",r,true)}}}function eventHover(e){var t=calcPointToPercentage(e.calcPoint);var r=m.getStep(t);var a=m.fromStepping(r);Object.keys(E).forEach((function(e){"hover"===e.split(".")[0]&&E[e].forEach((function(e){e.call(A,a)}))}))}function eventKeydown(e,t){if(isSliderDisabled()||isHandleDisabled(t))return false;var r=["Left","Right"];var n=["Down","Up"];var i=["PageDown","PageUp"];var s=["Home","End"];if(a.dir&&!a.ort)r.reverse();else if(a.ort&&!a.dir){n.reverse();i.reverse()}var o=e.key.replace("Arrow","");var l=o===i[0];var u=o===i[1];var c=o===n[0]||o===r[0]||l;var f=o===n[1]||o===r[1]||u;var d=o===s[0];var p=o===s[1];if(!c&&!f&&!d&&!p)return true;e.preventDefault();var v;if(f||c){var h=c?0:1;var b=getNextStepsForHandle(t);var x=b[h];if(x===null)return false;x===false&&(x=m.getDefaultStep(S[t],c,a.keyboardDefaultStep));x*=u||l?a.keyboardPageMultiplier:a.keyboardMultiplier;x=Math.max(x,1e-7);x*=c?-1:1;v=g[t]+x}else v=p?a.spectrum.xVal[a.spectrum.xVal.length-1]:a.spectrum.xVal[0];setHandle(t,m.toStepping(v),true,true);fireEvent("slide",t);fireEvent("update",t);fireEvent("change",t);fireEvent("set",t);return false}function bindSliderEvents(e){e.fixed||d.forEach((function(e,t){attachEvent(s.start,e.children[0],eventStart,{handleNumbers:[t]})}));e.tap&&attachEvent(s.start,c,eventTap,{});e.hover&&attachEvent(s.move,c,eventHover,{hover:true});e.drag&&p.forEach((function(t,r){if(t!==false&&r!==0&&r!==p.length-1){var n=d[r-1];var i=d[r];var o=[t];var l=[n,i];var u=[r-1,r];addClass(t,a.cssClasses.draggable);if(e.fixed){o.push(n.children[0]);o.push(i.children[0])}if(e.dragAll){l=d;u=b}o.forEach((function(e){attachEvent(s.start,e,eventStart,{handles:l,handleNumbers:u,connect:t})}))}}))}function bindEvent(e,t){E[e]=E[e]||[];E[e].push(t);e.split(".")[0]==="update"&&d.forEach((function(e,t){fireEvent("update",t)}))}function isInternalNamespace(e){return e===i.aria||e===i.tooltips}function removeEvent(e){var t=e&&e.split(".")[0];var r=t?e.substring(t.length):e;Object.keys(E).forEach((function(e){var a=e.split(".")[0];var n=e.substring(a.length);t&&t!==a||r&&r!==n||isInternalNamespace(n)&&r!==n||delete E[e]}))}function fireEvent(e,t,r){Object.keys(E).forEach((function(n){var i=n.split(".")[0];e===i&&E[n].forEach((function(e){e.call(A,g.map(a.format.to),t,g.slice(),r||false,S.slice(),A)}))}))}function checkHandlePosition(e,t,r,n,i,s,o){var l;if(d.length>1&&!a.events.unconstrained){if(n&&t>0){l=m.getAbsoluteDistance(e[t-1],a.margin,false);r=Math.max(r,l)}if(i&&t<d.length-1){l=m.getAbsoluteDistance(e[t+1],a.margin,true);r=Math.min(r,l)}}if(d.length>1&&a.limit){if(n&&t>0){l=m.getAbsoluteDistance(e[t-1],a.limit,false);r=Math.min(r,l)}if(i&&t<d.length-1){l=m.getAbsoluteDistance(e[t+1],a.limit,true);r=Math.max(r,l)}}if(a.padding){if(t===0){l=m.getAbsoluteDistance(0,a.padding[0],false);r=Math.max(r,l)}if(t===d.length-1){l=m.getAbsoluteDistance(100,a.padding[1],true);r=Math.min(r,l)}}o||(r=m.getStep(r));r=limit(r);return!(r===e[t]&&!s)&&r}function inRuleOrder(e,t){var r=a.ort;return(r?t:e)+", "+(r?e:t)}function moveHandles(e,t,r,n,i){var s=r.slice();var o=n[0];var l=a.events.smoothSteps;var u=[!e,e];var c=[e,!e];n=n.slice();e&&n.reverse();n.length>1?n.forEach((function(e,r){var a=checkHandlePosition(s,e,s[e]+t,u[r],c[r],false,l);if(a===false)t=0;else{t=a-s[e];s[e]=a}})):u=c=[true];var f=false;n.forEach((function(e,a){f=setHandle(e,r[e]+t,u[a],c[a],false,l)||f}));if(f){n.forEach((function(e){fireEvent("update",e);fireEvent("slide",e)}));i!=void 0&&fireEvent("drag",o)}}function transformDirection(e,t){return a.dir?100-e-t:e}function updateHandlePosition(e,t){S[e]=t;g[e]=m.fromStepping(t);var r=transformDirection(t,0)-P;var n="translate("+inRuleOrder(r+"%","0")+")";d[e].style[a.transformRule]=n;if(a.events.invertConnects&&S.length>1){var i=S.every((function(e,t,r){return t===0||e>=r[t-1]}));if(y!==!i){invertConnects();return}}updateConnect(e);updateConnect(e+1);if(y){updateConnect(e-1);updateConnect(e+2)}}function setZindex(){b.forEach((function(e){var t=S[e]>50?-1:1;var r=3+(d.length+t*e);d[e].style.zIndex=String(r)}))}function setHandle(e,t,r,a,n,i){n||(t=checkHandlePosition(S,e,t,r,a,false,i));if(t===false)return false;updateHandlePosition(e,t);return true}function updateConnect(e){if(p[e]){var t=S.slice();y&&t.sort((function(e,t){return e-t}));var r=0;var n=100;e!==0&&(r=t[e-1]);e!==p.length-1&&(n=t[e]);var i=n-r;var s="translate("+inRuleOrder(transformDirection(r,i)+"%","0")+")";var o="scale("+inRuleOrder(i/100,"1")+")";p[e].style[a.transformRule]=s+" "+o}}function resolveToValue(e,t){if(e===null||e===false||e===void 0)return S[t];typeof e==="number"&&(e=String(e));e=a.format.from(e);e!==false&&(e=m.toStepping(e));return e===false||isNaN(e)?S[t]:e}function valueSet(e,t,r){var n=asArray(e);var i=S[0]===void 0;t=t===void 0||t;a.animate&&!i&&addClassFor(u,a.cssClasses.tap,a.animationDuration);b.forEach((function(e){setHandle(e,resolveToValue(n[e],e),true,false,r)}));var s=b.length===1?0:1;if(i&&m.hasNoSize()){r=true;S[0]=0;if(b.length>1){var o=100/(b.length-1);b.forEach((function(e){S[e]=e*o}))}}for(;s<b.length;++s)b.forEach((function(e){setHandle(e,S[e],true,true,r)}));setZindex();b.forEach((function(e){fireEvent("update",e);n[e]!==null&&t&&fireEvent("set",e)}))}function valueReset(e){valueSet(a.start,e)}function valueSetHandle(e,t,r,a){e=Number(e);if(!(e>=0&&e<b.length))throw new Error("noUiSlider: invalid handle number, got: "+e);setHandle(e,resolveToValue(t,e),true,true,a);fireEvent("update",e);r&&fireEvent("set",e)}function valueGet(e){e===void 0&&(e=false);if(e)return g.length===1?g[0]:g.slice(0);var t=g.map(a.format.to);return t.length===1?t[0]:t}function destroy(){removeEvent(i.aria);removeEvent(i.tooltips);Object.keys(a.cssClasses).forEach((function(e){removeClass(u,a.cssClasses[e])}));while(u.firstChild)u.removeChild(u.firstChild);delete u.noUiSlider}function getNextStepsForHandle(e){var t=S[e];var r=m.getNearbySteps(t);var n=g[e];var i=r.thisStep.step;var s=null;if(a.snap)return[n-r.stepBefore.startValue||null,r.stepAfter.startValue-n||null];i!==false&&n+i>r.stepAfter.startValue&&(i=r.stepAfter.startValue-n);s=n>r.thisStep.startValue?r.thisStep.step:r.stepBefore.step!==false&&n-r.stepBefore.highestStep;t===100?i=null:t===0&&(s=null);var o=m.countStepDecimals();i!==null&&i!==false&&(i=Number(i.toFixed(o)));s!==null&&s!==false&&(s=Number(s.toFixed(o)));return[s,i]}function getNextSteps(){return b.map(getNextStepsForHandle)}function updateOptions(e,t){var r=valueGet();var i=["margin","limit","padding","range","animate","snap","step","format","pips","tooltips","connect"];i.forEach((function(t){e[t]!==void 0&&(n[t]=e[t])}));var s=testOptions(n);i.forEach((function(t){e[t]!==void 0&&(a[t]=s[t])}));m=s.spectrum;a.margin=s.margin;a.limit=s.limit;a.padding=s.padding;a.pips?pips(a.pips):removePips();a.tooltips?tooltips():removeTooltips();S=[];valueSet(isSet(e.start)?e.start:r,t);e.connect&&updateConnectOption()}function updateConnectOption(){while(f.firstChild)f.removeChild(f.firstChild);for(var e=0;e<=a.handles;e++){p[e]=addConnect(f,a.connect[e]);updateConnect(e)}bindSliderEvents({drag:a.events.drag,fixed:true})}function invertConnects(){y=!y;testConnect(a,a.connect.map((function(e){return!e})));updateConnectOption()}function setupSlider(){c=addSlider(u);addElements(a.connect,c);bindSliderEvents(a.events);valueSet(a.start);a.pips&&pips(a.pips);a.tooltips&&tooltips();aria()}setupSlider();var A={destroy:destroy,steps:getNextSteps,on:bindEvent,off:removeEvent,get:valueGet,set:valueSet,setHandle:valueSetHandle,reset:valueReset,disable:disable,enable:enable,__moveHandles:function(e,t,r){moveHandles(e,t,S,r)},options:n,updateOptions:updateOptions,target:u,removePips:removePips,removeTooltips:removeTooltips,getPositions:function(){return S.slice()},getTooltips:function(){return h},getOrigins:function(){return d},pips:pips};return A}function initialize(e,t){if(!e||!e.nodeName)throw new Error("noUiSlider: create requires a single element, got: "+e);if(e.noUiSlider)throw new Error("noUiSlider: Slider was already initialized.");var r=testOptions(t);var a=scope(e,r,t);e.noUiSlider=a;return a}var s={__spectrum:r,cssClasses:n,create:initialize};export{e as PipsMode,t as PipsType,initialize as create,n as cssClasses,s as default};
+
diff --git a/storefront/vendor/javascript/photoswipe--dist--photoswipe-lightbox.esm.js.js b/storefront/vendor/javascript/photoswipe--dist--photoswipe-lightbox.esm.js.js
new file mode 100644
index 0000000000..8ab0b01b52
--- /dev/null
+++ b/storefront/vendor/javascript/photoswipe--dist--photoswipe-lightbox.esm.js.js
@@ -0,0 +1,667 @@
+// photoswipe/dist/[email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/photoswipe-lightbox.esm.js
+
+/** @typedef {import('../photoswipe.js').Point} Point */
+/**
+ * @template {keyof HTMLElementTagNameMap} T
+ * @param {string} className
+ * @param {T} tagName
+ * @param {Node} [appendToEl]
+ * @returns {HTMLElementTagNameMap[T]}
+ */
+function createElement(t, e, i) { const s = document.createElement(e); t && (s.className = t); i && i.appendChild(s); return s }
+/**
+ * Get transform string
+ *
+ * @param {number} x
+ * @param {number} [y]
+ * @param {number} [scale]
+ * @returns {string}
+ */function toTransformString(t, e, i) { let s = `translate3d(${t}px,${e || 0}px,0)`; i !== void 0 && (s += ` scale3d(${i},${i},1)`); return s }
+/**
+ * Apply width and height CSS properties to element
+ *
+ * @param {HTMLElement} el
+ * @param {string | number} w
+ * @param {string | number} h
+ */function setWidthHeight(t, e, i) { t.style.width = typeof e === "number" ? `${e}px` : e; t.style.height = typeof i === "number" ? `${i}px` : i }
+/** @typedef {LOAD_STATE[keyof LOAD_STATE]} LoadState */
+/** @type {{ IDLE: 'idle'; LOADING: 'loading'; LOADED: 'loaded'; ERROR: 'error' }} */const t = { IDLE: "idle", LOADING: "loading", LOADED: "loaded", ERROR: "error" };
+/**
+ * Check if click or keydown event was dispatched
+ * with a special key or via mouse wheel.
+ *
+ * @param {MouseEvent | KeyboardEvent} e
+ * @returns {boolean}
+ */function specialKeyUsed(t) { return "button" in t && t.button === 1 || t.ctrlKey || t.metaKey || t.altKey || t.shiftKey }
+/**
+ * Parse `gallery` or `children` options.
+ *
+ * @param {import('../photoswipe.js').ElementProvider} [option]
+ * @param {string} [legacySelector]
+ * @param {HTMLElement | Document} [parent]
+ * @returns HTMLElement[]
+ */function getElementsFromOption(t, e, i = document) {
+ /** @type {HTMLElement[]} */
+ let s = []; if (t instanceof Element) s = [t]; else if (t instanceof NodeList || Array.isArray(t)) s = Array.from(t); else { const n = typeof t === "string" ? t : e; n && (s = Array.from(i.querySelectorAll(n))) } return s
+}
+/**
+ * Check if variable is PhotoSwipe class
+ *
+ * @param {any} fn
+ * @returns {boolean}
+ */function isPswpClass(t) { return typeof t === "function" && t.prototype && t.prototype.goTo }
+/**
+ * Check if browser is Safari
+ *
+ * @returns {boolean}
+ */function isSafari() { return !!(navigator.vendor && navigator.vendor.match(/apple/i)) }
+/** @typedef {import('../lightbox/lightbox.js').default} PhotoSwipeLightbox */
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
+/** @typedef {import('../photoswipe.js').DataSource} DataSource */
+/** @typedef {import('../ui/ui-element.js').UIElementData} UIElementData */
+/** @typedef {import('../slide/content.js').default} ContentDefault */
+/** @typedef {import('../slide/slide.js').default} Slide */
+/** @typedef {import('../slide/slide.js').SlideData} SlideData */
+/** @typedef {import('../slide/zoom-level.js').default} ZoomLevel */
+/** @typedef {import('../slide/get-thumb-bounds.js').Bounds} Bounds */
+/**
+ * Allow adding an arbitrary props to the Content
+ * https://photoswipe.com/custom-content/#using-webp-image-format
+ * @typedef {ContentDefault & Record<string, any>} Content
+ */
+/** @typedef {{ x?: number; y?: number }} Point */
+/**
+ * @typedef {Object} PhotoSwipeEventsMap https://photoswipe.com/events/
+ *
+ *
+ * https://photoswipe.com/adding-ui-elements/
+ *
+ * @prop {undefined} uiRegister
+ * @prop {{ data: UIElementData }} uiElementCreate
+ *
+ *
+ * https://photoswipe.com/events/#initialization-events
+ *
+ * @prop {undefined} beforeOpen
+ * @prop {undefined} firstUpdate
+ * @prop {undefined} initialLayout
+ * @prop {undefined} change
+ * @prop {undefined} afterInit
+ * @prop {undefined} bindEvents
+ *
+ *
+ * https://photoswipe.com/events/#opening-or-closing-transition-events
+ *
+ * @prop {undefined} openingAnimationStart
+ * @prop {undefined} openingAnimationEnd
+ * @prop {undefined} closingAnimationStart
+ * @prop {undefined} closingAnimationEnd
+ *
+ *
+ * https://photoswipe.com/events/#closing-events
+ *
+ * @prop {undefined} close
+ * @prop {undefined} destroy
+ *
+ *
+ * https://photoswipe.com/events/#pointer-and-gesture-events
+ *
+ * @prop {{ originalEvent: PointerEvent }} pointerDown
+ * @prop {{ originalEvent: PointerEvent }} pointerMove
+ * @prop {{ originalEvent: PointerEvent }} pointerUp
+ * @prop {{ bgOpacity: number }} pinchClose can be default prevented
+ * @prop {{ panY: number }} verticalDrag can be default prevented
+ *
+ *
+ * https://photoswipe.com/events/#slide-content-events
+ *
+ * @prop {{ content: Content }} contentInit
+ * @prop {{ content: Content; isLazy: boolean }} contentLoad can be default prevented
+ * @prop {{ content: Content; isLazy: boolean }} contentLoadImage can be default prevented
+ * @prop {{ content: Content; slide: Slide; isError?: boolean }} loadComplete
+ * @prop {{ content: Content; slide: Slide }} loadError
+ * @prop {{ content: Content; width: number; height: number }} contentResize can be default prevented
+ * @prop {{ content: Content; width: number; height: number; slide: Slide }} imageSizeChange
+ * @prop {{ content: Content }} contentLazyLoad can be default prevented
+ * @prop {{ content: Content }} contentAppend can be default prevented
+ * @prop {{ content: Content }} contentActivate can be default prevented
+ * @prop {{ content: Content }} contentDeactivate can be default prevented
+ * @prop {{ content: Content }} contentRemove can be default prevented
+ * @prop {{ content: Content }} contentDestroy can be default prevented
+ *
+ *
+ * undocumented
+ *
+ * @prop {{ point: Point; originalEvent: PointerEvent }} imageClickAction can be default prevented
+ * @prop {{ point: Point; originalEvent: PointerEvent }} bgClickAction can be default prevented
+ * @prop {{ point: Point; originalEvent: PointerEvent }} tapAction can be default prevented
+ * @prop {{ point: Point; originalEvent: PointerEvent }} doubleTapAction can be default prevented
+ *
+ * @prop {{ originalEvent: KeyboardEvent }} keydown can be default prevented
+ * @prop {{ x: number; dragging: boolean }} moveMainScroll
+ * @prop {{ slide: Slide }} firstZoomPan
+ * @prop {{ slide: Slide | undefined, data: SlideData, index: number }} gettingData
+ * @prop {undefined} beforeResize
+ * @prop {undefined} resize
+ * @prop {undefined} viewportSize
+ * @prop {undefined} updateScrollOffset
+ * @prop {{ slide: Slide }} slideInit
+ * @prop {{ slide: Slide }} afterSetContent
+ * @prop {{ slide: Slide }} slideLoad
+ * @prop {{ slide: Slide }} appendHeavy can be default prevented
+ * @prop {{ slide: Slide }} appendHeavyContent
+ * @prop {{ slide: Slide }} slideActivate
+ * @prop {{ slide: Slide }} slideDeactivate
+ * @prop {{ slide: Slide }} slideDestroy
+ * @prop {{ destZoomLevel: number, centerPoint: Point | undefined, transitionDuration: number | false | undefined }} beforeZoomTo
+ * @prop {{ slide: Slide }} zoomPanUpdate
+ * @prop {{ slide: Slide }} initialZoomPan
+ * @prop {{ slide: Slide }} calcSlideSize
+ * @prop {undefined} resolutionChanged
+ * @prop {{ originalEvent: WheelEvent }} wheel can be default prevented
+ * @prop {{ content: Content }} contentAppendImage can be default prevented
+ * @prop {{ index: number; itemData: SlideData }} lazyLoadSlide can be default prevented
+ * @prop {undefined} lazyLoad
+ * @prop {{ slide: Slide }} calcBounds
+ * @prop {{ zoomLevels: ZoomLevel, slideData: SlideData }} zoomLevelsUpdate
+ *
+ *
+ * legacy
+ *
+ * @prop {undefined} init
+ * @prop {undefined} initialZoomIn
+ * @prop {undefined} initialZoomOut
+ * @prop {undefined} initialZoomInEnd
+ * @prop {undefined} initialZoomOutEnd
+ * @prop {{ dataSource: DataSource | undefined, numItems: number }} numItems
+ * @prop {{ itemData: SlideData; index: number }} itemData
+ * @prop {{ index: number, itemData: SlideData, instance: PhotoSwipe }} thumbBounds
+ */
+/**
+ * @typedef {Object} PhotoSwipeFiltersMap https://photoswipe.com/filters/
+ *
+ * @prop {(numItems: number, dataSource: DataSource | undefined) => number} numItems
+ * Modify the total amount of slides. Example on Data sources page.
+ * https://photoswipe.com/filters/#numitems
+ *
+ * @prop {(itemData: SlideData, index: number) => SlideData} itemData
+ * Modify slide item data. Example on Data sources page.
+ * https://photoswipe.com/filters/#itemdata
+ *
+ * @prop {(itemData: SlideData, element: HTMLElement, linkEl: HTMLAnchorElement) => SlideData} domItemData
+ * Modify item data when it's parsed from DOM element. Example on Data sources page.
+ * https://photoswipe.com/filters/#domitemdata
+ *
+ * @prop {(clickedIndex: number, e: MouseEvent, instance: PhotoSwipeLightbox) => number} clickedIndex
+ * Modify clicked gallery item index.
+ * https://photoswipe.com/filters/#clickedindex
+ *
+ * @prop {(placeholderSrc: string | false, content: Content) => string | false} placeholderSrc
+ * Modify placeholder image source.
+ * https://photoswipe.com/filters/#placeholdersrc
+ *
+ * @prop {(isContentLoading: boolean, content: Content) => boolean} isContentLoading
+ * Modify if the content is currently loading.
+ * https://photoswipe.com/filters/#iscontentloading
+ *
+ * @prop {(isContentZoomable: boolean, content: Content) => boolean} isContentZoomable
+ * Modify if the content can be zoomed.
+ * https://photoswipe.com/filters/#iscontentzoomable
+ *
+ * @prop {(useContentPlaceholder: boolean, content: Content) => boolean} useContentPlaceholder
+ * Modify if the placeholder should be used for the content.
+ * https://photoswipe.com/filters/#usecontentplaceholder
+ *
+ * @prop {(isKeepingPlaceholder: boolean, content: Content) => boolean} isKeepingPlaceholder
+ * Modify if the placeholder should be kept after the content is loaded.
+ * https://photoswipe.com/filters/#iskeepingplaceholder
+ *
+ *
+ * @prop {(contentErrorElement: HTMLElement, content: Content) => HTMLElement} contentErrorElement
+ * Modify an element when the content has error state (for example, if image cannot be loaded).
+ * https://photoswipe.com/filters/#contenterrorelement
+ *
+ * @prop {(element: HTMLElement, data: UIElementData) => HTMLElement} uiElement
+ * Modify a UI element that's being created.
+ * https://photoswipe.com/filters/#uielement
+ *
+ * @prop {(thumbnail: HTMLElement | null | undefined, itemData: SlideData, index: number) => HTMLElement} thumbEl
+ * Modify the thumbnail element from which opening zoom animation starts or ends.
+ * https://photoswipe.com/filters/#thumbel
+ *
+ * @prop {(thumbBounds: Bounds | undefined, itemData: SlideData, index: number) => Bounds} thumbBounds
+ * Modify the thumbnail bounds from which opening zoom animation starts or ends.
+ * https://photoswipe.com/filters/#thumbbounds
+ *
+ * @prop {(srcsetSizesWidth: number, content: Content) => number} srcsetSizesWidth
+ *
+ * @prop {(preventPointerEvent: boolean, event: PointerEvent, pointerType: string) => boolean} preventPointerEvent
+ *
+ */
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @typedef {{ fn: PhotoSwipeFiltersMap[T], priority: number }} Filter
+ */
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @typedef {PhotoSwipeEventsMap[T] extends undefined ? PhotoSwipeEvent<T> : PhotoSwipeEvent<T> & PhotoSwipeEventsMap[T]} AugmentedEvent
+ */
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @typedef {(event: AugmentedEvent<T>) => void} EventCallback
+ */
+/**
+ * Base PhotoSwipe event object
+ *
+ * @template {keyof PhotoSwipeEventsMap} T
+ */class PhotoSwipeEvent {
+ /**
+ * @param {T} type
+ * @param {PhotoSwipeEventsMap[T]} [details]
+ */
+ constructor(t, e) { this.type = t; this.defaultPrevented = false; e && Object.assign(this, e) } preventDefault() { this.defaultPrevented = true }
+} class Eventable {
+ constructor() {
+ /**
+ * @type {{ [T in keyof PhotoSwipeEventsMap]?: ((event: AugmentedEvent<T>) => void)[] }}
+ */
+ this._listeners = {};
+/**
+ * @type {{ [T in keyof PhotoSwipeFiltersMap]?: Filter<T>[] }}
+ */this._filters = {};
+/** @type {PhotoSwipe | undefined} */this.pswp = void 0;
+/** @type {PhotoSwipeOptions | undefined} */this.options = void 0
+ }
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @param {T} name
+ * @param {PhotoSwipeFiltersMap[T]} fn
+ * @param {number} priority
+ */addFilter(t, e, i = 100) { var s, n, a; this._filters[t] || (this._filters[t] = []); (s = this._filters[t]) === null || s === void 0 || s.push({ fn: e, priority: i }); (n = this._filters[t]) === null || n === void 0 || n.sort(((t, e) => t.priority - e.priority)); (a = this.pswp) === null || a === void 0 || a.addFilter(t, e, i) }
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @param {T} name
+ * @param {PhotoSwipeFiltersMap[T]} fn
+ */removeFilter(t, e) { this._filters[t] && (this._filters[t] = this._filters[t].filter((t => t.fn !== e))); this.pswp && this.pswp.removeFilter(t, e) }
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @param {T} name
+ * @param {Parameters<PhotoSwipeFiltersMap[T]>} args
+ * @returns {Parameters<PhotoSwipeFiltersMap[T]>[0]}
+ */applyFilters(t, ...e) { var i; (i = this._filters[t]) === null || i === void 0 || i.forEach((t => { e[0] = t.fn.apply(this, e) })); return e[0] }
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @param {T} name
+ * @param {EventCallback<T>} fn
+ */on(t, e) { var i, s; this._listeners[t] || (this._listeners[t] = []); (i = this._listeners[t]) === null || i === void 0 || i.push(e); (s = this.pswp) === null || s === void 0 || s.on(t, e) }
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @param {T} name
+ * @param {EventCallback<T>} fn
+ */off(t, e) { var i; this._listeners[t] && (this._listeners[t] = this._listeners[t].filter((t => e !== t))); (i = this.pswp) === null || i === void 0 || i.off(t, e) }
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @param {T} name
+ * @param {PhotoSwipeEventsMap[T]} [details]
+ * @returns {AugmentedEvent<T>}
+ */dispatch(t, e) {
+ var i; if (this.pswp) return this.pswp.dispatch(t, e); const s =
+ /** @type {AugmentedEvent<T>} */
+ new PhotoSwipeEvent(t, e); (i = this._listeners[t]) === null || i === void 0 || i.forEach((t => { t.call(this, s) })); return s
+ }
+} class Placeholder {
+ /**
+ * @param {string | false} imageSrc
+ * @param {HTMLElement} container
+ */
+ constructor(t, e) {
+ /** @type {HTMLImageElement | HTMLDivElement | null} */
+ this.element = createElement("pswp__img pswp__img--placeholder", t ? "img" : "div", e); if (t) {
+ const e =
+ /** @type {HTMLImageElement} */
+ this.element; e.decoding = "async"; e.alt = ""; e.src = t; e.setAttribute("role", "presentation")
+ } this.element.setAttribute("aria-hidden", "true")
+ }
+/**
+ * @param {number} width
+ * @param {number} height
+ */setDisplayedSize(t, e) { if (this.element) if (this.element.tagName === "IMG") { setWidthHeight(this.element, 250, "auto"); this.element.style.transformOrigin = "0 0"; this.element.style.transform = toTransformString(0, 0, t / 250) } else setWidthHeight(this.element, t, e) } destroy() { var t; (t = this.element) !== null && t !== void 0 && t.parentNode && this.element.remove(); this.element = null }
+}
+/** @typedef {import('./slide.js').default} Slide */
+/** @typedef {import('./slide.js').SlideData} SlideData */
+/** @typedef {import('../core/base.js').default} PhotoSwipeBase */
+/** @typedef {import('../util/util.js').LoadState} LoadState */class Content {
+ /**
+ * @param {SlideData} itemData Slide data
+ * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance
+ * @param {number} index
+ */
+ constructor(e, i, s) {
+ this.instance = i; this.data = e; this.index = s;
+/** @type {HTMLImageElement | HTMLDivElement | undefined} */this.element = void 0;
+/** @type {Placeholder | undefined} */this.placeholder = void 0;
+/** @type {Slide | undefined} */this.slide = void 0; this.displayedImageWidth = 0; this.displayedImageHeight = 0; this.width = Number(this.data.w) || Number(this.data.width) || 0; this.height = Number(this.data.h) || Number(this.data.height) || 0; this.isAttached = false; this.hasSlide = false; this.isDecoding = false;
+/** @type {LoadState} */this.state = t.IDLE; this.data.type ? this.type = this.data.type : this.data.src ? this.type = "image" : this.type = "html"; this.instance.dispatch("contentInit", { content: this })
+ } removePlaceholder() { this.placeholder && !this.keepPlaceholder() && setTimeout((() => { if (this.placeholder) { this.placeholder.destroy(); this.placeholder = void 0 } }), 1e3) }
+/**
+ * Preload content
+ *
+ * @param {boolean} isLazy
+ * @param {boolean} [reload]
+ */load(t, e) { if (this.slide && this.usePlaceholder()) if (this.placeholder) { const t = this.placeholder.element; t && !t.parentElement && this.slide.container.prepend(t) } else { const t = this.instance.applyFilters("placeholderSrc", !(!this.data.msrc || !this.slide.isFirstSlide) && this.data.msrc, this); this.placeholder = new Placeholder(t, this.slide.container) } if ((!this.element || e) && !this.instance.dispatch("contentLoad", { content: this, isLazy: t }).defaultPrevented) { if (this.isImageContent()) { this.element = createElement("pswp__img", "img"); this.displayedImageWidth && this.loadImage(t) } else { this.element = createElement("pswp__content", "div"); this.element.innerHTML = this.data.html || "" } e && this.slide && this.slide.updateContentSize(true) } }
+/**
+ * Preload image
+ *
+ * @param {boolean} isLazy
+ */loadImage(e) {
+ var i, s; if (!this.isImageContent() || !this.element || this.instance.dispatch("contentLoadImage", { content: this, isLazy: e }).defaultPrevented) return; const n =
+ /** @type HTMLImageElement */
+ this.element; this.updateSrcsetSizes(); this.data.srcset && (n.srcset = this.data.srcset); n.src = (i = this.data.src) !== null && i !== void 0 ? i : ""; n.alt = (s = this.data.alt) !== null && s !== void 0 ? s : ""; this.state = t.LOADING; if (n.complete) this.onLoaded(); else { n.onload = () => { this.onLoaded() }; n.onerror = () => { this.onError() } }
+ }
+/**
+ * Assign slide to content
+ *
+ * @param {Slide} slide
+ */setSlide(t) { this.slide = t; this.hasSlide = true; this.instance = t.pswp } onLoaded() { this.state = t.LOADED; if (this.slide && this.element) { this.instance.dispatch("loadComplete", { slide: this.slide, content: this }); if (this.slide.isActive && this.slide.heavyAppended && !this.element.parentNode) { this.append(); this.slide.updateContentSize(true) } this.state !== t.LOADED && this.state !== t.ERROR || this.removePlaceholder() } } onError() { this.state = t.ERROR; if (this.slide) { this.displayError(); this.instance.dispatch("loadComplete", { slide: this.slide, isError: true, content: this }); this.instance.dispatch("loadError", { slide: this.slide, content: this }) } }
+/**
+ * @returns {Boolean} If the content is currently loading
+ */isLoading() { return this.instance.applyFilters("isContentLoading", this.state === t.LOADING, this) }
+/**
+ * @returns {Boolean} If the content is in error state
+ */isError() { return this.state === t.ERROR }
+/**
+ * @returns {boolean} If the content is image
+ */isImageContent() { return this.type === "image" }
+/**
+ * Update content size
+ *
+ * @param {Number} width
+ * @param {Number} height
+ */setDisplayedSize(t, e) { if (this.element) { this.placeholder && this.placeholder.setDisplayedSize(t, e); if (!this.instance.dispatch("contentResize", { content: this, width: t, height: e }).defaultPrevented) { setWidthHeight(this.element, t, e); if (this.isImageContent() && !this.isError()) { const i = !this.displayedImageWidth && t; this.displayedImageWidth = t; this.displayedImageHeight = e; i ? this.loadImage(false) : this.updateSrcsetSizes(); this.slide && this.instance.dispatch("imageSizeChange", { slide: this.slide, width: t, height: e, content: this }) } } } }
+/**
+ * @returns {boolean} If the content can be zoomed
+ */isZoomable() { return this.instance.applyFilters("isContentZoomable", this.isImageContent() && this.state !== t.ERROR, this) } updateSrcsetSizes() {
+ if (!this.isImageContent() || !this.element || !this.data.srcset) return; const t =
+ /** @type HTMLImageElement */
+ this.element; const e = this.instance.applyFilters("srcsetSizesWidth", this.displayedImageWidth, this); if (!t.dataset.largestUsedSize || e > parseInt(t.dataset.largestUsedSize, 10)) { t.sizes = e + "px"; t.dataset.largestUsedSize = String(e) }
+ }
+/**
+ * @returns {boolean} If content should use a placeholder (from msrc by default)
+ */usePlaceholder() { return this.instance.applyFilters("useContentPlaceholder", this.isImageContent(), this) } lazyLoad() { this.instance.dispatch("contentLazyLoad", { content: this }).defaultPrevented || this.load(true) }
+/**
+ * @returns {boolean} If placeholder should be kept after content is loaded
+ */keepPlaceholder() { return this.instance.applyFilters("isKeepingPlaceholder", this.isLoading(), this) } destroy() { this.hasSlide = false; this.slide = void 0; if (!this.instance.dispatch("contentDestroy", { content: this }).defaultPrevented) { this.remove(); if (this.placeholder) { this.placeholder.destroy(); this.placeholder = void 0 } if (this.isImageContent() && this.element) { this.element.onload = null; this.element.onerror = null; this.element = void 0 } } } displayError() {
+ if (this.slide) {
+ var t, e; let i = createElement("pswp__error-msg", "div"); i.innerText = (t = (e = this.instance.options) === null || e === void 0 ? void 0 : e.errorMsg) !== null && t !== void 0 ? t : ""; i =
+ /** @type {HTMLDivElement} */
+ this.instance.applyFilters("contentErrorElement", i, this); this.element = createElement("pswp__content pswp__error-msg-container", "div"); this.element.appendChild(i); this.slide.container.innerText = ""; this.slide.container.appendChild(this.element); this.slide.updateContentSize(true); this.removePlaceholder()
+ }
+ } append() {
+ if (this.isAttached || !this.element) return; this.isAttached = true; if (this.state === t.ERROR) { this.displayError(); return } if (this.instance.dispatch("contentAppend", { content: this }).defaultPrevented) return; const e = "decode" in this.element; if (this.isImageContent()) if (e && this.slide && (!this.slide.isActive || isSafari())) {
+ this.isDecoding = true;
+/** @type {HTMLImageElement} */this.element.decode().catch((() => { })).finally((() => { this.isDecoding = false; this.appendImage() }))
+ } else this.appendImage(); else this.slide && !this.element.parentNode && this.slide.container.appendChild(this.element)
+ } activate() { if (!this.instance.dispatch("contentActivate", { content: this }).defaultPrevented && this.slide) { this.isImageContent() && this.isDecoding && !isSafari() ? this.appendImage() : this.isError() && this.load(false, true); this.slide.holderElement && this.slide.holderElement.setAttribute("aria-hidden", "false") } } deactivate() { this.instance.dispatch("contentDeactivate", { content: this }); this.slide && this.slide.holderElement && this.slide.holderElement.setAttribute("aria-hidden", "true") } remove() { this.isAttached = false; if (!this.instance.dispatch("contentRemove", { content: this }).defaultPrevented) { this.element && this.element.parentNode && this.element.remove(); this.placeholder && this.placeholder.element && this.placeholder.element.remove() } } appendImage() { if (this.isAttached && !this.instance.dispatch("contentAppendImage", { content: this }).defaultPrevented) { this.slide && this.element && !this.element.parentNode && this.slide.container.appendChild(this.element); this.state !== t.LOADED && this.state !== t.ERROR || this.removePlaceholder() } }
+}
+/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
+/** @typedef {import('../core/base.js').default} PhotoSwipeBase */
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {import('../slide/slide.js').SlideData} SlideData */
+/**
+ * @param {PhotoSwipeOptions} options
+ * @param {PhotoSwipeBase} pswp
+ * @returns {Point}
+ */function getViewportSize(t, e) { if (t.getViewportSizeFn) { const i = t.getViewportSizeFn(t, e); if (i) return i } return { x: document.documentElement.clientWidth, y: window.innerHeight } }
+/**
+ * Parses padding option.
+ * Supported formats:
+ *
+ * // Object
+ * padding: {
+ * top: 0,
+ * bottom: 0,
+ * left: 0,
+ * right: 0
+ * }
+ *
+ * // A function that returns the object
+ * paddingFn: (viewportSize, itemData, index) => {
+ * return {
+ * top: 0,
+ * bottom: 0,
+ * left: 0,
+ * right: 0
+ * };
+ * }
+ *
+ * // Legacy variant
+ * paddingLeft: 0,
+ * paddingRight: 0,
+ * paddingTop: 0,
+ * paddingBottom: 0,
+ *
+ * @param {'left' | 'top' | 'bottom' | 'right'} prop
+ * @param {PhotoSwipeOptions} options PhotoSwipe options
+ * @param {Point} viewportSize PhotoSwipe viewport size, for example: { x:800, y:600 }
+ * @param {SlideData} itemData Data about the slide
+ * @param {number} index Slide index
+ * @returns {number}
+ */function parsePaddingOption(t, e, i, s, n) { let a = 0; if (e.paddingFn) a = e.paddingFn(i, s, n)[t]; else if (e.padding) a = e.padding[t]; else { const i = "padding" + t[0].toUpperCase() + t.slice(1); e[i] && (a = e[i]) } return Number(a) || 0 }
+/**
+ * @param {PhotoSwipeOptions} options
+ * @param {Point} viewportSize
+ * @param {SlideData} itemData
+ * @param {number} index
+ * @returns {Point}
+ */function getPanAreaSize(t, e, i, s) { return { x: e.x - parsePaddingOption("left", t, e, i, s) - parsePaddingOption("right", t, e, i, s), y: e.y - parsePaddingOption("top", t, e, i, s) - parsePaddingOption("bottom", t, e, i, s) } } const e = 4e3;
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {import('../slide/slide.js').SlideData} SlideData */
+/** @typedef {'fit' | 'fill' | number | ((zoomLevelObject: ZoomLevel) => number)} ZoomLevelOption */class ZoomLevel {
+ /**
+ * @param {PhotoSwipeOptions} options PhotoSwipe options
+ * @param {SlideData} itemData Slide data
+ * @param {number} index Slide index
+ * @param {PhotoSwipe} [pswp] PhotoSwipe instance, can be undefined if not initialized yet
+ */
+ constructor(t, e, i, s) {
+ this.pswp = s; this.options = t; this.itemData = e; this.index = i;
+/** @type { Point | null } */this.panAreaSize = null;
+/** @type { Point | null } */this.elementSize = null; this.fit = 1; this.fill = 1; this.vFill = 1; this.initial = 1; this.secondary = 1; this.max = 1; this.min = 1
+ }
+/**
+ * Calculate initial, secondary and maximum zoom level for the specified slide.
+ *
+ * It should be called when either image or viewport size changes.
+ *
+ * @param {number} maxWidth
+ * @param {number} maxHeight
+ * @param {Point} panAreaSize
+ */update(t, e, i) {
+ /** @type {Point} */
+ const s = { x: t, y: e }; this.elementSize = s; this.panAreaSize = i; const n = i.x / s.x; const a = i.y / s.y; this.fit = Math.min(1, n < a ? n : a); this.fill = Math.min(1, n > a ? n : a); this.vFill = Math.min(1, a); this.initial = this._getInitial(); this.secondary = this._getSecondary(); this.max = Math.max(this.initial, this.secondary, this._getMax()); this.min = Math.min(this.fit, this.initial, this.secondary); this.pswp && this.pswp.dispatch("zoomLevelsUpdate", { zoomLevels: this, slideData: this.itemData })
+ }
+/**
+ * Parses user-defined zoom option.
+ *
+ * @private
+ * @param {'initial' | 'secondary' | 'max'} optionPrefix Zoom level option prefix (initial, secondary, max)
+ * @returns { number | undefined }
+ */_parseZoomLevelOption(t) {
+ const e =
+ /** @type {'initialZoomLevel' | 'secondaryZoomLevel' | 'maxZoomLevel'} */
+ t + "ZoomLevel"; const i = this.options[e]; if (i) return typeof i === "function" ? i(this) : i === "fill" ? this.fill : i === "fit" ? this.fit : Number(i)
+ } _getSecondary() { let t = this._parseZoomLevelOption("secondary"); if (t) return t; t = Math.min(1, this.fit * 3); this.elementSize && t * this.elementSize.x > e && (t = e / this.elementSize.x); return t } _getInitial() { return this._parseZoomLevelOption("initial") || this.fit } _getMax() { return this._parseZoomLevelOption("max") || Math.max(1, this.fit * 4) }
+}
+/**
+ * Lazy-load an image
+ * This function is used both by Lightbox and PhotoSwipe core,
+ * thus it can be called before dialog is opened.
+ *
+ * @param {SlideData} itemData Data about the slide
+ * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance
+ * @param {number} index
+ * @returns {Content} Image that is being decoded or false.
+ */function lazyLoadData(t, e, i) {
+ const s = e.createContentFromData(t, i);
+/** @type {ZoomLevel | undefined} */let n; const { options: a } = e; if (a) { n = new ZoomLevel(a, t, -1); let l; l = e.pswp ? e.pswp.viewportSize : getViewportSize(a, e); const o = getPanAreaSize(a, l, t, i); n.update(s.width, s.height, o) } s.lazyLoad(); n && s.setDisplayedSize(Math.ceil(s.width * n.initial), Math.ceil(s.height * n.initial)); return s
+}
+/**
+ * Lazy-loads specific slide.
+ * This function is used both by Lightbox and PhotoSwipe core,
+ * thus it can be called before dialog is opened.
+ *
+ * By default, it loads image based on viewport size and initial zoom level.
+ *
+ * @param {number} index Slide index
+ * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox eventable instance
+ * @returns {Content | undefined}
+ */function lazyLoadSlide(t, e) { const i = e.getItemData(t); if (!e.dispatch("lazyLoadSlide", { index: t, itemData: i }).defaultPrevented) return lazyLoadData(i, e, t) }
+/** @typedef {import("../photoswipe.js").default} PhotoSwipe */
+/** @typedef {import("../slide/slide.js").SlideData} SlideData */class PhotoSwipeBase extends Eventable {
+ /**
+ * Get total number of slides
+ *
+ * @returns {number}
+ */
+ getNumItems() { var t; let e = 0; const i = (t = this.options) === null || t === void 0 ? void 0 : t.dataSource; if (i && "length" in i) e = i.length; else if (i && "gallery" in i) { i.items || (i.items = this._getGalleryDOMElements(i.gallery)); i.items && (e = i.items.length) } const s = this.dispatch("numItems", { dataSource: i, numItems: e }); return this.applyFilters("numItems", s.numItems, i) }
+/**
+ * @param {SlideData} slideData
+ * @param {number} index
+ * @returns {Content}
+ */createContentFromData(t, e) { return new Content(t, this, e) }
+/**
+ * Get item data by index.
+ *
+ * "item data" should contain normalized information that PhotoSwipe needs to generate a slide.
+ * For example, it may contain properties like
+ * `src`, `srcset`, `w`, `h`, which will be used to generate a slide with image.
+ *
+ * @param {number} index
+ * @returns {SlideData}
+ */getItemData(t) {
+ var e; const i = (e = this.options) === null || e === void 0 ? void 0 : e.dataSource;
+/** @type {SlideData | HTMLElement} */let s = {}; if (Array.isArray(i)) s = i[t]; else if (i && "gallery" in i) { i.items || (i.items = this._getGalleryDOMElements(i.gallery)); s = i.items[t] } let n = s; n instanceof Element && (n = this._domElementToItemData(n)); const a = this.dispatch("itemData", { itemData: n || {}, index: t }); return this.applyFilters("itemData", a.itemData, t)
+ }
+/**
+ * Get array of gallery DOM elements,
+ * based on childSelector and gallery element.
+ *
+ * @param {HTMLElement} galleryElement
+ * @returns {HTMLElement[]}
+ */_getGalleryDOMElements(t) { var e, i; return (e = this.options) !== null && e !== void 0 && e.children || (i = this.options) !== null && i !== void 0 && i.childSelector ? getElementsFromOption(this.options.children, this.options.childSelector, t) || [] : [t] }
+/**
+ * Converts DOM element to item data object.
+ *
+ * @param {HTMLElement} element DOM element
+ * @returns {SlideData}
+ */_domElementToItemData(t) {
+ /** @type {SlideData} */
+ const e = { element: t }; const i =
+ /** @type {HTMLAnchorElement} */
+ t.tagName === "A" ? t : t.querySelector("a"); if (i) { e.src = i.dataset.pswpSrc || i.href; i.dataset.pswpSrcset && (e.srcset = i.dataset.pswpSrcset); e.width = i.dataset.pswpWidth ? parseInt(i.dataset.pswpWidth, 10) : 0; e.height = i.dataset.pswpHeight ? parseInt(i.dataset.pswpHeight, 10) : 0; e.w = e.width; e.h = e.height; i.dataset.pswpType && (e.type = i.dataset.pswpType); const n = t.querySelector("img"); if (n) { var s; e.msrc = n.currentSrc || n.src; e.alt = (s = n.getAttribute("alt")) !== null && s !== void 0 ? s : "" } (i.dataset.pswpCropped || i.dataset.cropped) && (e.thumbCropped = true) } return this.applyFilters("domItemData", e, t, i)
+ }
+/**
+ * Lazy-load by slide data
+ *
+ * @param {SlideData} itemData Data about the slide
+ * @param {number} index
+ * @returns {Content} Image that is being decoded or false.
+ */lazyLoadData(t, e) { return lazyLoadData(t, this, e) }
+}
+/**
+ * @template T
+ * @typedef {import('../types.js').Type<T>} Type<T>
+ */
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
+/** @typedef {import('../photoswipe.js').DataSource} DataSource */
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {import('../slide/content.js').default} Content */
+/** @typedef {import('../core/eventable.js').PhotoSwipeEventsMap} PhotoSwipeEventsMap */
+/** @typedef {import('../core/eventable.js').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @typedef {import('../core/eventable.js').EventCallback<T>} EventCallback<T>
+ */class PhotoSwipeLightbox extends PhotoSwipeBase {
+ /**
+ * @param {PhotoSwipeOptions} [options]
+ */
+ constructor(t) {
+ super();
+/** @type {PhotoSwipeOptions} */this.options = t || {}; this._uid = 0; this.shouldOpen = false;
+/**
+ * @private
+ * @type {Content | undefined}
+ */this._preloadedContent = void 0; this.onThumbnailsClick = this.onThumbnailsClick.bind(this)
+ } init() { getElementsFromOption(this.options.gallery, this.options.gallerySelector).forEach((t => { t.addEventListener("click", this.onThumbnailsClick, false) })) }
+/**
+ * @param {MouseEvent} e
+ */onThumbnailsClick(t) {
+ if (specialKeyUsed(t) || window.pswp) return;
+/** @type {Point | null} */let e = { x: t.clientX, y: t.clientY }; e.x || e.y || (e = null); let i = this.getClickedIndex(t); i = this.applyFilters("clickedIndex", i, t, this);
+/** @type {DataSource} */const s = {
+ gallery:
+ /** @type {HTMLElement} */
+ t.currentTarget
+ }; if (i >= 0) { t.preventDefault(); this.loadAndOpen(i, s, e) }
+ }
+/**
+ * Get index of gallery item that was clicked.
+ *
+ * @param {MouseEvent} e click event
+ * @returns {number}
+ */getClickedIndex(t) {
+ if (this.options.getClickedIndexFn) return this.options.getClickedIndexFn.call(this, t); const e =
+ /** @type {HTMLElement} */
+ t.target; const i = getElementsFromOption(this.options.children, this.options.childSelector,
+ /** @type {HTMLElement} */
+ t.currentTarget); const s = i.findIndex((t => t === e || t.contains(e))); return s !== -1 ? s : this.options.children || this.options.childSelector ? -1 : 0
+ }
+/**
+ * Load and open PhotoSwipe
+ *
+ * @param {number} index
+ * @param {DataSource} [dataSource]
+ * @param {Point | null} [initialPoint]
+ * @returns {boolean}
+ */loadAndOpen(t, e, i) { if (window.pswp || !this.options) return false; if (!e && this.options.gallery && this.options.children) { const t = getElementsFromOption(this.options.gallery); t[0] && (e = { gallery: t[0] }) } this.options.index = t; this.options.initialPointerPos = i; this.shouldOpen = true; this.preload(t, e); return true }
+/**
+ * Load the main module and the slide content by index
+ *
+ * @param {number} index
+ * @param {DataSource} [dataSource]
+ */preload(t, e) {
+ const { options: i } = this; e && (i.dataSource = e);
+/** @type {Promise<Type<PhotoSwipe>>[]} */const s = []; const n = typeof i.pswpModule; if (isPswpClass(i.pswpModule)) s.push(Promise.resolve(
+ /** @type {Type<PhotoSwipe>} */
+ i.pswpModule)); else {
+ if (n === "string") throw new Error("pswpModule as string is no longer supported"); if (n !== "function") throw new Error("pswpModule is not valid"); s.push(
+ /** @type {() => Promise<Type<PhotoSwipe>>} */
+ i.pswpModule())
+ } typeof i.openPromise === "function" && s.push(i.openPromise()); i.preloadFirstSlide !== false && t >= 0 && (this._preloadedContent = lazyLoadSlide(t, this)); const a = ++this._uid; Promise.all(s).then((t => { if (this.shouldOpen) { const e = t[0]; this._openPhotoswipe(e, a) } }))
+ }
+/**
+ * @private
+ * @param {Type<PhotoSwipe> | { default: Type<PhotoSwipe> }} module
+ * @param {number} uid
+ */_openPhotoswipe(t, e) {
+ if (e !== this._uid && this.shouldOpen) return; this.shouldOpen = false; if (window.pswp) return;
+/**
+ * Pass data to PhotoSwipe and open init
+ *
+ * @type {PhotoSwipe}
+ */const i = typeof t === "object" ? new t.default(this.options) : new t(this.options); this.pswp = i; window.pswp = i;
+/** @type {(keyof PhotoSwipeEventsMap)[]} */Object.keys(this._listeners).forEach((t => {
+ var e; (e = this._listeners[t]) === null || e === void 0 || e.forEach((e => {
+ i.on(t,
+ /** @type {EventCallback<typeof name>} */
+ e)
+ }))
+ }));
+/** @type {(keyof PhotoSwipeFiltersMap)[]} */Object.keys(this._filters).forEach((t => { var e; (e = this._filters[t]) === null || e === void 0 || e.forEach((e => { i.addFilter(t, e.fn, e.priority) })) })); if (this._preloadedContent) { i.contentLoader.addToCache(this._preloadedContent); this._preloadedContent = void 0 } i.on("destroy", (() => { this.pswp = void 0; delete window.pswp })); i.init()
+ } destroy() { var t; (t = this.pswp) === null || t === void 0 || t.destroy(); this.shouldOpen = false; this._listeners = {}; getElementsFromOption(this.options.gallery, this.options.gallerySelector).forEach((t => { t.removeEventListener("click", this.onThumbnailsClick, false) })) }
+} export { PhotoSwipeLightbox as default };
+//# sourceMappingURL=photoswipe-lightbox.esm.js.map
diff --git a/storefront/vendor/javascript/photoswipe.js b/storefront/vendor/javascript/photoswipe.js
new file mode 100644
index 0000000000..52f7d9540e
--- /dev/null
+++ b/storefront/vendor/javascript/photoswipe.js
@@ -0,0 +1,1675 @@
+// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/photoswipe.esm.js
+
+/** @typedef {import('../photoswipe.js').Point} Point */
+/**
+ * @template {keyof HTMLElementTagNameMap} T
+ * @param {string} className
+ * @param {T} tagName
+ * @param {Node} [appendToEl]
+ * @returns {HTMLElementTagNameMap[T]}
+ */
+function createElement(t,e,i){const s=document.createElement(e);t&&(s.className=t);i&&i.appendChild(s);return s}
+/**
+ * @param {Point} p1
+ * @param {Point} p2
+ * @returns {Point}
+ */function equalizePoints(t,e){t.x=e.x;t.y=e.y;e.id!==void 0&&(t.id=e.id);return t}
+/**
+ * @param {Point} p
+ */function roundPoint(t){t.x=Math.round(t.x);t.y=Math.round(t.y)}
+/**
+ * Returns distance between two points.
+ *
+ * @param {Point} p1
+ * @param {Point} p2
+ * @returns {number}
+ */function getDistanceBetween(t,e){const i=Math.abs(t.x-e.x);const s=Math.abs(t.y-e.y);return Math.sqrt(i*i+s*s)}
+/**
+ * Whether X and Y positions of points are equal
+ *
+ * @param {Point} p1
+ * @param {Point} p2
+ * @returns {boolean}
+ */function pointsEqual(t,e){return t.x===e.x&&t.y===e.y}
+/**
+ * The float result between the min and max values.
+ *
+ * @param {number} val
+ * @param {number} min
+ * @param {number} max
+ * @returns {number}
+ */function clamp(t,e,i){return Math.min(Math.max(t,e),i)}
+/**
+ * Get transform string
+ *
+ * @param {number} x
+ * @param {number} [y]
+ * @param {number} [scale]
+ * @returns {string}
+ */function toTransformString(t,e,i){let s=`translate3d(${t}px,${e||0}px,0)`;i!==void 0&&(s+=` scale3d(${i},${i},1)`);return s}
+/**
+ * Apply transform:translate(x, y) scale(scale) to element
+ *
+ * @param {HTMLElement} el
+ * @param {number} x
+ * @param {number} [y]
+ * @param {number} [scale]
+ */function setTransform(t,e,i,s){t.style.transform=toTransformString(e,i,s)}const t="cubic-bezier(.4,0,.22,1)";
+/**
+ * Apply CSS transition to element
+ *
+ * @param {HTMLElement} el
+ * @param {string} [prop] CSS property to animate
+ * @param {number} [duration] in ms
+ * @param {string} [ease] CSS easing function
+ */function setTransitionStyle(e,i,s,n){e.style.transition=i?`${i} ${s}ms ${n||t}`:"none"}
+/**
+ * Apply width and height CSS properties to element
+ *
+ * @param {HTMLElement} el
+ * @param {string | number} w
+ * @param {string | number} h
+ */function setWidthHeight(t,e,i){t.style.width=typeof e==="number"?`${e}px`:e;t.style.height=typeof i==="number"?`${i}px`:i}
+/**
+ * @param {HTMLElement} el
+ */function removeTransitionStyle(t){setTransitionStyle(t)}
+/**
+ * @param {HTMLImageElement} img
+ * @returns {Promise<HTMLImageElement | void>}
+ */function decodeImage(t){return"decode"in t?t.decode().catch((()=>{})):t.complete?Promise.resolve(t):new Promise(((e,i)=>{t.onload=()=>e(t);t.onerror=i}))}
+/** @typedef {LOAD_STATE[keyof LOAD_STATE]} LoadState */
+/** @type {{ IDLE: 'idle'; LOADING: 'loading'; LOADED: 'loaded'; ERROR: 'error' }} */const e={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};
+/**
+ * Check if click or keydown event was dispatched
+ * with a special key or via mouse wheel.
+ *
+ * @param {MouseEvent | KeyboardEvent} e
+ * @returns {boolean}
+ */function specialKeyUsed(t){return"button"in t&&t.button===1||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}
+/**
+ * Parse `gallery` or `children` options.
+ *
+ * @param {import('../photoswipe.js').ElementProvider} [option]
+ * @param {string} [legacySelector]
+ * @param {HTMLElement | Document} [parent]
+ * @returns HTMLElement[]
+ */function getElementsFromOption(t,e,i=document){
+/** @type {HTMLElement[]} */
+let s=[];if(t instanceof Element)s=[t];else if(t instanceof NodeList||Array.isArray(t))s=Array.from(t);else{const n=typeof t==="string"?t:e;n&&(s=Array.from(i.querySelectorAll(n)))}return s}
+/**
+ * Check if browser is Safari
+ *
+ * @returns {boolean}
+ */function isSafari(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}let i=false;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{i=true}}))}catch(t){}
+/**
+ * @typedef {Object} PoolItem
+ * @prop {HTMLElement | Window | Document | undefined | null} target
+ * @prop {string} type
+ * @prop {EventListenerOrEventListenerObject} listener
+ * @prop {boolean} [passive]
+ */class DOMEvents{constructor(){
+/**
+ * @type {PoolItem[]}
+ * @private
+ */
+this._pool=[]}
+/**
+ * Adds event listeners
+ *
+ * @param {PoolItem['target']} target
+ * @param {PoolItem['type']} type Can be multiple, separated by space.
+ * @param {PoolItem['listener']} listener
+ * @param {PoolItem['passive']} [passive]
+ */add(t,e,i,s){this._toggleListener(t,e,i,s)}
+/**
+ * Removes event listeners
+ *
+ * @param {PoolItem['target']} target
+ * @param {PoolItem['type']} type
+ * @param {PoolItem['listener']} listener
+ * @param {PoolItem['passive']} [passive]
+ */remove(t,e,i,s){this._toggleListener(t,e,i,s,true)}removeAll(){this._pool.forEach((t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,true,true)}));this._pool=[]}
+/**
+ * Adds or removes event
+ *
+ * @private
+ * @param {PoolItem['target']} target
+ * @param {PoolItem['type']} type
+ * @param {PoolItem['listener']} listener
+ * @param {PoolItem['passive']} [passive]
+ * @param {boolean} [unbind] Whether the event should be added or removed
+ * @param {boolean} [skipPool] Whether events pool should be skipped
+ */_toggleListener(t,e,s,n,o,a){if(!t)return;const r=o?"removeEventListener":"addEventListener";const h=e.split(" ");h.forEach((e=>{if(e){a||(o?this._pool=this._pool.filter((i=>i.type!==e||i.listener!==s||i.target!==t)):this._pool.push({target:t,type:e,listener:s,passive:n}));const h=!!i&&{passive:n||false};t[r](e,s,h)}}))}}
+/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
+/** @typedef {import('../core/base.js').default} PhotoSwipeBase */
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {import('../slide/slide.js').SlideData} SlideData */
+/**
+ * @param {PhotoSwipeOptions} options
+ * @param {PhotoSwipeBase} pswp
+ * @returns {Point}
+ */function getViewportSize(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}
+/**
+ * Parses padding option.
+ * Supported formats:
+ *
+ * // Object
+ * padding: {
+ * top: 0,
+ * bottom: 0,
+ * left: 0,
+ * right: 0
+ * }
+ *
+ * // A function that returns the object
+ * paddingFn: (viewportSize, itemData, index) => {
+ * return {
+ * top: 0,
+ * bottom: 0,
+ * left: 0,
+ * right: 0
+ * };
+ * }
+ *
+ * // Legacy variant
+ * paddingLeft: 0,
+ * paddingRight: 0,
+ * paddingTop: 0,
+ * paddingBottom: 0,
+ *
+ * @param {'left' | 'top' | 'bottom' | 'right'} prop
+ * @param {PhotoSwipeOptions} options PhotoSwipe options
+ * @param {Point} viewportSize PhotoSwipe viewport size, for example: { x:800, y:600 }
+ * @param {SlideData} itemData Data about the slide
+ * @param {number} index Slide index
+ * @returns {number}
+ */function parsePaddingOption(t,e,i,s,n){let o=0;if(e.paddingFn)o=e.paddingFn(i,s,n)[t];else if(e.padding)o=e.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);e[i]&&(o=e[i])}return Number(o)||0}
+/**
+ * @param {PhotoSwipeOptions} options
+ * @param {Point} viewportSize
+ * @param {SlideData} itemData
+ * @param {number} index
+ * @returns {Point}
+ */function getPanAreaSize(t,e,i,s){return{x:e.x-parsePaddingOption("left",t,e,i,s)-parsePaddingOption("right",t,e,i,s),y:e.y-parsePaddingOption("top",t,e,i,s)-parsePaddingOption("bottom",t,e,i,s)}}
+/** @typedef {import('./slide.js').default} Slide */
+/** @typedef {Record<Axis, number>} Point */
+/** @typedef {'x' | 'y'} Axis */class PanBounds{
+/**
+ * @param {Slide} slide
+ */
+constructor(t){this.slide=t;this.currZoomLevel=1;this.center=
+/** @type {Point} */
+{x:0,y:0};this.max=
+/** @type {Point} */
+{x:0,y:0};this.min=
+/** @type {Point} */
+{x:0,y:0}}
+/**
+ * _getItemBounds
+ *
+ * @param {number} currZoomLevel
+ */update(t){this.currZoomLevel=t;if(this.slide.width){this._updateAxis("x");this._updateAxis("y");this.slide.pswp.dispatch("calcBounds",{slide:this.slide})}else this.reset()}
+/**
+ * _calculateItemBoundsForAxis
+ *
+ * @param {Axis} axis
+ */_updateAxis(t){const{pswp:e}=this.slide;const i=this.slide[t==="x"?"width":"height"]*this.currZoomLevel;const s=t==="x"?"left":"top";const n=parsePaddingOption(s,e.options,e.viewportSize,this.slide.data,this.slide.index);const o=this.slide.panAreaSize[t];this.center[t]=Math.round((o-i)/2)+n;this.max[t]=i>o?Math.round(o-i)+n:this.center[t];this.min[t]=i>o?n:this.center[t]}reset(){this.center.x=0;this.center.y=0;this.max.x=0;this.max.y=0;this.min.x=0;this.min.y=0}
+/**
+ * Correct pan position if it's beyond the bounds
+ *
+ * @param {Axis} axis x or y
+ * @param {number} panOffset
+ * @returns {number}
+ */correctPan(t,e){return clamp(e,this.max[t],this.min[t])}}const s=4e3;
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {import('../slide/slide.js').SlideData} SlideData */
+/** @typedef {'fit' | 'fill' | number | ((zoomLevelObject: ZoomLevel) => number)} ZoomLevelOption */class ZoomLevel{
+/**
+ * @param {PhotoSwipeOptions} options PhotoSwipe options
+ * @param {SlideData} itemData Slide data
+ * @param {number} index Slide index
+ * @param {PhotoSwipe} [pswp] PhotoSwipe instance, can be undefined if not initialized yet
+ */
+constructor(t,e,i,s){this.pswp=s;this.options=t;this.itemData=e;this.index=i;
+/** @type { Point | null } */this.panAreaSize=null;
+/** @type { Point | null } */this.elementSize=null;this.fit=1;this.fill=1;this.vFill=1;this.initial=1;this.secondary=1;this.max=1;this.min=1}
+/**
+ * Calculate initial, secondary and maximum zoom level for the specified slide.
+ *
+ * It should be called when either image or viewport size changes.
+ *
+ * @param {number} maxWidth
+ * @param {number} maxHeight
+ * @param {Point} panAreaSize
+ */update(t,e,i){
+/** @type {Point} */
+const s={x:t,y:e};this.elementSize=s;this.panAreaSize=i;const n=i.x/s.x;const o=i.y/s.y;this.fit=Math.min(1,n<o?n:o);this.fill=Math.min(1,n>o?n:o);this.vFill=Math.min(1,o);this.initial=this._getInitial();this.secondary=this._getSecondary();this.max=Math.max(this.initial,this.secondary,this._getMax());this.min=Math.min(this.fit,this.initial,this.secondary);this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}
+/**
+ * Parses user-defined zoom option.
+ *
+ * @private
+ * @param {'initial' | 'secondary' | 'max'} optionPrefix Zoom level option prefix (initial, secondary, max)
+ * @returns { number | undefined }
+ */_parseZoomLevelOption(t){const e=
+/** @type {'initialZoomLevel' | 'secondaryZoomLevel' | 'maxZoomLevel'} */
+t+"ZoomLevel";const i=this.options[e];if(i)return typeof i==="function"?i(this):i==="fill"?this.fill:i==="fit"?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");if(t)return t;t=Math.min(1,this.fit*3);this.elementSize&&t*this.elementSize.x>s&&(t=s/this.elementSize.x);return t}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}}
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */class Slide{
+/**
+ * @param {SlideData} data
+ * @param {number} index
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t,e,i){this.data=t;this.index=e;this.pswp=i;this.isActive=e===i.currIndex;this.currentResolution=0;
+/** @type {Point} */this.panAreaSize={x:0,y:0};
+/** @type {Point} */this.pan={x:0,y:0};this.isFirstSlide=this.isActive&&!i.opener.isOpen;this.zoomLevels=new ZoomLevel(i.options,t,e,i);this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:e});this.content=this.pswp.contentLoader.getContentBySlide(this);this.container=createElement("pswp__zoom-wrap","div");
+/** @type {HTMLElement | null} */this.holderElement=null;this.currZoomLevel=1;
+/** @type {number} */this.width=this.content.width;
+/** @type {number} */this.height=this.content.height;this.heavyAppended=false;this.bounds=new PanBounds(this);this.prevDisplayedWidth=-1;this.prevDisplayedHeight=-1;this.pswp.dispatch("slideInit",{slide:this})}
+/**
+ * If this slide is active/current/visible
+ *
+ * @param {boolean} isActive
+ */setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}
+/**
+ * Appends slide content to DOM
+ *
+ * @param {HTMLElement} holderElement
+ */append(t){this.holderElement=t;this.container.style.transformOrigin="0 0";if(this.data){this.calculateSize();this.load();this.updateContentSize();this.appendHeavy();this.holderElement.appendChild(this.container);this.zoomAndPanToInitial();this.pswp.dispatch("firstZoomPan",{slide:this});this.applyCurrentZoomPan();this.pswp.dispatch("afterSetContent",{slide:this});this.isActive&&this.activate()}}load(){this.content.load(false);this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){const{pswp:t}=this;const e=true;if(!this.heavyAppended&&t.opener.isOpen&&!t.mainScroll.isShifted()&&(this.isActive||e)&&!this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented){this.heavyAppended=true;this.content.append();this.pswp.dispatch("appendHeavyContent",{slide:this})}}activate(){this.isActive=true;this.appendHeavy();this.content.activate();this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=false;this.content.deactivate();this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize();this.currentResolution=0;this.zoomAndPanToInitial();this.applyCurrentZoomPan();this.updateContentSize();this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=false;this.content.remove();this.container.remove();this.pswp.dispatch("slideDestroy",{slide:this})}resize(){if(this.currZoomLevel!==this.zoomLevels.initial&&this.isActive){this.calculateSize();this.bounds.update(this.currZoomLevel);this.panTo(this.pan.x,this.pan.y)}else{this.calculateSize();this.currentResolution=0;this.zoomAndPanToInitial();this.applyCurrentZoomPan();this.updateContentSize()}}
+/**
+ * Apply size to current slide content,
+ * based on the current resolution and scale.
+ *
+ * @param {boolean} [force] if size should be updated even if dimensions weren't changed
+ */updateContentSize(t){const e=this.currentResolution||this.zoomLevels.initial;if(!e)return;const i=Math.round(this.width*e)||this.pswp.viewportSize.x;const s=Math.round(this.height*e)||this.pswp.viewportSize.y;(this.sizeChanged(i,s)||t)&&this.content.setDisplayedSize(i,s)}
+/**
+ * @param {number} width
+ * @param {number} height
+ */sizeChanged(t,e){if(t!==this.prevDisplayedWidth||e!==this.prevDisplayedHeight){this.prevDisplayedWidth=t;this.prevDisplayedHeight=e;return true}return false}
+/** @returns {HTMLImageElement | HTMLDivElement | null | undefined} */getPlaceholderElement(){var t;return(t=this.content.placeholder)===null||t===void 0?void 0:t.element}
+/**
+ * Zoom current slide image to...
+ *
+ * @param {number} destZoomLevel Destination zoom level.
+ * @param {Point} [centerPoint]
+ * Transform origin center point, or false if viewport center should be used.
+ * @param {number | false} [transitionDuration] Transition duration, may be set to 0.
+ * @param {boolean} [ignoreBounds] Minimum and maximum zoom levels will be ignored.
+ */zoomTo(t,e,i,s){const{pswp:n}=this;if(!this.isZoomable()||n.mainScroll.isShifted())return;n.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:e,transitionDuration:i});n.animations.stopAllPan();const o=this.currZoomLevel;s||(t=clamp(t,this.zoomLevels.min,this.zoomLevels.max));this.setZoomLevel(t);this.pan.x=this.calculateZoomToPanOffset("x",e,o);this.pan.y=this.calculateZoomToPanOffset("y",e,o);roundPoint(this.pan);const finishTransition=()=>{this._setResolution(t);this.applyCurrentZoomPan()};i?n.animations.startTransition({isPan:true,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:finishTransition,duration:i,easing:n.options.easing}):finishTransition()}
+/**
+ * @param {Point} [centerPoint]
+ */toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}
+/**
+ * Updates zoom level property and recalculates new pan bounds,
+ * unlike zoomTo it does not apply transform (use applyCurrentZoomPan)
+ *
+ * @param {number} currZoomLevel
+ */setZoomLevel(t){this.currZoomLevel=t;this.bounds.update(this.currZoomLevel)}
+/**
+ * Get pan position after zoom at a given `point`.
+ *
+ * Always call setZoomLevel(newZoomLevel) beforehand to recalculate
+ * pan bounds according to the new zoom level.
+ *
+ * @param {'x' | 'y'} axis
+ * @param {Point} [point]
+ * point based on which zoom is performed, usually refers to the current mouse position,
+ * if false - viewport center will be used.
+ * @param {number} [prevZoomLevel] Zoom level before new zoom was applied.
+ * @returns {number}
+ */calculateZoomToPanOffset(t,e,i){const s=this.bounds.max[t]-this.bounds.min[t];if(s===0)return this.bounds.center[t];e||(e=this.pswp.getViewportCenterPoint());i||(i=this.zoomLevels.initial);const n=this.currZoomLevel/i;return this.bounds.correctPan(t,(this.pan[t]-e[t])*n+e[t])}
+/**
+ * Apply pan and keep it within bounds.
+ *
+ * @param {number} panX
+ * @param {number} panY
+ */panTo(t,e){this.pan.x=this.bounds.correctPan("x",t);this.pan.y=this.bounds.correctPan("y",e);this.applyCurrentZoomPan()}
+/**
+ * If the slide in the current state can be panned by the user
+ * @returns {boolean}
+ */isPannable(){return Boolean(this.width)&&this.currZoomLevel>this.zoomLevels.fit}
+/**
+ * If the slide can be zoomed
+ * @returns {boolean}
+ */isZoomable(){return Boolean(this.width)&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel);this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial;this.bounds.update(this.currZoomLevel);equalizePoints(this.pan,this.bounds.center);this.pswp.dispatch("initialZoomPan",{slide:this})}
+/**
+ * Set translate and scale based on current resolution
+ *
+ * @param {number} x
+ * @param {number} y
+ * @param {number} zoom
+ * @private
+ */_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial;setTransform(this.container,t,e,i)}calculateSize(){const{pswp:t}=this;equalizePoints(this.panAreaSize,getPanAreaSize(t.options,t.viewportSize,this.data,this.index));this.zoomLevels.update(this.width,this.height,this.panAreaSize);t.dispatch("calcSlideSize",{slide:this})}
+/** @returns {string} */getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return toTransformString(this.pan.x,this.pan.y,t)}
+/**
+ * Set resolution and re-render the image.
+ *
+ * For example, if the real image size is 2000x1500,
+ * and resolution is 0.5 - it will be rendered as 1000x750.
+ *
+ * Image with zoom level 2 and resolution 0.5 is
+ * the same as image with zoom level 1 and resolution 1.
+ *
+ * Used to optimize animations and make
+ * sure that browser renders image in the highest quality.
+ * Also used by responsive images to load the correct one.
+ *
+ * @param {number} newResolution
+ */_setResolution(t){if(t!==this.currentResolution){this.currentResolution=t;this.updateContentSize();this.pswp.dispatch("resolutionChanged")}}}
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {import('./gestures.js').default} Gestures */const n=.35;const o=.6;const a=.4;const r=.5;
+/**
+ * @param {number} initialVelocity
+ * @param {number} decelerationRate
+ * @returns {number}
+ */function project(t,e){return t*e/(1-e)}class DragHandler{
+/**
+ * @param {Gestures} gestures
+ */
+constructor(t){this.gestures=t;this.pswp=t.pswp;
+/** @type {Point} */this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&equalizePoints(this.startPan,this.pswp.currSlide.pan);this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:e,dragAxis:i}=this.gestures;const{currSlide:s}=this.pswp;if(i==="y"&&this.pswp.options.closeOnVerticalDrag&&s&&s.currZoomLevel<=s.zoomLevels.fit&&!this.gestures.isMultitouch){const i=s.pan.y+(t.y-e.y);if(!this.pswp.dispatch("verticalDrag",{panY:i}).defaultPrevented){this._setPanWithFriction("y",i,o);const t=1-Math.abs(this._getVerticalDragRatio(s.pan.y));this.pswp.applyBgOpacity(t);s.applyCurrentZoomPan()}}else{const t=this._panOrMoveMainScroll("x");if(!t){this._panOrMoveMainScroll("y");if(s){roundPoint(s.pan);s.applyCurrentZoomPan()}}}}end(){const{velocity:t}=this.gestures;const{mainScroll:e,currSlide:i}=this.pswp;let s=0;this.pswp.animations.stopAll();if(e.isShifted()){const i=e.x-e.getCurrSlideX();const n=i/this.pswp.viewportSize.x;if(t.x<-r&&n<0||t.x<.1&&n<-.5){s=1;t.x=Math.min(t.x,0)}else if(t.x>r&&n>0||t.x>-.1&&n>.5){s=-1;t.x=Math.max(t.x,0)}e.moveIndexBy(s,true,t.x)}if(i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch)this.gestures.zoomLevels.correctZoomPan(true);else{this._finishPanGestureForAxis("x");this._finishPanGestureForAxis("y")}}
+/**
+ * @private
+ * @param {'x' | 'y'} axis
+ */_finishPanGestureForAxis(t){const{velocity:e}=this.gestures;const{currSlide:i}=this.pswp;if(!i)return;const{pan:s,bounds:n}=i;const o=s[t];const r=this.pswp.bgOpacity<1&&t==="y";const h=.995;const l=o+project(e[t],h);if(r){const t=this._getVerticalDragRatio(o);const e=this._getVerticalDragRatio(l);if(t<0&&e<-a||t>0&&e>a){this.pswp.close();return}}const p=n.correctPan(t,l);if(o===p)return;const d=p===l?1:.82;const c=this.pswp.bgOpacity;const u=p-o;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:true,start:o,end:p,velocity:e[t],dampingRatio:d,onUpdate:e=>{if(r&&this.pswp.bgOpacity<1){const t=1-(p-e)/u;this.pswp.applyBgOpacity(clamp(c+(1-c)*t,0,1))}s[t]=Math.floor(e);i.applyCurrentZoomPan()}})}
+/**
+ * Update position of the main scroll,
+ * or/and update pan position of the current slide.
+ *
+ * Should return true if it changes (or can change) main scroll.
+ *
+ * @private
+ * @param {'x' | 'y'} axis
+ * @returns {boolean}
+ */_panOrMoveMainScroll(t){const{p1:e,dragAxis:i,prevP1:s,isMultitouch:n}=this.gestures;const{currSlide:o,mainScroll:a}=this.pswp;const r=e[t]-s[t];const h=a.x+r;if(!r||!o)return false;if(t==="x"&&!o.isPannable()&&!n){a.moveTo(h,true);return true}const{bounds:l}=o;const p=o.pan[t]+r;if(this.pswp.options.allowPanToNext&&i==="x"&&t==="x"&&!n){const e=a.getCurrSlideX();const i=a.x-e;const s=r>0;const n=!s;if(p>l.min[t]&&s){const e=l.min[t]<=this.startPan[t];if(e){a.moveTo(h,true);return true}this._setPanWithFriction(t,p)}else if(p<l.max[t]&&n){const e=this.startPan[t]<=l.max[t];if(e){a.moveTo(h,true);return true}this._setPanWithFriction(t,p)}else if(i!==0){if(i>0){a.moveTo(Math.max(h,e),true);return true}if(i<0){a.moveTo(Math.min(h,e),true);return true}}else this._setPanWithFriction(t,p)}else t==="y"&&(a.isShifted()||l.min.y===l.max.y)||this._setPanWithFriction(t,p);return false}
+/**
+ * Relation between pan Y position and third of viewport height.
+ *
+ * When we are at initial position (center bounds) - the ratio is 0,
+ * if position is shifted upwards - the ratio is negative,
+ * if position is shifted downwards - the ratio is positive.
+ *
+ * @private
+ * @param {number} panY The current pan Y position.
+ * @returns {number}
+ */
+_getVerticalDragRatio(t){var e,i;return(t-((e=(i=this.pswp.currSlide)===null||i===void 0?void 0:i.bounds.center.y)!==null&&e!==void 0?e:0))/(this.pswp.viewportSize.y/3)}
+/**
+ * Set pan position of the current slide.
+ * Apply friction if the position is beyond the pan bounds,
+ * or if custom friction is defined.
+ *
+ * @private
+ * @param {'x' | 'y'} axis
+ * @param {number} potentialPan
+ * @param {number} [customFriction] (0.1 - 1)
+ */_setPanWithFriction(t,e,i){const{currSlide:s}=this.pswp;if(!s)return;const{pan:o,bounds:a}=s;const r=a.correctPan(t,e);if(r!==e||i){const s=Math.round(e-o[t]);o[t]+=s*(i||n)}else o[t]=e}}
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {import('./gestures.js').default} Gestures */const h=.05;const l=.15;
+/**
+ * Get center point between two points
+ *
+ * @param {Point} p
+ * @param {Point} p1
+ * @param {Point} p2
+ * @returns {Point}
+ */function getZoomPointsCenter(t,e,i){t.x=(e.x+i.x)/2;t.y=(e.y+i.y)/2;return t}class ZoomHandler{
+/**
+ * @param {Gestures} gestures
+ */
+constructor(t){this.gestures=t;
+/**
+ * @private
+ * @type {Point}
+ */this._startPan={x:0,y:0};
+/**
+ * @private
+ * @type {Point}
+ */this._startZoomPoint={x:0,y:0};
+/**
+ * @private
+ * @type {Point}
+ */this._zoomPoint={x:0,y:0};this._wasOverFitZoomLevel=false;this._startZoomLevel=1}start(){const{currSlide:t}=this.gestures.pswp;if(t){this._startZoomLevel=t.currZoomLevel;equalizePoints(this._startPan,t.pan)}this.gestures.pswp.animations.stopAllPan();this._wasOverFitZoomLevel=false}change(){const{p1:t,startP1:e,p2:i,startP2:s,pswp:n}=this.gestures;const{currSlide:o}=n;if(!o)return;const a=o.zoomLevels.min;const r=o.zoomLevels.max;if(!o.isZoomable()||n.mainScroll.isShifted())return;getZoomPointsCenter(this._startZoomPoint,e,s);getZoomPointsCenter(this._zoomPoint,t,i);let p=1/getDistanceBetween(e,s)*getDistanceBetween(t,i)*this._startZoomLevel;p>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=true);if(p<a)if(n.options.pinchToClose&&!this._wasOverFitZoomLevel&&this._startZoomLevel<=o.zoomLevels.initial){const t=1-(a-p)/(a/1.2);n.dispatch("pinchClose",{bgOpacity:t}).defaultPrevented||n.applyBgOpacity(t)}else p=a-(a-p)*l;else p>r&&(p=r+(p-r)*h);o.pan.x=this._calculatePanForZoomLevel("x",p);o.pan.y=this._calculatePanForZoomLevel("y",p);o.setZoomLevel(p);o.applyCurrentZoomPan()}end(){const{pswp:t}=this.gestures;const{currSlide:e}=t;(!e||e.currZoomLevel<e.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&t.options.pinchToClose?t.close():this.correctZoomPan()}
+/**
+ * @private
+ * @param {'x' | 'y'} axis
+ * @param {number} currZoomLevel
+ * @returns {number}
+ */_calculatePanForZoomLevel(t,e){const i=e/this._startZoomLevel;return this._zoomPoint[t]-(this._startZoomPoint[t]-this._startPan[t])*i}
+/**
+ * Correct currZoomLevel and pan if they are
+ * beyond minimum or maximum values.
+ * With animation.
+ *
+ * @param {boolean} [ignoreGesture]
+ * Wether gesture coordinates should be ignored when calculating destination pan position.
+ */correctZoomPan(t){const{pswp:e}=this.gestures;const{currSlide:i}=e;if(!(i!==null&&i!==void 0&&i.isZoomable()))return;this._zoomPoint.x===0&&(t=true);const s=i.currZoomLevel;
+/** @type {number} */let n;let o=true;if(s<i.zoomLevels.initial)n=i.zoomLevels.initial;else if(s>i.zoomLevels.max)n=i.zoomLevels.max;else{o=false;n=s}const a=e.bgOpacity;const r=e.bgOpacity<1;const h=equalizePoints({x:0,y:0},i.pan);let l=equalizePoints({x:0,y:0},h);if(t){this._zoomPoint.x=0;this._zoomPoint.y=0;this._startZoomPoint.x=0;this._startZoomPoint.y=0;this._startZoomLevel=s;equalizePoints(this._startPan,h)}o&&(l={x:this._calculatePanForZoomLevel("x",n),y:this._calculatePanForZoomLevel("y",n)});i.setZoomLevel(n);l={x:i.bounds.correctPan("x",l.x),y:i.bounds.correctPan("y",l.y)};i.setZoomLevel(s);const p=!pointsEqual(l,h);if(p||o||r){e.animations.stopAllPan();e.animations.startSpring({isPan:true,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:t=>{t/=1e3;if(p||o){if(p){i.pan.x=h.x+(l.x-h.x)*t;i.pan.y=h.y+(l.y-h.y)*t}if(o){const e=s+(n-s)*t;i.setZoomLevel(e)}i.applyCurrentZoomPan()}r&&e.bgOpacity<1&&e.applyBgOpacity(clamp(a+(1-a)*t,0,1))},onComplete:()=>{i._setResolution(n);i.applyCurrentZoomPan()}})}else{i._setResolution(n);i.applyCurrentZoomPan()}}}
+/**
+ * @template {string} T
+ * @template {string} P
+ * @typedef {import('../types.js').AddPostfix<T, P>} AddPostfix<T, P>
+ */
+/** @typedef {import('./gestures.js').default} Gestures */
+/** @typedef {import('../photoswipe.js').Point} Point */
+/** @typedef {'imageClick' | 'bgClick' | 'tap' | 'doubleTap'} Actions */
+/**
+ * Whether the tap was performed on the main slide
+ * (rather than controls or caption).
+ *
+ * @param {PointerEvent} event
+ * @returns {boolean}
+ */function didTapOnMainContent(t){return!!
+/** @type {HTMLElement} */
+t.target.closest(".pswp__container")}class TapHandler{
+/**
+ * @param {Gestures} gestures
+ */
+constructor(t){this.gestures=t}
+/**
+ * @param {Point} point
+ * @param {PointerEvent} originalEvent
+ */click(t,e){const i=
+/** @type {HTMLElement} */
+e.target.classList;const s=i.contains("pswp__img");const n=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");s?this._doClickOrTapAction("imageClick",t,e):n&&this._doClickOrTapAction("bgClick",t,e)}
+/**
+ * @param {Point} point
+ * @param {PointerEvent} originalEvent
+ */tap(t,e){didTapOnMainContent(e)&&this._doClickOrTapAction("tap",t,e)}
+/**
+ * @param {Point} point
+ * @param {PointerEvent} originalEvent
+ */doubleTap(t,e){didTapOnMainContent(e)&&this._doClickOrTapAction("doubleTap",t,e)}
+/**
+ * @private
+ * @param {Actions} actionName
+ * @param {Point} point
+ * @param {PointerEvent} originalEvent
+ */_doClickOrTapAction(t,e,i){var s;const{pswp:n}=this.gestures;const{currSlide:o}=n;const a=
+/** @type {AddPostfix<Actions, 'Action'>} */
+t+"Action";const r=n.options[a];if(!n.dispatch(a,{point:e,originalEvent:i}).defaultPrevented)if(typeof r!=="function")switch(r){case"close":case"next":n[r]();break;case"zoom":o===null||o===void 0||o.toggleZoom(e);break;case"zoom-or-close":o!==null&&o!==void 0&&o.isZoomable()&&o.zoomLevels.secondary!==o.zoomLevels.initial?o.toggleZoom(e):n.options.clickToCloseNonZoomable&&n.close();break;case"toggle-controls":(s=this.gestures.pswp.element)===null||s===void 0||s.classList.toggle("pswp--ui-visible");break}else r.call(n,e,i)}}
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('../photoswipe.js').Point} Point */const p=10;const d=300;const c=25;class Gestures{
+/**
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t){this.pswp=t;
+/** @type {'x' | 'y' | null} */this.dragAxis=null;
+/** @type {Point} */this.p1={x:0,y:0};
+/** @type {Point} */this.p2={x:0,y:0};
+/** @type {Point} */this.prevP1={x:0,y:0};
+/** @type {Point} */this.prevP2={x:0,y:0};
+/** @type {Point} */this.startP1={x:0,y:0};
+/** @type {Point} */this.startP2={x:0,y:0};
+/** @type {Point} */this.velocity={x:0,y:0};
+/** @type {Point}
+ * @private
+ */this._lastStartP1={x:0,y:0};
+/** @type {Point}
+ * @private
+ */this._intervalP1={x:0,y:0};this._numActivePoints=0;
+/** @type {Point[]}
+ * @private
+ */this._ongoingPointers=[];this._touchEventEnabled="ontouchstart"in window;this._pointerEventEnabled=!!window.PointerEvent;this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1;this._numActivePoints=0;this._intervalTime=0;this._velocityCalculated=false;this.isMultitouch=false;this.isDragging=false;this.isZooming=false;
+/** @type {number | null} */this.raf=null;
+/** @type {NodeJS.Timeout | null}
+ * @private
+ */this._tapTimer=null;this.supportsTouch||(t.options.allowPanToNext=false);this.drag=new DragHandler(this);this.zoomLevels=new ZoomHandler(this);this.tapHandler=new TapHandler(this);t.on("bindEvents",(()=>{t.events.add(t.scrollWrap,"click",
+/** @type EventListener */
+this._onClick.bind(this));if(this._pointerEventEnabled)this._bindEvents("pointer","down","up","cancel");else if(this._touchEventEnabled){this._bindEvents("touch","start","end","cancel");if(t.scrollWrap){t.scrollWrap.ontouchmove=()=>{};t.scrollWrap.ontouchend=()=>{}}}else this._bindEvents("mouse","down","up")}))}
+/**
+ * @private
+ * @param {'mouse' | 'touch' | 'pointer'} pref
+ * @param {'down' | 'start'} down
+ * @param {'up' | 'end'} up
+ * @param {'cancel'} [cancel]
+ */_bindEvents(t,e,i,s){const{pswp:n}=this;const{events:o}=n;const a=s?t+s:"";o.add(n.scrollWrap,t+e,
+/** @type EventListener */
+this.onPointerDown.bind(this));o.add(window,t+"move",
+/** @type EventListener */
+this.onPointerMove.bind(this));o.add(window,t+i,
+/** @type EventListener */
+this.onPointerUp.bind(this));a&&o.add(n.scrollWrap,a,
+/** @type EventListener */
+this.onPointerUp.bind(this))}
+/**
+ * @param {PointerEvent} e
+ */onPointerDown(t){const e=t.type==="mousedown"||t.pointerType==="mouse";if(e&&t.button>0)return;const{pswp:i}=this;if(i.opener.isOpen){if(!i.dispatch("pointerDown",{originalEvent:t}).defaultPrevented){if(e){i.mouseDetected();this._preventPointerEventBehaviour(t,"down")}i.animations.stopAll();this._updatePoints(t,"down");if(this._numActivePoints===1){this.dragAxis=null;equalizePoints(this.startP1,this.p1)}if(this._numActivePoints>1){this._clearTapTimer();this.isMultitouch=true}else this.isMultitouch=false}}else t.preventDefault()}
+/**
+ * @param {PointerEvent} e
+ */onPointerMove(t){this._preventPointerEventBehaviour(t,"move");if(this._numActivePoints){this._updatePoints(t,"move");if(!this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented)if(this._numActivePoints!==1||this.isDragging){if(this._numActivePoints>1&&!this.isZooming){this._finishDrag();this.isZooming=true;this._updateStartPoints();this.zoomLevels.start();this._rafStopLoop();this._rafRenderLoop()}}else{this.dragAxis||this._calculateDragDirection();if(this.dragAxis&&!this.isDragging){if(this.isZooming){this.isZooming=false;this.zoomLevels.end()}this.isDragging=true;this._clearTapTimer();this._updateStartPoints();this._intervalTime=Date.now();this._velocityCalculated=false;equalizePoints(this._intervalP1,this.p1);this.velocity.x=0;this.velocity.y=0;this.drag.start();this._rafStopLoop();this._rafRenderLoop()}}}}_finishDrag(){if(this.isDragging){this.isDragging=false;this._velocityCalculated||this._updateVelocity(true);this.drag.end();this.dragAxis=null}}
+/**
+ * @param {PointerEvent} e
+ */onPointerUp(t){if(this._numActivePoints){this._updatePoints(t,"up");if(!this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented){if(this._numActivePoints===0){this._rafStopLoop();this.isDragging?this._finishDrag():this.isZooming||this.isMultitouch||this._finishTap(t)}if(this._numActivePoints<2&&this.isZooming){this.isZooming=false;this.zoomLevels.end();if(this._numActivePoints===1){this.dragAxis=null;this._updateStartPoints()}}}}}_rafRenderLoop(){if(this.isDragging||this.isZooming){this._updateVelocity();this.isDragging?pointsEqual(this.p1,this.prevP1)||this.drag.change():pointsEqual(this.p1,this.prevP1)&&pointsEqual(this.p2,this.prevP2)||this.zoomLevels.change();this._updatePrevPoints();this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this))}}
+/**
+ * Update velocity at 50ms interval
+ *
+ * @private
+ * @param {boolean} [force]
+ */_updateVelocity(t){const e=Date.now();const i=e-this._intervalTime;if(!(i<50)||t){this.velocity.x=this._getVelocity("x",i);this.velocity.y=this._getVelocity("y",i);this._intervalTime=e;equalizePoints(this._intervalP1,this.p1);this._velocityCalculated=true}}
+/**
+ * @private
+ * @param {PointerEvent} e
+ */_finishTap(t){const{mainScroll:e}=this.pswp;if(e.isShifted()){e.moveIndexBy(0,true);return}if(t.type.indexOf("cancel")>0)return;if(t.type==="mouseup"||t.pointerType==="mouse"){this.tapHandler.click(this.startP1,t);return}const i=this.pswp.options.doubleTapAction?d:0;if(this._tapTimer){this._clearTapTimer();getDistanceBetween(this._lastStartP1,this.startP1)<c&&this.tapHandler.doubleTap(this.startP1,t)}else{equalizePoints(this._lastStartP1,this.startP1);this._tapTimer=setTimeout((()=>{this.tapHandler.tap(this.startP1,t);this._clearTapTimer()}),i)}}_clearTapTimer(){if(this._tapTimer){clearTimeout(this._tapTimer);this._tapTimer=null}}
+/**
+ * Get velocity for axis
+ *
+ * @private
+ * @param {'x' | 'y'} axis
+ * @param {number} duration
+ * @returns {number}
+ */_getVelocity(t,e){const i=this.p1[t]-this._intervalP1[t];return Math.abs(i)>1&&e>5?i/e:0}_rafStopLoop(){if(this.raf){cancelAnimationFrame(this.raf);this.raf=null}}
+/**
+ * @private
+ * @param {PointerEvent} e
+ * @param {'up' | 'down' | 'move'} pointerType Normalized pointer type
+ */_preventPointerEventBehaviour(t,e){const i=this.pswp.applyFilters("preventPointerEvent",true,t,e);i&&t.preventDefault()}
+/**
+ * Parses and normalizes points from the touch, mouse or pointer event.
+ * Updates p1 and p2.
+ *
+ * @private
+ * @param {PointerEvent | TouchEvent} e
+ * @param {'up' | 'down' | 'move'} pointerType Normalized pointer type
+ */_updatePoints(t,e){if(this._pointerEventEnabled){const i=
+/** @type {PointerEvent} */
+t;const s=this._ongoingPointers.findIndex((t=>t.id===i.pointerId));e==="up"&&s>-1?this._ongoingPointers.splice(s,1):e==="down"&&s===-1?this._ongoingPointers.push(this._convertEventPosToPoint(i,{x:0,y:0})):s>-1&&this._convertEventPosToPoint(i,this._ongoingPointers[s]);this._numActivePoints=this._ongoingPointers.length;this._numActivePoints>0&&equalizePoints(this.p1,this._ongoingPointers[0]);this._numActivePoints>1&&equalizePoints(this.p2,this._ongoingPointers[1])}else{const i=
+/** @type {TouchEvent} */
+t;this._numActivePoints=0;if(i.type.indexOf("touch")>-1){if(i.touches&&i.touches.length>0){this._convertEventPosToPoint(i.touches[0],this.p1);this._numActivePoints++;if(i.touches.length>1){this._convertEventPosToPoint(i.touches[1],this.p2);this._numActivePoints++}}}else{this._convertEventPosToPoint(
+/** @type {PointerEvent} */
+t,this.p1);e==="up"?this._numActivePoints=0:this._numActivePoints++}}}_updatePrevPoints(){equalizePoints(this.prevP1,this.p1);equalizePoints(this.prevP2,this.p2)}_updateStartPoints(){equalizePoints(this.startP1,this.p1);equalizePoints(this.startP2,this.p2);this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(t!==0){const e=t>0?"x":"y";Math.abs(this.p1[e]-this.startP1[e])>=p&&(this.dragAxis=e)}}}
+/**
+ * Converts touch, pointer or mouse event
+ * to PhotoSwipe point.
+ *
+ * @private
+ * @param {Touch | PointerEvent} e
+ * @param {Point} p
+ * @returns {Point}
+ */_convertEventPosToPoint(t,e){e.x=t.pageX-this.pswp.offset.x;e.y=t.pageY-this.pswp.offset.y;"pointerId"in t?e.id=t.pointerId:t.identifier!==void 0&&(e.id=t.identifier);return e}
+/**
+ * @private
+ * @param {PointerEvent} e
+ */_onClick(t){if(this.pswp.mainScroll.isShifted()){t.preventDefault();t.stopPropagation()}}}
+/** @typedef {import('./photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('./slide/slide.js').default} Slide */
+/** @typedef {{ el: HTMLDivElement; slide?: Slide }} ItemHolder */const u=.35;class MainScroll{
+/**
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t){this.pswp=t;this.x=0;this.slideWidth=0;this._currPositionIndex=0;this._prevPositionIndex=0;this._containerShiftIndex=-1;
+/** @type {ItemHolder[]} */this.itemHolders=[]}
+/**
+ * Position the scroller and slide containers
+ * according to viewport size.
+ *
+ * @param {boolean} [resizeSlides] Whether slides content should resized
+ */resize(t){const{pswp:e}=this;const i=Math.round(e.viewportSize.x+e.viewportSize.x*e.options.spacing);const s=i!==this.slideWidth;if(s){this.slideWidth=i;this.moveTo(this.getCurrSlideX())}this.itemHolders.forEach(((e,i)=>{s&&setTransform(e.el,(i+this._containerShiftIndex)*this.slideWidth);t&&e.slide&&e.slide.resize()}))}resetPosition(){this._currPositionIndex=0;this._prevPositionIndex=0;this.slideWidth=0;this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){const e=createElement("pswp__item","div",this.pswp.container);e.setAttribute("role","group");e.setAttribute("aria-roledescription","slide");e.setAttribute("aria-hidden","true");e.style.display=t===1?"block":"none";this.itemHolders.push({el:e})}}
+/**
+ * Whether the main scroll can be horizontally swiped to the next or previous slide.
+ * @returns {boolean}
+ */canBeSwiped(){return this.pswp.getNumItems()>1}
+/**
+ * Move main scroll by X amount of slides.
+ * For example:
+ * `-1` will move to the previous slide,
+ * `0` will reset the scroll position of the current slide,
+ * `3` will move three slides forward
+ *
+ * If loop option is enabled - index will be automatically looped too,
+ * (for example `-1` will move to the last slide of the gallery).
+ *
+ * @param {number} diff
+ * @param {boolean} [animate]
+ * @param {number} [velocityX]
+ * @returns {boolean} whether index was changed or not
+ */moveIndexBy(t,e,i){const{pswp:s}=this;let n=s.potentialIndex+t;const o=s.getNumItems();if(s.canLoop()){n=s.getLoopedIndex(n);const e=(t+o)%o;t=e<=o/2?e:e-o}else{n<0?n=0:n>=o&&(n=o-1);t=n-s.potentialIndex}s.potentialIndex=n;this._currPositionIndex-=t;s.animations.stopMainScroll();const a=this.getCurrSlideX();if(e){s.animations.startSpring({isMainScroll:true,start:this.x,end:a,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:t=>{this.moveTo(t)},onComplete:()=>{this.updateCurrItem();s.appendHeavy()}});let t=s.potentialIndex-s.currIndex;if(s.canLoop()){const e=(t+o)%o;t=e<=o/2?e:e-o}Math.abs(t)>1&&this.updateCurrItem()}else{this.moveTo(a);this.updateCurrItem()}return Boolean(t)}
+/**
+ * X position of the main scroll for the current slide
+ * (ignores position during dragging)
+ * @returns {number}
+ */getCurrSlideX(){return this.slideWidth*this._currPositionIndex}
+/**
+ * Whether scroll position is shifted.
+ * For example, it will return true if the scroll is being dragged or animated.
+ * @returns {boolean}
+ */isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;const{pswp:e}=this;const i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex;e.currIndex=e.potentialIndex;let s=Math.abs(i);
+/** @type {ItemHolder | undefined} */let n;if(s>=3){this._containerShiftIndex+=i+(i>0?-3:3);s=3;this.itemHolders.forEach((t=>{var e;(e=t.slide)===null||e===void 0||e.destroy();t.slide=void 0}))}for(let t=0;t<s;t++)if(i>0){n=this.itemHolders.shift();if(n){this.itemHolders[2]=n;this._containerShiftIndex++;setTransform(n.el,(this._containerShiftIndex+2)*this.slideWidth);e.setContent(n,e.currIndex-s+t+2)}}else{n=this.itemHolders.pop();if(n){this.itemHolders.unshift(n);this._containerShiftIndex--;setTransform(n.el,this._containerShiftIndex*this.slideWidth);e.setContent(n,e.currIndex+s-t-2)}}if(Math.abs(this._containerShiftIndex)>50&&!this.isShifted()){this.resetPosition();this.resize()}e.animations.stopAllPan();this.itemHolders.forEach(((t,e)=>{t.slide&&t.slide.setIsActive(e===1)}));e.currSlide=(t=this.itemHolders[1])===null||t===void 0?void 0:t.slide;e.contentLoader.updateLazy(i);e.currSlide&&e.currSlide.applyCurrentZoomPan();e.dispatch("change")}
+/**
+ * Move the X position of the main scroll container
+ *
+ * @param {number} x
+ * @param {boolean} [dragging]
+ */moveTo(t,e){if(!this.pswp.canLoop()&&e){let e=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;e+=this.pswp.currIndex;const i=Math.round(t-this.x);(e<0&&i>0||e>=this.pswp.getNumItems()-1&&i<0)&&(t=this.x+i*u)}this.x=t;this.pswp.container&&setTransform(this.pswp.container,t);this.pswp.dispatch("moveMainScroll",{x:t,dragging:e!==null&&e!==void 0&&e})}}
+/** @typedef {import('./photoswipe.js').default} PhotoSwipe */
+/**
+ * @template T
+ * @typedef {import('./types.js').Methods<T>} Methods<T>
+ */const m={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9};
+/**
+ * @template {keyof KeyboardKeyCodesMap} T
+ * @param {T} key
+ * @param {boolean} isKeySupported
+ * @returns {T | number | undefined}
+ */const getKeyboardEventKey=(t,e)=>e?t:m[t];class Keyboard{
+/**
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t){this.pswp=t;this._wasFocused=false;t.on("bindEvents",(()=>{if(t.options.trapFocus){t.options.initialPointerPos||this._focusRoot();t.events.add(document,"focusin",
+/** @type EventListener */
+this._onFocusIn.bind(this))}t.events.add(document,"keydown",
+/** @type EventListener */
+this._onKeyDown.bind(this))}));const e=
+/** @type {HTMLElement} */
+document.activeElement;t.on("destroy",(()=>{t.options.returnFocus&&e&&this._wasFocused&&e.focus()}))}_focusRoot(){if(!this._wasFocused&&this.pswp.element){this.pswp.element.focus();this._wasFocused=true}}
+/**
+ * @private
+ * @param {KeyboardEvent} e
+ */_onKeyDown(t){const{pswp:e}=this;if(e.dispatch("keydown",{originalEvent:t}).defaultPrevented)return;if(specialKeyUsed(t))return;
+/** @type {Methods<PhotoSwipe> | undefined} */let i;
+/** @type {'x' | 'y' | undefined} */let s;let n=false;const o="key"in t;switch(o?t.key:t.keyCode){case getKeyboardEventKey("Escape",o):e.options.escKey&&(i="close");break;case getKeyboardEventKey("z",o):i="toggleZoom";break;case getKeyboardEventKey("ArrowLeft",o):s="x";break;case getKeyboardEventKey("ArrowUp",o):s="y";break;case getKeyboardEventKey("ArrowRight",o):s="x";n=true;break;case getKeyboardEventKey("ArrowDown",o):n=true;s="y";break;case getKeyboardEventKey("Tab",o):this._focusRoot();break}if(s){t.preventDefault();const{currSlide:o}=e;if(e.options.arrowKeys&&s==="x"&&e.getNumItems()>1)i=n?"next":"prev";else if(o&&o.currZoomLevel>o.zoomLevels.fit){o.pan[s]+=n?-80:80;o.panTo(o.pan.x,o.pan.y)}}if(i){t.preventDefault();e[i]()}}
+/**
+ * Trap focus inside photoswipe
+ *
+ * @private
+ * @param {FocusEvent} e
+ */_onFocusIn(t){const{template:e}=this.pswp;e&&document!==t.target&&e!==t.target&&!e.contains(
+/** @type {Node} */
+t.target)&&e.focus()}}const f="cubic-bezier(.4,0,.22,1)";
+/** @typedef {import('./animations.js').SharedAnimationProps} SharedAnimationProps */
+/** @typedef {Object} DefaultCssAnimationProps
+ *
+ * @prop {HTMLElement} target
+ * @prop {number} [duration]
+ * @prop {string} [easing]
+ * @prop {string} [transform]
+ * @prop {string} [opacity]
+ * */
+/** @typedef {SharedAnimationProps & DefaultCssAnimationProps} CssAnimationProps */class CSSAnimation{
+/**
+ * onComplete can be unpredictable, be careful about current state
+ *
+ * @param {CssAnimationProps} props
+ */
+constructor(t){var e;this.props=t;const{target:i,onComplete:s,transform:n,onFinish:o=(()=>{}),duration:a=333,easing:r=f}=t;this.onFinish=o;const h=n?"transform":"opacity";const l=(e=t[h])!==null&&e!==void 0?e:"";this._target=i;this._onComplete=s;this._finished=false;this._onTransitionEnd=this._onTransitionEnd.bind(this);this._helperTimeout=setTimeout((()=>{setTransitionStyle(i,h,a,r);this._helperTimeout=setTimeout((()=>{i.addEventListener("transitionend",this._onTransitionEnd,false);i.addEventListener("transitioncancel",this._onTransitionEnd,false);this._helperTimeout=setTimeout((()=>{this._finalizeAnimation()}),a+500);i.style[h]=l}),30)}),0)}
+/**
+ * @private
+ * @param {TransitionEvent} e
+ */_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){if(!this._finished){this._finished=true;this.onFinish();this._onComplete&&this._onComplete()}}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout);removeTransitionStyle(this._target);this._target.removeEventListener("transitionend",this._onTransitionEnd,false);this._target.removeEventListener("transitioncancel",this._onTransitionEnd,false);this._finished||this._finalizeAnimation()}}const v=12;const g=.75;class SpringEaser{
+/**
+ * @param {number} initialVelocity Initial velocity, px per ms.
+ *
+ * @param {number} [dampingRatio]
+ * Determines how bouncy animation will be.
+ * From 0 to 1, 0 - always overshoot, 1 - do not overshoot.
+ * "overshoot" refers to part of animation that
+ * goes beyond the final value.
+ *
+ * @param {number} [naturalFrequency]
+ * Determines how fast animation will slow down.
+ * The higher value - the stiffer the transition will be,
+ * and the faster it will slow down.
+ * Recommended value from 10 to 50
+ */
+constructor(t,e,i){this.velocity=t*1e3;this._dampingRatio=e||g;this._naturalFrequency=i||v;this._dampedFrequency=this._naturalFrequency;this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}
+/**
+ * @param {number} deltaPosition Difference between current and end position of the animation
+ * @param {number} deltaTime Frame duration in milliseconds
+ *
+ * @returns {number} Displacement, relative to the end position.
+ */easeFrame(t,e){let i=0;let s;e/=1e3;const n=Math.E**(-this._dampingRatio*this._naturalFrequency*e);if(this._dampingRatio===1){s=this.velocity+this._naturalFrequency*t;i=(t+s*e)*n;this.velocity=i*-this._naturalFrequency+s*n}else if(this._dampingRatio<1){s=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);const o=Math.cos(this._dampedFrequency*e);const a=Math.sin(this._dampedFrequency*e);i=n*(t*o+s*a);this.velocity=i*-this._naturalFrequency*this._dampingRatio+n*(-this._dampedFrequency*t*a+this._dampedFrequency*s*o)}return i}}
+/** @typedef {import('./animations.js').SharedAnimationProps} SharedAnimationProps */
+/**
+ * @typedef {Object} DefaultSpringAnimationProps
+ *
+ * @prop {number} start
+ * @prop {number} end
+ * @prop {number} velocity
+ * @prop {number} [dampingRatio]
+ * @prop {number} [naturalFrequency]
+ * @prop {(end: number) => void} onUpdate
+ */
+/** @typedef {SharedAnimationProps & DefaultSpringAnimationProps} SpringAnimationProps */class SpringAnimation{
+/**
+ * @param {SpringAnimationProps} props
+ */
+constructor(t){this.props=t;this._raf=0;const{start:e,end:i,velocity:s,onUpdate:n,onComplete:o,onFinish:a=(()=>{}),dampingRatio:r,naturalFrequency:h}=t;this.onFinish=a;const l=new SpringEaser(s,r,h);let p=Date.now();let d=e-i;const animationLoop=()=>{if(this._raf){d=l.easeFrame(d,Date.now()-p);if(Math.abs(d)<1&&Math.abs(l.velocity)<50){n(i);o&&o();this.onFinish()}else{p=Date.now();n(d+i);this._raf=requestAnimationFrame(animationLoop)}}};this._raf=requestAnimationFrame(animationLoop)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf);this._raf=0}}
+/** @typedef {import('./css-animation.js').CssAnimationProps} CssAnimationProps */
+/** @typedef {import('./spring-animation.js').SpringAnimationProps} SpringAnimationProps */
+/** @typedef {Object} SharedAnimationProps
+ * @prop {string} [name]
+ * @prop {boolean} [isPan]
+ * @prop {boolean} [isMainScroll]
+ * @prop {VoidFunction} [onComplete]
+ * @prop {VoidFunction} [onFinish]
+ */
+/** @typedef {SpringAnimation | CSSAnimation} Animation */
+/** @typedef {SpringAnimationProps | CssAnimationProps} AnimationProps */class Animations{constructor(){
+/** @type {Animation[]} */
+this.activeAnimations=[]}
+/**
+ * @param {SpringAnimationProps} props
+ */startSpring(t){this._start(t,true)}
+/**
+ * @param {CssAnimationProps} props
+ */startTransition(t){this._start(t)}
+/**
+ * @private
+ * @param {AnimationProps} props
+ * @param {boolean} [isSpring]
+ * @returns {Animation}
+ */_start(t,e){const i=e?new SpringAnimation(
+/** @type SpringAnimationProps */
+t):new CSSAnimation(
+/** @type CssAnimationProps */
+t);this.activeAnimations.push(i);i.onFinish=()=>this.stop(i);return i}
+/**
+ * @param {Animation} animation
+ */stop(t){t.destroy();const e=this.activeAnimations.indexOf(t);e>-1&&this.activeAnimations.splice(e,1)}stopAll(){this.activeAnimations.forEach((t=>{t.destroy()}));this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((t=>{if(t.props.isPan){t.destroy();return false}return true}))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((t=>{if(t.props.isMainScroll){t.destroy();return false}return true}))}isPanRunning(){return this.activeAnimations.some((t=>t.props.isPan))}}
+/** @typedef {import('./photoswipe.js').default} PhotoSwipe */class ScrollWheel{
+/**
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t){this.pswp=t;t.events.add(t.element,"wheel",
+/** @type EventListener */
+this._onWheel.bind(this))}
+/**
+ * @private
+ * @param {WheelEvent} e
+ */_onWheel(t){t.preventDefault();const{currSlide:e}=this.pswp;let{deltaX:i,deltaY:s}=t;if(e&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(e.isZoomable()){let i=-s;t.deltaMode===1?i*=.05:i*=t.deltaMode?1:.002;i=2**i;const n=e.currZoomLevel*i;e.zoomTo(n,{x:t.clientX,y:t.clientY})}}else if(e.isPannable()){if(t.deltaMode===1){i*=18;s*=18}e.panTo(e.pan.x-i,e.pan.y-s)}}}
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/**
+ * @template T
+ * @typedef {import('../types.js').Methods<T>} Methods<T>
+ */
+/**
+ * @typedef {Object} UIElementMarkupProps
+ * @prop {boolean} [isCustomSVG]
+ * @prop {string} inner
+ * @prop {string} [outlineID]
+ * @prop {number | string} [size]
+ */
+/**
+ * @typedef {Object} UIElementData
+ * @prop {DefaultUIElements | string} [name]
+ * @prop {string} [className]
+ * @prop {UIElementMarkup} [html]
+ * @prop {boolean} [isButton]
+ * @prop {keyof HTMLElementTagNameMap} [tagName]
+ * @prop {string} [title]
+ * @prop {string} [ariaLabel]
+ * @prop {(element: HTMLElement, pswp: PhotoSwipe) => void} [onInit]
+ * @prop {Methods<PhotoSwipe> | ((e: MouseEvent, element: HTMLElement, pswp: PhotoSwipe) => void)} [onClick]
+ * @prop {'bar' | 'wrapper' | 'root'} [appendTo]
+ * @prop {number} [order]
+ */
+/** @typedef {'arrowPrev' | 'arrowNext' | 'close' | 'zoom' | 'counter'} DefaultUIElements */
+/** @typedef {string | UIElementMarkupProps} UIElementMarkup */
+/**
+ * @param {UIElementMarkup} [htmlData]
+ * @returns {string}
+ */function addElementHTML(t){if(typeof t==="string")return t;if(!t||!t.isCustomSVG)return"";const e=t;let i='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';i=i.split("%d").join(
+/** @type {string} */
+e.size||32);e.outlineID&&(i+='<use class="pswp__icn-shadow" xlink:href="#'+e.outlineID+'"/>');i+=e.inner;i+="</svg>";return i}class UIElement{
+/**
+ * @param {PhotoSwipe} pswp
+ * @param {UIElementData} data
+ */
+constructor(t,e){var i;const s=e.name||e.className;let n=e.html;if(t.options[s]===false)return;typeof t.options[s+"SVG"]==="string"&&(n=t.options[s+"SVG"]);t.dispatch("uiElementCreate",{data:e});let o="";if(e.isButton){o+="pswp__button ";o+=e.className||`pswp__button--${e.name}`}else o+=e.className||`pswp__${e.name}`;let a=e.isButton?e.tagName||"button":e.tagName||"div";a=
+/** @type {keyof HTMLElementTagNameMap} */
+a.toLowerCase();
+/** @type {HTMLElement} */const r=createElement(o,a);if(e.isButton){a==="button"&&(
+/** @type {HTMLButtonElement} */
+r.type="button");let{title:i}=e;const{ariaLabel:n}=e;typeof t.options[s+"Title"]==="string"&&(i=t.options[s+"Title"]);i&&(r.title=i);const o=n||i;o&&r.setAttribute("aria-label",o)}r.innerHTML=addElementHTML(n);e.onInit&&e.onInit(r,t);e.onClick&&(r.onclick=i=>{typeof e.onClick==="string"?t[e.onClick]():typeof e.onClick==="function"&&e.onClick(i,r,t)});const h=e.appendTo||"bar";
+/** @type {HTMLElement | undefined} root element by default */let l=t.element;if(h==="bar"){t.topBar||(t.topBar=createElement("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap));l=t.topBar}else{r.classList.add("pswp__hide-on-close");h==="wrapper"&&(l=t.scrollWrap)}(i=l)===null||i===void 0||i.appendChild(t.applyFilters("uiElement",r,e))}}
+/** @typedef {import('./ui-element.js').UIElementData} UIElementData */
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/**
+ *
+ * @param {HTMLElement} element
+ * @param {PhotoSwipe} pswp
+ * @param {boolean} [isNextButton]
+ */function initArrowButton(t,e,i){t.classList.add("pswp__button--arrow");t.setAttribute("aria-controls","pswp__items");e.on("change",(()=>{e.options.loop||(
+/** @type {HTMLButtonElement} */
+t.disabled=i?!(e.currIndex<e.getNumItems()-1):!(e.currIndex>0))}))}
+/** @type {UIElementData} */const _={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:true,appendTo:"wrapper",html:{isCustomSVG:true,size:60,inner:'<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:initArrowButton};
+/** @type {UIElementData} */const y={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:true,appendTo:"wrapper",html:{isCustomSVG:true,size:60,inner:'<use xlink:href="#pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(t,e)=>{initArrowButton(t,e,true)}};
+/** @type {import('./ui-element.js').UIElementData} UIElementData */const w={name:"close",title:"Close",order:20,isButton:true,html:{isCustomSVG:true,inner:'<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>',outlineID:"pswp__icn-close"},onClick:"close"};
+/** @type {import('./ui-element.js').UIElementData} UIElementData */const P={name:"zoom",title:"Zoom",order:10,isButton:true,html:{isCustomSVG:true,inner:'<path d="M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z" id="pswp__icn-zoom"/><path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/><path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"};
+/** @type {import('./ui-element.js').UIElementData} UIElementData */const S={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:true,inner:'<path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z" id="pswp__icn-loading"/>',outlineID:"pswp__icn-loading"},onInit:(t,e)=>{
+/** @type {boolean | undefined} */
+let i;
+/** @type {NodeJS.Timeout | null} */let s=null;
+/**
+ * @param {string} className
+ * @param {boolean} add
+ */const toggleIndicatorClass=(e,i)=>{t.classList.toggle("pswp__preloader--"+e,i)};
+/**
+ * @param {boolean} visible
+ */const setIndicatorVisibility=t=>{if(i!==t){i=t;toggleIndicatorClass("active",t)}};const updatePreloaderVisibility=()=>{var t;if((t=e.currSlide)!==null&&t!==void 0&&t.content.isLoading())s||(s=setTimeout((()=>{var t;setIndicatorVisibility(Boolean((t=e.currSlide)===null||t===void 0?void 0:t.content.isLoading()));s=null}),e.options.preloaderDelay));else{setIndicatorVisibility(false);if(s){clearTimeout(s);s=null}}};e.on("change",updatePreloaderVisibility);e.on("loadComplete",(t=>{e.currSlide===t.slide&&updatePreloaderVisibility()}));e.ui&&(e.ui.updatePreloaderVisibility=updatePreloaderVisibility)}};
+/** @type {import('./ui-element.js').UIElementData} UIElementData */const x={name:"counter",order:5,onInit:(t,e)=>{e.on("change",(()=>{t.innerText=e.currIndex+1+e.options.indexIndicatorSep+e.getNumItems()}))}};
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('./ui-element.js').UIElementData} UIElementData */
+/**
+ * Set special class on element when image is zoomed.
+ *
+ * By default, it is used to adjust
+ * zoom icon and zoom cursor via CSS.
+ *
+ * @param {HTMLElement} el
+ * @param {boolean} isZoomedIn
+ */function setZoomedIn(t,e){t.classList.toggle("pswp--zoomed-in",e)}class UI{
+/**
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t){this.pswp=t;this.isRegistered=false;
+/** @type {UIElementData[]} */this.uiElementsData=[];
+/** @type {(UIElement | UIElementData)[]} */this.items=[];
+/** @type {() => void} */this.updatePreloaderVisibility=()=>{};
+/**
+ * @private
+ * @type {number | undefined}
+ */this._lastUpdatedZoomLevel=void 0}init(){const{pswp:t}=this;this.isRegistered=false;this.uiElementsData=[w,_,y,P,S,x];t.dispatch("uiRegister");this.uiElementsData.sort(((t,e)=>(t.order||0)-(e.order||0)));this.items=[];this.isRegistered=true;this.uiElementsData.forEach((t=>{this.registerElement(t)}));t.on("change",(()=>{var e;(e=t.element)===null||e===void 0||e.classList.toggle("pswp--one-slide",t.getNumItems()===1)}));t.on("zoomPanUpdate",(()=>this._onZoomPanUpdate()))}
+/**
+ * @param {UIElementData} elementData
+ */registerElement(t){this.isRegistered?this.items.push(new UIElement(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){const{template:t,currSlide:e,options:i}=this.pswp;if(this.pswp.opener.isClosing||!t||!e)return;let{currZoomLevel:s}=e;this.pswp.opener.isOpen||(s=e.zoomLevels.initial);if(s===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=s;const n=e.zoomLevels.initial-e.zoomLevels.secondary;if(Math.abs(n)<.01||!e.isZoomable()){setZoomedIn(t,false);t.classList.remove("pswp--zoom-allowed");return}t.classList.add("pswp--zoom-allowed");const o=s===e.zoomLevels.initial?e.zoomLevels.secondary:e.zoomLevels.initial;setZoomedIn(t,o<=s);i.imageClickAction!=="zoom"&&i.imageClickAction!=="zoom-or-close"||t.classList.add("pswp--click-to-zoom")}}
+/** @typedef {import('./slide.js').SlideData} SlideData */
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {{ x: number; y: number; w: number; innerRect?: { w: number; h: number; x: number; y: number } }} Bounds */
+/**
+ * @param {HTMLElement} el
+ * @returns Bounds
+ */function getBoundsByElement(t){const e=t.getBoundingClientRect();return{x:e.left,y:e.top,w:e.width}}
+/**
+ * @param {HTMLElement} el
+ * @param {number} imageWidth
+ * @param {number} imageHeight
+ * @returns Bounds
+ */function getCroppedBoundsByElement(t,e,i){const s=t.getBoundingClientRect();const n=s.width/e;const o=s.height/i;const a=n>o?n:o;const r=(s.width-e*a)/2;const h=(s.height-i*a)/2;
+/**
+ * Coordinates of the image,
+ * as if it was not cropped,
+ * height is calculated automatically
+ *
+ * @type {Bounds}
+ */const l={x:s.left+r,y:s.top+h,w:e*a};l.innerRect={w:s.width,h:s.height,x:r,y:h};return l}
+/**
+ * Get dimensions of thumbnail image
+ * (click on which opens photoswipe or closes photoswipe to)
+ *
+ * @param {number} index
+ * @param {SlideData} itemData
+ * @param {PhotoSwipe} instance PhotoSwipe instance
+ * @returns {Bounds | undefined}
+ */function getThumbBounds(t,e,i){const s=i.dispatch("thumbBounds",{index:t,itemData:e,instance:i});if(s.thumbBounds)return s.thumbBounds;const{element:n}=e;
+/** @type {Bounds | undefined} */let o;
+/** @type {HTMLElement | null | undefined} */let a;if(n&&i.options.thumbSelector!==false){const t=i.options.thumbSelector||"img";a=n.matches(t)?n:
+/** @type {HTMLElement | null} */
+n.querySelector(t)}a=i.applyFilters("thumbEl",a,e,t);a&&(o=e.thumbCropped?getCroppedBoundsByElement(a,e.width||e.w||0,e.height||e.h||0):getBoundsByElement(a));return i.applyFilters("thumbBounds",o,e,t)}
+/** @typedef {import('../lightbox/lightbox.js').default} PhotoSwipeLightbox */
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
+/** @typedef {import('../photoswipe.js').DataSource} DataSource */
+/** @typedef {import('../ui/ui-element.js').UIElementData} UIElementData */
+/** @typedef {import('../slide/content.js').default} ContentDefault */
+/** @typedef {import('../slide/slide.js').default} Slide */
+/** @typedef {import('../slide/slide.js').SlideData} SlideData */
+/** @typedef {import('../slide/zoom-level.js').default} ZoomLevel */
+/** @typedef {import('../slide/get-thumb-bounds.js').Bounds} Bounds */
+/**
+ * Allow adding an arbitrary props to the Content
+ * https://photoswipe.com/custom-content/#using-webp-image-format
+ * @typedef {ContentDefault & Record<string, any>} Content
+ */
+/** @typedef {{ x?: number; y?: number }} Point */
+/**
+ * @typedef {Object} PhotoSwipeEventsMap https://photoswipe.com/events/
+ *
+ *
+ * https://photoswipe.com/adding-ui-elements/
+ *
+ * @prop {undefined} uiRegister
+ * @prop {{ data: UIElementData }} uiElementCreate
+ *
+ *
+ * https://photoswipe.com/events/#initialization-events
+ *
+ * @prop {undefined} beforeOpen
+ * @prop {undefined} firstUpdate
+ * @prop {undefined} initialLayout
+ * @prop {undefined} change
+ * @prop {undefined} afterInit
+ * @prop {undefined} bindEvents
+ *
+ *
+ * https://photoswipe.com/events/#opening-or-closing-transition-events
+ *
+ * @prop {undefined} openingAnimationStart
+ * @prop {undefined} openingAnimationEnd
+ * @prop {undefined} closingAnimationStart
+ * @prop {undefined} closingAnimationEnd
+ *
+ *
+ * https://photoswipe.com/events/#closing-events
+ *
+ * @prop {undefined} close
+ * @prop {undefined} destroy
+ *
+ *
+ * https://photoswipe.com/events/#pointer-and-gesture-events
+ *
+ * @prop {{ originalEvent: PointerEvent }} pointerDown
+ * @prop {{ originalEvent: PointerEvent }} pointerMove
+ * @prop {{ originalEvent: PointerEvent }} pointerUp
+ * @prop {{ bgOpacity: number }} pinchClose can be default prevented
+ * @prop {{ panY: number }} verticalDrag can be default prevented
+ *
+ *
+ * https://photoswipe.com/events/#slide-content-events
+ *
+ * @prop {{ content: Content }} contentInit
+ * @prop {{ content: Content; isLazy: boolean }} contentLoad can be default prevented
+ * @prop {{ content: Content; isLazy: boolean }} contentLoadImage can be default prevented
+ * @prop {{ content: Content; slide: Slide; isError?: boolean }} loadComplete
+ * @prop {{ content: Content; slide: Slide }} loadError
+ * @prop {{ content: Content; width: number; height: number }} contentResize can be default prevented
+ * @prop {{ content: Content; width: number; height: number; slide: Slide }} imageSizeChange
+ * @prop {{ content: Content }} contentLazyLoad can be default prevented
+ * @prop {{ content: Content }} contentAppend can be default prevented
+ * @prop {{ content: Content }} contentActivate can be default prevented
+ * @prop {{ content: Content }} contentDeactivate can be default prevented
+ * @prop {{ content: Content }} contentRemove can be default prevented
+ * @prop {{ content: Content }} contentDestroy can be default prevented
+ *
+ *
+ * undocumented
+ *
+ * @prop {{ point: Point; originalEvent: PointerEvent }} imageClickAction can be default prevented
+ * @prop {{ point: Point; originalEvent: PointerEvent }} bgClickAction can be default prevented
+ * @prop {{ point: Point; originalEvent: PointerEvent }} tapAction can be default prevented
+ * @prop {{ point: Point; originalEvent: PointerEvent }} doubleTapAction can be default prevented
+ *
+ * @prop {{ originalEvent: KeyboardEvent }} keydown can be default prevented
+ * @prop {{ x: number; dragging: boolean }} moveMainScroll
+ * @prop {{ slide: Slide }} firstZoomPan
+ * @prop {{ slide: Slide | undefined, data: SlideData, index: number }} gettingData
+ * @prop {undefined} beforeResize
+ * @prop {undefined} resize
+ * @prop {undefined} viewportSize
+ * @prop {undefined} updateScrollOffset
+ * @prop {{ slide: Slide }} slideInit
+ * @prop {{ slide: Slide }} afterSetContent
+ * @prop {{ slide: Slide }} slideLoad
+ * @prop {{ slide: Slide }} appendHeavy can be default prevented
+ * @prop {{ slide: Slide }} appendHeavyContent
+ * @prop {{ slide: Slide }} slideActivate
+ * @prop {{ slide: Slide }} slideDeactivate
+ * @prop {{ slide: Slide }} slideDestroy
+ * @prop {{ destZoomLevel: number, centerPoint: Point | undefined, transitionDuration: number | false | undefined }} beforeZoomTo
+ * @prop {{ slide: Slide }} zoomPanUpdate
+ * @prop {{ slide: Slide }} initialZoomPan
+ * @prop {{ slide: Slide }} calcSlideSize
+ * @prop {undefined} resolutionChanged
+ * @prop {{ originalEvent: WheelEvent }} wheel can be default prevented
+ * @prop {{ content: Content }} contentAppendImage can be default prevented
+ * @prop {{ index: number; itemData: SlideData }} lazyLoadSlide can be default prevented
+ * @prop {undefined} lazyLoad
+ * @prop {{ slide: Slide }} calcBounds
+ * @prop {{ zoomLevels: ZoomLevel, slideData: SlideData }} zoomLevelsUpdate
+ *
+ *
+ * legacy
+ *
+ * @prop {undefined} init
+ * @prop {undefined} initialZoomIn
+ * @prop {undefined} initialZoomOut
+ * @prop {undefined} initialZoomInEnd
+ * @prop {undefined} initialZoomOutEnd
+ * @prop {{ dataSource: DataSource | undefined, numItems: number }} numItems
+ * @prop {{ itemData: SlideData; index: number }} itemData
+ * @prop {{ index: number, itemData: SlideData, instance: PhotoSwipe }} thumbBounds
+ */
+/**
+ * @typedef {Object} PhotoSwipeFiltersMap https://photoswipe.com/filters/
+ *
+ * @prop {(numItems: number, dataSource: DataSource | undefined) => number} numItems
+ * Modify the total amount of slides. Example on Data sources page.
+ * https://photoswipe.com/filters/#numitems
+ *
+ * @prop {(itemData: SlideData, index: number) => SlideData} itemData
+ * Modify slide item data. Example on Data sources page.
+ * https://photoswipe.com/filters/#itemdata
+ *
+ * @prop {(itemData: SlideData, element: HTMLElement, linkEl: HTMLAnchorElement) => SlideData} domItemData
+ * Modify item data when it's parsed from DOM element. Example on Data sources page.
+ * https://photoswipe.com/filters/#domitemdata
+ *
+ * @prop {(clickedIndex: number, e: MouseEvent, instance: PhotoSwipeLightbox) => number} clickedIndex
+ * Modify clicked gallery item index.
+ * https://photoswipe.com/filters/#clickedindex
+ *
+ * @prop {(placeholderSrc: string | false, content: Content) => string | false} placeholderSrc
+ * Modify placeholder image source.
+ * https://photoswipe.com/filters/#placeholdersrc
+ *
+ * @prop {(isContentLoading: boolean, content: Content) => boolean} isContentLoading
+ * Modify if the content is currently loading.
+ * https://photoswipe.com/filters/#iscontentloading
+ *
+ * @prop {(isContentZoomable: boolean, content: Content) => boolean} isContentZoomable
+ * Modify if the content can be zoomed.
+ * https://photoswipe.com/filters/#iscontentzoomable
+ *
+ * @prop {(useContentPlaceholder: boolean, content: Content) => boolean} useContentPlaceholder
+ * Modify if the placeholder should be used for the content.
+ * https://photoswipe.com/filters/#usecontentplaceholder
+ *
+ * @prop {(isKeepingPlaceholder: boolean, content: Content) => boolean} isKeepingPlaceholder
+ * Modify if the placeholder should be kept after the content is loaded.
+ * https://photoswipe.com/filters/#iskeepingplaceholder
+ *
+ *
+ * @prop {(contentErrorElement: HTMLElement, content: Content) => HTMLElement} contentErrorElement
+ * Modify an element when the content has error state (for example, if image cannot be loaded).
+ * https://photoswipe.com/filters/#contenterrorelement
+ *
+ * @prop {(element: HTMLElement, data: UIElementData) => HTMLElement} uiElement
+ * Modify a UI element that's being created.
+ * https://photoswipe.com/filters/#uielement
+ *
+ * @prop {(thumbnail: HTMLElement | null | undefined, itemData: SlideData, index: number) => HTMLElement} thumbEl
+ * Modify the thumbnail element from which opening zoom animation starts or ends.
+ * https://photoswipe.com/filters/#thumbel
+ *
+ * @prop {(thumbBounds: Bounds | undefined, itemData: SlideData, index: number) => Bounds} thumbBounds
+ * Modify the thumbnail bounds from which opening zoom animation starts or ends.
+ * https://photoswipe.com/filters/#thumbbounds
+ *
+ * @prop {(srcsetSizesWidth: number, content: Content) => number} srcsetSizesWidth
+ *
+ * @prop {(preventPointerEvent: boolean, event: PointerEvent, pointerType: string) => boolean} preventPointerEvent
+ *
+ */
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @typedef {{ fn: PhotoSwipeFiltersMap[T], priority: number }} Filter
+ */
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @typedef {PhotoSwipeEventsMap[T] extends undefined ? PhotoSwipeEvent<T> : PhotoSwipeEvent<T> & PhotoSwipeEventsMap[T]} AugmentedEvent
+ */
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @typedef {(event: AugmentedEvent<T>) => void} EventCallback
+ */
+/**
+ * Base PhotoSwipe event object
+ *
+ * @template {keyof PhotoSwipeEventsMap} T
+ */class PhotoSwipeEvent{
+/**
+ * @param {T} type
+ * @param {PhotoSwipeEventsMap[T]} [details]
+ */
+constructor(t,e){this.type=t;this.defaultPrevented=false;e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=true}}class Eventable{constructor(){
+/**
+ * @type {{ [T in keyof PhotoSwipeEventsMap]?: ((event: AugmentedEvent<T>) => void)[] }}
+ */
+this._listeners={};
+/**
+ * @type {{ [T in keyof PhotoSwipeFiltersMap]?: Filter<T>[] }}
+ */this._filters={};
+/** @type {PhotoSwipe | undefined} */this.pswp=void 0;
+/** @type {PhotoSwipeOptions | undefined} */this.options=void 0}
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @param {T} name
+ * @param {PhotoSwipeFiltersMap[T]} fn
+ * @param {number} priority
+ */addFilter(t,e,i=100){var s,n,o;this._filters[t]||(this._filters[t]=[]);(s=this._filters[t])===null||s===void 0||s.push({fn:e,priority:i});(n=this._filters[t])===null||n===void 0||n.sort(((t,e)=>t.priority-e.priority));(o=this.pswp)===null||o===void 0||o.addFilter(t,e,i)}
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @param {T} name
+ * @param {PhotoSwipeFiltersMap[T]} fn
+ */removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter((t=>t.fn!==e)));this.pswp&&this.pswp.removeFilter(t,e)}
+/**
+ * @template {keyof PhotoSwipeFiltersMap} T
+ * @param {T} name
+ * @param {Parameters<PhotoSwipeFiltersMap[T]>} args
+ * @returns {Parameters<PhotoSwipeFiltersMap[T]>[0]}
+ */applyFilters(t,...e){var i;(i=this._filters[t])===null||i===void 0||i.forEach((t=>{e[0]=t.fn.apply(this,e)}));return e[0]}
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @param {T} name
+ * @param {EventCallback<T>} fn
+ */on(t,e){var i,s;this._listeners[t]||(this._listeners[t]=[]);(i=this._listeners[t])===null||i===void 0||i.push(e);(s=this.pswp)===null||s===void 0||s.on(t,e)}
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @param {T} name
+ * @param {EventCallback<T>} fn
+ */off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter((t=>e!==t)));(i=this.pswp)===null||i===void 0||i.off(t,e)}
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @param {T} name
+ * @param {PhotoSwipeEventsMap[T]} [details]
+ * @returns {AugmentedEvent<T>}
+ */dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);const s=
+/** @type {AugmentedEvent<T>} */
+new PhotoSwipeEvent(t,e);(i=this._listeners[t])===null||i===void 0||i.forEach((t=>{t.call(this,s)}));return s}}class Placeholder{
+/**
+ * @param {string | false} imageSrc
+ * @param {HTMLElement} container
+ */
+constructor(t,e){
+/** @type {HTMLImageElement | HTMLDivElement | null} */
+this.element=createElement("pswp__img pswp__img--placeholder",t?"img":"div",e);if(t){const e=
+/** @type {HTMLImageElement} */
+this.element;e.decoding="async";e.alt="";e.src=t;e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}
+/**
+ * @param {number} width
+ * @param {number} height
+ */setDisplayedSize(t,e){if(this.element)if(this.element.tagName==="IMG"){setWidthHeight(this.element,250,"auto");this.element.style.transformOrigin="0 0";this.element.style.transform=toTransformString(0,0,t/250)}else setWidthHeight(this.element,t,e)}destroy(){var t;(t=this.element)!==null&&t!==void 0&&t.parentNode&&this.element.remove();this.element=null}}
+/** @typedef {import('./slide.js').default} Slide */
+/** @typedef {import('./slide.js').SlideData} SlideData */
+/** @typedef {import('../core/base.js').default} PhotoSwipeBase */
+/** @typedef {import('../util/util.js').LoadState} LoadState */class Content{
+/**
+ * @param {SlideData} itemData Slide data
+ * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance
+ * @param {number} index
+ */
+constructor(t,i,s){this.instance=i;this.data=t;this.index=s;
+/** @type {HTMLImageElement | HTMLDivElement | undefined} */this.element=void 0;
+/** @type {Placeholder | undefined} */this.placeholder=void 0;
+/** @type {Slide | undefined} */this.slide=void 0;this.displayedImageWidth=0;this.displayedImageHeight=0;this.width=Number(this.data.w)||Number(this.data.width)||0;this.height=Number(this.data.h)||Number(this.data.height)||0;this.isAttached=false;this.hasSlide=false;this.isDecoding=false;
+/** @type {LoadState} */this.state=e.IDLE;this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html";this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{if(this.placeholder){this.placeholder.destroy();this.placeholder=void 0}}),1e3)}
+/**
+ * Preload content
+ *
+ * @param {boolean} isLazy
+ * @param {boolean} [reload]
+ */load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new Placeholder(t,this.slide.container)}if((!this.element||e)&&!this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented){if(this.isImageContent()){this.element=createElement("pswp__img","img");this.displayedImageWidth&&this.loadImage(t)}else{this.element=createElement("pswp__content","div");this.element.innerHTML=this.data.html||""}e&&this.slide&&this.slide.updateContentSize(true)}}
+/**
+ * Preload image
+ *
+ * @param {boolean} isLazy
+ */loadImage(t){var i,s;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const n=
+/** @type HTMLImageElement */
+this.element;this.updateSrcsetSizes();this.data.srcset&&(n.srcset=this.data.srcset);n.src=(i=this.data.src)!==null&&i!==void 0?i:"";n.alt=(s=this.data.alt)!==null&&s!==void 0?s:"";this.state=e.LOADING;if(n.complete)this.onLoaded();else{n.onload=()=>{this.onLoaded()};n.onerror=()=>{this.onError()}}}
+/**
+ * Assign slide to content
+ *
+ * @param {Slide} slide
+ */setSlide(t){this.slide=t;this.hasSlide=true;this.instance=t.pswp}onLoaded(){this.state=e.LOADED;if(this.slide&&this.element){this.instance.dispatch("loadComplete",{slide:this.slide,content:this});if(this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode){this.append();this.slide.updateContentSize(true)}this.state!==e.LOADED&&this.state!==e.ERROR||this.removePlaceholder()}}onError(){this.state=e.ERROR;if(this.slide){this.displayError();this.instance.dispatch("loadComplete",{slide:this.slide,isError:true,content:this});this.instance.dispatch("loadError",{slide:this.slide,content:this})}}
+/**
+ * @returns {Boolean} If the content is currently loading
+ */isLoading(){return this.instance.applyFilters("isContentLoading",this.state===e.LOADING,this)}
+/**
+ * @returns {Boolean} If the content is in error state
+ */isError(){return this.state===e.ERROR}
+/**
+ * @returns {boolean} If the content is image
+ */isImageContent(){return this.type==="image"}
+/**
+ * Update content size
+ *
+ * @param {Number} width
+ * @param {Number} height
+ */setDisplayedSize(t,e){if(this.element){this.placeholder&&this.placeholder.setDisplayedSize(t,e);if(!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented){setWidthHeight(this.element,t,e);if(this.isImageContent()&&!this.isError()){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t;this.displayedImageHeight=e;i?this.loadImage(false):this.updateSrcsetSizes();this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}}}
+/**
+ * @returns {boolean} If the content can be zoomed
+ */isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==e.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=
+/** @type HTMLImageElement */
+this.element;const e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);if(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10)){t.sizes=e+"px";t.dataset.largestUsedSize=String(e)}}
+/**
+ * @returns {boolean} If content should use a placeholder (from msrc by default)
+ */usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(true)}
+/**
+ * @returns {boolean} If placeholder should be kept after content is loaded
+ */keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=false;this.slide=void 0;if(!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented){this.remove();if(this.placeholder){this.placeholder.destroy();this.placeholder=void 0}if(this.isImageContent()&&this.element){this.element.onload=null;this.element.onerror=null;this.element=void 0}}}displayError(){if(this.slide){var t,e;let i=createElement("pswp__error-msg","div");i.innerText=(t=(e=this.instance.options)===null||e===void 0?void 0:e.errorMsg)!==null&&t!==void 0?t:"";i=
+/** @type {HTMLDivElement} */
+this.instance.applyFilters("contentErrorElement",i,this);this.element=createElement("pswp__content pswp__error-msg-container","div");this.element.appendChild(i);this.slide.container.innerText="";this.slide.container.appendChild(this.element);this.slide.updateContentSize(true);this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;this.isAttached=true;if(this.state===e.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;if(this.isImageContent())if(t&&this.slide&&(!this.slide.isActive||isSafari())){this.isDecoding=true;
+/** @type {HTMLImageElement} */this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=false;this.appendImage()}))}else this.appendImage();else this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){if(!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide){this.isImageContent()&&this.isDecoding&&!isSafari()?this.appendImage():this.isError()&&this.load(false,true);this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false")}}deactivate(){this.instance.dispatch("contentDeactivate",{content:this});this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=false;if(!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented){this.element&&this.element.parentNode&&this.element.remove();this.placeholder&&this.placeholder.element&&this.placeholder.element.remove()}}appendImage(){if(this.isAttached&&!this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented){this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element);this.state!==e.LOADED&&this.state!==e.ERROR||this.removePlaceholder()}}}
+/** @typedef {import('./content.js').default} Content */
+/** @typedef {import('./slide.js').default} Slide */
+/** @typedef {import('./slide.js').SlideData} SlideData */
+/** @typedef {import('../core/base.js').default} PhotoSwipeBase */
+/** @typedef {import('../photoswipe.js').default} PhotoSwipe */const z=5;
+/**
+ * Lazy-load an image
+ * This function is used both by Lightbox and PhotoSwipe core,
+ * thus it can be called before dialog is opened.
+ *
+ * @param {SlideData} itemData Data about the slide
+ * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance
+ * @param {number} index
+ * @returns {Content} Image that is being decoded or false.
+ */function lazyLoadData(t,e,i){const s=e.createContentFromData(t,i);
+/** @type {ZoomLevel | undefined} */let n;const{options:o}=e;if(o){n=new ZoomLevel(o,t,-1);let a;a=e.pswp?e.pswp.viewportSize:getViewportSize(o,e);const r=getPanAreaSize(o,a,t,i);n.update(s.width,s.height,r)}s.lazyLoad();n&&s.setDisplayedSize(Math.ceil(s.width*n.initial),Math.ceil(s.height*n.initial));return s}
+/**
+ * Lazy-loads specific slide.
+ * This function is used both by Lightbox and PhotoSwipe core,
+ * thus it can be called before dialog is opened.
+ *
+ * By default, it loads image based on viewport size and initial zoom level.
+ *
+ * @param {number} index Slide index
+ * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox eventable instance
+ * @returns {Content | undefined}
+ */function lazyLoadSlide(t,e){const i=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return lazyLoadData(i,e,t)}class ContentLoader{
+/**
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t){this.pswp=t;this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,z);
+/** @type {Content[]} */this._cachedItems=[]}
+/**
+ * Lazy load nearby slides based on `preload` option.
+ *
+ * @param {number} [diff] Difference between slide indexes that was changed recently, or 0.
+ */updateLazy(t){const{pswp:e}=this;if(e.dispatch("lazyLoad").defaultPrevented)return;const{preload:i}=e.options;const s=t===void 0||t>=0;let n;for(n=0;n<=i[1];n++)this.loadSlideByIndex(e.currIndex+(s?n:-n));for(n=1;n<=i[0];n++)this.loadSlideByIndex(e.currIndex+(s?-n:n))}
+/**
+ * @param {number} initialIndex
+ */loadSlideByIndex(t){const e=this.pswp.getLoopedIndex(t);let i=this.getContentByIndex(e);if(!i){i=lazyLoadSlide(e,this.pswp);i&&this.addToCache(i)}}
+/**
+ * @param {Slide} slide
+ * @returns {Content}
+ */getContentBySlide(t){let e=this.getContentByIndex(t.index);if(!e){e=this.pswp.createContentFromData(t.data,t.index);this.addToCache(e)}e.setSlide(t);return e}
+/**
+ * @param {Content} content
+ */addToCache(t){this.removeByIndex(t.index);this._cachedItems.push(t);if(this._cachedItems.length>this.limit){const t=this._cachedItems.findIndex((t=>!t.isAttached&&!t.hasSlide));if(t!==-1){const e=this._cachedItems.splice(t,1)[0];e.destroy()}}}
+/**
+ * Removes an image from cache, does not destroy() it, just removes.
+ *
+ * @param {number} index
+ */removeByIndex(t){const e=this._cachedItems.findIndex((e=>e.index===t));e!==-1&&this._cachedItems.splice(e,1)}
+/**
+ * @param {number} index
+ * @returns {Content | undefined}
+ */getContentByIndex(t){return this._cachedItems.find((e=>e.index===t))}destroy(){this._cachedItems.forEach((t=>t.destroy()));this._cachedItems=[]}}
+/** @typedef {import("../photoswipe.js").default} PhotoSwipe */
+/** @typedef {import("../slide/slide.js").SlideData} SlideData */class PhotoSwipeBase extends Eventable{
+/**
+ * Get total number of slides
+ *
+ * @returns {number}
+ */
+getNumItems(){var t;let e=0;const i=(t=this.options)===null||t===void 0?void 0:t.dataSource;if(i&&"length"in i)e=i.length;else if(i&&"gallery"in i){i.items||(i.items=this._getGalleryDOMElements(i.gallery));i.items&&(e=i.items.length)}const s=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",s.numItems,i)}
+/**
+ * @param {SlideData} slideData
+ * @param {number} index
+ * @returns {Content}
+ */createContentFromData(t,e){return new Content(t,this,e)}
+/**
+ * Get item data by index.
+ *
+ * "item data" should contain normalized information that PhotoSwipe needs to generate a slide.
+ * For example, it may contain properties like
+ * `src`, `srcset`, `w`, `h`, which will be used to generate a slide with image.
+ *
+ * @param {number} index
+ * @returns {SlideData}
+ */getItemData(t){var e;const i=(e=this.options)===null||e===void 0?void 0:e.dataSource;
+/** @type {SlideData | HTMLElement} */let s={};if(Array.isArray(i))s=i[t];else if(i&&"gallery"in i){i.items||(i.items=this._getGalleryDOMElements(i.gallery));s=i.items[t]}let n=s;n instanceof Element&&(n=this._domElementToItemData(n));const o=this.dispatch("itemData",{itemData:n||{},index:t});return this.applyFilters("itemData",o.itemData,t)}
+/**
+ * Get array of gallery DOM elements,
+ * based on childSelector and gallery element.
+ *
+ * @param {HTMLElement} galleryElement
+ * @returns {HTMLElement[]}
+ */_getGalleryDOMElements(t){var e,i;return(e=this.options)!==null&&e!==void 0&&e.children||(i=this.options)!==null&&i!==void 0&&i.childSelector?getElementsFromOption(this.options.children,this.options.childSelector,t)||[]:[t]}
+/**
+ * Converts DOM element to item data object.
+ *
+ * @param {HTMLElement} element DOM element
+ * @returns {SlideData}
+ */_domElementToItemData(t){
+/** @type {SlideData} */
+const e={element:t};const i=
+/** @type {HTMLAnchorElement} */
+t.tagName==="A"?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href;i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset);e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0;e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0;e.w=e.width;e.h=e.height;i.dataset.pswpType&&(e.type=i.dataset.pswpType);const n=t.querySelector("img");if(n){var s;e.msrc=n.currentSrc||n.src;e.alt=(s=n.getAttribute("alt"))!==null&&s!==void 0?s:""}(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=true)}return this.applyFilters("domItemData",e,t,i)}
+/**
+ * Lazy-load by slide data
+ *
+ * @param {SlideData} itemData Data about the slide
+ * @param {number} index
+ * @returns {Content} Image that is being decoded or false.
+ */lazyLoadData(t,e){return lazyLoadData(t,this,e)}}
+/** @typedef {import('./photoswipe.js').default} PhotoSwipe */
+/** @typedef {import('./slide/get-thumb-bounds.js').Bounds} Bounds */
+/** @typedef {import('./util/animations.js').AnimationProps} AnimationProps */const b=.003;class Opener{
+/**
+ * @param {PhotoSwipe} pswp
+ */
+constructor(t){this.pswp=t;this.isClosed=true;this.isOpen=false;this.isClosing=false;this.isOpening=false;
+/**
+ * @private
+ * @type {number | false | undefined}
+ */this._duration=void 0;this._useAnimation=false;this._croppedZoom=false;this._animateRootOpacity=false;this._animateBgOpacity=false;
+/**
+ * @private
+ * @type { HTMLDivElement | HTMLImageElement | null | undefined }
+ */this._placeholder=void 0;
+/**
+ * @private
+ * @type { HTMLDivElement | undefined }
+ */this._opacityElement=void 0;
+/**
+ * @private
+ * @type { HTMLDivElement | undefined }
+ */this._cropContainer1=void 0;
+/**
+ * @private
+ * @type { HTMLElement | null | undefined }
+ */this._cropContainer2=void 0;
+/**
+ * @private
+ * @type {Bounds | undefined}
+ */this._thumbBounds=void 0;this._prepareOpen=this._prepareOpen.bind(this);t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen();this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const t=this.pswp.currSlide;this.isOpen=false;this.isOpening=false;this.isClosing=true;this._duration=this.pswp.options.hideAnimationDuration;t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0);this._applyStartProps();setTimeout((()=>{this._start()}),this._croppedZoom?30:0)}_prepareOpen(){this.pswp.off("firstZoomPan",this._prepareOpen);if(!this.isOpening){const t=this.pswp.currSlide;this.isOpening=true;this.isClosing=false;this._duration=this.pswp.options.showAnimationDuration;t&&t.zoomLevels.initial*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0);this._applyStartProps()}}_applyStartProps(){const{pswp:t}=this;const e=this.pswp.currSlide;const{options:i}=t;if(i.showHideAnimationType==="fade"){i.showHideOpacity=true;this._thumbBounds=void 0}else if(i.showHideAnimationType==="none"){i.showHideOpacity=false;this._duration=0;this._thumbBounds=void 0}else this.isOpening&&t._initialThumbBounds?this._thumbBounds=t._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds();this._placeholder=e===null||e===void 0?void 0:e.getPlaceholderElement();t.animations.stopAll();this._useAnimation=Boolean(this._duration&&this._duration>50);this._animateZoom=Boolean(this._thumbBounds)&&(e===null||e===void 0?void 0:e.content.usePlaceholder())&&(!this.isClosing||!t.mainScroll.isShifted());if(this._animateZoom){var s;this._animateRootOpacity=(s=i.showHideOpacity)!==null&&s!==void 0&&s}else{this._animateRootOpacity=true;if(this.isOpening&&e){e.zoomAndPanToInitial();e.applyCurrentZoomPan()}}this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>b;this._opacityElement=this._animateRootOpacity?t.element:t.bg;if(this._useAnimation){if(this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect){var n;this._croppedZoom=true;this._cropContainer1=this.pswp.container;this._cropContainer2=(n=this.pswp.currSlide)===null||n===void 0?void 0:n.holderElement;if(t.container){t.container.style.overflow="hidden";t.container.style.width=t.viewportSize.x+"px"}}else this._croppedZoom=false;if(this.isOpening){if(this._animateRootOpacity){t.element&&(t.element.style.opacity=String(b));t.applyBgOpacity(1)}else{this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(b));t.element&&(t.element.style.opacity="1")}if(this._animateZoom){this._setClosedStateZoomPan();if(this._placeholder){this._placeholder.style.willChange="transform";this._placeholder.style.opacity=String(b)}}}else if(this.isClosing){t.mainScroll.itemHolders[0]&&(t.mainScroll.itemHolders[0].el.style.display="none");t.mainScroll.itemHolders[2]&&(t.mainScroll.itemHolders[2].el.style.display="none");if(this._croppedZoom&&t.mainScroll.x!==0){t.mainScroll.resetPosition();t.mainScroll.resize()}}}else{this._duration=0;this._animateZoom=false;this._animateBgOpacity=false;this._animateRootOpacity=true;if(this.isOpening){t.element&&(t.element.style.opacity=String(b));t.applyBgOpacity(1)}}}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&this._placeholder.tagName==="IMG"?new Promise((t=>{let e=false;let i=true;decodeImage(
+/** @type {HTMLImageElement} */
+this._placeholder).finally((()=>{e=true;i||t(true)}));setTimeout((()=>{i=false;e&&t(true)}),50);setTimeout(t,250)})).finally((()=>this._initiate())):this._initiate()}_initiate(){var t,e;(t=this.pswp.element)===null||t===void 0||t.style.setProperty("--pswp-transition-duration",this._duration+"ms");this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart");this.pswp.dispatch(
+/** @type {'initialZoomIn' | 'initialZoomOut'} */
+"initialZoom"+(this.isOpening?"In":"Out"));(e=this.pswp.element)===null||e===void 0||e.classList.toggle("pswp--ui-visible",this.isOpening);if(this.isOpening){this._placeholder&&(this._placeholder.style.opacity="1");this._animateToOpenState()}else this.isClosing&&this._animateToClosedState();this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){const{pswp:t}=this;this.isOpen=this.isOpening;this.isClosed=this.isClosing;this.isOpening=false;this.isClosing=false;t.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd");t.dispatch(
+/** @type {'initialZoomInEnd' | 'initialZoomOutEnd'} */
+"initialZoom"+(this.isOpen?"InEnd":"OutEnd"));if(this.isClosed)t.destroy();else if(this.isOpen){var e;if(this._animateZoom&&t.container){t.container.style.overflow="visible";t.container.style.width="100%"}(e=t.currSlide)===null||e===void 0||e.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:t}=this;if(this._animateZoom){if(this._croppedZoom&&this._cropContainer1&&this._cropContainer2){this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)");this._animateTo(this._cropContainer2,"transform","none")}if(t.currSlide){t.currSlide.zoomAndPanToInitial();this._animateTo(t.currSlide.container,"transform",t.currSlide.getCurrentTransform())}}this._animateBgOpacity&&t.bg&&this._animateTo(t.bg,"opacity",String(t.options.bgOpacity));this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","1")}_animateToClosedState(){const{pswp:t}=this;this._animateZoom&&this._setClosedStateZoomPan(true);this._animateBgOpacity&&t.bgOpacity>.01&&t.bg&&this._animateTo(t.bg,"opacity","0");this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","0")}
+/**
+ * @private
+ * @param {boolean} [animate]
+ */_setClosedStateZoomPan(t){if(!this._thumbBounds)return;const{pswp:e}=this;const{innerRect:i}=this._thumbBounds;const{currSlide:s,viewportSize:n}=e;if(this._croppedZoom&&i&&this._cropContainer1&&this._cropContainer2){const e=-n.x+(this._thumbBounds.x-i.x)+i.w;const s=-n.y+(this._thumbBounds.y-i.y)+i.h;const o=n.x-i.w;const a=n.y-i.h;if(t){this._animateTo(this._cropContainer1,"transform",toTransformString(e,s));this._animateTo(this._cropContainer2,"transform",toTransformString(o,a))}else{setTransform(this._cropContainer1,e,s);setTransform(this._cropContainer2,o,a)}}if(s){equalizePoints(s.pan,i||this._thumbBounds);s.currZoomLevel=this._thumbBounds.w/s.width;t?this._animateTo(s.container,"transform",s.getCurrentTransform()):s.applyCurrentZoomPan()}}
+/**
+ * @private
+ * @param {HTMLElement} target
+ * @param {'transform' | 'opacity'} prop
+ * @param {string} propValue
+ */_animateTo(t,e,i){if(!this._duration){t.style[e]=i;return}const{animations:s}=this.pswp;
+/** @type {AnimationProps} */const n={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{s.activeAnimations.length||this._onAnimationComplete()},target:t};n[e]=i;s.startTransition(n)}}
+/**
+ * @template T
+ * @typedef {import('./types.js').Type<T>} Type<T>
+ */
+/** @typedef {import('./slide/slide.js').SlideData} SlideData */
+/** @typedef {import('./slide/zoom-level.js').ZoomLevelOption} ZoomLevelOption */
+/** @typedef {import('./ui/ui-element.js').UIElementData} UIElementData */
+/** @typedef {import('./main-scroll.js').ItemHolder} ItemHolder */
+/** @typedef {import('./core/eventable.js').PhotoSwipeEventsMap} PhotoSwipeEventsMap */
+/** @typedef {import('./core/eventable.js').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */
+/** @typedef {import('./slide/get-thumb-bounds').Bounds} Bounds */
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @typedef {import('./core/eventable.js').EventCallback<T>} EventCallback<T>
+ */
+/**
+ * @template {keyof PhotoSwipeEventsMap} T
+ * @typedef {import('./core/eventable.js').AugmentedEvent<T>} AugmentedEvent<T>
+ */
+/** @typedef {{ x: number; y: number; id?: string | number }} Point */
+/** @typedef {{ top: number; bottom: number; left: number; right: number }} Padding */
+/** @typedef {SlideData[]} DataSourceArray */
+/** @typedef {{ gallery: HTMLElement; items?: HTMLElement[] }} DataSourceObject */
+/** @typedef {DataSourceArray | DataSourceObject} DataSource */
+/** @typedef {(point: Point, originalEvent: PointerEvent) => void} ActionFn */
+/** @typedef {'close' | 'next' | 'zoom' | 'zoom-or-close' | 'toggle-controls'} ActionType */
+/** @typedef {Type<PhotoSwipe> | { default: Type<PhotoSwipe> }} PhotoSwipeModule */
+/** @typedef {PhotoSwipeModule | Promise<PhotoSwipeModule> | (() => Promise<PhotoSwipeModule>)} PhotoSwipeModuleOption */
+/**
+ * @typedef {string | NodeListOf<HTMLElement> | HTMLElement[] | HTMLElement} ElementProvider
+ */
+/** @typedef {Partial<PreparedPhotoSwipeOptions>} PhotoSwipeOptions https://photoswipe.com/options/ */
+/**
+ * @typedef {Object} PreparedPhotoSwipeOptions
+ *
+ * @prop {DataSource} [dataSource]
+ * Pass an array of any items via dataSource option. Its length will determine amount of slides
+ * (which may be modified further from numItems event).
+ *
+ * Each item should contain data that you need to generate slide
+ * (for image slide it would be src (image URL), width (image width), height, srcset, alt).
+ *
+ * If these properties are not present in your initial array, you may "pre-parse" each item from itemData filter.
+ *
+ * @prop {number} bgOpacity
+ * Background backdrop opacity, always define it via this option and not via CSS rgba color.
+ *
+ * @prop {number} spacing
+ * Spacing between slides. Defined as ratio relative to the viewport width (0.1 = 10% of viewport).
+ *
+ * @prop {boolean} allowPanToNext
+ * Allow swipe navigation to the next slide when the current slide is zoomed. Does not apply to mouse events.
+ *
+ * @prop {boolean} loop
+ * If set to true you'll be able to swipe from the last to the first image.
+ * Option is always false when there are less than 3 slides.
+ *
+ * @prop {boolean} [wheelToZoom]
+ * By default PhotoSwipe zooms image with ctrl-wheel, if you enable this option - image will zoom just via wheel.
+ *
+ * @prop {boolean} pinchToClose
+ * Pinch touch gesture to close the gallery.
+ *
+ * @prop {boolean} closeOnVerticalDrag
+ * Vertical drag gesture to close the PhotoSwipe.
+ *
+ * @prop {Padding} [padding]
+ * Slide area padding (in pixels).
+ *
+ * @prop {(viewportSize: Point, itemData: SlideData, index: number) => Padding} [paddingFn]
+ * The option is checked frequently, so make sure it's performant. Overrides padding option if defined. For example:
+ *
+ * @prop {number | false} hideAnimationDuration
+ * Transition duration in milliseconds, can be 0.
+ *
+ * @prop {number | false} showAnimationDuration
+ * Transition duration in milliseconds, can be 0.
+ *
+ * @prop {number | false} zoomAnimationDuration
+ * Transition duration in milliseconds, can be 0.
+ *
+ * @prop {string} easing
+ * String, 'cubic-bezier(.4,0,.22,1)'. CSS easing function for open/close/zoom transitions.
+ *
+ * @prop {boolean} escKey
+ * Esc key to close.
+ *
+ * @prop {boolean} arrowKeys
+ * Left/right arrow keys for navigation.
+ *
+ * @prop {boolean} trapFocus
+ * Trap focus within PhotoSwipe element while it's open.
+ *
+ * @prop {boolean} returnFocus
+ * Restore focus the last active element after PhotoSwipe is closed.
+ *
+ * @prop {boolean} clickToCloseNonZoomable
+ * If image is not zoomable (for example, smaller than viewport) it can be closed by clicking on it.
+ *
+ * @prop {ActionType | ActionFn | false} imageClickAction
+ * Refer to click and tap actions page.
+ *
+ * @prop {ActionType | ActionFn | false} bgClickAction
+ * Refer to click and tap actions page.
+ *
+ * @prop {ActionType | ActionFn | false} tapAction
+ * Refer to click and tap actions page.
+ *
+ * @prop {ActionType | ActionFn | false} doubleTapAction
+ * Refer to click and tap actions page.
+ *
+ * @prop {number} preloaderDelay
+ * Delay before the loading indicator will be displayed,
+ * if image is loaded during it - the indicator will not be displayed at all. Can be zero.
+ *
+ * @prop {string} indexIndicatorSep
+ * Used for slide count indicator ("1 of 10 ").
+ *
+ * @prop {(options: PhotoSwipeOptions, pswp: PhotoSwipeBase) => Point} [getViewportSizeFn]
+ * A function that should return slide viewport width and height, in format {x: 100, y: 100}.
+ *
+ * @prop {string} errorMsg
+ * Message to display when the image wasn't able to load. If you need to display HTML - use contentErrorElement filter.
+ *
+ * @prop {[number, number]} preload
+ * Lazy loading of nearby slides based on direction of movement. Should be an array with two integers,
+ * first one - number of items to preload before the current image, second one - after the current image.
+ * Two nearby images are always loaded.
+ *
+ * @prop {string} [mainClass]
+ * Class that will be added to the root element of PhotoSwipe, may contain multiple separated by space.
+ * Example on Styling page.
+ *
+ * @prop {HTMLElement} [appendToEl]
+ * Element to which PhotoSwipe dialog will be appended when it opens.
+ *
+ * @prop {number} maxWidthToAnimate
+ * Maximum width of image to animate, if initial rendered image width
+ * is larger than this value - the opening/closing transition will be automatically disabled.
+ *
+ * @prop {string} [closeTitle]
+ * Translating
+ *
+ * @prop {string} [zoomTitle]
+ * Translating
+ *
+ * @prop {string} [arrowPrevTitle]
+ * Translating
+ *
+ * @prop {string} [arrowNextTitle]
+ * Translating
+ *
+ * @prop {'zoom' | 'fade' | 'none'} [showHideAnimationType]
+ * To adjust opening or closing transition type use lightbox option `showHideAnimationType` (`String`).
+ * It supports three values - `zoom` (default), `fade` (default if there is no thumbnail) and `none`.
+ *
+ * Animations are automatically disabled if user `(prefers-reduced-motion: reduce)`.
+ *
+ * @prop {number} index
+ * Defines start slide index.
+ *
+ * @prop {(e: MouseEvent) => number} [getClickedIndexFn]
+ *
+ * @prop {boolean} [arrowPrev]
+ * @prop {boolean} [arrowNext]
+ * @prop {boolean} [zoom]
+ * @prop {boolean} [close]
+ * @prop {boolean} [counter]
+ *
+ * @prop {string} [arrowPrevSVG]
+ * @prop {string} [arrowNextSVG]
+ * @prop {string} [zoomSVG]
+ * @prop {string} [closeSVG]
+ * @prop {string} [counterSVG]
+ *
+ * @prop {string} [arrowPrevTitle]
+ * @prop {string} [arrowNextTitle]
+ * @prop {string} [zoomTitle]
+ * @prop {string} [closeTitle]
+ * @prop {string} [counterTitle]
+ *
+ * @prop {ZoomLevelOption} [initialZoomLevel]
+ * @prop {ZoomLevelOption} [secondaryZoomLevel]
+ * @prop {ZoomLevelOption} [maxZoomLevel]
+ *
+ * @prop {boolean} [mouseMovePan]
+ * @prop {Point | null} [initialPointerPos]
+ * @prop {boolean} [showHideOpacity]
+ *
+ * @prop {PhotoSwipeModuleOption} [pswpModule]
+ * @prop {() => Promise<any>} [openPromise]
+ * @prop {boolean} [preloadFirstSlide]
+ * @prop {ElementProvider} [gallery]
+ * @prop {string} [gallerySelector]
+ * @prop {ElementProvider} [children]
+ * @prop {string} [childSelector]
+ * @prop {string | false} [thumbSelector]
+ */
+/** @type {PreparedPhotoSwipeOptions} */const L={allowPanToNext:true,spacing:.1,loop:true,pinchToClose:true,closeOnVerticalDrag:true,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:true,arrowKeys:true,trapFocus:true,returnFocus:true,maxWidthToAnimate:4e3,clickToCloseNonZoomable:true,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};class PhotoSwipe extends PhotoSwipeBase{
+/**
+ * @param {PhotoSwipeOptions} [options]
+ */
+constructor(t){super();this.options=this._prepareOptions(t||{});
+/**
+ * offset of viewport relative to document
+ *
+ * @type {Point}
+ */this.offset={x:0,y:0};
+/**
+ * @type {Point}
+ * @private
+ */this._prevViewportSize={x:0,y:0};
+/**
+ * Size of scrollable PhotoSwipe viewport
+ *
+ * @type {Point}
+ */this.viewportSize={x:0,y:0};this.bgOpacity=1;this.currIndex=0;this.potentialIndex=0;this.isOpen=false;this.isDestroying=false;this.hasMouse=false;
+/**
+ * @private
+ * @type {SlideData}
+ */this._initialItemData={};
+/** @type {Bounds | undefined} */this._initialThumbBounds=void 0;
+/** @type {HTMLDivElement | undefined} */this.topBar=void 0;
+/** @type {HTMLDivElement | undefined} */this.element=void 0;
+/** @type {HTMLDivElement | undefined} */this.template=void 0;
+/** @type {HTMLDivElement | undefined} */this.container=void 0;
+/** @type {HTMLElement | undefined} */this.scrollWrap=void 0;
+/** @type {Slide | undefined} */this.currSlide=void 0;this.events=new DOMEvents;this.animations=new Animations;this.mainScroll=new MainScroll(this);this.gestures=new Gestures(this);this.opener=new Opener(this);this.keyboard=new Keyboard(this);this.contentLoader=new ContentLoader(this)}
+/** @returns {boolean} */init(){if(this.isOpen||this.isDestroying)return false;this.isOpen=true;this.dispatch("init");this.dispatch("beforeOpen");this._createMainStructure();let t="pswp--open";this.gestures.supportsTouch&&(t+=" pswp--touch");this.options.mainClass&&(t+=" "+this.options.mainClass);this.element&&(this.element.className+=" "+t);this.currIndex=this.options.index||0;this.potentialIndex=this.currIndex;this.dispatch("firstUpdate");this.scrollWheel=new ScrollWheel(this);(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0);this.gestures.supportsTouch||this.mouseDetected();this.updateSize();this.offset.y=window.pageYOffset;this._initialItemData=this.getItemData(this.currIndex);this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0});this._initialThumbBounds=this.getThumbBounds();this.dispatch("initialLayout");this.on("openingAnimationEnd",(()=>{const{itemHolders:t}=this.mainScroll;if(t[0]){t[0].el.style.display="block";this.setContent(t[0],this.currIndex-1)}if(t[2]){t[2].el.style.display="block";this.setContent(t[2],this.currIndex+1)}this.appendHeavy();this.contentLoader.updateLazy();this.events.add(window,"resize",this._handlePageResize.bind(this));this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this));this.dispatch("bindEvents")}));this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex);this.dispatch("change");this.opener.open();this.dispatch("afterInit");return true}
+/**
+ * Get looped slide index
+ * (for example, -1 will return the last slide)
+ *
+ * @param {number} index
+ * @returns {number}
+ */getLoopedIndex(t){const e=this.getNumItems();if(this.options.loop){t>e-1&&(t-=e);t<0&&(t+=e)}return clamp(t,0,e-1)}appendHeavy(){this.mainScroll.itemHolders.forEach((t=>{var e;(e=t.slide)===null||e===void 0||e.appendHeavy()}))}
+/**
+ * Change the slide
+ * @param {number} index New index
+ */goTo(t){this.mainScroll.moveIndexBy(this.getLoopedIndex(t)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}
+/**
+ * @see slide/slide.js zoomTo
+ *
+ * @param {Parameters<Slide['zoomTo']>} args
+ */zoomTo(...t){var e;(e=this.currSlide)===null||e===void 0||e.zoomTo(...t)}toggleZoom(){var t;(t=this.currSlide)===null||t===void 0||t.toggleZoom()}close(){if(this.opener.isOpen&&!this.isDestroying){this.isDestroying=true;this.dispatch("close");this.events.removeAll();this.opener.close()}}destroy(){var t;if(this.isDestroying){this.dispatch("destroy");this._listeners={};if(this.scrollWrap){this.scrollWrap.ontouchmove=null;this.scrollWrap.ontouchend=null}(t=this.element)===null||t===void 0||t.remove();this.mainScroll.itemHolders.forEach((t=>{var e;(e=t.slide)===null||e===void 0||e.destroy()}));this.contentLoader.destroy();this.events.removeAll()}else{this.options.showHideAnimationType="none";this.close()}}
+/**
+ * Refresh/reload content of a slide by its index
+ *
+ * @param {number} slideIndex
+ */refreshSlideContent(t){this.contentLoader.removeByIndex(t);this.mainScroll.itemHolders.forEach(((e,i)=>{var s,n;let o=((s=(n=this.currSlide)===null||n===void 0?void 0:n.index)!==null&&s!==void 0?s:0)-1+i;this.canLoop()&&(o=this.getLoopedIndex(o));if(o===t){this.setContent(e,t,true);if(i===1){var a;this.currSlide=e.slide;(a=e.slide)===null||a===void 0||a.setIsActive(true)}}}));this.dispatch("change")}
+/**
+ * Set slide content
+ *
+ * @param {ItemHolder} holder mainScroll.itemHolders array item
+ * @param {number} index Slide index
+ * @param {boolean} [force] If content should be set even if index wasn't changed
+ */setContent(t,e,i){this.canLoop()&&(e=this.getLoopedIndex(e));if(t.slide){if(t.slide.index===e&&!i)return;t.slide.destroy();t.slide=void 0}if(!this.canLoop()&&(e<0||e>=this.getNumItems()))return;const s=this.getItemData(e);t.slide=new Slide(s,e,this);e===this.currIndex&&(this.currSlide=t.slide);t.slide.append(t.el)}
+/** @returns {Point} */getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}
+/**
+ * Update size of all elements.
+ * Executed on init and on page resize.
+ *
+ * @param {boolean} [force] Update size even if size of viewport was not changed.
+ */updateSize(t){if(this.isDestroying)return;const e=getViewportSize(this.options,this);if(t||!pointsEqual(e,this._prevViewportSize)){equalizePoints(this._prevViewportSize,e);this.dispatch("beforeResize");equalizePoints(this.viewportSize,this._prevViewportSize);this._updatePageScrollOffset();this.dispatch("viewportSize");this.mainScroll.resize(this.opener.isOpen);!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected();this.dispatch("resize")}}
+/**
+ * @param {number} opacity
+ */applyBgOpacity(t){this.bgOpacity=Math.max(t,0);this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){if(!this.hasMouse){var t;this.hasMouse=true;(t=this.element)===null||t===void 0||t.classList.add("pswp--has_mouse")}}_handlePageResize(){this.updateSize();/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout((()=>{this.updateSize()}),500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}
+/**
+ * @param {number} x
+ * @param {number} y
+ */setScrollOffset(t,e){this.offset.x=t;this.offset.y=e;this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=createElement("pswp","div");this.element.setAttribute("tabindex","-1");this.element.setAttribute("role","dialog");this.template=this.element;this.bg=createElement("pswp__bg","div",this.element);this.scrollWrap=createElement("pswp__scroll-wrap","section",this.element);this.container=createElement("pswp__container","div",this.scrollWrap);this.scrollWrap.setAttribute("aria-roledescription","carousel");this.container.setAttribute("aria-live","off");this.container.setAttribute("id","pswp__items");this.mainScroll.appendHolders();this.ui=new UI(this);this.ui.init();(this.options.appendToEl||document.body).appendChild(this.element)}
+/**
+ * Get position and dimensions of small thumbnail
+ * {x:,y:,w:}
+ *
+ * Height is optional (calculated based on the large image)
+ *
+ * @returns {Bounds | undefined}
+ */getThumbBounds(){return getThumbBounds(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}
+/**
+ * If the PhotoSwipe can have continuous loop
+ * @returns Boolean
+ */canLoop(){return this.options.loop&&this.getNumItems()>2}
+/**
+ * @private
+ * @param {PhotoSwipeOptions} options
+ * @returns {PreparedPhotoSwipeOptions}
+ */_prepareOptions(t){if(window.matchMedia("(prefers-reduced-motion), (update: slow)").matches){t.showHideAnimationType="none";t.zoomAnimationDuration=0}
+/** @type {PreparedPhotoSwipeOptions} */return{...L,...t}}}export{PhotoSwipe as default};
+
diff --git a/storefront/vendor/javascript/stimulus-read-more.js b/storefront/vendor/javascript/stimulus-read-more.js
new file mode 100644
index 0000000000..5329902e6b
--- /dev/null
+++ b/storefront/vendor/javascript/stimulus-read-more.js
@@ -0,0 +1,4 @@
+// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/stimulus-read-more.mjs
+
+import{Controller as e}from"@hotwired/stimulus";class s extends e{connect(){this.open=!1}toggle(e){!1===this.open?this.show(e):this.hide(e)}show(e){this.open=!0;const t=e.target;t.innerHTML=this.lessTextValue,this.contentTarget.style.setProperty("--read-more-line-clamp","'unset'")}hide(e){this.open=!1;const t=e.target;t.innerHTML=this.moreTextValue,this.contentTarget.style.removeProperty("--read-more-line-clamp")}}s.targets=["content"];s.values={moreText:String,lessText:String};export{s as default};
+
diff --git a/storefront/vendor/javascript/stimulus-scroll-to.js b/storefront/vendor/javascript/stimulus-scroll-to.js
new file mode 100644
index 0000000000..f022932af9
--- /dev/null
+++ b/storefront/vendor/javascript/stimulus-scroll-to.js
@@ -0,0 +1,4 @@
+// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/stimulus-scroll-to.mjs
+
+import{Controller as e}from"@hotwired/stimulus";class n extends e{initialize(){this.scroll=this.scroll.bind(this)}connect(){this.element.addEventListener("click",this.scroll)}disconnect(){this.element.removeEventListener("click",this.scroll)}scroll(e){e.preventDefault();const t=this.element.hash.replace(/^#/,""),s=document.getElementById(t);if(!s){console.warn(`[stimulus-scroll-to] The element with the id: "${t}" does not exist on the page.`);return}const i=s.getBoundingClientRect().top+window.pageYOffset-this.offset;window.scrollTo({top:i,behavior:this.behavior})}get offset(){return this.hasOffsetValue?this.offsetValue:void 0!==this.defaultOptions.offset?this.defaultOptions.offset:10}get behavior(){return this.behaviorValue||this.defaultOptions.behavior||"smooth"}get defaultOptions(){return{}}}n.values={offset:Number,behavior:String};export{n as default};
+
diff --git a/storefront/vendor/javascript/swiper--bundle.js b/storefront/vendor/javascript/swiper--bundle.js
new file mode 100644
index 0000000000..eff5f734ef
--- /dev/null
+++ b/storefront/vendor/javascript/swiper--bundle.js
@@ -0,0 +1,4 @@
+// swiper/[email protected] downloaded from https://ga.jspm.io/npm:[email protected]/swiper-bundle.mjs
+
+import{S as s}from"./_/CGpNtTMN.js";import{V as a,K as o,M as r,N as t,P as m,S as i,a as j,Z as p,C as e,A as f,H as _,b as c,c as d,T as u,f as S,G as b,d as g,E as h,e as l,g as n,h as x,i as A,j as C}from"./_/BLZbtAzk.js";import"./_/BL9Wmvfp.js";import"./_/AW-233Sq.js";const E=[a,o,r,t,m,i,j,p,e,f,_,c,d,u,S,b,g,h,l,n,x,A,C];s.use(E);export{s as Swiper,s as default};
+