{"version":3,"sources":["../../../../src/browser/useAnimate/index.ts"],"sourcesContent":["\"use client\";\nimport { useScope, toObs, type DeepMaybeObservable } from \"@usels/core\";\nimport { createAnimate, type UseAnimateOptions } from \"./core\";\n\nexport { createAnimate } from \"./core\";\nexport type { UseAnimateOptions, UseAnimateKeyframes, UseAnimateReturn } from \"./core\";\n\n/**\n * Reactive wrapper around the\n * [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API).\n *\n * Drives `element.animate()` with Observable-based reactive state for\n * `playState`, `currentTime`, `playbackRate`, and `pending`. The underlying\n * `createAnimate` core function is framework-agnostic and can be called\n * directly inside a `useScope` block.\n */\nexport type UseAnimate = typeof createAnimate;\nexport const useAnimate: UseAnimate = (target, keyframes, options) => {\n  // Normalize the number shorthand (duration) into an options object so the\n  // hook path always goes through `toObs` / ReactiveProps tracking.\n  // Standalone `createAnimate` callers can still pass a number directly.\n  const normalized: DeepMaybeObservable<UseAnimateOptions> =\n    typeof options === \"number\"\n      ? ({ duration: options } as UseAnimateOptions)\n      : (options ?? ({} as UseAnimateOptions));\n\n  return useScope((opts) => {\n    const opts$ = toObs(opts, {\n      window: \"opaque\",\n    });\n    return createAnimate(\n      target,\n      keyframes,\n      opts$ as unknown as DeepMaybeObservable<UseAnimateOptions>\n    );\n  }, normalized as UseAnimateOptions);\n};\n"],"mappings":";AACA,SAAS,UAAU,aAAuC;AAC1D,SAAS,qBAA6C;AAEtD,SAAS,iBAAAA,sBAAqB;AAavB,MAAM,aAAyB,CAAC,QAAQ,WAAW,YAAY;AAIpE,QAAM,aACJ,OAAO,YAAY,WACd,EAAE,UAAU,QAAQ,IACpB,WAAY,CAAC;AAEpB,SAAO,SAAS,CAAC,SAAS;AACxB,UAAM,QAAQ,MAAM,MAAM;AAAA,MACxB,QAAQ;AAAA,IACV,CAAC;AACD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,UAA+B;AACpC;","names":["createAnimate"]}