@untemps/react-vocal 2.0.0-beta.2 → 2.0.0-beta.4
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/CHANGELOG.md +14 -0
- package/README.md +18 -17
- package/dev/src/index.jsx +39 -26
- package/dist/index.es.js +318 -286
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Vocal.jsx +35 -8
- package/src/components/__tests__/Vocal.test.jsx +181 -0
- package/src/hooks/__tests__/useCommands.test.js +25 -0
- package/src/hooks/__tests__/useVocal.test.js +6 -1
- package/src/hooks/useCommands.js +34 -6
- package/src/hooks/useVocal.js +3 -3
- package/vitest.setup.js +6 -3
package/dist/index.es.js
CHANGED
|
@@ -427,7 +427,7 @@ function D(e, t) {
|
|
|
427
427
|
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
428
428
|
return r;
|
|
429
429
|
}
|
|
430
|
-
var
|
|
430
|
+
var O = function() {
|
|
431
431
|
var e = T(regeneratorRuntime.mark((function e(t) {
|
|
432
432
|
return regeneratorRuntime.wrap((function(e) {
|
|
433
433
|
for (;;) switch (e.prev = e.next) {
|
|
@@ -439,8 +439,8 @@ var ee = function() {
|
|
|
439
439
|
case 0: return S() || r(new DOMException("Navigator API: permissions not supported", "NOT_SUPPORTED_ERR")), e.prev = 1, e.next = 4, navigator.permissions.query({ name: t });
|
|
440
440
|
case 4:
|
|
441
441
|
i = e.sent, a = function e(t) {
|
|
442
|
-
i.removeEventListener("change", e),
|
|
443
|
-
}, i.addEventListener("change", a),
|
|
442
|
+
i.removeEventListener("change", e), k(t.target.state, n, r);
|
|
443
|
+
}, i.addEventListener("change", a), k(i.state, n, r), e.next = 13;
|
|
444
444
|
break;
|
|
445
445
|
case 10: e.prev = 10, e.t0 = e.catch(1), r(e.t0);
|
|
446
446
|
case 13:
|
|
@@ -460,14 +460,14 @@ var ee = function() {
|
|
|
460
460
|
return function(t) {
|
|
461
461
|
return e.apply(this, arguments);
|
|
462
462
|
};
|
|
463
|
-
}(),
|
|
463
|
+
}(), k = function(e, t, n) {
|
|
464
464
|
switch (e) {
|
|
465
465
|
case "denied":
|
|
466
466
|
n(new DOMException("Permission denied", "NOT_ALLOWED_ERR"));
|
|
467
467
|
break;
|
|
468
468
|
default: t(e);
|
|
469
469
|
}
|
|
470
|
-
},
|
|
470
|
+
}, A = function() {
|
|
471
471
|
var e = T(regeneratorRuntime.mark((function e(t, n) {
|
|
472
472
|
return regeneratorRuntime.wrap((function(e) {
|
|
473
473
|
for (;;) switch (e.prev = e.next) {
|
|
@@ -476,7 +476,7 @@ var ee = function() {
|
|
|
476
476
|
var a, o, s;
|
|
477
477
|
return regeneratorRuntime.wrap((function(e) {
|
|
478
478
|
for (;;) switch (e.prev = e.next) {
|
|
479
|
-
case 0: return S() && C() || i(new DOMException("Navigator API: permissions or Navigator API: mediaDevices not supported", "NOT_SUPPORTED_ERR")), e.prev = 1, e.t0 = Promise, e.next = 5,
|
|
479
|
+
case 0: return S() && C() || i(new DOMException("Navigator API: permissions or Navigator API: mediaDevices not supported", "NOT_SUPPORTED_ERR")), e.prev = 1, e.t0 = Promise, e.next = 5, O(t);
|
|
480
480
|
case 5: return e.t1 = e.sent, e.next = 8, navigator.mediaDevices.getUserMedia(n);
|
|
481
481
|
case 8: return e.t2 = e.sent, e.t3 = [e.t1, e.t2], e.next = 12, e.t0.all.call(e.t0, e.t3);
|
|
482
482
|
case 12:
|
|
@@ -501,7 +501,7 @@ var ee = function() {
|
|
|
501
501
|
return e.apply(this, arguments);
|
|
502
502
|
};
|
|
503
503
|
}();
|
|
504
|
-
function
|
|
504
|
+
function j(e, t) {
|
|
505
505
|
var n = Object.keys(e);
|
|
506
506
|
if (Object.getOwnPropertySymbols) {
|
|
507
507
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -511,24 +511,24 @@ function A(e, t) {
|
|
|
511
511
|
}
|
|
512
512
|
return n;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function M(e) {
|
|
515
515
|
for (var t = 1; t < arguments.length; t++) {
|
|
516
516
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
517
|
-
t % 2 ?
|
|
517
|
+
t % 2 ? j(Object(n), !0).forEach((function(t) {
|
|
518
518
|
x(e, t, n[t]);
|
|
519
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
519
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : j(Object(n)).forEach((function(t) {
|
|
520
520
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
521
521
|
}));
|
|
522
522
|
}
|
|
523
523
|
return e;
|
|
524
524
|
}
|
|
525
|
-
var
|
|
525
|
+
var N = function() {
|
|
526
526
|
function e(t) {
|
|
527
527
|
var n = this;
|
|
528
528
|
v(this, e), x(this, "_instance", null), x(this, "_listeners", null);
|
|
529
529
|
var r = e._resolveSpeechRecognition();
|
|
530
530
|
if (!r) throw new DOMException("SpeechRecognition not supported", "NOT_SUPPORTED_ERR");
|
|
531
|
-
this._instance = new r(), this._listeners = {}, Object.entries(
|
|
531
|
+
this._instance = new r(), this._listeners = {}, Object.entries(M(M({}, e.defaultOptions), t || {})).forEach((function(t) {
|
|
532
532
|
var r = _(t, 2), i = r[0], a = r[1];
|
|
533
533
|
if (i === "grammars" && !a) {
|
|
534
534
|
var o = e._resolveSpeechGrammarList();
|
|
@@ -558,7 +558,7 @@ var M = function() {
|
|
|
558
558
|
e.next = 14;
|
|
559
559
|
break;
|
|
560
560
|
}
|
|
561
|
-
return e.prev = 1, e.next = 4,
|
|
561
|
+
return e.prev = 1, e.next = 4, A("microphone", { audio: !0 });
|
|
562
562
|
case 4:
|
|
563
563
|
if (e.sent) {
|
|
564
564
|
e.next = 7;
|
|
@@ -650,14 +650,14 @@ var M = function() {
|
|
|
650
650
|
}
|
|
651
651
|
}]), e;
|
|
652
652
|
}();
|
|
653
|
-
x(
|
|
653
|
+
x(N, "defaultOptions", {
|
|
654
654
|
grammars: null,
|
|
655
655
|
lang: "en-US",
|
|
656
656
|
continuous: !1,
|
|
657
657
|
interimResults: !1,
|
|
658
658
|
maxAlternatives: 1,
|
|
659
659
|
serviceURI: null
|
|
660
|
-
}), x(
|
|
660
|
+
}), x(N, "eventTypes", {
|
|
661
661
|
AUDIO_END: "audioend",
|
|
662
662
|
AUDIO_START: "audiostart",
|
|
663
663
|
END: "end",
|
|
@@ -672,40 +672,42 @@ x(M, "defaultOptions", {
|
|
|
672
672
|
});
|
|
673
673
|
//#endregion
|
|
674
674
|
//#region node_modules/@untemps/utils/dist/function/isFunction.js
|
|
675
|
-
var
|
|
676
|
-
let
|
|
675
|
+
var ee = (e) => typeof e == "function", P = (e = "en-US", t = null, i = 1, o = null) => {
|
|
676
|
+
let s = a(null);
|
|
677
677
|
return r(() => {
|
|
678
|
-
if (
|
|
678
|
+
if (N.isSupported) return s.current = o || new N({
|
|
679
679
|
lang: e,
|
|
680
|
-
grammars: t
|
|
680
|
+
grammars: t,
|
|
681
|
+
maxAlternatives: i
|
|
681
682
|
}), () => {
|
|
682
|
-
|
|
683
|
+
s.current.abort(), s.current.cleanup();
|
|
683
684
|
};
|
|
684
685
|
}, [
|
|
685
686
|
e,
|
|
686
687
|
t,
|
|
687
|
-
i
|
|
688
|
-
|
|
688
|
+
i,
|
|
689
|
+
o
|
|
690
|
+
]), [s, {
|
|
689
691
|
start: n(() => {
|
|
690
|
-
|
|
692
|
+
s.current && s.current.start();
|
|
691
693
|
}, []),
|
|
692
694
|
stop: n(() => {
|
|
693
|
-
|
|
695
|
+
s.current && s.current.stop();
|
|
694
696
|
}, []),
|
|
695
697
|
abort: n(() => {
|
|
696
|
-
|
|
698
|
+
s.current && s.current.abort();
|
|
697
699
|
}, []),
|
|
698
700
|
subscribe: n((e, t) => {
|
|
699
|
-
|
|
701
|
+
s.current && s.current.addEventListener(e, t);
|
|
700
702
|
}, []),
|
|
701
703
|
unsubscribe: n((e, t) => {
|
|
702
|
-
|
|
704
|
+
s.current && s.current.removeEventListener(e, t);
|
|
703
705
|
}, []),
|
|
704
706
|
clean: n(() => {
|
|
705
|
-
|
|
707
|
+
s.current && s.current.cleanup();
|
|
706
708
|
}, [])
|
|
707
709
|
}];
|
|
708
|
-
},
|
|
710
|
+
}, te = (e, t = 0) => {
|
|
709
711
|
let i = a(-1), o = n(() => {
|
|
710
712
|
clearTimeout(i.current), i.current = -1;
|
|
711
713
|
}, []), s = n(() => {
|
|
@@ -719,48 +721,48 @@ var te = (e) => typeof e == "function", N = (e = "en-US", t = null, i = null) =>
|
|
|
719
721
|
};
|
|
720
722
|
//#endregion
|
|
721
723
|
//#region node_modules/fuse.js/dist/fuse.mjs
|
|
722
|
-
function P(e) {
|
|
723
|
-
return Array.isArray ? Array.isArray(e) : H(e) === "[object Array]";
|
|
724
|
-
}
|
|
725
724
|
function F(e) {
|
|
725
|
+
return Array.isArray ? Array.isArray(e) : W(e) === "[object Array]";
|
|
726
|
+
}
|
|
727
|
+
function I(e) {
|
|
726
728
|
if (typeof e == "string") return e;
|
|
727
729
|
if (typeof e == "bigint") return e.toString();
|
|
728
730
|
let t = e + "";
|
|
729
731
|
return t == "0" && 1 / e == -Infinity ? "-0" : t;
|
|
730
732
|
}
|
|
731
|
-
function I(e) {
|
|
732
|
-
return e == null ? "" : F(e);
|
|
733
|
-
}
|
|
734
733
|
function L(e) {
|
|
735
|
-
return
|
|
734
|
+
return e == null ? "" : I(e);
|
|
736
735
|
}
|
|
737
736
|
function R(e) {
|
|
737
|
+
return typeof e == "string";
|
|
738
|
+
}
|
|
739
|
+
function z(e) {
|
|
738
740
|
return typeof e == "number";
|
|
739
741
|
}
|
|
740
|
-
function
|
|
741
|
-
return e === !0 || e === !1 ||
|
|
742
|
+
function B(e) {
|
|
743
|
+
return e === !0 || e === !1 || ne(e) && W(e) == "[object Boolean]";
|
|
742
744
|
}
|
|
743
|
-
function
|
|
745
|
+
function V(e) {
|
|
744
746
|
return typeof e == "object";
|
|
745
747
|
}
|
|
746
|
-
function
|
|
747
|
-
return
|
|
748
|
+
function ne(e) {
|
|
749
|
+
return V(e) && e !== null;
|
|
748
750
|
}
|
|
749
|
-
function
|
|
751
|
+
function H(e) {
|
|
750
752
|
return e != null;
|
|
751
753
|
}
|
|
752
|
-
function
|
|
754
|
+
function U(e) {
|
|
753
755
|
return !e.trim().length;
|
|
754
756
|
}
|
|
755
|
-
function
|
|
757
|
+
function W(e) {
|
|
756
758
|
return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
|
|
757
759
|
}
|
|
758
|
-
var
|
|
760
|
+
var G = "Incorrect 'index' type", re = (e) => `Invalid value for key ${e}`, K = (e) => `Pattern length exceeds max of ${e}.`, q = (e) => `Missing ${e} property in key`, ie = (e) => `Property 'weight' in key '${e}' must be a positive integer`, ae = Object.prototype.hasOwnProperty, oe = class {
|
|
759
761
|
constructor(e) {
|
|
760
762
|
this._keys = [], this._keyMap = {};
|
|
761
763
|
let t = 0;
|
|
762
764
|
e.forEach((e) => {
|
|
763
|
-
let n =
|
|
765
|
+
let n = se(e);
|
|
764
766
|
this._keys.push(n), this._keyMap[n.id] = n, t += n.weight;
|
|
765
767
|
}), this._keys.forEach((e) => {
|
|
766
768
|
e.weight /= t;
|
|
@@ -776,14 +778,14 @@ var U = "Incorrect 'index' type", W = (e) => `Invalid value for key ${e}`, G = (
|
|
|
776
778
|
return JSON.stringify(this._keys);
|
|
777
779
|
}
|
|
778
780
|
};
|
|
779
|
-
function
|
|
781
|
+
function se(e) {
|
|
780
782
|
let t = null, n = null, r = null, i = 1, a = null;
|
|
781
|
-
if (
|
|
783
|
+
if (R(e) || F(e)) r = e, t = ce(e), n = le(e);
|
|
782
784
|
else {
|
|
783
|
-
if (!
|
|
785
|
+
if (!ae.call(e, "name")) throw Error(q("name"));
|
|
784
786
|
let o = e.name;
|
|
785
|
-
if (r = o,
|
|
786
|
-
t =
|
|
787
|
+
if (r = o, ae.call(e, "weight") && (i = e.weight, i <= 0)) throw Error(ie(o));
|
|
788
|
+
t = ce(o), n = le(o), a = e.getFn;
|
|
787
789
|
}
|
|
788
790
|
return {
|
|
789
791
|
path: t,
|
|
@@ -793,66 +795,66 @@ function le(e) {
|
|
|
793
795
|
getFn: a
|
|
794
796
|
};
|
|
795
797
|
}
|
|
796
|
-
function
|
|
797
|
-
return
|
|
798
|
+
function ce(e) {
|
|
799
|
+
return F(e) ? e : e.split(".");
|
|
798
800
|
}
|
|
799
|
-
function
|
|
800
|
-
return
|
|
801
|
+
function le(e) {
|
|
802
|
+
return F(e) ? e.join(".") : e;
|
|
801
803
|
}
|
|
802
|
-
function
|
|
804
|
+
function ue(e, t) {
|
|
803
805
|
let n = [], r = !1, i = (e, t, a, o) => {
|
|
804
|
-
if (
|
|
806
|
+
if (H(e)) if (!t[a]) n.push(o === void 0 ? e : {
|
|
805
807
|
v: e,
|
|
806
808
|
i: o
|
|
807
809
|
});
|
|
808
810
|
else {
|
|
809
811
|
let s = e[t[a]];
|
|
810
|
-
if (!
|
|
811
|
-
if (a === t.length - 1 && (
|
|
812
|
-
v:
|
|
812
|
+
if (!H(s)) return;
|
|
813
|
+
if (a === t.length - 1 && (R(s) || z(s) || B(s) || typeof s == "bigint")) n.push(o === void 0 ? L(s) : {
|
|
814
|
+
v: L(s),
|
|
813
815
|
i: o
|
|
814
816
|
});
|
|
815
|
-
else if (
|
|
817
|
+
else if (F(s)) {
|
|
816
818
|
r = !0;
|
|
817
819
|
for (let e = 0, n = s.length; e < n; e += 1) i(s[e], t, a + 1, e);
|
|
818
820
|
} else t.length && i(s, t, a + 1, o);
|
|
819
821
|
}
|
|
820
822
|
};
|
|
821
|
-
return i(e,
|
|
823
|
+
return i(e, R(t) ? t.split(".") : t, 0), r ? n : n[0];
|
|
822
824
|
}
|
|
823
|
-
var
|
|
825
|
+
var de = {
|
|
824
826
|
includeMatches: !1,
|
|
825
827
|
findAllMatches: !1,
|
|
826
828
|
minMatchCharLength: 1
|
|
827
|
-
},
|
|
829
|
+
}, fe = {
|
|
828
830
|
isCaseSensitive: !1,
|
|
829
831
|
ignoreDiacritics: !1,
|
|
830
832
|
includeScore: !1,
|
|
831
833
|
keys: [],
|
|
832
834
|
shouldSort: !0,
|
|
833
835
|
sortFn: (e, t) => e.score === t.score ? e.idx < t.idx ? -1 : 1 : e.score < t.score ? -1 : 1
|
|
834
|
-
},
|
|
836
|
+
}, pe = {
|
|
835
837
|
location: 0,
|
|
836
838
|
threshold: .6,
|
|
837
839
|
distance: 100
|
|
838
|
-
},
|
|
840
|
+
}, me = {
|
|
839
841
|
useExtendedSearch: !1,
|
|
840
842
|
useTokenSearch: !1,
|
|
841
|
-
getFn:
|
|
843
|
+
getFn: ue,
|
|
842
844
|
ignoreLocation: !1,
|
|
843
845
|
ignoreFieldNorm: !1,
|
|
844
846
|
fieldNormWeight: 1
|
|
845
|
-
},
|
|
846
|
-
...
|
|
847
|
+
}, J = Object.freeze({
|
|
848
|
+
...fe,
|
|
849
|
+
...de,
|
|
847
850
|
...pe,
|
|
848
|
-
...
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
function ve(e = 1, t = 3) {
|
|
851
|
+
...me
|
|
852
|
+
}), he = /[^ ]+/g;
|
|
853
|
+
function ge(e = 1, t = 3) {
|
|
852
854
|
let n = /* @__PURE__ */ new Map(), r = 10 ** t;
|
|
853
855
|
return {
|
|
854
856
|
get(t) {
|
|
855
|
-
let i = t.match(
|
|
857
|
+
let i = t.match(he).length;
|
|
856
858
|
if (n.has(i)) return n.get(i);
|
|
857
859
|
let a = 1 / i ** (.5 * e), o = parseFloat(Math.round(a * r) / r);
|
|
858
860
|
return n.set(i, o), o;
|
|
@@ -862,9 +864,9 @@ function ve(e = 1, t = 3) {
|
|
|
862
864
|
}
|
|
863
865
|
};
|
|
864
866
|
}
|
|
865
|
-
var
|
|
866
|
-
constructor({ getFn: e =
|
|
867
|
-
this.norm =
|
|
867
|
+
var _e = class {
|
|
868
|
+
constructor({ getFn: e = J.getFn, fieldNormWeight: t = J.fieldNormWeight } = {}) {
|
|
869
|
+
this.norm = ge(t, 3), this.getFn = e, this.isCreated = !1, this.docs = [], this.keys = [], this._keysMap = {}, this.setIndexRecords();
|
|
868
870
|
}
|
|
869
871
|
setSources(e = []) {
|
|
870
872
|
this.docs = e;
|
|
@@ -878,7 +880,7 @@ var ye = class {
|
|
|
878
880
|
});
|
|
879
881
|
}
|
|
880
882
|
create() {
|
|
881
|
-
this.isCreated || !this.docs.length || (this.isCreated = !0,
|
|
883
|
+
this.isCreated || !this.docs.length || (this.isCreated = !0, R(this.docs[0]) ? this.docs.forEach((e, t) => {
|
|
882
884
|
this._addString(e, t);
|
|
883
885
|
}) : this.docs.forEach((e, t) => {
|
|
884
886
|
this._addObject(e, t);
|
|
@@ -886,7 +888,7 @@ var ye = class {
|
|
|
886
888
|
}
|
|
887
889
|
add(e) {
|
|
888
890
|
let t = this.size();
|
|
889
|
-
|
|
891
|
+
R(e) ? this._addString(e, t) : this._addObject(e, t);
|
|
890
892
|
}
|
|
891
893
|
removeAt(e) {
|
|
892
894
|
this.records.splice(e, 1);
|
|
@@ -903,7 +905,7 @@ var ye = class {
|
|
|
903
905
|
return this.records.length;
|
|
904
906
|
}
|
|
905
907
|
_addString(e, t) {
|
|
906
|
-
if (!
|
|
908
|
+
if (!H(e) || U(e)) return;
|
|
907
909
|
let n = {
|
|
908
910
|
v: e,
|
|
909
911
|
i: t,
|
|
@@ -918,14 +920,14 @@ var ye = class {
|
|
|
918
920
|
};
|
|
919
921
|
this.keys.forEach((t, r) => {
|
|
920
922
|
let i = t.getFn ? t.getFn(e) : this.getFn(e, t.path);
|
|
921
|
-
if (
|
|
922
|
-
if (
|
|
923
|
+
if (H(i)) {
|
|
924
|
+
if (F(i)) {
|
|
923
925
|
let e = [];
|
|
924
926
|
for (let t = 0, n = i.length; t < n; t += 1) {
|
|
925
927
|
let n = i[t];
|
|
926
|
-
if (
|
|
927
|
-
if (
|
|
928
|
-
if (!
|
|
928
|
+
if (H(n)) {
|
|
929
|
+
if (R(n)) {
|
|
930
|
+
if (!U(n)) {
|
|
929
931
|
let r = {
|
|
930
932
|
v: n,
|
|
931
933
|
i: t,
|
|
@@ -933,9 +935,9 @@ var ye = class {
|
|
|
933
935
|
};
|
|
934
936
|
e.push(r);
|
|
935
937
|
}
|
|
936
|
-
} else if (
|
|
937
|
-
let t =
|
|
938
|
-
if (!
|
|
938
|
+
} else if (H(n.v)) {
|
|
939
|
+
let t = R(n.v) ? n.v : L(n.v);
|
|
940
|
+
if (!U(t)) {
|
|
939
941
|
let r = {
|
|
940
942
|
v: t,
|
|
941
943
|
i: n.i,
|
|
@@ -947,7 +949,7 @@ var ye = class {
|
|
|
947
949
|
}
|
|
948
950
|
}
|
|
949
951
|
n.$[r] = e;
|
|
950
|
-
} else if (
|
|
952
|
+
} else if (R(i) && !U(i)) {
|
|
951
953
|
let e = {
|
|
952
954
|
v: i,
|
|
953
955
|
n: this.norm.get(i)
|
|
@@ -964,21 +966,21 @@ var ye = class {
|
|
|
964
966
|
};
|
|
965
967
|
}
|
|
966
968
|
};
|
|
967
|
-
function
|
|
968
|
-
let i = new
|
|
969
|
+
function ve(e, t, { getFn: n = J.getFn, fieldNormWeight: r = J.fieldNormWeight } = {}) {
|
|
970
|
+
let i = new _e({
|
|
969
971
|
getFn: n,
|
|
970
972
|
fieldNormWeight: r
|
|
971
973
|
});
|
|
972
|
-
return i.setKeys(e.map(
|
|
974
|
+
return i.setKeys(e.map(se)), i.setSources(t), i.create(), i;
|
|
973
975
|
}
|
|
974
|
-
function
|
|
975
|
-
let { keys: r, records: i } = e, a = new
|
|
976
|
+
function ye(e, { getFn: t = J.getFn, fieldNormWeight: n = J.fieldNormWeight } = {}) {
|
|
977
|
+
let { keys: r, records: i } = e, a = new _e({
|
|
976
978
|
getFn: t,
|
|
977
979
|
fieldNormWeight: n
|
|
978
980
|
});
|
|
979
981
|
return a.setKeys(r), a.setIndexRecords(i), a;
|
|
980
982
|
}
|
|
981
|
-
function
|
|
983
|
+
function be(e = [], t = J.minMatchCharLength) {
|
|
982
984
|
let n = [], r = -1, i = -1, a = 0;
|
|
983
985
|
for (let o = e.length; a < o; a += 1) {
|
|
984
986
|
let o = e[a];
|
|
@@ -986,9 +988,9 @@ function Se(e = [], t = K.minMatchCharLength) {
|
|
|
986
988
|
}
|
|
987
989
|
return e[a - 1] && a - r >= t && n.push([r, a - 1]), n;
|
|
988
990
|
}
|
|
989
|
-
var
|
|
990
|
-
function
|
|
991
|
-
if (t.length >
|
|
991
|
+
var Y = 32;
|
|
992
|
+
function xe(e, t, n, { location: r = J.location, distance: i = J.distance, threshold: a = J.threshold, findAllMatches: o = J.findAllMatches, minMatchCharLength: s = J.minMatchCharLength, includeMatches: c = J.includeMatches, ignoreLocation: l = J.ignoreLocation } = {}) {
|
|
993
|
+
if (t.length > Y) throw Error(K(Y));
|
|
992
994
|
let u = t.length, d = e.length, f = Math.max(0, Math.min(r, d)), p = a, m = f, h = (e, t) => {
|
|
993
995
|
let n = e / u;
|
|
994
996
|
if (l) return n;
|
|
@@ -1025,12 +1027,12 @@ function Ce(e, t, n, { location: r = K.location, distance: i = K.distance, thres
|
|
|
1025
1027
|
score: Math.max(.001, b)
|
|
1026
1028
|
};
|
|
1027
1029
|
if (g) {
|
|
1028
|
-
let e =
|
|
1030
|
+
let e = be(_, s);
|
|
1029
1031
|
e.length ? c && (C.indices = e) : C.isMatch = !1;
|
|
1030
1032
|
}
|
|
1031
1033
|
return C;
|
|
1032
1034
|
}
|
|
1033
|
-
function
|
|
1035
|
+
function Se(e) {
|
|
1034
1036
|
let t = {};
|
|
1035
1037
|
for (let n = 0, r = e.length; n < r; n += 1) {
|
|
1036
1038
|
let i = e.charAt(n);
|
|
@@ -1038,7 +1040,7 @@ function we(e) {
|
|
|
1038
1040
|
}
|
|
1039
1041
|
return t;
|
|
1040
1042
|
}
|
|
1041
|
-
function
|
|
1043
|
+
function Ce(e) {
|
|
1042
1044
|
if (e.length <= 1) return e;
|
|
1043
1045
|
e.sort((e, t) => e[0] - t[0] || e[1] - t[1]);
|
|
1044
1046
|
let t = [e[0]];
|
|
@@ -1048,7 +1050,7 @@ function Te(e) {
|
|
|
1048
1050
|
}
|
|
1049
1051
|
return t;
|
|
1050
1052
|
}
|
|
1051
|
-
var
|
|
1053
|
+
var we = {
|
|
1052
1054
|
ł: "l",
|
|
1053
1055
|
Ł: "L",
|
|
1054
1056
|
đ: "d",
|
|
@@ -1061,8 +1063,8 @@ var Ee = {
|
|
|
1061
1063
|
Ŧ: "T",
|
|
1062
1064
|
ı: "i",
|
|
1063
1065
|
ß: "ss"
|
|
1064
|
-
},
|
|
1065
|
-
constructor(e, { location: t =
|
|
1066
|
+
}, Te = RegExp("[" + Object.keys(we).join("") + "]", "g"), X = String.prototype.normalize ? (e) => e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "").replace(Te, (e) => we[e]) : (e) => e, Ee = class {
|
|
1067
|
+
constructor(e, { location: t = J.location, threshold: n = J.threshold, distance: r = J.distance, includeMatches: i = J.includeMatches, findAllMatches: a = J.findAllMatches, minMatchCharLength: o = J.minMatchCharLength, isCaseSensitive: s = J.isCaseSensitive, ignoreDiacritics: c = J.ignoreDiacritics, ignoreLocation: l = J.ignoreLocation } = {}) {
|
|
1066
1068
|
if (this.options = {
|
|
1067
1069
|
location: t,
|
|
1068
1070
|
threshold: n,
|
|
@@ -1073,26 +1075,26 @@ var Ee = {
|
|
|
1073
1075
|
isCaseSensitive: s,
|
|
1074
1076
|
ignoreDiacritics: c,
|
|
1075
1077
|
ignoreLocation: l
|
|
1076
|
-
}, e = s ? e : e.toLowerCase(), e = c ?
|
|
1078
|
+
}, e = s ? e : e.toLowerCase(), e = c ? X(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length) return;
|
|
1077
1079
|
let u = (e, t) => {
|
|
1078
1080
|
this.chunks.push({
|
|
1079
1081
|
pattern: e,
|
|
1080
|
-
alphabet:
|
|
1082
|
+
alphabet: Se(e),
|
|
1081
1083
|
startIndex: t
|
|
1082
1084
|
});
|
|
1083
1085
|
}, d = this.pattern.length;
|
|
1084
|
-
if (d >
|
|
1085
|
-
let e = 0, t = d %
|
|
1086
|
-
for (; e < n;) u(this.pattern.substr(e,
|
|
1086
|
+
if (d > Y) {
|
|
1087
|
+
let e = 0, t = d % Y, n = d - t;
|
|
1088
|
+
for (; e < n;) u(this.pattern.substr(e, Y), e), e += Y;
|
|
1087
1089
|
if (t) {
|
|
1088
|
-
let e = d -
|
|
1090
|
+
let e = d - Y;
|
|
1089
1091
|
u(this.pattern.substr(e), e);
|
|
1090
1092
|
}
|
|
1091
1093
|
} else u(this.pattern, 0);
|
|
1092
1094
|
}
|
|
1093
1095
|
searchIn(e) {
|
|
1094
1096
|
let { isCaseSensitive: t, ignoreDiacritics: n, includeMatches: r } = this.options;
|
|
1095
|
-
if (e = t ? e : e.toLowerCase(), e = n ?
|
|
1097
|
+
if (e = t ? e : e.toLowerCase(), e = n ? X(e) : e, this.pattern === e) {
|
|
1096
1098
|
let t = {
|
|
1097
1099
|
isMatch: !0,
|
|
1098
1100
|
score: 0
|
|
@@ -1101,7 +1103,7 @@ var Ee = {
|
|
|
1101
1103
|
}
|
|
1102
1104
|
let { location: i, distance: a, threshold: o, findAllMatches: s, minMatchCharLength: c, ignoreLocation: l } = this.options, u = [], d = 0, f = !1;
|
|
1103
1105
|
this.chunks.forEach(({ pattern: t, alphabet: n, startIndex: p }) => {
|
|
1104
|
-
let { isMatch: m, score: h, indices: g } =
|
|
1106
|
+
let { isMatch: m, score: h, indices: g } = xe(e, t, n, {
|
|
1105
1107
|
location: i + p,
|
|
1106
1108
|
distance: a,
|
|
1107
1109
|
threshold: o,
|
|
@@ -1116,17 +1118,17 @@ var Ee = {
|
|
|
1116
1118
|
isMatch: f,
|
|
1117
1119
|
score: f ? d / this.chunks.length : 1
|
|
1118
1120
|
};
|
|
1119
|
-
return f && r && (p.indices =
|
|
1121
|
+
return f && r && (p.indices = Ce(u)), p;
|
|
1120
1122
|
}
|
|
1121
|
-
},
|
|
1123
|
+
}, Z = class {
|
|
1122
1124
|
constructor(e) {
|
|
1123
1125
|
this.pattern = e;
|
|
1124
1126
|
}
|
|
1125
1127
|
static isMultiMatch(e) {
|
|
1126
|
-
return
|
|
1128
|
+
return De(e, this.multiRegex);
|
|
1127
1129
|
}
|
|
1128
1130
|
static isSingleMatch(e) {
|
|
1129
|
-
return
|
|
1131
|
+
return De(e, this.singleRegex);
|
|
1130
1132
|
}
|
|
1131
1133
|
search(e) {
|
|
1132
1134
|
return {
|
|
@@ -1135,11 +1137,11 @@ var Ee = {
|
|
|
1135
1137
|
};
|
|
1136
1138
|
}
|
|
1137
1139
|
};
|
|
1138
|
-
function
|
|
1140
|
+
function De(e, t) {
|
|
1139
1141
|
let n = e.match(t);
|
|
1140
1142
|
return n ? n[1] : null;
|
|
1141
1143
|
}
|
|
1142
|
-
var
|
|
1144
|
+
var Oe = class extends Z {
|
|
1143
1145
|
constructor(e) {
|
|
1144
1146
|
super(e);
|
|
1145
1147
|
}
|
|
@@ -1160,7 +1162,7 @@ var Ae = class extends Y {
|
|
|
1160
1162
|
indices: [0, this.pattern.length - 1]
|
|
1161
1163
|
};
|
|
1162
1164
|
}
|
|
1163
|
-
},
|
|
1165
|
+
}, ke = class extends Z {
|
|
1164
1166
|
constructor(e) {
|
|
1165
1167
|
super(e);
|
|
1166
1168
|
}
|
|
@@ -1181,7 +1183,7 @@ var Ae = class extends Y {
|
|
|
1181
1183
|
indices: [0, e.length - 1]
|
|
1182
1184
|
};
|
|
1183
1185
|
}
|
|
1184
|
-
},
|
|
1186
|
+
}, Ae = class extends Z {
|
|
1185
1187
|
constructor(e) {
|
|
1186
1188
|
super(e);
|
|
1187
1189
|
}
|
|
@@ -1202,7 +1204,7 @@ var Ae = class extends Y {
|
|
|
1202
1204
|
indices: [0, this.pattern.length - 1]
|
|
1203
1205
|
};
|
|
1204
1206
|
}
|
|
1205
|
-
},
|
|
1207
|
+
}, je = class extends Z {
|
|
1206
1208
|
constructor(e) {
|
|
1207
1209
|
super(e);
|
|
1208
1210
|
}
|
|
@@ -1223,7 +1225,7 @@ var Ae = class extends Y {
|
|
|
1223
1225
|
indices: [0, e.length - 1]
|
|
1224
1226
|
};
|
|
1225
1227
|
}
|
|
1226
|
-
},
|
|
1228
|
+
}, Me = class extends Z {
|
|
1227
1229
|
constructor(e) {
|
|
1228
1230
|
super(e);
|
|
1229
1231
|
}
|
|
@@ -1244,7 +1246,7 @@ var Ae = class extends Y {
|
|
|
1244
1246
|
indices: [e.length - this.pattern.length, e.length - 1]
|
|
1245
1247
|
};
|
|
1246
1248
|
}
|
|
1247
|
-
},
|
|
1249
|
+
}, Ne = class extends Z {
|
|
1248
1250
|
constructor(e) {
|
|
1249
1251
|
super(e);
|
|
1250
1252
|
}
|
|
@@ -1265,9 +1267,9 @@ var Ae = class extends Y {
|
|
|
1265
1267
|
indices: [0, e.length - 1]
|
|
1266
1268
|
};
|
|
1267
1269
|
}
|
|
1268
|
-
},
|
|
1269
|
-
constructor(e, { location: t =
|
|
1270
|
-
super(e), this._bitapSearch = new
|
|
1270
|
+
}, Pe = class extends Z {
|
|
1271
|
+
constructor(e, { location: t = J.location, threshold: n = J.threshold, distance: r = J.distance, includeMatches: i = J.includeMatches, findAllMatches: a = J.findAllMatches, minMatchCharLength: o = J.minMatchCharLength, isCaseSensitive: s = J.isCaseSensitive, ignoreDiacritics: c = J.ignoreDiacritics, ignoreLocation: l = J.ignoreLocation } = {}) {
|
|
1272
|
+
super(e), this._bitapSearch = new Ee(e, {
|
|
1271
1273
|
location: t,
|
|
1272
1274
|
threshold: n,
|
|
1273
1275
|
distance: r,
|
|
@@ -1291,7 +1293,7 @@ var Ae = class extends Y {
|
|
|
1291
1293
|
search(e) {
|
|
1292
1294
|
return this._bitapSearch.searchIn(e);
|
|
1293
1295
|
}
|
|
1294
|
-
},
|
|
1296
|
+
}, Fe = class extends Z {
|
|
1295
1297
|
constructor(e) {
|
|
1296
1298
|
super(e);
|
|
1297
1299
|
}
|
|
@@ -1314,17 +1316,17 @@ var Ae = class extends Y {
|
|
|
1314
1316
|
indices: r
|
|
1315
1317
|
};
|
|
1316
1318
|
}
|
|
1317
|
-
},
|
|
1318
|
-
|
|
1319
|
-
Le,
|
|
1320
|
-
Me,
|
|
1321
|
-
Ne,
|
|
1319
|
+
}, Ie = [
|
|
1320
|
+
Oe,
|
|
1322
1321
|
Fe,
|
|
1323
|
-
|
|
1322
|
+
Ae,
|
|
1324
1323
|
je,
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1324
|
+
Ne,
|
|
1325
|
+
Me,
|
|
1326
|
+
ke,
|
|
1327
|
+
Pe
|
|
1328
|
+
], Le = Ie.length, Re = "\0", ze = "|";
|
|
1329
|
+
function Be(e) {
|
|
1328
1330
|
let t = [], n = e.length, r = 0;
|
|
1329
1331
|
for (; r < n;) {
|
|
1330
1332
|
for (; r < n && e[r] === " ";) r++;
|
|
@@ -1354,17 +1356,17 @@ function He(e) {
|
|
|
1354
1356
|
}
|
|
1355
1357
|
return t;
|
|
1356
1358
|
}
|
|
1357
|
-
function
|
|
1358
|
-
return e.replace(/\\\|/g,
|
|
1359
|
-
let n =
|
|
1359
|
+
function Ve(e, t = {}) {
|
|
1360
|
+
return e.replace(/\\\|/g, Re).split(ze).map((e) => {
|
|
1361
|
+
let n = Be(e.replace(/\u0000/g, "|").trim()).filter((e) => e && !!e.trim()), r = [];
|
|
1360
1362
|
for (let e = 0, i = n.length; e < i; e += 1) {
|
|
1361
1363
|
let i = n[e], a = !1, o = -1;
|
|
1362
|
-
for (; !a && ++o <
|
|
1363
|
-
let e =
|
|
1364
|
+
for (; !a && ++o < Le;) {
|
|
1365
|
+
let e = Ie[o], n = e.isMultiMatch(i);
|
|
1364
1366
|
n && (r.push(new e(n, t)), a = !0);
|
|
1365
1367
|
}
|
|
1366
|
-
if (!a) for (o = -1; ++o <
|
|
1367
|
-
let e =
|
|
1368
|
+
if (!a) for (o = -1; ++o < Le;) {
|
|
1369
|
+
let e = Ie[o], n = e.isSingleMatch(i);
|
|
1368
1370
|
if (n) {
|
|
1369
1371
|
r.push(new e(n, t));
|
|
1370
1372
|
break;
|
|
@@ -1374,8 +1376,8 @@ function Ue(e, t = {}) {
|
|
|
1374
1376
|
return r;
|
|
1375
1377
|
});
|
|
1376
1378
|
}
|
|
1377
|
-
var
|
|
1378
|
-
constructor(e, { isCaseSensitive: t =
|
|
1379
|
+
var He = new Set([Pe.type, Fe.type]), Ue = class {
|
|
1380
|
+
constructor(e, { isCaseSensitive: t = J.isCaseSensitive, ignoreDiacritics: n = J.ignoreDiacritics, includeMatches: r = J.includeMatches, minMatchCharLength: i = J.minMatchCharLength, ignoreLocation: a = J.ignoreLocation, findAllMatches: o = J.findAllMatches, location: s = J.location, threshold: c = J.threshold, distance: l = J.distance } = {}) {
|
|
1379
1381
|
this.query = null, this.options = {
|
|
1380
1382
|
isCaseSensitive: t,
|
|
1381
1383
|
ignoreDiacritics: n,
|
|
@@ -1386,7 +1388,7 @@ var We = new Set([Ie.type, Le.type]), Ge = class {
|
|
|
1386
1388
|
location: s,
|
|
1387
1389
|
threshold: c,
|
|
1388
1390
|
distance: l
|
|
1389
|
-
}, e = t ? e : e.toLowerCase(), e = n ?
|
|
1391
|
+
}, e = t ? e : e.toLowerCase(), e = n ? X(e) : e, this.pattern = e, this.query = Ve(this.pattern, this.options);
|
|
1390
1392
|
}
|
|
1391
1393
|
static condition(e, t) {
|
|
1392
1394
|
return t.useExtendedSearch;
|
|
@@ -1398,7 +1400,7 @@ var We = new Set([Ie.type, Le.type]), Ge = class {
|
|
|
1398
1400
|
score: 1
|
|
1399
1401
|
};
|
|
1400
1402
|
let { includeMatches: n, isCaseSensitive: r, ignoreDiacritics: i } = this.options;
|
|
1401
|
-
e = r ? e : e.toLowerCase(), e = i ?
|
|
1403
|
+
e = r ? e : e.toLowerCase(), e = i ? X(e) : e;
|
|
1402
1404
|
let a = 0, o = [], s = 0, c = !1;
|
|
1403
1405
|
for (let r = 0, i = t.length; r < i; r += 1) {
|
|
1404
1406
|
let i = t[r];
|
|
@@ -1408,7 +1410,7 @@ var We = new Set([Ie.type, Le.type]), Ge = class {
|
|
|
1408
1410
|
if (l) {
|
|
1409
1411
|
a += 1, s += d;
|
|
1410
1412
|
let e = r.constructor.type;
|
|
1411
|
-
e.startsWith("inverse") && (c = !0), n && (
|
|
1413
|
+
e.startsWith("inverse") && (c = !0), n && (He.has(e) ? o.push(...u) : o.push(u));
|
|
1412
1414
|
} else {
|
|
1413
1415
|
s = 0, a = 0, o.length = 0, c = !1;
|
|
1414
1416
|
break;
|
|
@@ -1419,7 +1421,7 @@ var We = new Set([Ie.type, Le.type]), Ge = class {
|
|
|
1419
1421
|
isMatch: !0,
|
|
1420
1422
|
score: s / a
|
|
1421
1423
|
};
|
|
1422
|
-
return c && (e.hasInverse = !0), n && (e.indices =
|
|
1424
|
+
return c && (e.hasInverse = !0), n && (e.indices = Ce(o)), e;
|
|
1423
1425
|
}
|
|
1424
1426
|
}
|
|
1425
1427
|
return {
|
|
@@ -1427,43 +1429,43 @@ var We = new Set([Ie.type, Le.type]), Ge = class {
|
|
|
1427
1429
|
score: 1
|
|
1428
1430
|
};
|
|
1429
1431
|
}
|
|
1430
|
-
},
|
|
1431
|
-
function
|
|
1432
|
-
|
|
1432
|
+
}, We = [];
|
|
1433
|
+
function Ge(...e) {
|
|
1434
|
+
We.push(...e);
|
|
1433
1435
|
}
|
|
1434
|
-
function
|
|
1435
|
-
for (let n = 0, r =
|
|
1436
|
-
let r =
|
|
1436
|
+
function Ke(e, t) {
|
|
1437
|
+
for (let n = 0, r = We.length; n < r; n += 1) {
|
|
1438
|
+
let r = We[n];
|
|
1437
1439
|
if (r.condition(e, t)) return new r(e, t);
|
|
1438
1440
|
}
|
|
1439
|
-
return new
|
|
1441
|
+
return new Ee(e, t);
|
|
1440
1442
|
}
|
|
1441
|
-
var
|
|
1443
|
+
var qe = {
|
|
1442
1444
|
AND: "$and",
|
|
1443
1445
|
OR: "$or"
|
|
1444
1446
|
}, Je = {
|
|
1445
1447
|
PATH: "$path",
|
|
1446
1448
|
PATTERN: "$val"
|
|
1447
|
-
}, Ye = (e) => !!(e[
|
|
1449
|
+
}, Ye = (e) => !!(e[qe.AND] || e[qe.OR]), Xe = (e) => !!e[Je.PATH], Ze = (e) => !F(e) && V(e) && !Ye(e), Qe = (e) => ({ [qe.AND]: Object.keys(e).map((t) => ({ [t]: e[t] })) });
|
|
1448
1450
|
function $e(e, t, { auto: n = !0 } = {}) {
|
|
1449
1451
|
let r = (e) => {
|
|
1450
|
-
if (
|
|
1452
|
+
if (R(e)) {
|
|
1451
1453
|
let r = {
|
|
1452
1454
|
keyId: null,
|
|
1453
1455
|
pattern: e
|
|
1454
1456
|
};
|
|
1455
|
-
return n && (r.searcher =
|
|
1457
|
+
return n && (r.searcher = Ke(e, t)), r;
|
|
1456
1458
|
}
|
|
1457
1459
|
let i = Object.keys(e), a = Xe(e);
|
|
1458
1460
|
if (!a && i.length > 1 && !Ye(e)) return r(Qe(e));
|
|
1459
1461
|
if (Ze(e)) {
|
|
1460
1462
|
let r = a ? e[Je.PATH] : i[0], o = a ? e[Je.PATTERN] : e[r];
|
|
1461
|
-
if (!
|
|
1463
|
+
if (!R(o)) throw Error(re(r));
|
|
1462
1464
|
let s = {
|
|
1463
|
-
keyId:
|
|
1465
|
+
keyId: le(r),
|
|
1464
1466
|
pattern: o
|
|
1465
1467
|
};
|
|
1466
|
-
return n && (s.searcher =
|
|
1468
|
+
return n && (s.searcher = Ke(o, t)), s;
|
|
1467
1469
|
}
|
|
1468
1470
|
let o = {
|
|
1469
1471
|
children: [],
|
|
@@ -1471,21 +1473,21 @@ function $e(e, t, { auto: n = !0 } = {}) {
|
|
|
1471
1473
|
};
|
|
1472
1474
|
return i.forEach((t) => {
|
|
1473
1475
|
let n = e[t];
|
|
1474
|
-
|
|
1476
|
+
F(n) && n.forEach((e) => {
|
|
1475
1477
|
o.children.push(r(e));
|
|
1476
1478
|
});
|
|
1477
1479
|
}), o;
|
|
1478
1480
|
};
|
|
1479
1481
|
return Ye(e) || (e = Qe(e)), r(e);
|
|
1480
1482
|
}
|
|
1481
|
-
function et(e, { ignoreFieldNorm: t =
|
|
1483
|
+
function et(e, { ignoreFieldNorm: t = J.ignoreFieldNorm }) {
|
|
1482
1484
|
let n = 1;
|
|
1483
1485
|
return e.forEach(({ key: e, norm: r, score: i }) => {
|
|
1484
1486
|
let a = e ? e.weight : null;
|
|
1485
1487
|
n *= (i === 0 && a ? 2 ** -52 : i) ** +((a || 1) * (t ? 1 : r));
|
|
1486
1488
|
}), n;
|
|
1487
1489
|
}
|
|
1488
|
-
function tt(e, { ignoreFieldNorm: t =
|
|
1490
|
+
function tt(e, { ignoreFieldNorm: t = J.ignoreFieldNorm }) {
|
|
1489
1491
|
e.forEach((e) => {
|
|
1490
1492
|
e.score = et(e.matches, { ignoreFieldNorm: t });
|
|
1491
1493
|
});
|
|
@@ -1529,8 +1531,8 @@ var nt = class {
|
|
|
1529
1531
|
};
|
|
1530
1532
|
function rt(e, t) {
|
|
1531
1533
|
let n = e.matches;
|
|
1532
|
-
t.matches = [],
|
|
1533
|
-
if (!
|
|
1534
|
+
t.matches = [], H(n) && n.forEach((e) => {
|
|
1535
|
+
if (!H(e.indices) || !e.indices.length) return;
|
|
1534
1536
|
let { indices: n, value: r } = e, i = {
|
|
1535
1537
|
indices: n,
|
|
1536
1538
|
value: r
|
|
@@ -1541,7 +1543,7 @@ function rt(e, t) {
|
|
|
1541
1543
|
function it(e, t) {
|
|
1542
1544
|
t.score = e.score;
|
|
1543
1545
|
}
|
|
1544
|
-
function at(e, t, { includeMatches: n =
|
|
1546
|
+
function at(e, t, { includeMatches: n = J.includeMatches, includeScore: r = J.includeScore } = {}) {
|
|
1545
1547
|
let i = [];
|
|
1546
1548
|
return n && i.push(rt), r && i.push(it), e.map((e) => {
|
|
1547
1549
|
let { idx: n } = e, r = {
|
|
@@ -1556,7 +1558,7 @@ function at(e, t, { includeMatches: n = K.includeMatches, includeScore: r = K.in
|
|
|
1556
1558
|
var ot = /\b\w+\b/g;
|
|
1557
1559
|
function st({ isCaseSensitive: e = !1, ignoreDiacritics: t = !1 } = {}) {
|
|
1558
1560
|
return { tokenize(n) {
|
|
1559
|
-
return e || (n = n.toLowerCase()), t && (n =
|
|
1561
|
+
return e || (n = n.toLowerCase()), t && (n = X(n)), n.match(ot) || [];
|
|
1560
1562
|
} };
|
|
1561
1563
|
}
|
|
1562
1564
|
function ct(e, t, n) {
|
|
@@ -1632,21 +1634,21 @@ function ut(e, t) {
|
|
|
1632
1634
|
var Q = class {
|
|
1633
1635
|
constructor(e, t, n) {
|
|
1634
1636
|
this.options = {
|
|
1635
|
-
...
|
|
1637
|
+
...J,
|
|
1636
1638
|
...t
|
|
1637
|
-
}, this.options.useExtendedSearch, this.options.useTokenSearch, this._keyStore = new
|
|
1639
|
+
}, this.options.useExtendedSearch, this.options.useTokenSearch, this._keyStore = new oe(this.options.keys), this._docs = e, this._myIndex = null, this._invertedIndex = null, this.setCollection(e, n), this._lastQuery = null, this._lastSearcher = null;
|
|
1638
1640
|
}
|
|
1639
1641
|
_getSearcher(e) {
|
|
1640
1642
|
if (this._lastQuery === e) return this._lastSearcher;
|
|
1641
|
-
let t =
|
|
1643
|
+
let t = Ke(e, this._invertedIndex ? {
|
|
1642
1644
|
...this.options,
|
|
1643
1645
|
_invertedIndex: this._invertedIndex
|
|
1644
1646
|
} : this.options);
|
|
1645
1647
|
return this._lastQuery = e, this._lastSearcher = t, t;
|
|
1646
1648
|
}
|
|
1647
1649
|
setCollection(e, t) {
|
|
1648
|
-
if (this._docs = e, t && !(t instanceof
|
|
1649
|
-
if (this._myIndex = t ||
|
|
1650
|
+
if (this._docs = e, t && !(t instanceof _e)) throw Error(G);
|
|
1651
|
+
if (this._myIndex = t || ve(this.options.keys, this._docs, {
|
|
1650
1652
|
getFn: this.options.getFn,
|
|
1651
1653
|
fieldNormWeight: this.options.fieldNormWeight
|
|
1652
1654
|
}), this.options.useTokenSearch) {
|
|
@@ -1658,7 +1660,7 @@ var Q = class {
|
|
|
1658
1660
|
}
|
|
1659
1661
|
}
|
|
1660
1662
|
add(e) {
|
|
1661
|
-
if (
|
|
1663
|
+
if (H(e) && (this._docs.push(e), this._myIndex.add(e), this._invertedIndex)) {
|
|
1662
1664
|
let e = this._myIndex.records[this._myIndex.records.length - 1], t = st({
|
|
1663
1665
|
isCaseSensitive: this.options.isCaseSensitive,
|
|
1664
1666
|
ignoreDiacritics: this.options.ignoreDiacritics
|
|
@@ -1686,24 +1688,24 @@ var Q = class {
|
|
|
1686
1688
|
}
|
|
1687
1689
|
search(e, t) {
|
|
1688
1690
|
let { limit: n = -1 } = t || {}, { includeMatches: r, includeScore: i, shouldSort: a, sortFn: o, ignoreFieldNorm: s } = this.options;
|
|
1689
|
-
if (
|
|
1691
|
+
if (R(e) && !e.trim()) {
|
|
1690
1692
|
let e = this._docs.map((e, t) => ({
|
|
1691
1693
|
item: e,
|
|
1692
1694
|
refIndex: t
|
|
1693
1695
|
}));
|
|
1694
|
-
return
|
|
1696
|
+
return z(n) && n > -1 && (e = e.slice(0, n)), e;
|
|
1695
1697
|
}
|
|
1696
|
-
let c =
|
|
1698
|
+
let c = z(n) && n > 0 && R(e), l;
|
|
1697
1699
|
if (c) {
|
|
1698
1700
|
let t = new nt(n);
|
|
1699
|
-
|
|
1701
|
+
R(this._docs[0]) ? this._searchStringList(e, {
|
|
1700
1702
|
heap: t,
|
|
1701
1703
|
ignoreFieldNorm: s
|
|
1702
1704
|
}) : this._searchObjectList(e, {
|
|
1703
1705
|
heap: t,
|
|
1704
1706
|
ignoreFieldNorm: s
|
|
1705
1707
|
}), l = t.extractSorted(o);
|
|
1706
|
-
} else l =
|
|
1708
|
+
} else l = R(e) ? R(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e), tt(l, { ignoreFieldNorm: s }), a && l.sort(o), z(n) && n > -1 && (l = l.slice(0, n));
|
|
1707
1709
|
return at(l, this._docs, {
|
|
1708
1710
|
includeMatches: r,
|
|
1709
1711
|
includeScore: i
|
|
@@ -1712,7 +1714,7 @@ var Q = class {
|
|
|
1712
1714
|
_searchStringList(e, { heap: t, ignoreFieldNorm: n } = {}) {
|
|
1713
1715
|
let r = this._getSearcher(e), { records: i } = this._myIndex, a = t ? null : [];
|
|
1714
1716
|
return i.forEach(({ v: e, i, n: o }) => {
|
|
1715
|
-
if (!
|
|
1717
|
+
if (!H(e)) return;
|
|
1716
1718
|
let { isMatch: s, score: c, indices: l } = r.searchIn(e);
|
|
1717
1719
|
if (s) {
|
|
1718
1720
|
let r = {
|
|
@@ -1753,12 +1755,12 @@ var Q = class {
|
|
|
1753
1755
|
for (let e = 0, s = i.length; e < s; e += 1) {
|
|
1754
1756
|
let s = i[e], c = n(s, t, r);
|
|
1755
1757
|
if (c.length) o.push(...c);
|
|
1756
|
-
else if (a ===
|
|
1758
|
+
else if (a === qe.AND) return [];
|
|
1757
1759
|
}
|
|
1758
1760
|
return o;
|
|
1759
1761
|
}, r = this._myIndex.records, i = /* @__PURE__ */ new Map(), a = [];
|
|
1760
1762
|
return r.forEach(({ $: e, i: r }) => {
|
|
1761
|
-
if (
|
|
1763
|
+
if (H(e)) {
|
|
1762
1764
|
let o = n(t, e, r);
|
|
1763
1765
|
o.length && (i.has(r) || (i.set(r, {
|
|
1764
1766
|
idx: r,
|
|
@@ -1773,7 +1775,7 @@ var Q = class {
|
|
|
1773
1775
|
_searchObjectList(e, { heap: t, ignoreFieldNorm: n } = {}) {
|
|
1774
1776
|
let r = this._getSearcher(e), { keys: i, records: a } = this._myIndex, o = t ? null : [];
|
|
1775
1777
|
return a.forEach(({ $: e, i: a }) => {
|
|
1776
|
-
if (!
|
|
1778
|
+
if (!H(e)) return;
|
|
1777
1779
|
let s = [], c = !1, l = !1;
|
|
1778
1780
|
if (i.forEach((t, n) => {
|
|
1779
1781
|
let i = this._findMatches({
|
|
@@ -1793,10 +1795,10 @@ var Q = class {
|
|
|
1793
1795
|
}), o;
|
|
1794
1796
|
}
|
|
1795
1797
|
_findMatches({ key: e, value: t, searcher: n }) {
|
|
1796
|
-
if (!
|
|
1798
|
+
if (!H(t)) return [];
|
|
1797
1799
|
let r = [];
|
|
1798
|
-
if (
|
|
1799
|
-
if (!
|
|
1800
|
+
if (F(t)) t.forEach(({ v: t, i, n: a }) => {
|
|
1801
|
+
if (!H(t)) return;
|
|
1800
1802
|
let { isMatch: o, score: s, indices: c, hasInverse: l } = n.searchIn(t);
|
|
1801
1803
|
o && r.push({
|
|
1802
1804
|
score: s,
|
|
@@ -1833,7 +1835,7 @@ var Q = class {
|
|
|
1833
1835
|
let n = this.analyzer.tokenize(e), { df: r, fieldCount: i } = t._invertedIndex;
|
|
1834
1836
|
this.termSearchers = [], this.idfWeights = [];
|
|
1835
1837
|
for (let e of n) {
|
|
1836
|
-
this.termSearchers.push(new
|
|
1838
|
+
this.termSearchers.push(new Ee(e, {
|
|
1837
1839
|
location: t.location,
|
|
1838
1840
|
threshold: t.threshold,
|
|
1839
1841
|
distance: t.distance,
|
|
@@ -1866,30 +1868,41 @@ var Q = class {
|
|
|
1866
1868
|
isMatch: !0,
|
|
1867
1869
|
score: Math.max(.001, a)
|
|
1868
1870
|
};
|
|
1869
|
-
return this.options.includeMatches && t.length && (o.indices =
|
|
1871
|
+
return this.options.includeMatches && t.length && (o.indices = Ce(t)), o;
|
|
1870
1872
|
}
|
|
1871
1873
|
};
|
|
1872
|
-
Q.version = "7.3.0", Q.createIndex =
|
|
1873
|
-
return
|
|
1874
|
-
...
|
|
1874
|
+
Q.version = "7.3.0", Q.createIndex = ve, Q.parseIndex = ye, Q.config = J, Q.match = function(e, t, n) {
|
|
1875
|
+
return Ke(e, {
|
|
1876
|
+
...J,
|
|
1875
1877
|
...n
|
|
1876
1878
|
}).searchIn(t);
|
|
1877
|
-
}, Q.parseQuery = $e,
|
|
1878
|
-
e.forEach((e) =>
|
|
1879
|
+
}, Q.parseQuery = $e, Ge(Ue), Ge(dt), Q.use = function(...e) {
|
|
1880
|
+
e.forEach((e) => Ge(e));
|
|
1879
1881
|
};
|
|
1880
1882
|
//#endregion
|
|
1881
1883
|
//#region src/hooks/useCommands.js
|
|
1882
|
-
var ft = (e, t = .4) =>
|
|
1883
|
-
let
|
|
1884
|
+
var ft = (e, t = .4) => {
|
|
1885
|
+
let n = i(() => e ? Object.entries(e).reduce((e, [t, n]) => ({
|
|
1886
|
+
...e,
|
|
1887
|
+
[t.toLowerCase()]: n
|
|
1888
|
+
}), {}) : {}, [e]), r = i(() => Object.keys(n), [n]), a = i(() => r.some((e) => e.includes(" ")), [r]), o = i(() => a ? new Q(r, {
|
|
1884
1889
|
includeScore: !0,
|
|
1885
1890
|
ignoreLocation: !0
|
|
1886
|
-
})
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1891
|
+
}) : null, [a, r]);
|
|
1892
|
+
return (e) => {
|
|
1893
|
+
if (!r.length) return null;
|
|
1894
|
+
if (!a) {
|
|
1895
|
+
let t = e.trim().split(/\s+/), r = t.length > 1 ? t : [e.trim()];
|
|
1896
|
+
for (let e of r) {
|
|
1897
|
+
let t = e.toLowerCase();
|
|
1898
|
+
if (t in n) return n[t]?.(e);
|
|
1899
|
+
}
|
|
1900
|
+
return null;
|
|
1901
|
+
}
|
|
1902
|
+
let i = o.search(e).filter((e) => e.score < t);
|
|
1903
|
+
return i?.length ? n[i[0].item.toLowerCase()]?.(e) : null;
|
|
1904
|
+
};
|
|
1905
|
+
}, pt = /* @__PURE__ */ s(((e) => {
|
|
1893
1906
|
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
1894
1907
|
function r(e, n, r) {
|
|
1895
1908
|
var i = null;
|
|
@@ -1908,7 +1921,7 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1908
1921
|
process.env.NODE_ENV !== "production" && (function() {
|
|
1909
1922
|
function t(e) {
|
|
1910
1923
|
if (e == null) return null;
|
|
1911
|
-
if (typeof e == "function") return e.$$typeof ===
|
|
1924
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
1912
1925
|
if (typeof e == "string") return e;
|
|
1913
1926
|
switch (e) {
|
|
1914
1927
|
case v: return "Fragment";
|
|
@@ -1916,7 +1929,7 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1916
1929
|
case y: return "StrictMode";
|
|
1917
1930
|
case w: return "Suspense";
|
|
1918
1931
|
case T: return "SuspenseList";
|
|
1919
|
-
case
|
|
1932
|
+
case O: return "Activity";
|
|
1920
1933
|
}
|
|
1921
1934
|
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
1922
1935
|
case _: return "Portal";
|
|
@@ -1961,14 +1974,14 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1961
1974
|
}
|
|
1962
1975
|
}
|
|
1963
1976
|
function a() {
|
|
1964
|
-
var e =
|
|
1977
|
+
var e = A.A;
|
|
1965
1978
|
return e === null ? null : e.getOwner();
|
|
1966
1979
|
}
|
|
1967
1980
|
function o() {
|
|
1968
1981
|
return Error("react-stack-top-frame");
|
|
1969
1982
|
}
|
|
1970
1983
|
function s(e) {
|
|
1971
|
-
if (
|
|
1984
|
+
if (j.call(e, "key")) {
|
|
1972
1985
|
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
1973
1986
|
if (t && t.isReactWarning) return !1;
|
|
1974
1987
|
}
|
|
@@ -1976,7 +1989,7 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1976
1989
|
}
|
|
1977
1990
|
function l(e, t) {
|
|
1978
1991
|
function n() {
|
|
1979
|
-
|
|
1992
|
+
ee || (ee = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
1980
1993
|
}
|
|
1981
1994
|
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
1982
1995
|
get: n,
|
|
@@ -1985,7 +1998,7 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
1985
1998
|
}
|
|
1986
1999
|
function u() {
|
|
1987
2000
|
var e = t(this.type);
|
|
1988
|
-
return
|
|
2001
|
+
return P[e] || (P[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
1989
2002
|
}
|
|
1990
2003
|
function d(e, t, n, r, i, a) {
|
|
1991
2004
|
var o = n.ref;
|
|
@@ -2025,17 +2038,17 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
2025
2038
|
}
|
|
2026
2039
|
function f(e, n, i, o, c, u) {
|
|
2027
2040
|
var f = n.children;
|
|
2028
|
-
if (f !== void 0) if (o) if (
|
|
2041
|
+
if (f !== void 0) if (o) if (M(f)) {
|
|
2029
2042
|
for (o = 0; o < f.length; o++) p(f[o]);
|
|
2030
2043
|
Object.freeze && Object.freeze(f);
|
|
2031
2044
|
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
2032
2045
|
else p(f);
|
|
2033
|
-
if (
|
|
2046
|
+
if (j.call(n, "key")) {
|
|
2034
2047
|
f = t(e);
|
|
2035
2048
|
var m = Object.keys(n).filter(function(e) {
|
|
2036
2049
|
return e !== "key";
|
|
2037
2050
|
});
|
|
2038
|
-
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
2051
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", I[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), I[f + o] = !0);
|
|
2039
2052
|
}
|
|
2040
2053
|
if (f = null, i !== void 0 && (r(i), f = "" + i), s(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
2041
2054
|
else i = n;
|
|
@@ -2047,19 +2060,19 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
2047
2060
|
function m(e) {
|
|
2048
2061
|
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
2049
2062
|
}
|
|
2050
|
-
var h = c("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"),
|
|
2063
|
+
var h = c("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
2051
2064
|
return null;
|
|
2052
2065
|
};
|
|
2053
2066
|
h = { react_stack_bottom_frame: function(e) {
|
|
2054
2067
|
return e();
|
|
2055
2068
|
} };
|
|
2056
|
-
var
|
|
2069
|
+
var ee, P = {}, te = h.react_stack_bottom_frame.bind(h, o)(), F = N(i(o)), I = {};
|
|
2057
2070
|
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
2058
|
-
var r = 1e4 >
|
|
2059
|
-
return f(e, t, n, !1, r ? Error("react-stack-top-frame") :
|
|
2071
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
2072
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : te, r ? N(i(e)) : F);
|
|
2060
2073
|
}, e.jsxs = function(e, t, n) {
|
|
2061
|
-
var r = 1e4 >
|
|
2062
|
-
return f(e, t, n, !0, r ? Error("react-stack-top-frame") :
|
|
2074
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
2075
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : te, r ? N(i(e)) : F);
|
|
2063
2076
|
};
|
|
2064
2077
|
})();
|
|
2065
2078
|
})), $ = (/* @__PURE__ */ s(((e, t) => {
|
|
@@ -2081,102 +2094,121 @@ var ft = (e, t = .4) => (e = e ? Object.entries(e)?.reduce((e, [t, n]) => ({ [t.
|
|
|
2081
2094
|
cy: "4",
|
|
2082
2095
|
r: "4"
|
|
2083
2096
|
})] })
|
|
2084
|
-
}), gt = (
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2097
|
+
}), gt = (e, t) => {
|
|
2098
|
+
for (let { alternatives: n } of e) for (let e of n) if (t(e) !== null) return;
|
|
2099
|
+
}, _t = ({ children: r, commands: s = null, lang: c = "en-US", grammars: l = null, timeout: u = 3e3, precision: d = .4, maxAlternatives: f = 1, ariaLabel: p = "start recognition", style: m = null, className: h = null, outlineStyle: g = "2px solid", onStart: _ = null, onEnd: v = null, onSpeechStart: y = null, onSpeechEnd: b = null, onResult: x = null, onError: S = null, onNoMatch: C = null, __rsInstance: w }) => {
|
|
2100
|
+
let T = a(null), [E, D] = o(!1), [, { start: O, stop: k, subscribe: A, unsubscribe: j }] = P(c, l, f, w), M = ft(s, d), F = a({});
|
|
2101
|
+
F.current = {
|
|
2102
|
+
onStart: _,
|
|
2103
|
+
onEnd: v,
|
|
2104
|
+
onSpeechStart: y,
|
|
2105
|
+
onSpeechEnd: b,
|
|
2106
|
+
onResult: x,
|
|
2107
|
+
onError: S,
|
|
2108
|
+
onNoMatch: C
|
|
2094
2109
|
};
|
|
2095
|
-
let
|
|
2096
|
-
|
|
2097
|
-
let
|
|
2110
|
+
let I = a(M);
|
|
2111
|
+
I.current = M;
|
|
2112
|
+
let L = a(null), R = a(null), [z, B] = te(n(() => R.current?.(), []), u), V = n(() => {
|
|
2098
2113
|
try {
|
|
2099
|
-
|
|
2114
|
+
D(!1), k();
|
|
2100
2115
|
} catch (e) {
|
|
2101
|
-
|
|
2116
|
+
F.current.onError?.(e), L.current?.();
|
|
2117
|
+
}
|
|
2118
|
+
}, [k]), ne = n((e) => {
|
|
2119
|
+
z(), F.current.onStart?.(e);
|
|
2120
|
+
}, [z]), H = n((e) => {
|
|
2121
|
+
B(), F.current.onSpeechStart?.(e);
|
|
2122
|
+
}, [B]), U = n((e) => {
|
|
2123
|
+
z(), F.current.onSpeechEnd?.(e);
|
|
2124
|
+
}, [z]), W = n((e) => {
|
|
2125
|
+
let t = Array.from(e?.results ?? [], (e) => {
|
|
2126
|
+
let t = {
|
|
2127
|
+
confidence: -Infinity,
|
|
2128
|
+
transcript: ""
|
|
2129
|
+
}, n = [];
|
|
2130
|
+
for (let r = 0; r < e.length; r++) {
|
|
2131
|
+
let i = e[r];
|
|
2132
|
+
n.push(i.transcript ?? ""), (i.confidence === void 0 || i.confidence > t.confidence) && (t = i);
|
|
2133
|
+
}
|
|
2134
|
+
return {
|
|
2135
|
+
best: t.transcript ?? "",
|
|
2136
|
+
alternatives: n
|
|
2137
|
+
};
|
|
2138
|
+
}), n = t.map((e) => e.best).join("");
|
|
2139
|
+
B(), V(), gt(t, I.current), F.current.onResult?.(n, e);
|
|
2140
|
+
}, [B, V]), G = n((e) => {
|
|
2141
|
+
V(), F.current.onError?.(e);
|
|
2142
|
+
}, [V]), re = n((e) => {
|
|
2143
|
+
B(), V(), F.current.onNoMatch?.(e);
|
|
2144
|
+
}, [B, V]), K = n((e) => {
|
|
2145
|
+
B();
|
|
2146
|
+
try {
|
|
2147
|
+
V(), L.current?.();
|
|
2102
2148
|
} finally {
|
|
2103
|
-
|
|
2149
|
+
F.current.onEnd?.(e);
|
|
2104
2150
|
}
|
|
2105
|
-
}, [
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
}, [R]), H = n((e) => {
|
|
2116
|
-
L(), R(), A.current.onNoMatch?.(e);
|
|
2117
|
-
}, [L, R]), U = n((e) => {
|
|
2118
|
-
L(), R(), A.current.onEnd?.(e);
|
|
2119
|
-
}, [L, R]);
|
|
2120
|
-
F.current = U;
|
|
2121
|
-
let W = i(() => ({
|
|
2122
|
-
start: re,
|
|
2123
|
-
end: U,
|
|
2124
|
-
speechstart: z,
|
|
2125
|
-
speechend: ie,
|
|
2126
|
-
result: B,
|
|
2127
|
-
error: V,
|
|
2128
|
-
nomatch: H
|
|
2151
|
+
}, [B, V]);
|
|
2152
|
+
R.current = K;
|
|
2153
|
+
let q = i(() => ({
|
|
2154
|
+
start: ne,
|
|
2155
|
+
end: K,
|
|
2156
|
+
speechstart: H,
|
|
2157
|
+
speechend: U,
|
|
2158
|
+
result: W,
|
|
2159
|
+
error: G,
|
|
2160
|
+
nomatch: re
|
|
2129
2161
|
}), [
|
|
2130
|
-
|
|
2162
|
+
ne,
|
|
2163
|
+
K,
|
|
2164
|
+
H,
|
|
2131
2165
|
U,
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
V,
|
|
2136
|
-
H
|
|
2166
|
+
W,
|
|
2167
|
+
G,
|
|
2168
|
+
re
|
|
2137
2169
|
]);
|
|
2138
|
-
|
|
2139
|
-
let
|
|
2170
|
+
L.current = () => Object.entries(q).forEach(([e, t]) => j?.(e, t));
|
|
2171
|
+
let ie = n(() => {
|
|
2140
2172
|
try {
|
|
2141
|
-
|
|
2173
|
+
D(!0), Object.entries(q).forEach(([e, t]) => A(e, t)), O();
|
|
2142
2174
|
} catch (e) {
|
|
2143
|
-
|
|
2175
|
+
G(e);
|
|
2144
2176
|
}
|
|
2145
2177
|
}, [
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2178
|
+
q,
|
|
2179
|
+
A,
|
|
2180
|
+
O,
|
|
2181
|
+
G
|
|
2150
2182
|
]), ae = () => {
|
|
2151
|
-
!
|
|
2183
|
+
!h && g && (T.current.style.outline = g);
|
|
2152
2184
|
}, oe = () => {
|
|
2153
|
-
!
|
|
2185
|
+
!h && g && (T.current.style.outline = "none");
|
|
2154
2186
|
};
|
|
2155
|
-
return
|
|
2187
|
+
return N.isSupported ? ee(r) ? r(ie, V, E) : t(r) ? e(r, { ...!E && { onClick: ie } }) : /* @__PURE__ */ (0, $.jsx)("button", {
|
|
2156
2188
|
"data-testid": "__vocal-root__",
|
|
2157
|
-
ref:
|
|
2189
|
+
ref: T,
|
|
2158
2190
|
role: "button",
|
|
2159
|
-
"aria-label":
|
|
2160
|
-
style:
|
|
2191
|
+
"aria-label": p,
|
|
2192
|
+
style: h ? null : {
|
|
2161
2193
|
width: 24,
|
|
2162
2194
|
height: 24,
|
|
2163
2195
|
backgroundColor: "transparent",
|
|
2164
2196
|
border: "none",
|
|
2165
2197
|
padding: 0,
|
|
2166
|
-
cursor:
|
|
2167
|
-
...
|
|
2198
|
+
cursor: E ? "default" : "pointer",
|
|
2199
|
+
...m
|
|
2168
2200
|
},
|
|
2169
|
-
className:
|
|
2201
|
+
className: h,
|
|
2170
2202
|
onFocus: ae,
|
|
2171
2203
|
onBlur: oe,
|
|
2172
|
-
onClick:
|
|
2204
|
+
onClick: ie,
|
|
2173
2205
|
children: /* @__PURE__ */ (0, $.jsx)(ht, {
|
|
2174
|
-
isActive:
|
|
2206
|
+
isActive: E,
|
|
2175
2207
|
color: "#aaa"
|
|
2176
2208
|
})
|
|
2177
2209
|
}) : null;
|
|
2178
|
-
},
|
|
2210
|
+
}, vt = N.isSupported, yt = _t;
|
|
2179
2211
|
//#endregion
|
|
2180
|
-
export {
|
|
2212
|
+
export { yt as default, vt as isSupported, P as useVocal };
|
|
2181
2213
|
|
|
2182
2214
|
//# sourceMappingURL=index.es.js.map
|