dictate-button 2.1.0 → 2.1.1
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.
- package/dist/dictate-button.js +274 -240
- package/package.json +1 -1
package/dist/dictate-button.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
const
|
|
2
|
-
equals:
|
|
1
|
+
const $t = (t, n) => t === n, J = {
|
|
2
|
+
equals: $t
|
|
3
3
|
};
|
|
4
|
-
let
|
|
5
|
-
const
|
|
4
|
+
let mt = Et;
|
|
5
|
+
const k = 1, G = 2, vt = {
|
|
6
6
|
owned: null,
|
|
7
7
|
cleanups: null,
|
|
8
8
|
context: null,
|
|
9
9
|
owner: null
|
|
10
10
|
};
|
|
11
11
|
var y = null;
|
|
12
|
-
let
|
|
13
|
-
function
|
|
14
|
-
const e = b, i = y, r = t.length === 0, o = n === void 0 ? i : n, l = r ?
|
|
12
|
+
let st = null, Nt = null, b = null, w = null, S = null, tt = 0;
|
|
13
|
+
function Dt(t, n) {
|
|
14
|
+
const e = b, i = y, r = t.length === 0, o = n === void 0 ? i : n, l = r ? vt : {
|
|
15
15
|
owned: null,
|
|
16
16
|
cleanups: null,
|
|
17
17
|
context: o ? o.context : null,
|
|
18
18
|
owner: o
|
|
19
|
-
}, s = r ? t : () => t(() =>
|
|
19
|
+
}, s = r ? t : () => t(() => et(() => j(l)));
|
|
20
20
|
y = l, b = null;
|
|
21
21
|
try {
|
|
22
|
-
return
|
|
22
|
+
return U(s, !0);
|
|
23
23
|
} finally {
|
|
24
24
|
b = e, y = i;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
n = n ? Object.assign({},
|
|
27
|
+
function Ct(t, n) {
|
|
28
|
+
n = n ? Object.assign({}, J, n) : J;
|
|
29
29
|
const e = {
|
|
30
30
|
value: t,
|
|
31
31
|
observers: null,
|
|
32
32
|
observerSlots: null,
|
|
33
33
|
comparator: n.equals || void 0
|
|
34
|
-
}, i = (r) => (typeof r == "function" && (r = r(e.value)),
|
|
35
|
-
return [
|
|
34
|
+
}, i = (r) => (typeof r == "function" && (r = r(e.value)), xt(e, r));
|
|
35
|
+
return [St.bind(e), i];
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const i =
|
|
39
|
-
|
|
37
|
+
function X(t, n, e) {
|
|
38
|
+
const i = ct(t, n, !1, k);
|
|
39
|
+
B(i);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
const i =
|
|
44
|
-
i.user = !0,
|
|
41
|
+
function It(t, n, e) {
|
|
42
|
+
mt = zt;
|
|
43
|
+
const i = ct(t, n, !1, k);
|
|
44
|
+
i.user = !0, S ? S.push(i) : B(i);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
e = e ? Object.assign({},
|
|
48
|
-
const i =
|
|
49
|
-
return i.observers = null, i.observerSlots = null, i.comparator = e.equals || void 0,
|
|
46
|
+
function jt(t, n, e) {
|
|
47
|
+
e = e ? Object.assign({}, J, e) : J;
|
|
48
|
+
const i = ct(t, n, !0, 0);
|
|
49
|
+
return i.observers = null, i.observerSlots = null, i.comparator = e.equals || void 0, B(i), St.bind(i);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function et(t) {
|
|
52
52
|
if (b === null) return t();
|
|
53
53
|
const n = b;
|
|
54
54
|
b = null;
|
|
@@ -58,15 +58,15 @@ function Y(t) {
|
|
|
58
58
|
b = n;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function ht(t) {
|
|
62
62
|
return y === null || (y.cleanups === null ? y.cleanups = [t] : y.cleanups.push(t)), t;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function St() {
|
|
65
65
|
if (this.sources && this.state)
|
|
66
|
-
if (this.state ===
|
|
66
|
+
if (this.state === k) B(this);
|
|
67
67
|
else {
|
|
68
68
|
const t = w;
|
|
69
|
-
w = null,
|
|
69
|
+
w = null, U(() => Q(this), !1), w = t;
|
|
70
70
|
}
|
|
71
71
|
if (b) {
|
|
72
72
|
const t = this.observers ? this.observers.length : 0;
|
|
@@ -74,37 +74,37 @@ function vt() {
|
|
|
74
74
|
}
|
|
75
75
|
return this.value;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function xt(t, n, e) {
|
|
78
78
|
let i = t.value;
|
|
79
|
-
return (!t.comparator || !t.comparator(i, n)) && (t.value = n, t.observers && t.observers.length &&
|
|
79
|
+
return (!t.comparator || !t.comparator(i, n)) && (t.value = n, t.observers && t.observers.length && U(() => {
|
|
80
80
|
for (let r = 0; r < t.observers.length; r += 1) {
|
|
81
|
-
const o = t.observers[r], l =
|
|
82
|
-
l &&
|
|
81
|
+
const o = t.observers[r], l = st && st.running;
|
|
82
|
+
l && st.disposed.has(o), (l ? !o.tState : !o.state) && (o.pure ? w.push(o) : S.push(o), o.observers && At(o)), l || (o.state = k);
|
|
83
83
|
}
|
|
84
84
|
if (w.length > 1e6)
|
|
85
85
|
throw w = [], new Error();
|
|
86
86
|
}, !1)), n;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function B(t) {
|
|
89
89
|
if (!t.fn) return;
|
|
90
90
|
j(t);
|
|
91
|
-
const n =
|
|
92
|
-
|
|
91
|
+
const n = tt;
|
|
92
|
+
Bt(t, t.value, n);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Bt(t, n, e) {
|
|
95
95
|
let i;
|
|
96
96
|
const r = y, o = b;
|
|
97
97
|
b = y = t;
|
|
98
98
|
try {
|
|
99
99
|
i = t.fn(n);
|
|
100
100
|
} catch (l) {
|
|
101
|
-
return t.pure && (t.state =
|
|
101
|
+
return t.pure && (t.state = k, t.owned && t.owned.forEach(j), t.owned = null), t.updatedAt = e + 1, kt(l);
|
|
102
102
|
} finally {
|
|
103
103
|
b = o, y = r;
|
|
104
104
|
}
|
|
105
|
-
(!t.updatedAt || t.updatedAt <= e) && (t.updatedAt != null && "observers" in t ?
|
|
105
|
+
(!t.updatedAt || t.updatedAt <= e) && (t.updatedAt != null && "observers" in t ? xt(t, i) : t.value = i, t.updatedAt = e);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function ct(t, n, e, i = k, r) {
|
|
108
108
|
const o = {
|
|
109
109
|
fn: t,
|
|
110
110
|
state: i,
|
|
@@ -118,64 +118,64 @@ function ot(t, n, e, i = T, r) {
|
|
|
118
118
|
context: y ? y.context : null,
|
|
119
119
|
pure: e
|
|
120
120
|
};
|
|
121
|
-
return y === null || y !==
|
|
121
|
+
return y === null || y !== vt && (y.owned ? y.owned.push(o) : y.owned = [o]), o;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Z(t) {
|
|
124
124
|
if (t.state === 0) return;
|
|
125
|
-
if (t.state ===
|
|
126
|
-
if (t.suspense &&
|
|
125
|
+
if (t.state === G) return Q(t);
|
|
126
|
+
if (t.suspense && et(t.suspense.inFallback)) return t.suspense.effects.push(t);
|
|
127
127
|
const n = [t];
|
|
128
|
-
for (; (t = t.owner) && (!t.updatedAt || t.updatedAt <
|
|
128
|
+
for (; (t = t.owner) && (!t.updatedAt || t.updatedAt < tt); )
|
|
129
129
|
t.state && n.push(t);
|
|
130
130
|
for (let e = n.length - 1; e >= 0; e--)
|
|
131
|
-
if (t = n[e], t.state ===
|
|
132
|
-
|
|
133
|
-
else if (t.state ===
|
|
131
|
+
if (t = n[e], t.state === k)
|
|
132
|
+
B(t);
|
|
133
|
+
else if (t.state === G) {
|
|
134
134
|
const i = w;
|
|
135
|
-
w = null,
|
|
135
|
+
w = null, U(() => Q(t, n[0]), !1), w = i;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function U(t, n) {
|
|
139
139
|
if (w) return t();
|
|
140
140
|
let e = !1;
|
|
141
|
-
n || (w = []),
|
|
141
|
+
n || (w = []), S ? e = !0 : S = [], tt++;
|
|
142
142
|
try {
|
|
143
143
|
const i = t();
|
|
144
|
-
return
|
|
144
|
+
return Ut(e), i;
|
|
145
145
|
} catch (i) {
|
|
146
|
-
e || (
|
|
146
|
+
e || (S = null), w = null, kt(i);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
if (w && (
|
|
151
|
-
const n =
|
|
152
|
-
|
|
149
|
+
function Ut(t) {
|
|
150
|
+
if (w && (Et(w), w = null), t) return;
|
|
151
|
+
const n = S;
|
|
152
|
+
S = null, n.length && U(() => mt(n), !1);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
for (let n = 0; n < t.length; n++)
|
|
154
|
+
function Et(t) {
|
|
155
|
+
for (let n = 0; n < t.length; n++) Z(t[n]);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function zt(t) {
|
|
158
158
|
let n, e = 0;
|
|
159
159
|
for (n = 0; n < t.length; n++) {
|
|
160
160
|
const i = t[n];
|
|
161
|
-
i.user ? t[e++] = i :
|
|
161
|
+
i.user ? t[e++] = i : Z(i);
|
|
162
162
|
}
|
|
163
|
-
for (n = 0; n < e; n++)
|
|
163
|
+
for (n = 0; n < e; n++) Z(t[n]);
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Q(t, n) {
|
|
166
166
|
t.state = 0;
|
|
167
167
|
for (let e = 0; e < t.sources.length; e += 1) {
|
|
168
168
|
const i = t.sources[e];
|
|
169
169
|
if (i.sources) {
|
|
170
170
|
const r = i.state;
|
|
171
|
-
r ===
|
|
171
|
+
r === k ? i !== n && (!i.updatedAt || i.updatedAt < tt) && Z(i) : r === G && Q(i, n);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function At(t) {
|
|
176
176
|
for (let n = 0; n < t.observers.length; n += 1) {
|
|
177
177
|
const e = t.observers[n];
|
|
178
|
-
e.state || (e.state =
|
|
178
|
+
e.state || (e.state = G, e.pure ? w.push(e) : S.push(e), e.observers && At(e));
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
function j(t) {
|
|
@@ -202,19 +202,19 @@ function j(t) {
|
|
|
202
202
|
}
|
|
203
203
|
t.state = 0;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Ft(t) {
|
|
206
206
|
return t instanceof Error ? t : new Error(typeof t == "string" ? t : "Unknown error", {
|
|
207
207
|
cause: t
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
throw
|
|
210
|
+
function kt(t, n = y) {
|
|
211
|
+
throw Ft(t);
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return
|
|
213
|
+
function H(t, n) {
|
|
214
|
+
return et(() => t(n || {}));
|
|
215
215
|
}
|
|
216
|
-
const
|
|
217
|
-
function
|
|
216
|
+
const q = (t) => jt(() => t());
|
|
217
|
+
function Wt(t, n, e) {
|
|
218
218
|
let i = e.length, r = n.length, o = i, l = 0, s = 0, a = n[r - 1].nextSibling, g = null;
|
|
219
219
|
for (; l < r || s < o; ) {
|
|
220
220
|
if (n[l] === e[s]) {
|
|
@@ -245,15 +245,15 @@ function Ut(t, n, e) {
|
|
|
245
245
|
for (; ++d < r && d < o && !((c = g.get(n[d])) == null || c !== f + m); )
|
|
246
246
|
m++;
|
|
247
247
|
if (m > f - s) {
|
|
248
|
-
const
|
|
249
|
-
for (; s < f; ) t.insertBefore(e[s++],
|
|
248
|
+
const T = n[l];
|
|
249
|
+
for (; s < f; ) t.insertBefore(e[s++], T);
|
|
250
250
|
} else t.replaceChild(e[s++], n[l++]);
|
|
251
251
|
} else l++;
|
|
252
252
|
else n[l++].remove();
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function z(t, n, e, i) {
|
|
257
257
|
let r;
|
|
258
258
|
const o = () => {
|
|
259
259
|
const s = document.createElement("template");
|
|
@@ -261,11 +261,11 @@ function D(t, n, e, i) {
|
|
|
261
261
|
}, l = () => (r || (r = o())).cloneNode(!0);
|
|
262
262
|
return l.cloneNode = l, l;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function I(t, n, e) {
|
|
265
265
|
e == null ? t.removeAttribute(n) : t.setAttribute(n, e);
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
if (!n) return e ?
|
|
267
|
+
function Kt(t, n, e) {
|
|
268
|
+
if (!n) return e ? I(t, "style") : n;
|
|
269
269
|
const i = t.style;
|
|
270
270
|
if (typeof n == "string") return i.cssText = n;
|
|
271
271
|
typeof e == "string" && (i.cssText = e = void 0), e || (e = {}), n || (n = {});
|
|
@@ -276,14 +276,14 @@ function zt(t, n, e) {
|
|
|
276
276
|
r = n[o], r !== e[o] && (i.setProperty(o, r), e[o] = r);
|
|
277
277
|
return e;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
return
|
|
279
|
+
function Vt(t, n, e) {
|
|
280
|
+
return et(() => t(n, e));
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
if (e !== void 0 && !i && (i = []), typeof n != "function") return
|
|
284
|
-
|
|
282
|
+
function P(t, n, e, i) {
|
|
283
|
+
if (e !== void 0 && !i && (i = []), typeof n != "function") return Y(t, n, i, e);
|
|
284
|
+
X((r) => Y(t, n(), r, e), i);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function Y(t, n, e, i, r) {
|
|
287
287
|
for (; typeof e == "function"; ) e = e();
|
|
288
288
|
if (n === e) return e;
|
|
289
289
|
const o = typeof n, l = i !== void 0;
|
|
@@ -292,48 +292,48 @@ function Z(t, n, e, i, r) {
|
|
|
292
292
|
return e;
|
|
293
293
|
if (l) {
|
|
294
294
|
let s = e[0];
|
|
295
|
-
s && s.nodeType === 3 ? s.data !== n && (s.data = n) : s = document.createTextNode(n), e =
|
|
295
|
+
s && s.nodeType === 3 ? s.data !== n && (s.data = n) : s = document.createTextNode(n), e = R(t, e, i, s);
|
|
296
296
|
} else
|
|
297
297
|
e !== "" && typeof e == "string" ? e = t.firstChild.data = n : e = t.textContent = n;
|
|
298
298
|
} else if (n == null || o === "boolean")
|
|
299
|
-
e =
|
|
299
|
+
e = R(t, e, i);
|
|
300
300
|
else {
|
|
301
301
|
if (o === "function")
|
|
302
|
-
return
|
|
302
|
+
return X(() => {
|
|
303
303
|
let s = n();
|
|
304
304
|
for (; typeof s == "function"; ) s = s();
|
|
305
|
-
e =
|
|
305
|
+
e = Y(t, s, e, i);
|
|
306
306
|
}), () => e;
|
|
307
307
|
if (Array.isArray(n)) {
|
|
308
308
|
const s = [], a = e && Array.isArray(e);
|
|
309
|
-
if (
|
|
310
|
-
return
|
|
309
|
+
if (at(s, n, e, r))
|
|
310
|
+
return X(() => e = Y(t, s, e, i, !0)), () => e;
|
|
311
311
|
if (s.length === 0) {
|
|
312
|
-
if (e =
|
|
313
|
-
} else a ? e.length === 0 ?
|
|
312
|
+
if (e = R(t, e, i), l) return e;
|
|
313
|
+
} else a ? e.length === 0 ? gt(t, s, i) : Wt(t, e, s) : (e && R(t), gt(t, s));
|
|
314
314
|
e = s;
|
|
315
315
|
} else if (n.nodeType) {
|
|
316
316
|
if (Array.isArray(e)) {
|
|
317
|
-
if (l) return e =
|
|
318
|
-
|
|
317
|
+
if (l) return e = R(t, e, i, n);
|
|
318
|
+
R(t, e, null, n);
|
|
319
319
|
} else e == null || e === "" || !t.firstChild ? t.appendChild(n) : t.replaceChild(n, t.firstChild);
|
|
320
320
|
e = n;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
return e;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function at(t, n, e, i) {
|
|
326
326
|
let r = !1;
|
|
327
327
|
for (let o = 0, l = n.length; o < l; o++) {
|
|
328
328
|
let s = n[o], a = e && e[t.length], g;
|
|
329
329
|
if (!(s == null || s === !0 || s === !1)) if ((g = typeof s) == "object" && s.nodeType)
|
|
330
330
|
t.push(s);
|
|
331
331
|
else if (Array.isArray(s))
|
|
332
|
-
r =
|
|
332
|
+
r = at(t, s, a) || r;
|
|
333
333
|
else if (g === "function")
|
|
334
334
|
if (i) {
|
|
335
335
|
for (; typeof s == "function"; ) s = s();
|
|
336
|
-
r =
|
|
336
|
+
r = at(t, Array.isArray(s) ? s : [s], Array.isArray(a) ? a : [a]) || r;
|
|
337
337
|
} else
|
|
338
338
|
t.push(s), r = !0;
|
|
339
339
|
else {
|
|
@@ -343,10 +343,10 @@ function st(t, n, e, i) {
|
|
|
343
343
|
}
|
|
344
344
|
return r;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function gt(t, n, e = null) {
|
|
347
347
|
for (let i = 0, r = n.length; i < r; i++) t.insertBefore(n[i], e);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function R(t, n, e, i) {
|
|
350
350
|
if (e === void 0) return t.textContent = "";
|
|
351
351
|
const r = i || document.createTextNode("");
|
|
352
352
|
if (n.length) {
|
|
@@ -361,34 +361,34 @@ function $(t, n, e, i) {
|
|
|
361
361
|
} else t.insertBefore(r, e);
|
|
362
362
|
return [r];
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function Ht(t) {
|
|
365
365
|
return Object.keys(t).reduce((e, i) => {
|
|
366
366
|
const r = t[i];
|
|
367
|
-
return e[i] = Object.assign({}, r),
|
|
367
|
+
return e[i] = Object.assign({}, r), Pt(r.value) && !Zt(r.value) && !Array.isArray(r.value) && (e[i].value = Object.assign({}, r.value)), Array.isArray(r.value) && (e[i].value = r.value.slice(0)), e;
|
|
368
368
|
}, {});
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function qt(t) {
|
|
371
371
|
return t ? Object.keys(t).reduce((e, i) => {
|
|
372
372
|
const r = t[i];
|
|
373
|
-
return e[i] =
|
|
373
|
+
return e[i] = Pt(r) && "value" in r ? r : {
|
|
374
374
|
value: r
|
|
375
|
-
}, e[i].attribute || (e[i].attribute =
|
|
375
|
+
}, e[i].attribute || (e[i].attribute = Xt(i)), e[i].parse = "parse" in e[i] ? e[i].parse : typeof e[i].value != "string", e;
|
|
376
376
|
}, {}) : {};
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function Jt(t) {
|
|
379
379
|
return Object.keys(t).reduce((e, i) => (e[i] = t[i].value, e), {});
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
const e =
|
|
381
|
+
function Gt(t, n) {
|
|
382
|
+
const e = Ht(n);
|
|
383
383
|
return Object.keys(n).forEach((r) => {
|
|
384
384
|
const o = e[r], l = t.getAttribute(o.attribute), s = t[r];
|
|
385
|
-
l != null && (o.value = o.parse ?
|
|
385
|
+
l != null && (o.value = o.parse ? Tt(l) : l), s != null && (o.value = Array.isArray(s) ? s.slice(0) : s), o.reflect && bt(t, o.attribute, o.value, !!o.parse), Object.defineProperty(t, r, {
|
|
386
386
|
get() {
|
|
387
387
|
return o.value;
|
|
388
388
|
},
|
|
389
389
|
set(a) {
|
|
390
390
|
const g = o.value;
|
|
391
|
-
o.value = a, o.reflect &&
|
|
391
|
+
o.value = a, o.reflect && bt(this, o.attribute, o.value, !!o.parse);
|
|
392
392
|
for (let f = 0, d = this.__propertyChangedCallbacks.length; f < d; f++)
|
|
393
393
|
this.__propertyChangedCallbacks[f](r, a, g);
|
|
394
394
|
},
|
|
@@ -397,7 +397,7 @@ function qt(t, n) {
|
|
|
397
397
|
});
|
|
398
398
|
}), e;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Tt(t) {
|
|
401
401
|
if (t)
|
|
402
402
|
try {
|
|
403
403
|
return JSON.parse(t);
|
|
@@ -405,25 +405,25 @@ function St(t) {
|
|
|
405
405
|
return t;
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function bt(t, n, e, i) {
|
|
409
409
|
if (e == null || e === !1) return t.removeAttribute(n);
|
|
410
410
|
let r = i ? JSON.stringify(e) : e;
|
|
411
411
|
t.__updating[n] = !0, r === "true" && (r = ""), t.setAttribute(n, r), Promise.resolve().then(() => delete t.__updating[n]);
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function Xt(t) {
|
|
414
414
|
return t.replace(/\.?([A-Z]+)/g, (n, e) => "-" + e.toLowerCase()).replace("_", "-").replace(/^-/, "");
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function Pt(t) {
|
|
417
417
|
return t != null && (typeof t == "object" || typeof t == "function");
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function Zt(t) {
|
|
420
420
|
return Object.prototype.toString.call(t) === "[object Function]";
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function Qt(t) {
|
|
423
423
|
return typeof t == "function" && t.toString().indexOf("class") === 0;
|
|
424
424
|
}
|
|
425
|
-
let
|
|
426
|
-
function
|
|
425
|
+
let ot;
|
|
426
|
+
function Yt(t, n) {
|
|
427
427
|
const e = Object.keys(n);
|
|
428
428
|
return class extends t {
|
|
429
429
|
static get observedAttributes() {
|
|
@@ -436,16 +436,16 @@ function Xt(t, n) {
|
|
|
436
436
|
}
|
|
437
437
|
connectedCallback() {
|
|
438
438
|
if (this.__initialized) return;
|
|
439
|
-
this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props =
|
|
440
|
-
const r =
|
|
439
|
+
this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props = Gt(this, n);
|
|
440
|
+
const r = Jt(this.props), o = this.Component, l = ot;
|
|
441
441
|
try {
|
|
442
|
-
|
|
442
|
+
ot = this, this.__initialized = !0, Qt(o) ? new o(r, {
|
|
443
443
|
element: this
|
|
444
444
|
}) : o(r, {
|
|
445
445
|
element: this
|
|
446
446
|
});
|
|
447
447
|
} finally {
|
|
448
|
-
|
|
448
|
+
ot = l;
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
async disconnectedCallback() {
|
|
@@ -458,7 +458,7 @@ function Xt(t, n) {
|
|
|
458
458
|
attributeChangedCallback(r, o, l) {
|
|
459
459
|
if (this.__initialized && !this.__updating[r] && (r = this.lookupProp(r), r in n)) {
|
|
460
460
|
if (l == null && !this[r]) return;
|
|
461
|
-
this[r] = n[r].parse ?
|
|
461
|
+
this[r] = n[r].parse ? Tt(l) : l;
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
lookupProp(r) {
|
|
@@ -478,7 +478,7 @@ function Xt(t, n) {
|
|
|
478
478
|
}
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function te(t, n = {}, e = {}) {
|
|
482
482
|
const {
|
|
483
483
|
BaseElement: i = HTMLElement,
|
|
484
484
|
extension: r,
|
|
@@ -486,13 +486,13 @@ function Zt(t, n = {}, e = {}) {
|
|
|
486
486
|
} = e;
|
|
487
487
|
return (l) => {
|
|
488
488
|
let s = o.get(t);
|
|
489
|
-
return s ? (s.prototype.Component = l, s) : (s =
|
|
489
|
+
return s ? (s.prototype.Component = l, s) : (s = Yt(i, qt(n)), s.prototype.Component = l, s.prototype.registeredTag = t, o.define(t, s, r), s);
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function ee(t) {
|
|
493
493
|
const n = Object.keys(t), e = {};
|
|
494
494
|
for (let i = 0; i < n.length; i++) {
|
|
495
|
-
const [r, o] =
|
|
495
|
+
const [r, o] = Ct(t[n[i]]);
|
|
496
496
|
Object.defineProperty(e, n[i], {
|
|
497
497
|
get: r,
|
|
498
498
|
set(l) {
|
|
@@ -502,30 +502,30 @@ function Qt(t) {
|
|
|
502
502
|
}
|
|
503
503
|
return e;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function ne(t) {
|
|
506
506
|
if (t.assignedSlot && t.assignedSlot._$owner) return t.assignedSlot._$owner;
|
|
507
507
|
let n = t.parentNode;
|
|
508
508
|
for (; n && !n._$owner && !(n.assignedSlot && n.assignedSlot._$owner); )
|
|
509
509
|
n = n.parentNode;
|
|
510
510
|
return n && n.assignedSlot ? n.assignedSlot._$owner : t._$owner;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function re(t) {
|
|
513
513
|
return (n, e) => {
|
|
514
514
|
const { element: i } = e;
|
|
515
|
-
return
|
|
516
|
-
const o =
|
|
515
|
+
return Dt((r) => {
|
|
516
|
+
const o = ee(n);
|
|
517
517
|
i.addPropertyChangedCallback((s, a) => o[s] = a), i.addReleaseCallback(() => {
|
|
518
518
|
i.renderRoot.textContent = "", r();
|
|
519
519
|
});
|
|
520
520
|
const l = t(o, e);
|
|
521
|
-
return
|
|
522
|
-
},
|
|
521
|
+
return P(i.renderRoot, l);
|
|
522
|
+
}, ne(i));
|
|
523
523
|
};
|
|
524
524
|
}
|
|
525
|
-
function
|
|
526
|
-
return arguments.length === 2 && (e = n, n = {}),
|
|
525
|
+
function ie(t, n, e) {
|
|
526
|
+
return arguments.length === 2 && (e = n, n = {}), te(t, n)(re(e));
|
|
527
527
|
}
|
|
528
|
-
const
|
|
528
|
+
const se = `
|
|
529
529
|
:host([theme="dark"]) {
|
|
530
530
|
color-scheme: only dark;
|
|
531
531
|
}
|
|
@@ -583,73 +583,103 @@ const ne = `
|
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
`;
|
|
586
|
-
var
|
|
587
|
-
console.debug("[dictate-button] version:", "2.1.
|
|
588
|
-
const
|
|
589
|
-
customElements.get("dictate-button") ? console.debug("[dictate-button] We don't require importing the dictate-button component separately anymore, so you may remove the script tag which imports https://cdn.dictate-button.io/dictate-button.js from the HTML head.") :
|
|
586
|
+
var oe = /* @__PURE__ */ z('<div part=container class=dictate-button__container><style></style><div aria-live=polite class=dictate-button__status-announcer style="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0"></div><button part=button class=dictate-button__button>'), le = /* @__PURE__ */ z('<svg part=icon class="dictate-button__icon dictate-button__icon--idle"fill=none viewBox="0 0 24 24"stroke-width=1.5 stroke=currentColor role=img aria-hidden=true><path stroke-linecap=round stroke-linejoin=round d="M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z">'), ae = /* @__PURE__ */ z('<svg part=icon class="dictate-button__icon dictate-button__icon--recording"viewBox="0 0 24 24"fill=currentColor role=img aria-hidden=true><circle cx=12 cy=12 r=10>'), ce = /* @__PURE__ */ z('<svg part=icon class="dictate-button__icon dictate-button__icon--error"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=4 stroke-linecap=round stroke-linejoin=round role=img aria-hidden=true><line x1=12 x2=12 y1=4 y2=14></line><line x1=12 x2=12.01 y1=20 y2=20>'), ue = /* @__PURE__ */ z('<svg part=icon class="dictate-button__icon dictate-button__icon--processing"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round role=img aria-hidden=true><path d="M12 2v4"></path><path d="M12 18v4"></path><path d="M4.93 4.93l2.83 2.83"></path><path d="M16.24 16.24l2.83 2.83"></path><path d="M2 12h4"></path><path d="M18 12h4"></path><path d="M4.93 19.07l2.83-2.83"></path><path d="M16.24 7.76l2.83-2.83">');
|
|
587
|
+
console.debug("[dictate-button] version:", "2.1.1");
|
|
588
|
+
const fe = "wss://api.dictate-button.io/v2/transcribe", A = "dictate-button.io", lt = -70, yt = -10, _t = 0, de = 4, pe = 0.25, he = 0.05;
|
|
589
|
+
customElements.get("dictate-button") ? console.debug("[dictate-button] We don't require importing the dictate-button component separately anymore, so you may remove the script tag which imports https://cdn.dictate-button.io/dictate-button.js from the HTML head.") : ie("dictate-button", {
|
|
590
590
|
size: 30,
|
|
591
|
-
apiEndpoint:
|
|
591
|
+
apiEndpoint: fe,
|
|
592
592
|
language: "en"
|
|
593
593
|
}, (t, {
|
|
594
594
|
element: n
|
|
595
595
|
}) => {
|
|
596
596
|
console.debug("[dictate-button] api:", t.apiEndpoint);
|
|
597
|
-
const [e, i] =
|
|
598
|
-
let r = null, o = null, l = null, s = "", a = "", g = -1, f = "", d = null, m = null, c = null,
|
|
599
|
-
const
|
|
597
|
+
const [e, i] = Ct("idle");
|
|
598
|
+
let r = null, o = null, l = null, s = "", a = "", g = -1, f = "", d = null, m = null, c = null, T = null, F = !1, O = 0;
|
|
599
|
+
const Lt = (u) => u <= lt ? 0 : u >= yt ? 1 : (u - lt) / (yt - lt), Mt = (u) => {
|
|
600
600
|
let _ = 0;
|
|
601
|
-
for (let
|
|
602
|
-
const
|
|
603
|
-
_ +=
|
|
601
|
+
for (let v = 0; v < u.length; v++) {
|
|
602
|
+
const h = (u[v] - 128) / 128;
|
|
603
|
+
_ += h * h;
|
|
604
604
|
}
|
|
605
605
|
return Math.sqrt(_ / u.length);
|
|
606
|
-
},
|
|
606
|
+
}, Rt = (u) => 20 * Math.log10(Math.max(u, 1e-8)), ut = (u) => {
|
|
607
607
|
const _ = n.shadowRoot.querySelector(".dictate-button__button");
|
|
608
608
|
if (!_)
|
|
609
609
|
return;
|
|
610
|
-
const
|
|
611
|
-
_.style.boxShadow = `0 0 0 ${
|
|
612
|
-
},
|
|
613
|
-
if (!
|
|
614
|
-
m.getByteTimeDomainData(
|
|
615
|
-
const u =
|
|
616
|
-
|
|
617
|
-
},
|
|
618
|
-
r && (r.close(), r = null), c && (c.disconnect(), c = null), o && (o.getTracks().forEach((u) => u.stop()), o = null), l = null, s = "", a = "", g = -1, f = "",
|
|
610
|
+
const v = _t + u * (de - _t), h = 0 + u * 0.4;
|
|
611
|
+
_.style.boxShadow = `0 0 0 ${v}px light-dark(rgba(0, 0, 0, ${h}), rgba(255, 255, 255, ${h}))`;
|
|
612
|
+
}, ft = () => {
|
|
613
|
+
if (!F || !m || !T) return;
|
|
614
|
+
m.getByteTimeDomainData(T);
|
|
615
|
+
const u = Mt(T), _ = Rt(u), v = Lt(_), h = v > O ? pe : he;
|
|
616
|
+
O = h * v + (1 - h) * O, ut(O), requestAnimationFrame(ft);
|
|
617
|
+
}, L = () => {
|
|
618
|
+
r && (r.close(), r = null), c && (c.disconnect(), c = null), o && (o.getTracks().forEach((u) => u.stop()), o = null), l = null, s = "", a = "", g = -1, f = "", F = !1, d && d.state !== "closed" && d.close(), d = null, m = null, T = null, O = 0, ut(0);
|
|
619
619
|
};
|
|
620
|
-
n.addEventListener("disconnected",
|
|
621
|
-
const
|
|
622
|
-
document.visibilityState === "hidden" && e() === "transcribing" &&
|
|
620
|
+
n.addEventListener("disconnected", L);
|
|
621
|
+
const dt = () => {
|
|
622
|
+
document.visibilityState === "hidden" && e() === "transcribing" && nt();
|
|
623
623
|
};
|
|
624
|
-
document.addEventListener("visibilitychange",
|
|
625
|
-
document.removeEventListener("visibilitychange",
|
|
624
|
+
document.addEventListener("visibilitychange", dt), ht(() => {
|
|
625
|
+
document.removeEventListener("visibilitychange", dt);
|
|
626
626
|
});
|
|
627
|
-
const
|
|
627
|
+
const pt = async (u) => {
|
|
628
628
|
if (e() === "idle") {
|
|
629
629
|
l = u, s = "", a = "", g = -1, f = "";
|
|
630
630
|
try {
|
|
631
631
|
const _ = await navigator.mediaDevices.getUserMedia({
|
|
632
632
|
audio: {
|
|
633
|
-
sampleRate:
|
|
633
|
+
sampleRate: {
|
|
634
|
+
ideal: 16e3
|
|
635
|
+
},
|
|
634
636
|
channelCount: 1,
|
|
635
637
|
echoCancellation: !0,
|
|
636
638
|
noiseSuppression: !0
|
|
637
639
|
}
|
|
638
640
|
});
|
|
639
|
-
o = _
|
|
640
|
-
|
|
641
|
+
o = _;
|
|
642
|
+
const $ = _.getAudioTracks()[0].getSettings().sampleRate || 48e3;
|
|
643
|
+
d = new (window.AudioContext || window.webkitAudioContext)({
|
|
644
|
+
sampleRate: $
|
|
641
645
|
});
|
|
642
|
-
const
|
|
643
|
-
m = d.createAnalyser(), m.fftSize = 2048,
|
|
644
|
-
const
|
|
646
|
+
const p = d.createMediaStreamSource(_);
|
|
647
|
+
m = d.createAnalyser(), m.fftSize = 2048, p.connect(m), T = new Uint8Array(m.fftSize);
|
|
648
|
+
const it = `
|
|
645
649
|
class PcmProcessor extends AudioWorkletProcessor {
|
|
650
|
+
constructor(options) {
|
|
651
|
+
super()
|
|
652
|
+
this.inputSampleRate = options.processorOptions.inputSampleRate
|
|
653
|
+
this.outputSampleRate = 16000
|
|
654
|
+
this.ratio = this.inputSampleRate / this.outputSampleRate
|
|
655
|
+
this.buffer = []
|
|
656
|
+
this.bufferIndex = 0
|
|
657
|
+
}
|
|
658
|
+
|
|
646
659
|
process(inputs) {
|
|
647
660
|
const input = inputs[0]
|
|
648
661
|
if (input.length > 0) {
|
|
649
662
|
const channelData = input[0]
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
663
|
+
|
|
664
|
+
// Resample to 16kHz if needed
|
|
665
|
+
let resampledData
|
|
666
|
+
if (this.ratio === 1) {
|
|
667
|
+
// No resampling needed
|
|
668
|
+
resampledData = channelData
|
|
669
|
+
} else {
|
|
670
|
+
// Simple decimation for downsampling
|
|
671
|
+
const outputLength = Math.floor(channelData.length / this.ratio)
|
|
672
|
+
resampledData = new Float32Array(outputLength)
|
|
673
|
+
for (let i = 0; i < outputLength; i++) {
|
|
674
|
+
const srcIndex = Math.floor(i * this.ratio)
|
|
675
|
+
resampledData[i] = channelData[srcIndex]
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// Convert to PCM16
|
|
680
|
+
const pcm16 = new Int16Array(resampledData.length)
|
|
681
|
+
for (let i = 0; i < resampledData.length; i++) {
|
|
682
|
+
const s = Math.max(-1, Math.min(1, resampledData[i]))
|
|
653
683
|
pcm16[i] = s < 0 ? s * 0x8000 : s * 0x7fff
|
|
654
684
|
}
|
|
655
685
|
this.port.postMessage(pcm16.buffer, [pcm16.buffer])
|
|
@@ -658,87 +688,91 @@ customElements.get("dictate-button") ? console.debug("[dictate-button] We don't
|
|
|
658
688
|
}
|
|
659
689
|
}
|
|
660
690
|
registerProcessor('pcm-processor', PcmProcessor)
|
|
661
|
-
`,
|
|
691
|
+
`, K = new Blob([it], {
|
|
662
692
|
type: "application/javascript"
|
|
663
|
-
}),
|
|
664
|
-
await d.audioWorklet.addModule(
|
|
665
|
-
|
|
666
|
-
|
|
693
|
+
}), N = URL.createObjectURL(K);
|
|
694
|
+
await d.audioWorklet.addModule(N), URL.revokeObjectURL(N), c = new AudioWorkletNode(d, "pcm-processor", {
|
|
695
|
+
processorOptions: {
|
|
696
|
+
inputSampleRate: $
|
|
697
|
+
}
|
|
698
|
+
}), p.connect(c);
|
|
699
|
+
const D = new URL(t.apiEndpoint);
|
|
700
|
+
t.language && D.searchParams.set("language", t.language), r = new WebSocket(D.toString()), r.onmessage = (x) => {
|
|
667
701
|
try {
|
|
668
|
-
const
|
|
669
|
-
if (
|
|
670
|
-
f =
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
} else if (
|
|
674
|
-
const
|
|
675
|
-
f = "",
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
} else
|
|
679
|
-
} catch (
|
|
680
|
-
console.error("[dictate-button] Error parsing message:",
|
|
702
|
+
const C = JSON.parse(x.data);
|
|
703
|
+
if (C.type === "interim_transcript" && C.text) {
|
|
704
|
+
f = C.text;
|
|
705
|
+
const V = [a, s, f].filter(Boolean).join(" ");
|
|
706
|
+
E(n, "dictate-text", V);
|
|
707
|
+
} else if (C.type === "transcript" && C.text) {
|
|
708
|
+
const V = C.turn_order ?? 0, M = C.text;
|
|
709
|
+
f = "", V > g ? (s && (a = a ? a + " " + s : s), g = V, s = M) : M.length > s.length && M.startsWith(s.substring(0, Math.min(10, s.length))) ? s = M : s = s ? s + " " + M : M;
|
|
710
|
+
const Ot = a ? a + " " + s : s;
|
|
711
|
+
E(n, "dictate-text", Ot);
|
|
712
|
+
} else C.type === "error" && (console.error("[dictate-button] Server error:", C.error), E(n, "dictate-error", C.error), rt(), L());
|
|
713
|
+
} catch (C) {
|
|
714
|
+
console.error("[dictate-button] Error parsing message:", C);
|
|
681
715
|
}
|
|
682
|
-
}, r.onerror = (
|
|
683
|
-
console.error("[dictate-button] WebSocket error:",
|
|
716
|
+
}, r.onerror = (x) => {
|
|
717
|
+
console.error("[dictate-button] WebSocket error:", x), E(n, "dictate-error", "Connection error"), rt(), L();
|
|
684
718
|
}, r.onclose = () => {
|
|
685
|
-
}, c.port.onmessage = (
|
|
686
|
-
r && r.readyState === WebSocket.OPEN && r.send(
|
|
687
|
-
},
|
|
719
|
+
}, c.port.onmessage = (x) => {
|
|
720
|
+
r && r.readyState === WebSocket.OPEN && r.send(x.data);
|
|
721
|
+
}, E(n, "dictate-start", "Started transcribing"), F = !0, ft(), i("transcribing");
|
|
688
722
|
} catch (_) {
|
|
689
|
-
console.error("[dictate-button] Failed to start:", _),
|
|
723
|
+
console.error("[dictate-button] Failed to start:", _), E(n, "dictate-error", "Failed to start transcription"), rt(), L();
|
|
690
724
|
}
|
|
691
725
|
}
|
|
692
|
-
},
|
|
726
|
+
}, nt = () => {
|
|
693
727
|
if (e() === "transcribing")
|
|
694
|
-
if (
|
|
728
|
+
if (F = !1, i("finalizing"), r && r.readyState === WebSocket.OPEN)
|
|
695
729
|
r.send(JSON.stringify({
|
|
696
730
|
type: "close"
|
|
697
731
|
})), setTimeout(() => {
|
|
698
732
|
const u = a ? a + (s ? " " + s : "") : s;
|
|
699
|
-
u &&
|
|
733
|
+
u && E(n, "dictate-end", u), L(), i("idle");
|
|
700
734
|
}, 500);
|
|
701
735
|
else {
|
|
702
736
|
const u = a ? a + (s ? " " + s : "") : s;
|
|
703
|
-
u &&
|
|
737
|
+
u && E(n, "dictate-end", u), L(), i("idle");
|
|
704
738
|
}
|
|
705
|
-
},
|
|
739
|
+
}, rt = () => {
|
|
706
740
|
i("error"), setTimeout(() => i("idle"), 2e3);
|
|
707
741
|
};
|
|
708
|
-
let
|
|
709
|
-
return
|
|
710
|
-
if (!
|
|
711
|
-
const u =
|
|
742
|
+
let W;
|
|
743
|
+
return It(() => {
|
|
744
|
+
if (!W) return;
|
|
745
|
+
const u = me(W, {
|
|
712
746
|
onShortTap: () => {
|
|
713
|
-
e() === "idle" ?
|
|
747
|
+
e() === "idle" ? pt("short-tap") : e() === "transcribing" && l === "short-tap" && nt();
|
|
714
748
|
},
|
|
715
749
|
onLongPressStart: () => {
|
|
716
|
-
e() === "idle" &&
|
|
750
|
+
e() === "idle" && pt("long-press");
|
|
717
751
|
},
|
|
718
752
|
onLongPressEnd: () => {
|
|
719
|
-
e() === "transcribing" && l === "long-press" &&
|
|
753
|
+
e() === "transcribing" && l === "long-press" && nt();
|
|
720
754
|
}
|
|
721
755
|
});
|
|
722
|
-
|
|
756
|
+
ht(u);
|
|
723
757
|
}), (() => {
|
|
724
|
-
var u =
|
|
725
|
-
|
|
726
|
-
var
|
|
727
|
-
return typeof
|
|
728
|
-
var
|
|
729
|
-
return () =>
|
|
730
|
-
})(), null),
|
|
731
|
-
var
|
|
732
|
-
return () =>
|
|
733
|
-
})(), null),
|
|
734
|
-
var
|
|
735
|
-
return () =>
|
|
736
|
-
})(), null),
|
|
737
|
-
var
|
|
738
|
-
return () =>
|
|
739
|
-
})(), null),
|
|
740
|
-
var
|
|
741
|
-
return
|
|
758
|
+
var u = oe(), _ = u.firstChild, v = _.nextSibling, h = v.nextSibling;
|
|
759
|
+
P(_, se), P(v, () => wt(e()));
|
|
760
|
+
var $ = W;
|
|
761
|
+
return typeof $ == "function" ? Vt($, h) : W = h, P(h, (() => {
|
|
762
|
+
var p = q(() => e() === "idle");
|
|
763
|
+
return () => p() && H(be, {});
|
|
764
|
+
})(), null), P(h, (() => {
|
|
765
|
+
var p = q(() => e() === "transcribing");
|
|
766
|
+
return () => p() && H(ye, {});
|
|
767
|
+
})(), null), P(h, (() => {
|
|
768
|
+
var p = q(() => e() === "finalizing");
|
|
769
|
+
return () => p() && H(we, {});
|
|
770
|
+
})(), null), P(h, (() => {
|
|
771
|
+
var p = q(() => e() === "error");
|
|
772
|
+
return () => p() && H(_e, {});
|
|
773
|
+
})(), null), X((p) => {
|
|
774
|
+
var it = `width:${t.size}px;height:${t.size}px"`, K = ge(e()), N = wt(e()), D = e() === "transcribing", x = e() === "transcribing" || e() === "finalizing";
|
|
775
|
+
return p.e = Kt(h, it, p.e), K !== p.t && I(h, "title", p.t = K), N !== p.a && I(h, "aria-label", p.a = N), D !== p.o && I(h, "aria-pressed", p.o = D), x !== p.i && I(h, "aria-busy", p.i = x), p;
|
|
742
776
|
}, {
|
|
743
777
|
e: void 0,
|
|
744
778
|
t: void 0,
|
|
@@ -748,36 +782,36 @@ customElements.get("dictate-button") ? console.debug("[dictate-button] We don't
|
|
|
748
782
|
}), u;
|
|
749
783
|
})();
|
|
750
784
|
});
|
|
751
|
-
const
|
|
785
|
+
const ge = (t) => {
|
|
752
786
|
switch (t) {
|
|
753
787
|
case "idle":
|
|
754
|
-
return `Start dictation (${
|
|
788
|
+
return `Start dictation (${A})`;
|
|
755
789
|
case "transcribing":
|
|
756
|
-
return `Stop dictation (${
|
|
790
|
+
return `Stop dictation (${A})`;
|
|
757
791
|
case "finalizing":
|
|
758
|
-
return `Finalizing dictation (${
|
|
792
|
+
return `Finalizing dictation (${A})`;
|
|
759
793
|
case "error":
|
|
760
|
-
return `Click to reset (${
|
|
794
|
+
return `Click to reset (${A})`;
|
|
761
795
|
}
|
|
762
|
-
},
|
|
796
|
+
}, wt = (t) => {
|
|
763
797
|
switch (t) {
|
|
764
798
|
case "idle":
|
|
765
|
-
return `Start dictation (${
|
|
799
|
+
return `Start dictation (${A})`;
|
|
766
800
|
case "transcribing":
|
|
767
|
-
return `Transcribing. Click to stop (${
|
|
801
|
+
return `Transcribing. Click to stop (${A})`;
|
|
768
802
|
case "finalizing":
|
|
769
|
-
return `Finalizing dictation. Please wait (${
|
|
803
|
+
return `Finalizing dictation. Please wait (${A})`;
|
|
770
804
|
case "error":
|
|
771
|
-
return `Dictation error. Click to reset (${
|
|
805
|
+
return `Dictation error. Click to reset (${A})`;
|
|
772
806
|
}
|
|
773
|
-
},
|
|
807
|
+
}, E = (t, n, e) => {
|
|
774
808
|
t.dispatchEvent(new CustomEvent(n, {
|
|
775
809
|
detail: e,
|
|
776
810
|
bubbles: !0,
|
|
777
811
|
composed: !0
|
|
778
812
|
}));
|
|
779
|
-
},
|
|
780
|
-
function
|
|
813
|
+
}, be = () => le(), ye = () => ae(), _e = () => ce(), we = () => ue();
|
|
814
|
+
function me(t, {
|
|
781
815
|
threshold: n = 500,
|
|
782
816
|
preventScroll: e = !0,
|
|
783
817
|
onShortTap: i,
|