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D,IAAK,WACH,OAAO,KAAK,SACb,IAEH,OAAO,eAAe,MAAM,UAAW,aAAc,CACnD,IAAK,WACH,OAAO,KAAK,UACb,EACD,IAAK,SAAU,GACb,KAAK,WAAa,CACnB,IAEH,MAAM,UAAN,gBAAqC,MAAM,UAAU,gBACrD,MAAM,UAAN,QAA6B,MAAM,UAAU,QAC7C,MAAM,UAAN,OAA4B,MAAM,UAAU,OAC5C,MAAM,UAAN,QAA6B,MAAM,UAAU","file":"/npm/drift-zoom@1.5.1/lib/Drift.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/drift-zoom@1.5.1/lib/Drift.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { isDOMElement } from \"./util/dom\";\nimport injectBaseStylesheet from \"./injectBaseStylesheet\";\n\nimport Trigger from \"./Trigger\";\nimport ZoomPane from \"./ZoomPane\";\n\nexport default class Drift {\n  constructor(triggerEl, options = {}) {\n    this.VERSION = \"1.5.1\";\n    this.triggerEl = triggerEl;\n\n    this.destroy = this.destroy.bind(this);\n\n    if (!isDOMElement(this.triggerEl)) {\n      throw new TypeError(\"`new Drift` requires a DOM element as its first argument.\");\n    }\n\n    // Prefix for generated element class names (e.g. `my-ns` will\n    // result in classes such as `my-ns-pane`. Default `drift-`\n    // prefixed classes will always be added as well.\n    const namespace = options[\"namespace\"] || null;\n    // Whether the ZoomPane should show whitespace when near the edges.\n    const showWhitespaceAtEdges = options[\"showWhitespaceAtEdges\"] || false;\n    // Whether the inline ZoomPane should stay inside\n    // the bounds of its image.\n    const containInline = options[\"containInline\"] || false;\n    // How much to offset the ZoomPane from the\n    // interaction point when inline.\n    const inlineOffsetX = options[\"inlineOffsetX\"] || 0;\n    const inlineOffsetY = options[\"inlineOffsetY\"] || 0;\n    // A DOM element to append the inline ZoomPane to\n    const inlineContainer = options[\"inlineContainer\"] || document.body;\n    // Which trigger attribute to pull the ZoomPane image source from.\n    const sourceAttribute = options[\"sourceAttribute\"] || \"data-zoom\";\n    // How much to magnify the trigger by in the ZoomPane.\n    // (e.g., `zoomFactor: 3` will result in a 900 px wide ZoomPane imag\n    // if the trigger is displayed at 300 px wide)\n    const zoomFactor = options[\"zoomFactor\"] || 3;\n    // A DOM element to append the non-inline ZoomPane to.\n    // Required if `inlinePane !== true`.\n    const paneContainer = options[\"paneContainer\"] === undefined ? document.body : options[\"paneContainer\"];\n    // When to switch to an inline ZoomPane. This can be a boolean or\n    // an integer. If `true`, the ZoomPane will always be inline,\n    // if `false`, it will switch to inline when `windowWidth <= inlinePane`\n    const inlinePane = options[\"inlinePane\"] || 375;\n    // If `true`, touch events will trigger the zoom, like mouse events.\n    const handleTouch = \"handleTouch\" in options ? !!options[\"handleTouch\"] : true;\n    // If present (and a function), this will be called\n    // whenever the ZoomPane is shown.\n    const onShow = options[\"onShow\"] || null;\n    // If present (and a function), this will be called\n    // whenever the ZoomPane is hidden.\n    const onHide = options[\"onHide\"] || null;\n    // Add base styles to the page. See the \"Theming\"\n    // section of README.md for more information.\n    const injectBaseStyles = \"injectBaseStyles\" in options ? !!options[\"injectBaseStyles\"] : true;\n    // An optional number that determines how long to wait before\n    // showing the ZoomPane because of a `mouseenter` event.\n    const hoverDelay = options[\"hoverDelay\"] || 0;\n    // An optional number that determines how long to wait before\n    // showing the ZoomPane because of a `touchstart` event.\n    // It's unlikely that you would want to use this option, since\n    // \"tap and hold\" is much more intentional than a hover event.\n    const touchDelay = options[\"touchDelay\"] || 0;\n    // If true, a bounding box will show the area currently being previewed\n    // during mouse hover\n    const hoverBoundingBox = options[\"hoverBoundingBox\"] || false;\n    // If true, a bounding box will show the area currently being previewed\n    // during touch events\n    const touchBoundingBox = options[\"touchBoundingBox\"] || false;\n    // A DOM element to append the bounding box to.\n    const boundingBoxContainer = options[\"boundingBoxContainer\"] || document.body;\n    // If true, the events related to handleTouch use passive listeners in\n    // order to improve performance for touch devices.\n    const passive = options[\"passive\"] || false;\n\n    if (inlinePane !== true && !isDOMElement(paneContainer)) {\n      throw new TypeError(\"`paneContainer` must be a DOM element when `inlinePane !== true`\");\n    }\n    if (!isDOMElement(inlineContainer)) {\n      throw new TypeError(\"`inlineContainer` must be a DOM element\");\n    }\n\n    this.settings = {\n      namespace,\n      showWhitespaceAtEdges,\n      containInline,\n      inlineOffsetX,\n      inlineOffsetY,\n      inlineContainer,\n      sourceAttribute,\n      zoomFactor,\n      paneContainer,\n      inlinePane,\n      handleTouch,\n      onShow,\n      onHide,\n      injectBaseStyles,\n      hoverDelay,\n      touchDelay,\n      hoverBoundingBox,\n      touchBoundingBox,\n      boundingBoxContainer,\n      passive,\n    };\n\n    if (this.settings.injectBaseStyles) {\n      injectBaseStylesheet();\n    }\n\n    this._buildZoomPane();\n    this._buildTrigger();\n  }\n\n  get isShowing() {\n    return this.zoomPane.isShowing;\n  }\n\n  get zoomFactor() {\n    return this.settings.zoomFactor;\n  }\n\n  set zoomFactor(zf) {\n    this.settings.zoomFactor = zf;\n    this.zoomPane.settings.zoomFactor = zf;\n    this.trigger.settings.zoomFactor = zf;\n    this.boundingBox.settings.zoomFactor = zf;\n  }\n\n  _buildZoomPane() {\n    this.zoomPane = new ZoomPane({\n      container: this.settings.paneContainer,\n      zoomFactor: this.settings.zoomFactor,\n      showWhitespaceAtEdges: this.settings.showWhitespaceAtEdges,\n      containInline: this.settings.containInline,\n      inline: this.settings.inlinePane,\n      namespace: this.settings.namespace,\n      inlineOffsetX: this.settings.inlineOffsetX,\n      inlineOffsetY: this.settings.inlineOffsetY,\n      inlineContainer: this.settings.inlineContainer,\n    });\n  }\n\n  _buildTrigger() {\n    this.trigger = new Trigger({\n      el: this.triggerEl,\n      zoomPane: this.zoomPane,\n      handleTouch: this.settings.handleTouch,\n      onShow: this.settings.onShow,\n      onHide: this.settings.onHide,\n      sourceAttribute: this.settings.sourceAttribute,\n      hoverDelay: this.settings.hoverDelay,\n      touchDelay: this.settings.touchDelay,\n      hoverBoundingBox: this.settings.hoverBoundingBox,\n      touchBoundingBox: this.settings.touchBoundingBox,\n      namespace: this.settings.namespace,\n      zoomFactor: this.settings.zoomFactor,\n      boundingBoxContainer: this.settings.boundingBoxContainer,\n      passive: this.settings.passive,\n    });\n  }\n\n  setZoomImageURL(imageURL) {\n    this.zoomPane._setImageURL(imageURL);\n  }\n\n  disable() {\n    this.trigger.enabled = false;\n  }\n\n  enable() {\n    this.trigger.enabled = true;\n  }\n\n  destroy() {\n    this.trigger._hide();\n    this.trigger._unbindEvents();\n  }\n}\n\n// Public API\n/* eslint-disable no-self-assign */\nObject.defineProperty(Drift.prototype, \"isShowing\", {\n  get: function () {\n    return this.isShowing;\n  },\n});\nObject.defineProperty(Drift.prototype, \"zoomFactor\", {\n  get: function () {\n    return this.zoomFactor;\n  },\n  set: function (value) {\n    this.zoomFactor = value;\n  },\n});\nDrift.prototype[\"setZoomImageURL\"] = Drift.prototype.setZoomImageURL;\nDrift.prototype[\"disable\"] = Drift.prototype.disable;\nDrift.prototype[\"enable\"] = Drift.prototype.enable;\nDrift.prototype[\"destroy\"] = Drift.prototype.destroy;\n/* eslint-enable no-self-assign */\n"]}