{"version":3,"file":"index.cjs","sources":["../../src/vue/hooks/use-zoom.ts","../../src/shared/utils/zoom-gesture-logic.ts","../../src/vue/hooks/use-zoom-gesture.ts","../../src/vue/components/marquee-zoom.vue","../../src/vue/components/zoom-gesture-wrapper.vue"],"sourcesContent":["import { ref, watch, readonly, computed, toValue, type MaybeRefOrGetter } from 'vue';\nimport { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { initialDocumentState, ZoomPlugin, ZoomDocumentState } from '@embedpdf/plugin-zoom';\n\nexport const useZoomCapability = () => useCapability<ZoomPlugin>(ZoomPlugin.id);\nexport const useZoomPlugin = () => usePlugin<ZoomPlugin>(ZoomPlugin.id);\n\n/**\n * Hook for zoom state for a specific document\n * @param documentId Document ID (can be ref, computed, getter, or plain value)\n */\nexport const useZoom = (documentId: MaybeRefOrGetter<string>) => {\n  const { provides } = useZoomCapability();\n  const state = ref<ZoomDocumentState>(initialDocumentState);\n\n  watch(\n    [provides, () => toValue(documentId)],\n    ([providesValue, docId], _, onCleanup) => {\n      if (!providesValue) {\n        state.value = initialDocumentState;\n        return;\n      }\n\n      const scope = providesValue.forDocument(docId);\n\n      // Get initial state\n      state.value = scope.getState();\n\n      // Subscribe to state changes\n      const unsubscribe = scope.onStateChange((newState) => {\n        state.value = newState;\n      });\n\n      onCleanup(unsubscribe);\n    },\n    { immediate: true },\n  );\n\n  // Return a computed ref for the scoped capability\n  const scopedProvides = computed(() => {\n    const docId = toValue(documentId);\n    return provides.value?.forDocument(docId) ?? null;\n  });\n\n  return {\n    state: readonly(state),\n    provides: scopedProvides,\n  };\n};\n","import type { ZoomCapability } from '@embedpdf/plugin-zoom';\n\nexport interface ZoomGestureOptions {\n  /** Enable pinch-to-zoom gesture (default: true) */\n  enablePinch?: boolean;\n  /** Enable wheel zoom with ctrl/cmd key (default: true) */\n  enableWheel?: boolean;\n}\n\nexport interface ZoomGestureDeps {\n  element: HTMLDivElement;\n  /** Viewport container element for attaching events */\n  container: HTMLElement;\n  documentId: string;\n  zoomProvides: ZoomCapability;\n  /** Viewport gap in pixels (default: 0) */\n  viewportGap?: number;\n  options?: ZoomGestureOptions;\n}\n\nfunction getTouchDistance(touches: TouchList): number {\n  const [t1, t2] = [touches[0], touches[1]];\n  const dx = t2.clientX - t1.clientX;\n  const dy = t2.clientY - t1.clientY;\n  return Math.hypot(dx, dy);\n}\n\nfunction getTouchCenter(touches: TouchList): { x: number; y: number } {\n  const [t1, t2] = [touches[0], touches[1]];\n  return {\n    x: (t1.clientX + t2.clientX) / 2,\n    y: (t1.clientY + t2.clientY) / 2,\n  };\n}\n\nexport function setupZoomGestures({\n  element,\n  container,\n  documentId,\n  zoomProvides,\n  viewportGap = 0,\n  options = {},\n}: ZoomGestureDeps) {\n  const { enablePinch = true, enableWheel = true } = options;\n  if (typeof window === 'undefined') {\n    return () => {};\n  }\n\n  const zoomScope = zoomProvides.forDocument(documentId);\n  const getState = () => zoomScope.getState();\n\n  // Shared state\n  let initialZoom = 0;\n  let currentScale = 1;\n  let isPinching = false;\n  let initialDistance = 0;\n\n  // Wheel state\n  let wheelZoomTimeout: ReturnType<typeof setTimeout> | null = null;\n  let accumulatedWheelScale = 1;\n\n  // Gesture state\n  let initialElementWidth = 0;\n  let initialElementHeight = 0;\n  let initialElementLeft = 0;\n  let initialElementTop = 0;\n\n  // Container Dimensions (Bounding Box)\n  let containerRectWidth = 0;\n  let containerRectHeight = 0;\n\n  // Layout Dimensions (Client Box from Metrics)\n  let layoutWidth = 0;\n  let layoutCenterX = 0;\n\n  let pointerLocalY = 0;\n  let pointerContainerX = 0;\n  let pointerContainerY = 0;\n\n  let currentGap = 0;\n  let pivotLocalX = 0;\n\n  const clamp = (val: number, min: number, max: number) => Math.min(Math.max(val, min), max);\n\n  // --- Margin calculation ---\n  const updateMargin = () => {\n    const availableWidth = container.clientWidth - 2 * viewportGap;\n    const elementWidth = element.offsetWidth;\n\n    const newMargin = elementWidth < availableWidth ? (availableWidth - elementWidth) / 2 : 0;\n    element.style.marginLeft = `${newMargin}px`;\n  };\n\n  const calculateTransform = (scale: number) => {\n    const finalWidth = initialElementWidth * scale;\n    const finalHeight = initialElementHeight * scale;\n\n    let ty = pointerLocalY * (1 - scale);\n\n    const targetX = layoutCenterX - finalWidth / 2;\n    const txCenter = targetX - initialElementLeft;\n    const txMouse = pointerContainerX - pivotLocalX * scale - initialElementLeft;\n\n    const overflow = Math.max(0, finalWidth - layoutWidth);\n    const blendRange = layoutWidth * 0.3;\n    const blend = Math.min(1, overflow / blendRange);\n\n    let tx = txCenter + (txMouse - txCenter) * blend;\n\n    const safeHeight = containerRectHeight - currentGap * 2;\n    if (finalHeight > safeHeight) {\n      const currentTop = initialElementTop + ty;\n      const maxTop = currentGap;\n      const minTop = containerRectHeight - currentGap - finalHeight;\n      const constrainedTop = clamp(currentTop, minTop, maxTop);\n      ty = constrainedTop - initialElementTop;\n    }\n\n    const safeWidth = containerRectWidth - currentGap * 2;\n    if (finalWidth > safeWidth) {\n      const currentLeft = initialElementLeft + tx;\n      const maxLeft = currentGap;\n      const minLeft = containerRectWidth - currentGap - finalWidth;\n      const constrainedLeft = clamp(currentLeft, minLeft, maxLeft);\n      tx = constrainedLeft - initialElementLeft;\n    }\n\n    return { tx, ty, blend, finalWidth };\n  };\n\n  const updateTransform = (scale: number) => {\n    currentScale = scale;\n    const { tx, ty } = calculateTransform(scale);\n    element.style.transformOrigin = '0 0';\n    element.style.transform = `translate(${tx}px, ${ty}px) scale(${scale})`;\n  };\n\n  const resetTransform = () => {\n    element.style.transform = 'none';\n    element.style.transformOrigin = '0 0';\n    currentScale = 1;\n  };\n\n  const commitZoom = () => {\n    const { tx, finalWidth } = calculateTransform(currentScale);\n    const delta = (currentScale - 1) * initialZoom;\n\n    let anchorX: number;\n    let anchorY: number = pointerContainerY;\n\n    if (finalWidth <= layoutWidth) {\n      anchorX = layoutCenterX;\n    } else {\n      const scaleDiff = 1 - currentScale;\n      anchorX =\n        Math.abs(scaleDiff) > 0.001 ? initialElementLeft + tx / scaleDiff : pointerContainerX;\n    }\n\n    zoomScope.requestZoomBy(delta, { vx: anchorX, vy: anchorY });\n    resetTransform();\n    initialZoom = 0;\n  };\n\n  const initializeGestureState = (clientX: number, clientY: number) => {\n    const containerRect = container.getBoundingClientRect();\n    const innerRect = element.getBoundingClientRect();\n\n    currentGap = viewportGap;\n    initialElementWidth = innerRect.width;\n    initialElementHeight = innerRect.height;\n    initialElementLeft = innerRect.left - containerRect.left;\n    initialElementTop = innerRect.top - containerRect.top;\n\n    containerRectWidth = containerRect.width;\n    containerRectHeight = containerRect.height;\n\n    // Layout dimensions from container's client area\n    layoutWidth = container.clientWidth;\n    layoutCenterX = container.clientLeft + layoutWidth / 2;\n\n    const rawPointerLocalX = clientX - innerRect.left;\n    pointerLocalY = clientY - innerRect.top;\n    pointerContainerX = clientX - containerRect.left;\n    pointerContainerY = clientY - containerRect.top;\n\n    if (initialElementWidth < layoutWidth) {\n      pivotLocalX = (pointerContainerX * initialElementWidth) / layoutWidth;\n    } else {\n      pivotLocalX = rawPointerLocalX;\n    }\n  };\n\n  // --- Handlers ---\n  const handleTouchStart = (e: TouchEvent) => {\n    if (e.touches.length !== 2) return;\n    isPinching = true;\n    initialZoom = getState().currentZoomLevel;\n    initialDistance = getTouchDistance(e.touches);\n    const center = getTouchCenter(e.touches);\n    initializeGestureState(center.x, center.y);\n    e.preventDefault();\n  };\n\n  const handleTouchMove = (e: TouchEvent) => {\n    if (!isPinching || e.touches.length !== 2) return;\n    const currentDistance = getTouchDistance(e.touches);\n    const scale = currentDistance / initialDistance;\n    updateTransform(scale);\n    e.preventDefault();\n  };\n\n  const handleTouchEnd = (e: TouchEvent) => {\n    if (!isPinching) return;\n    if (e.touches.length >= 2) return;\n    isPinching = false;\n    commitZoom();\n  };\n\n  const handleWheel = (e: WheelEvent) => {\n    if (!e.ctrlKey && !e.metaKey) return;\n    e.preventDefault();\n\n    if (wheelZoomTimeout === null) {\n      initialZoom = getState().currentZoomLevel;\n      accumulatedWheelScale = 1;\n      initializeGestureState(e.clientX, e.clientY);\n    } else {\n      clearTimeout(wheelZoomTimeout);\n    }\n\n    const zoomFactor = 1 - e.deltaY * 0.01;\n    accumulatedWheelScale *= zoomFactor;\n    accumulatedWheelScale = Math.max(0.1, Math.min(10, accumulatedWheelScale));\n    updateTransform(accumulatedWheelScale);\n\n    wheelZoomTimeout = setTimeout(() => {\n      wheelZoomTimeout = null;\n      commitZoom();\n      accumulatedWheelScale = 1;\n    }, 150);\n  };\n\n  // Subscribe to zoom changes to update margin\n  const unsubZoom = zoomScope.onStateChange(() => updateMargin());\n\n  // Use ResizeObserver to update margin when element or container size changes\n  const resizeObserver = new ResizeObserver(() => updateMargin());\n  resizeObserver.observe(element);\n  resizeObserver.observe(container);\n\n  // Initial margin calculation\n  updateMargin();\n\n  // Attach events to the viewport container for better UX\n  // (gestures work anywhere in viewport, not just on the PDF)\n  if (enablePinch) {\n    container.addEventListener('touchstart', handleTouchStart, { passive: false });\n    container.addEventListener('touchmove', handleTouchMove, { passive: false });\n    container.addEventListener('touchend', handleTouchEnd);\n    container.addEventListener('touchcancel', handleTouchEnd);\n  }\n  if (enableWheel) {\n    container.addEventListener('wheel', handleWheel, { passive: false });\n  }\n\n  return () => {\n    if (enablePinch) {\n      container.removeEventListener('touchstart', handleTouchStart);\n      container.removeEventListener('touchmove', handleTouchMove);\n      container.removeEventListener('touchend', handleTouchEnd);\n      container.removeEventListener('touchcancel', handleTouchEnd);\n    }\n    if (enableWheel) {\n      container.removeEventListener('wheel', handleWheel);\n    }\n    if (wheelZoomTimeout) {\n      clearTimeout(wheelZoomTimeout);\n    }\n    unsubZoom();\n    resizeObserver.disconnect();\n    resetTransform();\n    element.style.marginLeft = '';\n  };\n}\n","import { ref, watch, toValue, inject, type MaybeRefOrGetter, type Ref } from 'vue';\nimport { useCapability } from '@embedpdf/core/vue';\nimport type { ViewportPlugin, ViewportCapability } from '@embedpdf/plugin-viewport';\n\nimport { setupZoomGestures, type ZoomGestureOptions } from '../../shared/utils/zoom-gesture-logic';\nimport { useZoomCapability } from './use-zoom';\nimport type { ZoomCapability } from '../../lib/types';\n\nexport type { ZoomGestureOptions };\n\nexport interface UseZoomGestureOptions {\n  /** Enable pinch-to-zoom gesture (default: true) */\n  enablePinch?: MaybeRefOrGetter<boolean>;\n  /** Enable wheel zoom with ctrl/cmd key (default: true) */\n  enableWheel?: MaybeRefOrGetter<boolean>;\n}\n\n/**\n * Hook for setting up zoom gesture functionality (pinch and wheel zoom) on an element\n * @param documentId Document ID (can be ref, computed, getter, or plain value)\n * @param options Optional configuration for enabling/disabling gestures\n */\nexport function useZoomGesture(\n  documentId: MaybeRefOrGetter<string>,\n  options: UseZoomGestureOptions = {},\n) {\n  const { provides: viewportProvides } = useCapability<ViewportPlugin>('viewport');\n  const { provides: zoomProvides } = useZoomCapability();\n  const viewportElementRef = inject<Ref<HTMLDivElement | null> | undefined>('viewport-element');\n  const elementRef = ref<HTMLDivElement | null>(null);\n\n  let cleanup: (() => void) | undefined;\n\n  watch(\n    [\n      elementRef,\n      viewportProvides,\n      zoomProvides,\n      () => toValue(documentId),\n      () => toValue(options.enablePinch ?? true),\n      () => toValue(options.enableWheel ?? true),\n    ],\n    ([element, viewport, zoom, docId, enablePinch, enableWheel]: [\n      HTMLDivElement | null,\n      ViewportCapability | null,\n      ZoomCapability | null,\n      string,\n      boolean,\n      boolean,\n    ]) => {\n      // Clean up previous setup\n      if (cleanup) {\n        cleanup();\n        cleanup = undefined;\n      }\n\n      const container = viewportElementRef?.value;\n\n      // Setup new zoom gestures if all dependencies are available\n      if (!element || !container || !zoom) {\n        return;\n      }\n\n      cleanup = setupZoomGestures({\n        element,\n        container,\n        documentId: docId,\n        zoomProvides: zoom,\n        viewportGap: viewport?.getViewportGap() || 0,\n        options: { enablePinch, enableWheel },\n      });\n    },\n    { immediate: true },\n  );\n\n  return { elementRef };\n}\n","<template>\n  <div\n    v-if=\"rect\"\n    :style=\"{\n      position: 'absolute',\n      pointerEvents: 'none',\n      left: `${rect.origin.x * actualScale}px`,\n      top: `${rect.origin.y * actualScale}px`,\n      width: `${rect.size.width * actualScale}px`,\n      height: `${rect.size.height * actualScale}px`,\n      border: `1px solid ${stroke}`,\n      background: fill,\n      boxSizing: 'border-box',\n    }\"\n    :class=\"className\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport { useZoomCapability } from '../hooks';\n\ninterface MarqueeZoomProps {\n  /** The ID of the document */\n  documentId: string;\n  /** Index of the page this layer lives on */\n  pageIndex: number;\n  /** Scale of the page */\n  scale?: number;\n  /** Optional CSS class applied to the marquee rectangle */\n  className?: string;\n  /** Stroke / fill colours (defaults below) */\n  stroke?: string;\n  fill?: string;\n}\n\nconst props = withDefaults(defineProps<MarqueeZoomProps>(), {\n  stroke: 'rgba(33,150,243,0.8)',\n  fill: 'rgba(33,150,243,0.15)',\n});\n\nconst { provides: zoomPlugin } = useZoomCapability();\nconst documentState = useDocumentState(() => props.documentId);\nconst rect = ref<Rect | null>(null);\n\nconst actualScale = computed(() => {\n  if (props.scale !== undefined) return props.scale;\n  return documentState.value?.scale ?? 1;\n});\n\nwatch(\n  [zoomPlugin, () => props.documentId, () => props.pageIndex, actualScale],\n  ([plugin, docId, pageIdx, scale], _, onCleanup) => {\n    if (!plugin) {\n      rect.value = null;\n      return;\n    }\n\n    const unregister = plugin.registerMarqueeOnPage({\n      documentId: docId,\n      pageIndex: pageIdx,\n      scale,\n      callback: {\n        onPreview: (newRect) => {\n          rect.value = newRect;\n        },\n      },\n    });\n\n    onCleanup(() => {\n      unregister?.();\n    });\n  },\n  { immediate: true },\n);\n</script>\n","<template>\n  <div\n    ref=\"elementRef\"\n    :style=\"{\n      display: 'inline-block',\n      overflow: 'visible',\n      boxSizing: 'border-box',\n    }\"\n    v-bind=\"$attrs\"\n  >\n    <slot />\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { toRef } from 'vue';\nimport { useZoomGesture } from '../hooks/use-zoom-gesture';\n\ninterface Props {\n  documentId: string;\n  /** Enable pinch-to-zoom gesture (default: true) */\n  enablePinch?: boolean;\n  /** Enable wheel zoom with ctrl/cmd key (default: true) */\n  enableWheel?: boolean;\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n  enablePinch: true,\n  enableWheel: true,\n});\n\nconst { elementRef } = useZoomGesture(() => props.documentId, {\n  enablePinch: toRef(() => props.enablePinch),\n  enableWheel: toRef(() => props.enableWheel),\n});\n</script>\n"],"names":["useZoomCapability","useCapability","ZoomPlugin","id","getTouchDistance","touches","t1","t2","dx","clientX","dy","clientY","Math","hypot","useZoomGesture","documentId","options","provides","viewportProvides","zoomProvides","viewportElementRef","inject","elementRef","ref","cleanup","watch","toValue","enablePinch","enableWheel","element","viewport","zoom","docId","container","value","viewportGap","window","zoomScope","forDocument","getState","initialZoom","currentScale","isPinching","initialDistance","wheelZoomTimeout","accumulatedWheelScale","initialElementWidth","initialElementHeight","initialElementLeft","initialElementTop","containerRectWidth","containerRectHeight","layoutWidth","layoutCenterX","pointerLocalY","pointerContainerX","pointerContainerY","currentGap","pivotLocalX","clamp","val","min","max","updateMargin","availableWidth","clientWidth","elementWidth","offsetWidth","newMargin","style","marginLeft","calculateTransform","scale","finalWidth","finalHeight","ty","txCenter","txMouse","overflow","blendRange","blend","tx","updateTransform","transformOrigin","transform","resetTransform","commitZoom","delta","anchorX","anchorY","scaleDiff","abs","requestZoomBy","vx","vy","initializeGestureState","containerRect","getBoundingClientRect","innerRect","width","height","left","top","clientLeft","rawPointerLocalX","handleTouchStart","e","length","currentZoomLevel","center","x","y","getTouchCenter","preventDefault","handleTouchMove","currentDistance","handleTouchEnd","handleWheel","ctrlKey","metaKey","clearTimeout","zoomFactor","deltaY","setTimeout","unsubZoom","onStateChange","resizeObserver","ResizeObserver","observe","addEventListener","passive","removeEventListener","disconnect","setupZoomGestures","getViewportGap","immediate","props","__props","zoomPlugin","documentState","useDocumentState","rect","actualScale","computed","_a","pageIndex","plugin","pageIdx","_","onCleanup","unregister","registerMarqueeOnPage","callback","onPreview","newRect","_createElementBlock","_normalizeStyle","origin","size","stroke","fill","class","className","toRef","_openBlock","_mergeProps","$attrs","_renderSlot","_ctx","$slots","state","initialDocumentState","providesValue","scope","newState","scopedProvides","readonly","usePlugin"],"mappings":"0KAIaA,EAAoB,IAAMC,gBAA0BC,EAAAA,WAAWC,ICgB5E,SAASC,EAAiBC,GACxB,MAAOC,EAAIC,GAAM,CAACF,EAAQ,GAAIA,EAAQ,IAChCG,EAAKD,EAAGE,QAAUH,EAAGG,QACrBC,EAAKH,EAAGI,QAAUL,EAAGK,QAC3B,OAAOC,KAAKC,MAAML,EAAIE,EACxB,CCHO,SAASI,EACdC,EACAC,EAAiC,IAEjC,MAAQC,SAAUC,GAAqBjB,EAAAA,cAA8B,aAC7DgB,SAAUE,GAAiBnB,IAC7BoB,EAAqBC,EAAAA,OAA+C,oBACpEC,EAAaC,EAAAA,IAA2B,MAE9C,IAAIC,EA4CJ,OA1CAC,EAAAA,MACE,CACEH,EACAJ,EACAC,EACA,IAAMO,EAAAA,QAAQX,GACd,IAAMW,UAAQV,EAAQW,cAAe,GACrC,IAAMD,EAAAA,QAAQV,EAAQY,cAAe,IAEvC,EAAEC,EAASC,EAAUC,EAAMC,EAAOL,EAAaC,MASzCJ,IACFA,IACAA,OAAU,GAGZ,MAAMS,EAAY,MAAAb,OAAA,EAAAA,EAAoBc,MAGjCL,GAAYI,GAAcF,IAI/BP,ED5BC,UAA2BK,QAChCA,EAAAI,UACAA,EAAAlB,WACAA,EAAAI,aACAA,EAAAgB,YACAA,EAAc,EAAAnB,QACdA,EAAU,CAAA,IAEV,MAAMW,YAAEA,GAAc,EAAAC,YAAMA,GAAc,GAASZ,EACnD,GAAsB,oBAAXoB,OACT,MAAO,OAGT,MAAMC,EAAYlB,EAAamB,YAAYvB,GACrCwB,EAAW,IAAMF,EAAUE,WAGjC,IAAIC,EAAc,E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