{"version":3,"sources":["../src/useZoomImageWheel.ts"],"names":[],"mappings":";AAAA,SAAS,wBAAwB,6BAA6B;AAC9D,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAIlB,SAAS,oBAAoB;AAClC,MAAI;AAEJ,QAAM,EAAE,KAAK,UAAU,IAAI,SAA8B;AAAA,IACvD,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,EACnB,CAAC;AAED,QAAM,kBAAkB,IAAI,QAAkD;AAC5E,YAAQ,QAAQ;AAChB,aAAS,sBAAsB,GAAG,GAAG;AACrC,QAAI,OAAO,SAAS,CAAC;AAErB,WAAO,UAAU,CAAC,EAAE,MAAM,MAAM;AAC9B,UAAI,KAAK;AAAA,IACX,CAAC;AAAA,EACH;AAEA,YAAU,MAAM;AACd,YAAQ,QAAQ;AAAA,EAClB,CAAC;AAED,QAAM,oBAAoB,CAAC,UAAqC;AAC9D,YAAQ,SAAS,KAAK;AAAA,EACxB;AAEA,SAAO;AAAA,IACL;AAAA,IACA,gBAAgB;AAAA,MACd;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["import { createZoomImageWheel as _createZoomImageWheel } from \"@zoom-image/core\"\nimport { onDestroy } from \"svelte\"\nimport { writable } from \"svelte/store\"\n\nimport type { ZoomImageWheelState, ZoomImageWheelStateUpdate } from \"@zoom-image/core\"\n\nexport function useZoomImageWheel() {\n  let result: ReturnType<typeof _createZoomImageWheel> | undefined\n\n  const { set, subscribe } = writable<ZoomImageWheelState>({\n    currentZoom: 1,\n    enable: false,\n    currentPositionX: -1,\n    currentPositionY: -1,\n    currentRotation: 0,\n  })\n\n  const createZoomImage = (...arg: Parameters<typeof _createZoomImageWheel>) => {\n    result?.cleanup()\n    result = _createZoomImageWheel(...arg)\n    set(result.getState())\n\n    result.subscribe(({ state }) => {\n      set(state)\n    })\n  }\n\n  onDestroy(() => {\n    result?.cleanup()\n  })\n\n  const setZoomImageState = (state: ZoomImageWheelStateUpdate) => {\n    result?.setState(state)\n  }\n\n  return {\n    createZoomImage,\n    zoomImageState: {\n      subscribe,\n    },\n    setZoomImageState,\n  }\n}\n"]}