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MiE,YAAY,oBAAqB,iCAC7D,EAEkB,oBAAXvE,QACPA,OAAOuF,eAAeC,OAAO,wBAAyB9G,E","sources":["webpack://img-comparison-slider/./src/styles.scss","webpack://img-comparison-slider/../../node_modules/css-loader/dist/runtime/api.js","webpack://img-comparison-slider/webpack/bootstrap","webpack://img-comparison-slider/webpack/runtime/compat get default export","webpack://img-comparison-slider/webpack/runtime/define property getters","webpack://img-comparison-slider/webpack/runtime/hasOwnProperty shorthand","webpack://img-comparison-slider/./src/template.html","webpack://img-comparison-slider/./src/defaults.ts","webpack://img-comparison-slider/./src/isElementAffected.ts","webpack://img-comparison-slider/./src/index.ts","webpack://img-comparison-slider/./src/inBetween.ts"],"sourcesContent":["// Imports\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \":host{--divider-width: 1px;--divider-color: #fff;--divider-shadow: none;--default-handle-width: 50px;--default-handle-color: #fff;--default-handle-opacity: 1;--default-handle-shadow: none;--handle-position-start: 50%;position:relative;display:inline-block;overflow:hidden;line-height:0;direction:ltr}@media screen and (-webkit-min-device-pixel-ratio: 0)and (min-resolution: 0.001dpcm){:host{outline-offset:1px}}:host(:focus){outline:2px solid -webkit-focus-ring-color}::slotted(*){-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;user-drag:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.first{position:absolute;left:0;top:0;right:0;line-height:normal;font-size:100%;max-height:100%;height:100%;width:100%;--exposure: 50%;--keyboard-transition-time: 0ms;--default-transition-time: 0ms;--transition-time: var(--default-transition-time)}.first .first-overlay-container{position:relative;clip-path:inset(0 var(--exposure) 0 0);transition:clip-path var(--transition-time);height:100%}.first .first-overlay{overflow:hidden;height:100%}.first.focused{will-change:clip-path}.first.focused .first-overlay-container{will-change:clip-path}.second{position:relative}.handle-container{transform:translateX(50%);position:absolute;top:0;right:var(--exposure);height:100%;transition:right var(--transition-time),bottom var(--transition-time)}.focused .handle-container{will-change:right}.divider{position:absolute;height:100%;width:100%;left:0;top:0;display:flex;align-items:center;justify-content:center;flex-direction:column}.divider:after{content:\\\" \\\";display:block;height:100%;border-left-width:var(--divider-width);border-left-style:solid;border-left-color:var(--divider-color);box-shadow:var(--divider-shadow)}.handle{position:absolute;top:var(--handle-position-start);pointer-events:none;box-sizing:border-box;margin-left:1px;transform:translate(calc(-50% - 0.5px), -50%);line-height:0}.default-handle{width:var(--default-handle-width);opacity:var(--default-handle-opacity);transition:all 1s;filter:drop-shadow(var(--default-handle-shadow))}.default-handle path{stroke:var(--default-handle-color)}.vertical .first-overlay-container{clip-path:inset(0 0 var(--exposure) 0)}.vertical .handle-container{transform:translateY(50%);height:auto;top:unset;bottom:var(--exposure);width:100%;left:0;flex-direction:row}.vertical .divider:after{height:1px;width:100%;border-top-width:var(--divider-width);border-top-style:solid;border-top-color:var(--divider-color);border-left:0}.vertical .handle{top:auto;left:var(--handle-position-start);transform:translate(calc(-50% - 0.5px), -50%) rotate(90deg)}\", \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// Module\nvar code = \"
\";\n// Exports\nexport default code;","export const TABINDEX = 0;\nexport const RENDERED_CLASS = 'rendered';\n","export const isMouseEvent = (event) => {\n return event.type === 'mousedown';\n};\nexport const isElementAffected = (element, e) => {\n const rect = element.getBoundingClientRect();\n let eventX, eventY;\n if (isMouseEvent(e)) {\n eventX = e.clientX;\n eventY = e.clientY;\n }\n else {\n eventX = e.touches[0].clientX;\n eventY = e.touches[0].clientY;\n }\n return (eventX >= rect.x &&\n eventX <= rect.x + rect.width &&\n eventY >= rect.y &&\n eventY <= rect.y + rect.height);\n};\n","import styles from './styles.scss';\nimport { inBetween } from './inBetween';\nimport templateHtml from './template.html';\nimport { TABINDEX, RENDERED_CLASS } from './defaults';\nimport { isElementAffected } from './isElementAffected';\nconst templateElement = document.createElement('template');\ntemplateElement.innerHTML = templateHtml;\nconst KeySlideOffset = {\n ArrowLeft: -1,\n ArrowRight: 1,\n};\nconst slideDirections = ['horizontal', 'vertical'];\nconst getTouchPagePoint = (e) => ({\n x: e.touches[0].pageX,\n y: e.touches[0].pageY,\n});\nconst getMousePagePoint = (e) => ({\n x: e.pageX,\n y: e.pageY,\n});\nconst slideAnimationPeriod = 1000 / 60;\nexport class HTMLImgComparisonSliderElement extends HTMLElement {\n constructor() {\n super();\n this.exposure = this.hasAttribute('value')\n ? parseFloat(this.getAttribute('value'))\n : 50;\n this.slideOnHover = false;\n this.slideDirection = 'horizontal';\n this.keyboard = 'enabled';\n this.isMouseDown = false;\n this.animationDirection = 0;\n this.isFocused = false;\n this.handle = false;\n this.onMouseMove = (e) => {\n if (this.isMouseDown || this.slideOnHover) {\n const currentPoint = getMousePagePoint(e);\n this.slideToPage(currentPoint);\n }\n };\n this.bodyUserSelectStyle = '';\n this.onMouseDown = (e) => {\n if (this.slideOnHover) {\n return;\n }\n if (this.handle && !isElementAffected(this.handleElement, e)) {\n return;\n }\n e.preventDefault();\n window.addEventListener('mousemove', this.onMouseMove);\n window.addEventListener('mouseup', this.onWindowMouseUp);\n this.isMouseDown = true;\n this.enableTransition();\n const currentPoint = getMousePagePoint(e);\n this.slideToPage(currentPoint);\n this.focus();\n this.bodyUserSelectStyle = window.document.body.style.userSelect;\n window.document.body.style.userSelect = 'none';\n };\n this.onWindowMouseUp = () => {\n this.isMouseDown = false;\n window.document.body.style.userSelect = this.bodyUserSelectStyle;\n window.removeEventListener('mousemove', this.onMouseMove);\n window.removeEventListener('mouseup', this.onWindowMouseUp);\n };\n this.touchStartPoint = null;\n this.isTouchComparing = false;\n this.hasTouchMoved = false;\n this.onTouchStart = (e) => {\n if (this.handle && !isElementAffected(this.handleElement, e)) {\n return;\n }\n this.touchStartPoint = getTouchPagePoint(e);\n if (this.isFocused) {\n this.enableTransition();\n this.slideToPage(this.touchStartPoint);\n }\n };\n this.onTouchMove = (e) => {\n if (this.touchStartPoint === null) {\n return;\n }\n const currentPoint = getTouchPagePoint(e);\n if (this.isTouchComparing) {\n this.slideToPage(currentPoint);\n e.preventDefault();\n return false;\n }\n if (!this.hasTouchMoved) {\n const offsetY = Math.abs(currentPoint.y - this.touchStartPoint.y);\n const offsetX = Math.abs(currentPoint.x - this.touchStartPoint.x);\n if ((this.slideDirection === 'horizontal' && offsetY < offsetX) ||\n (this.slideDirection === 'vertical' && offsetY > offsetX)) {\n this.isTouchComparing = true;\n this.focus();\n this.slideToPage(currentPoint);\n e.preventDefault();\n return false;\n }\n this.hasTouchMoved = true;\n }\n };\n this.onTouchEnd = () => {\n this.isTouchComparing = false;\n this.hasTouchMoved = false;\n this.touchStartPoint = null;\n };\n this.onBlur = () => {\n this.stopSlideAnimation();\n this.isFocused = false;\n this.firstElement.classList.remove('focused');\n };\n this.onFocus = () => {\n this.isFocused = true;\n this.firstElement.classList.add('focused');\n };\n this.onKeyDown = (e) => {\n if (this.keyboard === 'disabled') {\n return;\n }\n const direction = KeySlideOffset[e.key];\n if (this.animationDirection === direction) {\n return;\n }\n if (direction === undefined) {\n return;\n }\n this.animationDirection = direction;\n this.startSlideAnimation();\n };\n this.onKeyUp = (e) => {\n if (this.keyboard === 'disabled') {\n return;\n }\n const direction = KeySlideOffset[e.key];\n if (direction === undefined) {\n return;\n }\n if (this.animationDirection !== direction) {\n return;\n }\n this.stopSlideAnimation();\n };\n this.resetDimensions = () => {\n this.imageWidth = this.offsetWidth;\n this.imageHeight = this.offsetHeight;\n };\n const shadowRoot = this.attachShadow({ mode: 'open' });\n const styleEl = document.createElement('style');\n styleEl.innerHTML = styles;\n if (this.getAttribute('nonce')) {\n styleEl.setAttribute('nonce', this.getAttribute('nonce'));\n }\n shadowRoot.appendChild(styleEl);\n shadowRoot.appendChild(templateElement.content.cloneNode(true));\n this.firstElement = shadowRoot.getElementById('first');\n this.secondElement = shadowRoot.getElementById('second');\n this.handleElement = shadowRoot.getElementById('handle');\n }\n get value() {\n return this.exposure;\n }\n set value(newValue) {\n const newExposure = parseFloat(newValue);\n if (newExposure === this.exposure) {\n return;\n }\n this.exposure = newExposure;\n this.enableTransition();\n this.setExposure();\n }\n get hover() {\n return this.slideOnHover;\n }\n set hover(newValue) {\n this.slideOnHover = newValue.toString().toLowerCase() !== 'false';\n this.removeEventListener('mousemove', this.onMouseMove);\n if (this.slideOnHover) {\n this.addEventListener('mousemove', this.onMouseMove);\n }\n }\n get direction() {\n return this.slideDirection;\n }\n set direction(newValue) {\n this.slideDirection = newValue.toString().toLowerCase();\n this.slide(0);\n this.firstElement.classList.remove(...slideDirections);\n if (!slideDirections.includes(this.slideDirection)) {\n return;\n }\n this.firstElement.classList.add(this.slideDirection);\n }\n static get observedAttributes() {\n return ['hover', 'direction'];\n }\n connectedCallback() {\n if (!this.hasAttribute('tabindex')) {\n this.tabIndex = TABINDEX;\n }\n this.addEventListener('dragstart', (e) => {\n e.preventDefault();\n return false;\n });\n const resizeObserver = new ResizeObserver(this.resetDimensions);\n resizeObserver.observe(this);\n this.setExposure(0);\n this.keyboard =\n this.hasAttribute('keyboard') &&\n this.getAttribute('keyboard') === 'disabled'\n ? 'disabled'\n : 'enabled';\n this.addEventListener('keydown', this.onKeyDown);\n this.addEventListener('keyup', this.onKeyUp);\n this.addEventListener('focus', this.onFocus);\n this.addEventListener('blur', this.onBlur);\n this.addEventListener('touchstart', this.onTouchStart, {\n passive: true,\n });\n this.addEventListener('touchmove', this.onTouchMove, {\n passive: false,\n });\n this.addEventListener('touchend', this.onTouchEnd);\n this.addEventListener('mousedown', this.onMouseDown);\n this.handle = this.hasAttribute('handle');\n this.hover = this.hasAttribute('hover')\n ? this.getAttribute('hover')\n : this.slideOnHover;\n this.direction = this.hasAttribute('direction')\n ? this.getAttribute('direction')\n : this.slideDirection;\n this.resetDimensions();\n if (!this.classList.contains(RENDERED_CLASS)) {\n this.classList.add(RENDERED_CLASS);\n }\n if (this.querySelectorAll('[slot=\"before\"], [slot=\"after\"]').length > 0) {\n console.warn(': ' +\n 'slot names \"before\" and \"after\" are deprecated and soon won\\'t be supported. ' +\n 'Please use slot=\"first\" instead of slot=\"after\", and slot=\"second\" instead of slot=\"before\".');\n }\n }\n disconnectedCallback() {\n if (this.transitionTimer) {\n window.clearTimeout(this.transitionTimer);\n }\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'hover') {\n this.hover = newValue;\n }\n if (name === 'direction') {\n this.direction = newValue;\n }\n if (name === 'keyboard') {\n this.keyboard = newValue === 'disabled' ? 'disabled' : 'enabled';\n }\n }\n setExposure(increment = 0) {\n this.exposure = inBetween(this.exposure + increment, 0, 100);\n this.firstElement.style.setProperty('--exposure', `${100 - this.exposure}%`);\n }\n slide(increment = 0) {\n this.setExposure(increment);\n const event = new Event('slide');\n this.dispatchEvent(event);\n }\n slideToPage(currentPoint) {\n if (this.slideDirection === 'horizontal') {\n this.slideToPageX(currentPoint.x);\n }\n if (this.slideDirection === 'vertical') {\n this.slideToPageY(currentPoint.y);\n }\n }\n slideToPageX(pageX) {\n const x = pageX - this.getBoundingClientRect().left - window.scrollX;\n this.exposure = (x / this.imageWidth) * 100;\n this.slide(0);\n }\n slideToPageY(pageY) {\n const y = pageY - this.getBoundingClientRect().top - window.scrollY;\n this.exposure = (y / this.imageHeight) * 100;\n this.slide(0);\n }\n enableTransition() {\n const transitionTime = 100;\n this.firstElement.style.setProperty('--transition-time', `${transitionTime}ms`);\n this.transitionTimer = window.setTimeout(() => {\n this.firstElement.style.setProperty('--transition-time', `var(--default-transition-time)`);\n this.transitionTimer = null;\n }, transitionTime);\n }\n startSlideAnimation() {\n let lastTimestamp = null;\n let initialDirection = this.animationDirection;\n this.firstElement.style.setProperty('--transition-time', `var(--keyboard-transition-time)`);\n const slide = (now) => {\n if (this.animationDirection === 0 ||\n initialDirection !== this.animationDirection) {\n return;\n }\n if (lastTimestamp === null) {\n lastTimestamp = now;\n }\n const interval = now - lastTimestamp, distance = (interval / slideAnimationPeriod) * this.animationDirection;\n this.slide(distance);\n // This is necessary to speed up the key up event in Desktop Safari\n setTimeout(() => window.requestAnimationFrame(slide), 0);\n lastTimestamp = now;\n };\n window.requestAnimationFrame(slide);\n }\n stopSlideAnimation() {\n this.animationDirection = 0;\n this.firstElement.style.setProperty('--transition-time', `var(--default-transition-time)`);\n }\n}\nif (typeof window !== 'undefined') {\n window.customElements.define('img-comparison-slider', HTMLImgComparisonSliderElement);\n}\n","export const inBetween = (actual, min, max) => {\n if (actual < min) {\n return min;\n }\n if (actual > max) {\n return max;\n }\n return actual;\n};\n"],"names":["___CSS_LOADER_EXPORT___","i","push","module","id","exports","cssWithMappingToString","list","toString","this","map","item","content","concat","join","modules","mediaQuery","dedupe","alreadyImportedModules","length","_i","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","RENDERED_CLASS","isElementAffected","element","e","rect","getBoundingClientRect","eventX","eventY","type","clientX","clientY","touches","x","width","y","height","templateElement","document","createElement","innerHTML","KeySlideOffset","ArrowLeft","ArrowRight","slideDirections","getTouchPagePoint","pageX","pageY","getMousePagePoint","HTMLImgComparisonSliderElement","HTMLElement","constructor","super","exposure","hasAttribute","parseFloat","getAttribute","slideOnHover","slideDirection","keyboard","isMouseDown","animationDirection","isFocused","handle","onMouseMove","currentPoint","slideToPage","bodyUserSelectStyle","onMouseDown","handleElement","preventDefault","window","addEventListener","onWindowMouseUp","enableTransition","focus","body","style","userSelect","removeEventListener","touchStartPoint","isTouchComparing","hasTouchMoved","onTouchStart","onTouchMove","offsetY","Math","abs","offsetX","onTouchEnd","onBlur","stopSlideAnimation","firstElement","classList","remove","onFocus","add","onKeyDown","direction","startSlideAnimation","onKeyUp","resetDimensions","imageWidth","offsetWidth","imageHeight","offsetHeight","shadowRoot","attachShadow","mode","styleEl","styles","setAttribute","appendChild","cloneNode","getElementById","secondElement","value","newValue","newExposure","setExposure","hover","toLowerCase","slide","includes","observedAttributes","connectedCallback","tabIndex","ResizeObserver","observe","passive","contains","querySelectorAll","console","warn","disconnectedCallback","transitionTimer","clearTimeout","attributeChangedCallback","name","oldValue","increment","actual","setProperty","event","Event","dispatchEvent","slideToPageX","slideToPageY","left","scrollX","top","scrollY","setTimeout","lastTimestamp","initialDirection","now","distance","requestAnimationFrame","customElements","define"],"sourceRoot":""}