@inupedia/spotlight-vue 0.8.5 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/assets/spotlight-vue.css +1 -1
  2. package/dist/avatar/speech/live2dTtsPlayback.d.ts +15 -2
  3. package/dist/avatar/speech/live2dTtsPlayback.d.ts.map +1 -1
  4. package/dist/avatar/speech/live2dTtsPlayback.js +77 -15
  5. package/dist/avatar/speech/spotlightSpeech.d.ts.map +1 -1
  6. package/dist/avatar/speech/spotlightSpeech.js +44 -36
  7. package/dist/avatar/spine/live2dApp.d.ts +3 -0
  8. package/dist/avatar/spine/live2dApp.d.ts.map +1 -1
  9. package/dist/avatar/spine/live2dApp.js +30 -18
  10. package/dist/avatar/spine/spineAvatar.d.ts +4 -0
  11. package/dist/avatar/spine/spineAvatar.d.ts.map +1 -1
  12. package/dist/avatar/spine/spineAvatar.js +114 -83
  13. package/dist/avatar/spine/spineLipSync.d.ts +1 -0
  14. package/dist/avatar/spine/spineLipSync.d.ts.map +1 -1
  15. package/dist/avatar/spine/spineLipSync.js +41 -36
  16. package/dist/avatar/voice/avatarDirector.d.ts +8 -0
  17. package/dist/avatar/voice/avatarDirector.d.ts.map +1 -0
  18. package/dist/avatar/voice/avatarDirector.js +6 -0
  19. package/dist/avatar/voice/config.d.ts +5 -0
  20. package/dist/avatar/voice/config.d.ts.map +1 -0
  21. package/dist/avatar/voice/config.js +5 -0
  22. package/dist/avatar/voice/panelHidePolicy.d.ts +6 -0
  23. package/dist/avatar/voice/panelHidePolicy.d.ts.map +1 -0
  24. package/dist/avatar/voice/panelHidePolicy.js +6 -0
  25. package/dist/avatar/voice/voiceSession.d.ts +5 -0
  26. package/dist/avatar/voice/voiceSession.d.ts.map +1 -0
  27. package/dist/avatar/voice/voiceSession.js +14 -0
  28. package/dist/components/Live2dPanel.vue.d.ts.map +1 -1
  29. package/dist/components/Live2dPanel.vue.js +2 -2
  30. package/dist/components/Live2dPanel2.vue.js +31 -27
  31. package/dist/components/SpotlightShell.vue.d.ts.map +1 -1
  32. package/dist/components/SpotlightShell.vue.js +5 -2
  33. package/dist/components/SpotlightShell2.vue.js +289 -222
  34. package/dist/config.d.ts +3 -0
  35. package/dist/config.d.ts.map +1 -1
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +24 -22
  39. package/dist/mountShell.d.ts.map +1 -1
  40. package/dist/mountShell.js +13 -10
  41. package/dist/plugin.js +1 -1
  42. package/dist/remote/audio.d.ts.map +1 -1
  43. package/dist/remote/audio.js +19 -18
  44. package/dist/remote/runPipeline.d.ts +10 -3
  45. package/dist/remote/runPipeline.d.ts.map +1 -1
  46. package/dist/remote/runPipeline.js +120 -111
  47. package/dist/store/live2dSpeechStore.d.ts +2 -2
  48. package/dist/store/memoryPreferenceStore.d.ts +1 -1
  49. package/dist/store/pipeline/constants.d.ts +2 -0
  50. package/dist/store/pipeline/constants.d.ts.map +1 -1
  51. package/dist/store/pipeline/constants.js +2 -0
  52. package/dist/store/runtime/types.d.ts +1 -1
  53. package/dist/store/runtime/types.d.ts.map +1 -1
  54. package/dist/store/spotlightStore.d.ts +11 -13
  55. package/dist/store/spotlightStore.d.ts.map +1 -1
  56. package/package.json +3 -3
  57. package/dist/avatar/speech/live2dBriefingSummarizer.js +0 -91
  58. package/dist/avatar/speech/live2dStreamSpeech.js +0 -4
  59. package/dist/avatar/speech/llmUtils.js +0 -18
