{"version":3,"sources":["../../../../src/sensors/useSpeechSynthesis/index.ts"],"sourcesContent":["\"use client\";\nimport type { Observable } from \"@legendapp/state\";\nimport { useScope, toObs } from \"@usels/core\";\nimport { createSpeechSynthesis } from \"./core\";\n\nexport { createSpeechSynthesis } from \"./core\";\nexport type {\n  UseSpeechSynthesisOptions,\n  UseSpeechSynthesisReturn,\n  UseSpeechSynthesisStatus,\n  UseSpeechSynthesisErrorData,\n} from \"./core\";\n\n/**\n * Reactive wrapper around the\n * [SpeechSynthesis API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis).\n *\n * Exposes `isPlaying$`, `status$`, and `error$` as observables with\n * `speak()` / `stop()` / `toggle()` controls. Text and option fields are read\n * at each `speak()` call so reactive updates apply on the next utterance.\n */\nexport type UseSpeechSynthesis = typeof createSpeechSynthesis;\nexport const useSpeechSynthesis: UseSpeechSynthesis = (text, options = {}) => {\n  return useScope(\n    (p, opts) => {\n      const p$ = toObs(p);\n      const opts$ = toObs(opts, { voice: \"opaque\", window: \"opaque\" });\n      return createSpeechSynthesis(p$.text as Observable<string>, opts$);\n    },\n    { text },\n    options as Record<string, unknown>\n  );\n};\n"],"mappings":";AAEA,SAAS,UAAU,aAAa;AAChC,SAAS,6BAA6B;AAEtC,SAAS,yBAAAA,8BAA6B;AAiB/B,MAAM,qBAAyC,CAAC,MAAM,UAAU,CAAC,MAAM;AAC5E,SAAO;AAAA,IACL,CAAC,GAAG,SAAS;AACX,YAAM,KAAK,MAAM,CAAC;AAClB,YAAM,QAAQ,MAAM,MAAM,EAAE,OAAO,UAAU,QAAQ,SAAS,CAAC;AAC/D,aAAO,sBAAsB,GAAG,MAA4B,KAAK;AAAA,IACnE;AAAA,IACA,EAAE,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":["createSpeechSynthesis"]}