@@ -1,100 +1,131 @@
1
- import { Application as k, Assets as w } from "pixi.js";
2
- import { Spine as I } from "@pixi-spine/all-3.8";
3
- import { buildWavEnvelope as U, envelopeLevelAt as E, mouthAttachmentForLevel as O, MOUTH_SLOT as _ } from "./spineLipSync.js";
4
- import { resolveAvatarSkeletonUrl as x } from "../config.js";
5
- const p = "idle", h = "hello", v = "mouth_smile";
6
- let T;
7
- function q(e) {
8
- T = e;
9
- }
10
- let d = !1, u = null;
11
- function g() {
12
- u != null && (window.clearTimeout(u), u = null);
13
- }
14
- let l = null, t = null, o = null, f = null, A = !1, m = !1, c = null, s = null;
15
- function H(e, n) {
16
- if (!t) return;
17
- const i = t.skeleton, a = i.findSlot(e);
18
- if (!a) return;
19
- const r = i.getAttachment(a.data.index, n);
20
- a.setAttachment(r ?? null);
21
- }
22
- function C() {
23
- if (!t || !c || !s || s.ended) return;
24
- const e = s.currentTime * 1e3, n = E(c, e);
25
- H(_, O(n));
1
+ import { Application as _, Assets as E } from "pixi.js";
2
+ import { Spine as C } from "@pixi-spine/all-3.8";
3
+ import { buildWavEnvelope as D, envelopeLevelAt as H, mouthAttachmentForLevel as M, MOUTH_SLOT as b } from "./spineLipSync.js";
4
+ import { resolveAvatarSkeletonUrl as z } from "../config.js";
5
+ const h = "idle", v = "hello", k = "mouth_smile";
6
+ let I;
7
+ function V(t) {
8
+ I = t;
9
+ }
10
+ let S = !1, p = null;
11
+ function O() {
12
+ p != null && (window.clearTimeout(p), p = null);
13
+ }
14
+ let o = null, e = null, a = null, A = null, w = !1, f = !1, c = null, d = null, r = null, u = null;
15
+ function U(t, n) {
16
+ if (!e) return;
17
+ const i = e.skeleton, l = i.findSlot(t);
18
+ if (!l) return;
19
+ const s = i.getAttachment(l.data.index, n);
20
+ l.setAttachment(s ?? null);
26
21
  }
27
- function S() {
28
- t?.state.hasAnimation(v) && t.state.setAnimation(1, v, !0);
22
+ function N() {
23
+ if (!e) return;
24
+ if (r) {
25
+ const i = new Uint8Array(r.fftSize);
26
+ r.getByteTimeDomainData(i);
27
+ let l = 0;
28
+ for (const y of i) {
29
+ const m = (y - 128) / 128;
30
+ l += m * m;
31
+ }
32
+ const s = Math.min(1, Math.sqrt(l / i.length) * 4);
33
+ U(b, M(s));
34
+ return;
35
+ }
36
+ if (!c || !d) return;
37
+ const t = d(), n = H(c, t);
38
+ U(b, M(n));
39
+ }
40
+ function T() {
41
+ e?.state.hasAnimation(k) && e.state.setAnimation(1, k, !0);
29
42
  }
30
43
  function L() {
31
- t && t.state.setEmptyAnimation(1, 0);
32
- }
33
- function D() {
34
- t && (t.state.hasAnimation(p) && t.state.setAnimation(0, p, !0), S());
35
- }
36
- function J() {
37
- if (!t?.state.hasAnimation(h) || d) return;
38
- g(), d = !0;
39
- const e = t.state;
40
- e.setAnimation(0, h, !1), e.hasAnimation(p) && e.addAnimation(0, p, !0, 0), m ? L() : S(), t.update(0);
41
- const n = e.data.skeletonData.findAnimation(h), i = n ? (n.duration + 0.15) * 1e3 : 2500;
42
- u = window.setTimeout(() => {
43
- d = !1, u = null;
44
+ e && e.state.setEmptyAnimation(1, 0);
45
+ }
46
+ function R() {
47
+ e && (e.state.hasAnimation(h) && e.state.setAnimation(0, h, !0), T());
48
+ }
49
+ function X() {
50
+ if (!e?.state.hasAnimation(v) || S) return;
51
+ O(), S = !0;
52
+ const t = e.state;
53
+ t.setAnimation(0, v, !1), t.hasAnimation(h) && t.addAnimation(0, h, !0, 0), f ? L() : T(), e.update(0);
54
+ const n = t.data.skeletonData.findAnimation(v), i = n ? (n.duration + 0.15) * 1e3 : 2500;
55
+ p = window.setTimeout(() => {
56
+ S = !1, p = null;
44
57
  }, i);
45
58
  }
46
- function N() {
47
- if (!t || A) return;
48
- const e = t.update.bind(t);
49
- t.update = (n) => {
50
- e(n), !(!m || !c || !s) && (C(), e(0));
51
- }, A = !0;
52
- }
53
- const R = "shuidi_17";
54
59
  function W() {
55
- if (!t) return;
56
- const e = t.skeleton.findSlot(R);
57
- e && e.setAttachment(null);
58
- }
59
- function y() {
60
- if (!t || !o) return;
61
- const { clientWidth: e, clientHeight: n } = o;
62
- if (e <= 0 || n <= 0) return;
63
- t.scale.set(1), t.position.set(0, 0), t.update(0);
64
- const i = t.getLocalBounds();
60
+ if (!e || w) return;
61
+ const t = e.update.bind(e);
62
+ e.update = (n) => {
63
+ t(n), f && (!r && (!c || !d) || (N(), t(0)));
64
+ }, w = !0;
65
+ }
66
+ const B = "shuidi_17";
67
+ function G() {
68
+ if (!e) return;
69
+ const t = e.skeleton.findSlot(B);
70
+ t && t.setAttachment(null);
71
+ }
72
+ function x() {
73
+ if (!e || !a) return;
74
+ const { clientWidth: t, clientHeight: n } = a;
75
+ if (t <= 0 || n <= 0) return;
76
+ e.scale.set(1), e.position.set(0, 0), e.update(0);
77
+ const i = e.getLocalBounds();
65
78
  if (i.width <= 0 || i.height <= 0) return;
66
- const a = 0.9, r = Math.min(e * a / i.width, n * a / i.height), b = i.x + i.width / 2, M = i.y + i.height / 2;
67
- t.scale.set(r), t.position.set(e / 2 - b * r, n / 2 - M * r);
79
+ const l = 0.9, s = Math.min(t * l / i.width, n * l / i.height), y = i.x + i.width / 2, m = i.y + i.height / 2;
80
+ e.scale.set(s), e.position.set(t / 2 - y * s, n / 2 - m * s);
68
81
  }
69
- async function K() {
70
- if (o = document.getElementById("live2d-container"), !o || l) return;
71
- l = new k({
82
+ async function Y() {
83
+ if (a = document.getElementById("live2d-container"), !a || o) return;
84
+ o = new _({
72
85
  backgroundAlpha: 0,
73
86
  antialias: !0,
74
- resizeTo: o
75
- }), o.appendChild(l.view);
76
- const e = await w.load(x(T));
77
- t = new I(e.spineData), t.autoUpdate = !0, N(), l.stage.addChild(t), W(), D(), t.update(0), y(), f = new ResizeObserver(() => y()), f.observe(o);
87
+ resizeTo: a
88
+ }), a.appendChild(o.view);
89
+ const t = await E.load(z(I));
90
+ e = new C(t.spineData), e.autoUpdate = !0, W(), o.stage.addChild(e), G(), R(), e.update(0), x(), A = new ResizeObserver(() => x()), A.observe(a);
78
91
  }
79
- function Q() {
80
- B(), g(), d = !1, f?.disconnect(), f = null, A = !1, t && l && (l.stage.removeChild(t), t.destroy({ children: !0 }), t = null), l && (l.destroy(!0, { children: !0, texture: !0, baseTexture: !0 }), l = null), o = null, w.reset();
92
+ function Z() {
93
+ P(), O(), S = !1, A?.disconnect(), A = null, w = !1, e && o && (o.stage.removeChild(e), e.destroy({ children: !0 }), e = null), o && (o.destroy(!0, { children: !0, texture: !0, baseTexture: !0 }), o = null), a = null, E.reset();
81
94
  }
82
- function z(e, n) {
83
- t && (s = e, c = n, L(), m = !0, t.update(0));
95
+ function q(t, n) {
96
+ e && (g(), d = t, c = n, L(), f = !0, e.update(0));
97
+ }
98
+ function F(t, n) {
99
+ q(() => t.currentTime * 1e3, n);
100
+ }
101
+ function $(t) {
102
+ if (!e) return;
103
+ g(), d = null, c = null;
104
+ const n = new AudioContext(), i = n.createMediaStreamSource(t), l = n.createAnalyser();
105
+ l.fftSize = 1024, i.connect(l), u = n, r = l, n.resume(), L(), f = !0, e.update(0);
106
+ }
107
+ async function ee() {
108
+ u?.state === "suspended" && await u.resume();
109
+ }
110
+ function g() {
111
+ r = null, u && (u.close(), u = null);
84
112
  }
85
- async function V(e, n) {
86
- const i = await U(n);
87
- z(e, i);
113
+ async function te(t, n) {
114
+ const i = await D(n);
115
+ F(t, i);
88
116
  }
89
- function B() {
90
- m = !1, c = null, s = null, S(), t?.update(0);
117
+ function P() {
118
+ f = !1, c = null, d = null, g(), T(), e?.update(0);
91
119
  }
92
120
  export {
93
- z as bindSpineLipSyncToAudio,
94
- V as bindSpineLipSyncToAudioUrl,
95
- q as configureSpineAvatar,
96
- J as playSpineHello,
97
- K as startSpineAvatar,
98
- Q as stopSpineAvatar,
99
- B as stopSpineLipSync
121
+ F as bindSpineLipSyncToAudio,
122
+ te as bindSpineLipSyncToAudioUrl,
123
+ q as bindSpineLipSyncToClock,
124
+ $ as bindSpineLipSyncToMediaStream,
125
+ V as configureSpineAvatar,
126
+ X as playSpineHello,
127
+ ee as resumeSpineLipSyncAudio,
128
+ Y as startSpineAvatar,
129
+ Z as stopSpineAvatar,
130
+ P as stopSpineLipSync
100
131
  };
@@ -7,6 +7,7 @@ export type WavEnvelope = {
7
7
  levels: number[];
8
8
  };
9
9
  export declare function buildWavEnvelope(wavUrl: string): Promise<WavEnvelope>;
10
+ export declare function wavEnvelopeFromAudioBuffer(audioBuffer: AudioBuffer): WavEnvelope;
10
11
  export declare function buildWavEnvelopeFromBlob(blob: Blob): Promise<WavEnvelope>;
11
12
  export declare function envelopeLevelAt(envelope: WavEnvelope, elapsedMs: number): number;
12
13
  export declare function mouthAttachmentForLevel(level: number): string;
@@ -1 +1 @@
1
- {"version":3,"file":"spineLipSync.d.ts","sourceRoot":"","sources":["../../../src/avatar/spine/spineLipSync.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,iBAAiB,2DAA4D,CAAC;AAI3F,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAG3E;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CA4B/E;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAKR;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7D"}
1
+ {"version":3,"file":"spineLipSync.d.ts","sourceRoot":"","sources":["../../../src/avatar/spine/spineLipSync.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,iBAAiB,2DAA4D,CAAC;AAI3F,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAG3E;AAED,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAqBhF;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAS/E;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAKR;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7D"}
@@ -1,47 +1,52 @@
1
- const M = "shuidi_0", c = ["shuidi_3", "shuidi_2", "shuidi_1", "shuidi_0"];
2
- async function S(t) {
3
- const e = await fetch(t);
4
- return m(await e.blob());
1
+ const m = "shuidi_0", l = ["shuidi_3", "shuidi_2", "shuidi_1", "shuidi_0"];
2
+ async function _(t) {
3
+ const n = await fetch(t);
4
+ return d(await n.blob());
5
5
  }
6
- async function m(t) {
7
- const e = await t.arrayBuffer(), n = new AudioContext();
8
- try {
9
- const a = await n.decodeAudioData(e.slice(0)), s = a.getChannelData(0), d = a.sampleRate, r = Math.max(1, Math.floor(d * 50 / 1e3)), i = [];
10
- for (let o = 0; o < s.length; o += r) {
11
- const u = Math.min(o + r, s.length);
12
- let h = 0;
13
- for (let l = o; l < u; l += 1) {
14
- const f = s[l];
15
- h += f * f;
16
- }
17
- i.push(Math.sqrt(h / (u - o)));
6
+ function f(t) {
7
+ const n = t.getChannelData(0), e = t.sampleRate, a = Math.max(1, Math.floor(e * 50 / 1e3)), s = [];
8
+ for (let o = 0; o < n.length; o += a) {
9
+ const c = Math.min(o + a, n.length);
10
+ let r = 0;
11
+ for (let i = o; i < c; i += 1) {
12
+ const u = n[i];
13
+ r += u * u;
18
14
  }
19
- const _ = Math.max(...i, 1e-4);
20
- return {
21
- durationMs: a.duration * 1e3,
22
- levels: i.map((o) => Math.min(1, o / _))
23
- };
15
+ s.push(Math.sqrt(r / (c - o)));
16
+ }
17
+ const h = Math.max(...s, 1e-4);
18
+ return {
19
+ durationMs: t.duration * 1e3,
20
+ levels: s.map((o) => Math.min(1, o / h))
21
+ };
22
+ }
23
+ async function d(t) {
24
+ const n = await t.arrayBuffer(), e = new AudioContext();
25
+ try {
26
+ const a = await e.decodeAudioData(n.slice(0));
27
+ return f(a);
24
28
  } finally {
25
- n.close();
29
+ e.close();
26
30
  }
27
31
  }
28
- function p(t, e) {
29
- if (e < 0) return 0;
30
- const n = Math.floor(e / 50);
31
- return n >= t.levels.length ? 0 : t.levels[n] ?? 0;
32
+ function M(t, n) {
33
+ if (n < 0) return 0;
34
+ const e = Math.floor(n / 50);
35
+ return e >= t.levels.length ? 0 : t.levels[e] ?? 0;
32
36
  }
33
37
  function v(t) {
34
- const e = Math.max(0, Math.min(1, t)), n = Math.min(
35
- c.length - 1,
36
- Math.floor(e * c.length)
38
+ const n = Math.max(0, Math.min(1, t)), e = Math.min(
39
+ l.length - 1,
40
+ Math.floor(n * l.length)
37
41
  );
38
- return c[n];
42
+ return l[e];
39
43
  }
40
44
  export {
41
- c as MOUTH_OPEN_LEVELS,
42
- M as MOUTH_SLOT,
43
- S as buildWavEnvelope,
44
- m as buildWavEnvelopeFromBlob,
45
- p as envelopeLevelAt,
46
- v as mouthAttachmentForLevel
45
+ l as MOUTH_OPEN_LEVELS,
46
+ m as MOUTH_SLOT,
47
+ _ as buildWavEnvelope,
48
+ d as buildWavEnvelopeFromBlob,
49
+ M as envelopeLevelAt,
50
+ v as mouthAttachmentForLevel,
51
+ f as wavEnvelopeFromAudioBuffer
47
52
  };
@@ -0,0 +1,8 @@
1
+ import type { SpotlightVoicePhase } from "@inupedia/spotlight-protocol";
2
+ export declare function directorPhaseFromTurn(input: {
3
+ loading: boolean;
4
+ speaking: boolean;
5
+ toolRunning: boolean;
6
+ interrupted?: boolean;
7
+ }): SpotlightVoicePhase;
8
+ //# sourceMappingURL=avatarDirector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatarDirector.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/avatarDirector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,mBAAmB,CAMtB"}
@@ -0,0 +1,6 @@
1
+ function r(n) {
2
+ return n.interrupted ? "interrupted" : n.speaking ? "speaking" : n.toolRunning ? "tool-running" : n.loading ? "thinking" : "listening";
3
+ }
4
+ export {
5
+ r as directorPhaseFromTurn
6
+ };
@@ -0,0 +1,5 @@
1
+ import { type InjectionKey } from "vue";
2
+ import type { SpotlightVoiceConfig } from "@inupedia/spotlight-protocol";
3
+ export declare const SPOTLIGHT_VOICE_CONFIG_KEY: InjectionKey<SpotlightVoiceConfig>;
4
+ export declare function useSpotlightVoiceConfig(): SpotlightVoiceConfig;
5
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,eAAO,MAAM,0BAA0B,EAAE,YAAY,CAAC,oBAAoB,CACxC,CAAC;AAEnC,wBAAgB,uBAAuB,IAAI,oBAAoB,CAE9D"}
@@ -0,0 +1,5 @@
1
+ import "vue";
2
+ const t = /* @__PURE__ */ Symbol("spotlight-voice-config");
3
+ export {
4
+ t as SPOTLIGHT_VOICE_CONFIG_KEY
5
+ };
@@ -0,0 +1,6 @@
1
+ /** Text submit hides the command panel to show thinking. That is not a user cancel. */
2
+ export declare function shouldAbortVoiceOnPanelHide(state: {
3
+ loading: boolean;
4
+ pipelinePhase: string;
5
+ }): boolean;
6
+ //# sourceMappingURL=panelHidePolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panelHidePolicy.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/panelHidePolicy.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAEV"}
@@ -0,0 +1,6 @@
1
+ function e(n) {
2
+ return !n.loading && n.pipelinePhase !== "running";
3
+ }
4
+ export {
5
+ e as shouldAbortVoiceOnPanelHide
6
+ };
@@ -0,0 +1,5 @@
1
+ import type { SpotlightVoiceConfig } from "@inupedia/spotlight-protocol";
2
+ export declare function unlockVoicePlayback(): Promise<void>;
3
+ export declare function describeMicrophoneError(error: unknown): string;
4
+ export declare function voiceConfigEnabled(config?: SpotlightVoiceConfig): boolean;
5
+ //# sourceMappingURL=voiceSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceSession.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/voiceSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAWzD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAgB9D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAEzE"}
@@ -0,0 +1,14 @@
1
+ async function e() {
2
+ const o = globalThis.AudioContext ?? globalThis.webkitAudioContext;
3
+ if (!o) return;
4
+ const t = new o();
5
+ try {
6
+ t.state === "suspended" && await t.resume();
7
+ } finally {
8
+ await t.close().catch(() => {
9
+ });
10
+ }
11
+ }
12
+ export {
13
+ e as unlockVoicePlayback
14
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Live2dPanel.vue.d.ts","sourceRoot":"","sources":["../../src/components/Live2dPanel.vue"],"names":[],"mappings":"AA6ZA,KAAK,WAAW,GAAG;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAiPpE,QAAA,MAAM,YAAY;;;;;;;;;mBAjPmB,OAAO;gBAAe,MAAM;6EAqP/D,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"Live2dPanel.vue.d.ts","sourceRoot":"","sources":["../../src/components/Live2dPanel.vue"],"names":[],"mappings":"AA6bA,KAAK,WAAW,GAAG;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA8PJ,QAAA,MAAM,YAAY;;;;;;;;;mBAhQE,OAAO;gBACV,MAAM;6EAmQrB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./Live2dPanel2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c16f40d6"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ca5091e3"]]);
5
5
  export {
6
- f as default
6
+ m as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as x, ref as V, computed as k, watch as E, onMounted as A, onUnmounted as B, openBlock as p, createElementBlock as m, createElementVNode as t, unref as l, normalizeClass as y, toDisplayString as c, createCommentVNode as L, createVNode as I, Transition as N, withCtx as z } from "vue";
1
+ import { defineComponent as x, ref as V, computed as k, watch as E, onMounted as A, onUnmounted as B, openBlock as p, createElementBlock as m, createElementVNode as e, unref as o, normalizeClass as y, toDisplayString as c, createCommentVNode as L, createVNode as I, Transition as N, withCtx as z } from "vue";
2
2
  import { storeToRefs as M } from "pinia";
3
3
  import { startLive2dApp as P, stopLive2dApp as R } from "../avatar/spine/live2dApp.js";
4
4
  import { configureSpineAvatar as U } from "../avatar/spine/spineAvatar.js";
@@ -17,32 +17,32 @@ const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls"
17
17
  },
18
18
  emits: ["voiceStart", "voiceStop", "close"],
19
19
  setup(r, { emit: w }) {
20
- const b = r, d = w, f = j(), i = q(), g = $(), { message: h, speaking: C, revealInstant: D } = M(f), n = V("");
20
+ const b = r, d = w, f = j(), t = q(), g = $(), { message: h, speaking: C, revealInstant: D } = M(f), n = V("");
21
21
  let s = null;
22
- const T = k(() => C.value || h.value.trim().length > 0), S = k(() => i.recording ? "点击发送" : i.transcribing ? "正在识别…" : b.voiceDisabled ? "Spotlight 忙碌中" : "点击说话");
22
+ const T = k(() => C.value || h.value.trim().length > 0), S = k(() => t.recording ? "点击发送" : t.transcribing ? "正在识别…" : b.voiceDisabled ? "Spotlight 忙碌中" : "点击说话");
23
23
  function _(a) {
24
- b.voiceDisabled || i.transcribing || (a.preventDefault(), i.recording ? d("voiceStop") : d("voiceStart"));
24
+ b.voiceDisabled || t.transcribing || (a.preventDefault(), t.recording ? d("voiceStop") : d("voiceStart"));
25
25
  }
26
26
  function v() {
27
27
  s != null && (window.clearInterval(s), s = null);
28
28
  }
29
29
  return E(
30
30
  () => [h.value, D.value],
31
- ([a, e]) => {
31
+ ([a, i]) => {
32
32
  v();
33
- const o = a.trim();
34
- if (!o) {
33
+ const l = a.trim();
34
+ if (!l) {
35
35
  n.value = "";
36
36
  return;
37
37
  }
38
- if (e) {
39
- n.value = o;
38
+ if (i) {
39
+ n.value = l;
40
40
  return;
41
41
  }
42
42
  n.value = "";
43
43
  let u = 0;
44
44
  s = window.setInterval(() => {
45
- u += 1, n.value = o.slice(0, u), u >= o.length && v();
45
+ u += 1, n.value = l.slice(0, u), u >= l.length && v();
46
46
  }, 24);
47
47
  },
48
48
  { immediate: !0 }
@@ -50,49 +50,53 @@ const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls"
50
50
  U(g), await P();
51
51
  }), B(() => {
52
52
  v(), f.reset(), R();
53
- }), (a, e) => (p(), m("div", F, [
54
- e[3] || (e[3] = t("div", {
53
+ }), (a, i) => (p(), m("div", F, [
54
+ i[3] || (i[3] = e("div", {
55
55
  id: "live2d-container",
56
56
  class: "live2d-panel",
57
57
  "aria-label": "Live2D"
58
58
  }, null, -1)),
59
- t("button", {
59
+ e("button", {
60
60
  type: "button",
61
61
  class: "live2d-close",
62
62
  "aria-label": "关闭数字人",
63
63
  title: "关闭数字人(Ctrl/Command + L 可再次打开)",
64
- onClick: e[0] || (e[0] = (o) => d("close"))
64
+ onClick: i[0] || (i[0] = (l) => d("close"))
65
65
  }, " × "),
66
- t("div", G, [
67
- t("button", {
66
+ e("div", G, [
67
+ e("button", {
68
68
  type: "button",
69
69
  class: y(["live2d-voice-button", {
70
- "is-recording": l(i).recording,
71
- "is-transcribing": l(i).transcribing
70
+ "is-recording": o(t).recording,
71
+ "is-transcribing": o(t).transcribing
72
72
  }]),
73
- disabled: r.voiceDisabled || l(i).transcribing,
73
+ disabled: r.voiceDisabled || o(t).transcribing,
74
74
  "aria-label": S.value,
75
75
  onClick: _
76
- }, [...e[1] || (e[1] = [
77
- t("span", {
76
+ }, [...i[1] || (i[1] = [
77
+ e("span", {
78
+ class: "live2d-voice-ring",
79
+ "aria-hidden": "true"
80
+ }, null, -1),
81
+ e("span", {
78
82
  class: "live2d-mic-icon",
79
83
  "aria-hidden": "true"
80
84
  }, null, -1)
81
85
  ])], 10, H),
82
- t("span", J, c(S.value), 1),
86
+ e("span", J, c(S.value), 1),
83
87
  r.voiceError ? (p(), m("span", K, c(r.voiceError), 1)) : L("", !0)
84
88
  ]),
85
89
  I(N, { name: "speech-bubble" }, {
86
90
  default: z(() => [
87
91
  T.value ? (p(), m("div", {
88
92
  key: 0,
89
- class: y(["live2d-speech-bubble", { "is-speaking": l(C) }])
93
+ class: y(["live2d-speech-bubble", { "is-speaking": o(C) }])
90
94
  }, [
91
- t("div", O, [
92
- e[2] || (e[2] = t("span", { class: "live2d-speech-dot" }, null, -1)),
93
- t("span", null, c(l(g).bubbleTitle ?? "数字人"), 1)
95
+ e("div", O, [
96
+ i[2] || (i[2] = e("span", { class: "live2d-speech-dot" }, null, -1)),
97
+ e("span", null, c(o(g).bubbleTitle ?? "数字人"), 1)
94
98
  ]),
95
- t("p", Q, c(n.value), 1)
99
+ e("p", Q, c(n.value), 1)
96
100
  ], 2)) : L("", !0)
97
101
  ]),
98
102
  _: 1
@@ -1 +1 @@
1
- {"version":3,"file":"SpotlightShell.vue.d.ts","sourceRoot":"","sources":["../../src/components/SpotlightShell.vue"],"names":[],"mappings":"AA6qBA,KAAK,WAAW,GAAG;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAwsB/C,QAAA,MAAM,YAAY;mBAxsBmB,OAAO;6EA2sB1C,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"SpotlightShell.vue.d.ts","sourceRoot":"","sources":["../../src/components/SpotlightShell.vue"],"names":[],"mappings":"AA00BA,KAAK,WAAW,GAAG;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAqyB/C,QAAA,MAAM,YAAY;mBAryBmB,OAAO;6EAwyB1C,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,4 +1,7 @@
1
- import f from "./SpotlightShell2.vue.js";
1
+ import o from "./SpotlightShell2.vue.js";
2
+ /* empty css */
3
+ import t from "../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-826535e7"]]);
2
5
  export {
3
- f as default
6
+ m as default
4
7
  };