@deepgram/sdk 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +90 -86
- package/README.md +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/alternatives.d.ts +9 -0
- package/dist/types/prerecordedTranscriptionOptions.d.ts +11 -0
- package/dist/types/summary.d.ts +17 -0
- package/package.json +1 -1
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -1,128 +1,132 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
# Code of Conduct
|
|
3
|
+
|
|
4
|
+
The Deepgram developer community is filled with amazing, clever and creative people, and we're excited for you to join us. Our goal is to create safe and inclusive spaces, have meaningful conversations, and explore ways to make sure that every voice is heard and understood.
|
|
5
|
+
|
|
6
|
+
#### Being a Good Community Member
|
|
7
|
+
|
|
8
|
+
Because we prioritize creating a safe space for our members, we believe in actively working on how we, as individuals, can ensure a positive community environment through our own actions and mindsets.
|
|
9
|
+
|
|
10
|
+
Every supportive community starts with each member. We feel it’s important to be open to others, respectful, and supportive. As part of the Deepgram community, please begin by thinking carefully about and agreeing with the following statements:
|
|
11
|
+
|
|
12
|
+
- I will be welcoming to everyone at the table;
|
|
13
|
+
- I will be patient and open to learning from everyone around me;
|
|
14
|
+
- I will treat everyone with respect, because they deserve it;
|
|
15
|
+
- I will be mindful of the needs and boundaries of others;
|
|
16
|
+
|
|
17
|
+
We strive to create a space where we learn and grow together. Here are some other key things you can do to make the community great:
|
|
18
|
+
|
|
19
|
+
### BE HUMBLE
|
|
20
|
+
|
|
21
|
+
People come from all different places, and it’s best not to make assumptions about what they think or feel. Approach others with curiosity and openness. We **all** have a lot to learn from each other.
|
|
22
|
+
|
|
23
|
+
### BE HELPFUL
|
|
24
|
+
|
|
25
|
+
If someone asks for help, consider jumping in. You don’t have to be an expert to talk through a problem, suggest a resource, or help find a solution. We all have something to contribute.
|
|
26
|
+
|
|
27
|
+
### ENCOURAGE OTHERS
|
|
28
|
+
|
|
29
|
+
There’s no one path to have a career in technology or to this community. Let’s engage others in ways that create opportunities for learning and fun for all of us.
|
|
2
30
|
|
|
3
31
|
## Our Pledge
|
|
4
32
|
|
|
5
|
-
|
|
6
|
-
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
-
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
-
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
-
and orientation.
|
|
33
|
+
Everyone who participates in our community must agree to abide by our Code of Conduct. By agreeing, you help create a welcoming, respectful, and friendly community based on respect and trust. We are committed to creating a harassment-free community.
|
|
11
34
|
|
|
12
|
-
|
|
13
|
-
diverse, inclusive, and healthy community.
|
|
35
|
+
These rules will be strictly enforced in any and all of our official spaces, including direct messages, social media, and physical and virtual events. Everyone who participates in these spaces is required to agree to this community code. We also ask and expect community members to observe these rules anywhere the community is meeting (for example, online chats on unofficial platforms or event after-parties).
|
|
14
36
|
|
|
15
37
|
## Our Standards
|
|
16
38
|
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
### BE RESPECTFUL
|
|
40
|
+
|
|
41
|
+
Exercise consideration and respect in your speech and actions. Be willing to accept and give feedback gracefully.
|
|
42
|
+
|
|
43
|
+
Don’t make offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, neuro(a)typicality, physical appearance, body size, race, ethnicity, immigration status, religion, experience level, socioeconomic status, nationality, or other identity markers.
|
|
44
|
+
|
|
45
|
+
Additionally, don’t insult or demean others. This includes making unwelcome comments about a person’s lifestyle choices and practices, including things related to diet, health, parenting, drugs, or employment. It’s not okay to insult or demean others if it’s "just a joke."
|
|
46
|
+
|
|
47
|
+
### BE WELCOMING AND OPEN
|
|
48
|
+
|
|
49
|
+
Encourage others, be supportive and willing to listen, and be willing to learn from others’ perspectives and experiences. Lead with empathy and kindness.
|
|
50
|
+
|
|
51
|
+
Don’t engage in gatekeeping behaviors, like questioning the intelligence or knowledge of others as a way to prove their credentials. And don’t exclude people for prejudicial reasons.
|
|
52
|
+
|
|
53
|
+
### RESPECT PRIVACY
|
|
54
|
+
|
|
55
|
+
Do not publish private communications without consent. Additionally, never disclose private aspects of a person’s personal identity without consent, except as necessary to protect them from intentional abuse.
|
|
56
|
+
|
|
57
|
+
### RESPECT PERSONAL BOUNDARIES
|
|
58
|
+
|
|
59
|
+
Do not introduce gratuitous or off-topic sexual images, languages, or behavior in spaces where they are not appropriate. Never make physical contact or simulated physical contact without consent or after a request to stop. Additionally, do not continue to message others about anything if they ask you to stop or leave them alone.
|
|
60
|
+
|
|
61
|
+
#### BE A GOOD NEIGHBOR
|
|
62
|
+
|
|
63
|
+
Contribute to the community in a positive and thoughtful way. Consider what’s best for the overall community. Do not make threats of violence, intimidate others, incite violence or intimidation against others, incite self-harm, stalk, follow, or otherwise harass others. Be mindful of your surroundings and of your fellow participants.
|
|
64
|
+
|
|
65
|
+
Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
|
|
66
|
+
|
|
67
|
+
# Additional rules for online spaces
|
|
68
|
+
|
|
69
|
+
For Deepgram’s official online spaces, like our YouTube & Twitch chats, we have some additional rules. Any of the following behaviors can result in a ban without warning.
|
|
70
|
+
|
|
71
|
+
### DON'T SPAM
|
|
19
72
|
|
|
20
|
-
|
|
21
|
-
- Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
-
- Giving and gracefully accepting constructive feedback
|
|
23
|
-
- Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
-
and learning from the experience
|
|
25
|
-
- Focusing on what is best not just for us as individuals, but for the
|
|
26
|
-
overall community
|
|
73
|
+
Don't spam. We'll ban you.
|
|
27
74
|
|
|
28
|
-
|
|
75
|
+
### KEEP IT LEGAL
|
|
29
76
|
|
|
30
|
-
|
|
31
|
-
advances of any kind
|
|
32
|
-
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
-
- Public or private harassment
|
|
34
|
-
- Publishing others' private information, such as a physical or email
|
|
35
|
-
address, without their explicit permission
|
|
36
|
-
- Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
-
professional setting
|
|
77
|
+
If it’s illegal, it’s not allowed on our websites or in our online spaces. Please don’t share links to pirated material or other nefarious things.
|
|
38
78
|
|
|
39
|
-
|
|
79
|
+
### NO TROLLING
|
|
40
80
|
|
|
41
|
-
|
|
42
|
-
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
-
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
-
or harmful.
|
|
81
|
+
Please be earnest. Don’t use excessive sarcasm to annoy or undermine other people. And don’t bait them with bad faith comments or abuse.
|
|
45
82
|
|
|
46
|
-
|
|
47
|
-
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
-
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
-
decisions when appropriate.
|
|
83
|
+
### PORNOGRAPHY AND OTHER NSFW STUFF
|
|
50
84
|
|
|
51
|
-
|
|
85
|
+
Please don’t post it or link to it. It doesn’t belong in our online spaces.
|
|
52
86
|
|
|
53
|
-
|
|
54
|
-
an individual is officially representing the community in public spaces.
|
|
55
|
-
Examples of representing our community include using an official e-mail address,
|
|
56
|
-
posting via an official social media account, or acting as an appointed
|
|
57
|
-
representative at an online or offline event.
|
|
87
|
+
### FOUL AND GRAPHIC LANGUAGE
|
|
58
88
|
|
|
59
|
-
|
|
89
|
+
Please do not use excessive curse words. Additionally, do not use graphic sexual or violent language — again, think of our spaces as places for people of all ages.
|
|
60
90
|
|
|
61
|
-
|
|
62
|
-
reported to the community leaders responsible for enforcement at
|
|
63
|
-
devrel@deepgram.com.
|
|
64
|
-
All complaints will be reviewed and investigated promptly and fairly.
|
|
91
|
+
# Enforcement & Reporting
|
|
65
92
|
|
|
66
|
-
|
|
67
|
-
reporter of any incident.
|
|
93
|
+
If you are being harassed by a member of the Deepgram developer community, if you observe someone else being harassed, or you experience actions or behaviors that are contrary to our Code of Conduct, please report the behavior using our [Code of Conduct Report Form](https://developers.deepgram.com/code-of-conduct/report-form/).
|
|
68
94
|
|
|
69
95
|
## Enforcement Guidelines
|
|
70
96
|
|
|
71
|
-
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
-
the consequences for any action they deem in violation of this Code of Conduct:
|
|
97
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
98
|
|
|
74
99
|
### 1. Correction
|
|
75
100
|
|
|
76
|
-
**
|
|
77
|
-
unprofessional or unwelcome in the community.
|
|
101
|
+
**_Community Impact:_** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
78
102
|
|
|
79
|
-
**
|
|
80
|
-
clarity around the nature of the violation and an explanation of why the
|
|
81
|
-
behavior was inappropriate. A public apology may be requested.
|
|
103
|
+
**_Consequence:_** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
82
104
|
|
|
83
105
|
### 2. Warning
|
|
84
106
|
|
|
85
|
-
**
|
|
86
|
-
of actions.
|
|
107
|
+
**_Community Impact:_** A violation through a single incident or series of actions.
|
|
87
108
|
|
|
88
|
-
**
|
|
89
|
-
interaction with the people involved, including unsolicited interaction with
|
|
90
|
-
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
-
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
-
like social media. Violating these terms may lead to a temporary or
|
|
93
|
-
permanent ban.
|
|
109
|
+
**_Consequence:_** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
94
110
|
|
|
95
111
|
### 3. Temporary Ban
|
|
96
112
|
|
|
97
|
-
**
|
|
98
|
-
sustained inappropriate behavior.
|
|
113
|
+
**_Community Impact:_** A serious violation of community standards, including sustained inappropriate behavior.
|
|
99
114
|
|
|
100
|
-
**
|
|
101
|
-
communication with the community for a specified period of time. No public or
|
|
102
|
-
private interaction with the people involved, including unsolicited interaction
|
|
103
|
-
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
-
Violating these terms may lead to a permanent ban.
|
|
115
|
+
**_Consequence:_** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
105
116
|
|
|
106
117
|
### 4. Permanent Ban
|
|
107
118
|
|
|
108
|
-
**
|
|
109
|
-
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
-
individual, or aggression toward or disparagement of classes of individuals.
|
|
119
|
+
**_Community Impact:_** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
111
120
|
|
|
112
|
-
**
|
|
113
|
-
the community.
|
|
121
|
+
**_Consequence:_** A permanent ban from any sort of public interaction within the community.
|
|
114
122
|
|
|
115
|
-
|
|
123
|
+
# Attribution
|
|
116
124
|
|
|
117
|
-
This Code of Conduct is adapted from
|
|
118
|
-
version 2.0, available at
|
|
119
|
-
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
125
|
+
This Code of Conduct is adapted from:
|
|
120
126
|
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
- Contributor Covenant, version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct
|
|
128
|
+
- https://eventhandler.community/conduct/, which itself is inspired by Quest, who in turn provides credit to Scripto, the #botALLY Code of Conduct, the LGBTQ in Tech code of Conduct, and the XOXO Code of Conduct.
|
|
123
129
|
|
|
124
|
-
|
|
130
|
+
Community Impact Guidelines, which were copied from InnerSource Commons, were inspired by Mozilla’s code of conduct enforcement ladder.
|
|
125
131
|
|
|
126
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
-
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
-
https://www.contributor-covenant.org/translations.
|
|
132
|
+
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
package/README.md
CHANGED
|
@@ -141,7 +141,7 @@ We love to hear from you so if you have questions, comments or find a bug in the
|
|
|
141
141
|
project, let us know! You can either:
|
|
142
142
|
|
|
143
143
|
- [Open an issue](https://github.com/deepgram/node-sdk/issues/new) on this repository
|
|
144
|
-
- Tweet at us! We're [@
|
|
144
|
+
- Tweet at us! We're [@DeepgramAI on Twitter](https://twitter.com/DeepgramAI)
|
|
145
145
|
|
|
146
146
|
## Further Reading
|
|
147
147
|
|
package/dist/browser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t={587:t=>{function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,i,n,r){i=i||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(i);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var c=t.length;o>0&&c>o&&(c=o);for(var h=0;h<c;++h){var u,l,p,d,v=t[h].replace(a,"%20"),f=v.indexOf(n);f>=0?(u=v.substr(0,f),l=v.substr(f+1)):(u=v,l=""),p=decodeURIComponent(u),d=decodeURIComponent(l),e(s,p)?Array.isArray(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s}},361:t=>{var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,i,n,r){return i=i||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){var s=encodeURIComponent(e(r))+n;return Array.isArray(t[r])?t[r].map((function(t){return s+encodeURIComponent(e(t))})).join(i):s+encodeURIComponent(e(t[r]))})).join(i):r?encodeURIComponent(e(r))+n+encodeURIComponent(e(t)):""}},673:(t,e,i)=>{e.decode=e.parse=i(587),e.encode=e.stringify=i(361)}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};(()=>{i.d(n,{X:()=>U});var t=i(673);function e(t){return new Date(1e3*t).toISOString().substr(11,12)}class r{toWebVTT(){var t,i,n,r;if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let s="WEBVTT\n\n";s+=`NOTE\nTranscription provided by Deepgram\nRequest Id: ${null===(t=this.metadata)||void 0===t?void 0:t.request_id}\nCreated: ${null===(i=this.metadata)||void 0===i?void 0:i.created}\nDuration: ${null===(n=this.metadata)||void 0===n?void 0:n.duration}\nChannels: ${null===(r=this.metadata)||void 0===r?void 0:r.channels}\n\n`;for(let t=0;t<this.results.utterances.length;t++){const i=this.results.utterances[t];s+=`${t+1}\n${e(i.start)} --\x3e ${e(i.end)}\n- ${i.transcript}\n\n`}return s}toSRT(){if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let t="";for(let i=0;i<this.results.utterances.length;i++){const n=this.results.utterances[i];t+=`${i+1}\n${e(n.start).replace(".",",")} --\x3e ${e(n.end).replace(".",",")}\n${n.transcript}\n\n`}return t}}function s(){let t="@deepgram/sdk/UNKNOWN node/UNKNOWN";try{t=`@deepgram/sdk/1.7.0 node/${process.version.replace("v","")}`}catch(t){console.warn("Could not load package details")}return t}function a(t,e,i,n,r){return a=this,o=void 0,h=function*(){const a=`https://${i}${n}`;try{const i=yield fetch(a,{method:t,headers:{Authorization:`token ${e}`,"Content-Type":"application/json","X-DG-Agent":s()},body:r});let n;if(!i.ok)throw n=yield i.json(),new Error(`${n.err_code}: ${n.err_msg}`);return n=yield i.json(),n}catch(t){throw`DG: ${t}`}},new((c=void 0)||(c=Promise))((function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof c?r:new c((function(t){t(r)}))).then(i,n)}r((h=h.apply(a,o||[])).next())}));var a,o,c,h}class o{constructor(t,e){this._credentials=t,this._apiUrl=e}preRecorded(e,i){return n=this,s=void 0,c=function*(){return yield((e,i,n,s)=>{return o=void 0,c=void 0,u=function*(){const o=Object.assign({},s);if(!n.url)throw new Error("DG: Source must be a URL string");const c=JSON.stringify(n),h=yield a("POST",e,i,`/v1/listen?${t.stringify(o)}`,c);return Object.assign(new r,h)},new((h=void 0)||(h=Promise))((function(t,e){function i(t){try{r(u.next(t))}catch(t){e(t)}}function n(t){try{r(u.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof h?r:new h((function(t){t(r)}))).then(i,n)}r((u=u.apply(o,c||[])).next())}));var o,c,h,u})(this._credentials,this._apiUrl||"",e,i)},new((o=void 0)||(o=Promise))((function(t,e){function i(t){try{a(c.next(t))}catch(t){e(t)}}function r(t){try{a(c.throw(t))}catch(t){e(t)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,r)}a((c=c.apply(n,s||[])).next())}));var n,s,o,c}live(e){return new WebSocket(`wss://${this._apiUrl}/v1/listen?${t.stringify(e)}`,["token",this._credentials])}}var c=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class h{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,this.apiPath)}))}get(t){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}`)}))}update(t,e){return c(this,void 0,void 0,(function*(){return this._request("PATCH",this._credentials,this._apiUrl,`${this.apiPath}/${t.project_id}`,JSON.stringify(e))}))}}var u=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class l{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return u(this,void 0,void 0,(function*(){return{api_keys:(yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`)).api_keys.map((t=>Object.assign(Object.assign({},t),t.api_key)))}}))}get(t,e){return u(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}create(t,e,i,n){return u(this,void 0,void 0,(function*(){if(n&&void 0!==n.expirationDate&&void 0!==n.timeToLive)throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`,JSON.stringify({comment:e,scopes:i,expiration_date:n&&n.expirationDate?n.expirationDate:void 0,time_to_live_in_seconds:n&&n.timeToLive?n.timeToLive:void 0}))}))}delete(t,e){return u(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}}var p=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class d{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listRequests(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests?${t.stringify(n)}`)}))}getRequest(t,e){return p(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/requests/${e}`)}))}getUsage(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage?${t.stringify(n)}`)}))}getFields(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage/fields?${t.stringify(n)}`)}))}}var v=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class f{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listMembers(t){return v(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members`)}))}removeMember(t,e){return v(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}`)}))}}var _=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class y{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return _(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`)}))}send(t,e){return _(this,void 0,void 0,(function*(){return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`,JSON.stringify({email:e.email,scope:e.scope}))}))}leave(t){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/leave`)}))}delete(t,e){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites/${e}`)}))}}var $=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class w{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listBalances(t){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances`)}))}getBalance(t,e){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances/${e}`)}))}}var m=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class g{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}get(t,e){return m(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`)}))}update(t,e,i){return m(this,void 0,void 0,(function*(){return this._request("PUT",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`,JSON.stringify({scope:i}))}))}}class U{constructor(t,e){this._apiKey=t,this._apiUrl=e||"api.deepgram.com",function(t,e){if(!t||0===t.trim().length)throw new Error("DG: API key is required");if(!e||0===e.trim().length)throw new Error("DG: API url should be a valid url or not provided")}(this._apiKey,this._apiUrl),this.transcription=new o(this._apiKey,this._apiUrl),this.projects=new h(this._apiKey,this._apiUrl,a),this.keys=new l(this._apiKey,this._apiUrl,a),this.usage=new d(this._apiKey,this._apiUrl,a),this.members=new f(this._apiKey,this._apiUrl,a),this.invitation=new y(this._apiKey,this._apiUrl,a),this.billing=new w(this._apiKey,this._apiUrl,a),this.scopes=new g(this._apiKey,this._apiUrl,a)}}})();var r=n.X;export{r as Deepgram};
|
|
1
|
+
var t={587:t=>{function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,i,n,r){i=i||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(i);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var c=t.length;o>0&&c>o&&(c=o);for(var h=0;h<c;++h){var u,l,p,d,v=t[h].replace(a,"%20"),f=v.indexOf(n);f>=0?(u=v.substr(0,f),l=v.substr(f+1)):(u=v,l=""),p=decodeURIComponent(u),d=decodeURIComponent(l),e(s,p)?Array.isArray(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s}},361:t=>{var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,i,n,r){return i=i||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){var s=encodeURIComponent(e(r))+n;return Array.isArray(t[r])?t[r].map((function(t){return s+encodeURIComponent(e(t))})).join(i):s+encodeURIComponent(e(t[r]))})).join(i):r?encodeURIComponent(e(r))+n+encodeURIComponent(e(t)):""}},673:(t,e,i)=>{e.decode=e.parse=i(587),e.encode=e.stringify=i(361)}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};(()=>{i.d(n,{X:()=>U});var t=i(673);function e(t){return new Date(1e3*t).toISOString().substr(11,12)}class r{toWebVTT(){var t,i,n,r;if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let s="WEBVTT\n\n";s+=`NOTE\nTranscription provided by Deepgram\nRequest Id: ${null===(t=this.metadata)||void 0===t?void 0:t.request_id}\nCreated: ${null===(i=this.metadata)||void 0===i?void 0:i.created}\nDuration: ${null===(n=this.metadata)||void 0===n?void 0:n.duration}\nChannels: ${null===(r=this.metadata)||void 0===r?void 0:r.channels}\n\n`;for(let t=0;t<this.results.utterances.length;t++){const i=this.results.utterances[t];s+=`${t+1}\n${e(i.start)} --\x3e ${e(i.end)}\n- ${i.transcript}\n\n`}return s}toSRT(){if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let t="";for(let i=0;i<this.results.utterances.length;i++){const n=this.results.utterances[i];t+=`${i+1}\n${e(n.start).replace(".",",")} --\x3e ${e(n.end).replace(".",",")}\n${n.transcript}\n\n`}return t}}function s(){let t="@deepgram/sdk/UNKNOWN node/UNKNOWN";try{t=`@deepgram/sdk/1.9.0 node/${process.version.replace("v","")}`}catch(t){console.warn("Could not load package details")}return t}function a(t,e,i,n,r){return a=this,o=void 0,h=function*(){const a=`https://${i}${n}`;try{const i=yield fetch(a,{method:t,headers:{Authorization:`token ${e}`,"Content-Type":"application/json","X-DG-Agent":s()},body:r});let n;if(!i.ok)throw n=yield i.json(),new Error(`${n.err_code}: ${n.err_msg}`);return n=yield i.json(),n}catch(t){throw`DG: ${t}`}},new((c=void 0)||(c=Promise))((function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof c?r:new c((function(t){t(r)}))).then(i,n)}r((h=h.apply(a,o||[])).next())}));var a,o,c,h}class o{constructor(t,e){this._credentials=t,this._apiUrl=e}preRecorded(e,i){return n=this,s=void 0,c=function*(){return yield((e,i,n,s)=>{return o=void 0,c=void 0,u=function*(){const o=Object.assign({},s);if(!n.url)throw new Error("DG: Source must be a URL string");const c=JSON.stringify(n),h=yield a("POST",e,i,`/v1/listen?${t.stringify(o)}`,c);return Object.assign(new r,h)},new((h=void 0)||(h=Promise))((function(t,e){function i(t){try{r(u.next(t))}catch(t){e(t)}}function n(t){try{r(u.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof h?r:new h((function(t){t(r)}))).then(i,n)}r((u=u.apply(o,c||[])).next())}));var o,c,h,u})(this._credentials,this._apiUrl||"",e,i)},new((o=void 0)||(o=Promise))((function(t,e){function i(t){try{a(c.next(t))}catch(t){e(t)}}function r(t){try{a(c.throw(t))}catch(t){e(t)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,r)}a((c=c.apply(n,s||[])).next())}));var n,s,o,c}live(e){return new WebSocket(`wss://${this._apiUrl}/v1/listen?${t.stringify(e)}`,["token",this._credentials])}}var c=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class h{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,this.apiPath)}))}get(t){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}`)}))}update(t,e){return c(this,void 0,void 0,(function*(){return this._request("PATCH",this._credentials,this._apiUrl,`${this.apiPath}/${t.project_id}`,JSON.stringify(e))}))}}var u=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class l{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return u(this,void 0,void 0,(function*(){return{api_keys:(yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`)).api_keys.map((t=>Object.assign(Object.assign({},t),t.api_key)))}}))}get(t,e){return u(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}create(t,e,i,n){return u(this,void 0,void 0,(function*(){if(n&&void 0!==n.expirationDate&&void 0!==n.timeToLive)throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`,JSON.stringify({comment:e,scopes:i,expiration_date:n&&n.expirationDate?n.expirationDate:void 0,time_to_live_in_seconds:n&&n.timeToLive?n.timeToLive:void 0}))}))}delete(t,e){return u(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}}var p=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class d{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listRequests(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests?${t.stringify(n)}`)}))}getRequest(t,e){return p(this,void 0,void 0,(function*(){return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/requests/${e}`)}))}getUsage(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage?${t.stringify(n)}`)}))}getFields(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage/fields?${t.stringify(n)}`)}))}}var v=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class f{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listMembers(t){return v(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members`)}))}removeMember(t,e){return v(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}`)}))}}var _=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class y{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return _(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`)}))}send(t,e){return _(this,void 0,void 0,(function*(){return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`,JSON.stringify({email:e.email,scope:e.scope}))}))}leave(t){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/leave`)}))}delete(t,e){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites/${e}`)}))}}var $=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class w{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listBalances(t){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances`)}))}getBalance(t,e){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances/${e}`)}))}}var m=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class g{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}get(t,e){return m(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`)}))}update(t,e,i){return m(this,void 0,void 0,(function*(){return this._request("PUT",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`,JSON.stringify({scope:i}))}))}}class U{constructor(t,e){this._apiKey=t,this._apiUrl=e||"api.deepgram.com",function(t,e){if(!t||0===t.trim().length)throw new Error("DG: API key is required");if(!e||0===e.trim().length)throw new Error("DG: API url should be a valid url or not provided")}(this._apiKey,this._apiUrl),this.transcription=new o(this._apiKey,this._apiUrl),this.projects=new h(this._apiKey,this._apiUrl,a),this.keys=new l(this._apiKey,this._apiUrl,a),this.usage=new d(this._apiKey,this._apiUrl,a),this.members=new f(this._apiKey,this._apiUrl,a),this.invitation=new y(this._apiKey,this._apiUrl,a),this.billing=new w(this._apiKey,this._apiUrl,a),this.scopes=new g(this._apiKey,this._apiUrl,a)}}})();var r=n.X;export{r as Deepgram};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["dg-node-sdk"]=t():e["dg-node-sdk"]=t()}(global,(()=>(()=>{var e={343:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Billing:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}listBalances(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/balances`)}))}getBalance(e,t){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/balances/${t}`)}))}}},986:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DefaultOptions:()=>s});const s={apiUrl:"api.deepgram.com"}},344:(e,t,r)=>{"use strict";var s;r.r(t),r.d(t,{ConnectionState:()=>s}),function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(s||(s={}))},298:(e,t,r)=>{"use strict";r.r(t),r.d(t,{secondsToTimestamp:()=>s.k,validateOptions:()=>i});var s=r(489);function i(e,t){if(!e||0===e.trim().length)throw new Error("DG: API key is required");if(!t||0===t.trim().length)throw new Error("DG: API url should be a valid url or not provided")}},489:(e,t,r)=>{"use strict";function s(e){return new Date(1e3*e).toISOString().substr(11,12)}r.d(t,{k:()=>s})},98:function(e,t,r){"use strict";var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t._request=void 0;var i=r(781),n=r(687),o=r(408);t._request=function(e,t,r,a,c,h){var l=function(e,t,r,n,a,c){var h={};!a||a instanceof i.Readable||(h["Content-Length"]=Buffer.byteLength(a));var l={host:t,path:r,method:n,headers:s({"User-Agent":(0,o.userAgent)(),"Content-Type":"application/json",Authorization:"token ".concat(e)},h)},u=l.headers;return c&&c.headers&&(u=s(s({},u),c.headers)),s(s(s({},l),c),{headers:u})}(t,r,a,e,c,h);return new Promise((function(e,t){try{var r=(0,n.request)(l,(function(r){var s="";r.on("data",(function(e){s+=e})),r.on("end",(function(){var i;try{i=JSON.parse(s)}catch(e){i={error:s}}r.statusCode&&r.statusCode>=400&&t("DG: ".concat(i.err_code,": ").concat(i.err_msg)),i.error&&t("DG: ".concat(s)),e(i)})),r.on("error",(function(e){t("DG: ".concat(e))}))}));r.on("error",(function(e){t("DG: ".concat(e))})),c?c instanceof i.Readable?(c.pipe(r),c.on("finish",(function(){r.end()}))):(r.write(c),r.end()):r.end()}catch(e){t("DG: ".concat(e))}}))}},359:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Invitation:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}list(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/invites`)}))}send(e,t){return s(this,void 0,void 0,(function*(){return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${e}/invites`,JSON.stringify({email:t.email,scope:t.scope}))}))}leave(e){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/leave`)}))}delete(e,t){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/invites/${t}`)}))}}},292:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Keys:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}list(e){return s(this,void 0,void 0,(function*(){return{api_keys:(yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys`)).api_keys.map((e=>Object.assign(Object.assign({},e),e.api_key)))}}))}get(e,t){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys/${t}`)}))}create(e,t,r,i){return s(this,void 0,void 0,(function*(){if(i&&void 0!==i.expirationDate&&void 0!==i.timeToLive)throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys`,JSON.stringify({comment:t,scopes:r,expiration_date:i&&i.expirationDate?i.expirationDate:void 0,time_to_live_in_seconds:i&&i.timeToLive?i.timeToLive:void 0}))}))}delete(e,t){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys/${t}`)}))}}},949:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Members:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}listMembers(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members`)}))}removeMember(e,t){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members/${t}`)}))}}},319:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Projects:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}list(){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,this.apiPath)}))}get(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}`)}))}update(e,t){return s(this,void 0,void 0,(function*(){return this._request("PATCH",this._credentials,this._apiUrl,`${this.apiPath}/${e.project_id}`,JSON.stringify(t))}))}}},647:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Scopes:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}get(e,t){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members/${t}/scopes`)}))}update(e,t,r){return s(this,void 0,void 0,(function*(){return this._request("PUT",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members/${t}/scopes`,JSON.stringify({scope:r}))}))}}},487:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,s,i,n,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,s&&(i=2&n[0]?s.return:n[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,n[1])).done)return i;switch(s=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,s=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){o.label=n[1];break}if(6===n[0]&&o.label<i[1]){o.label=i[1],i=n;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(n);break}i[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e],s=0}finally{r=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Transcriber=void 0;var n=r(379),o=r(825),a=function(){function e(e,t){this._credentials=e,this._apiUrl=t}return e.prototype.preRecorded=function(e,t){return s(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,(0,o.preRecordedTranscription)(this._credentials,this._apiUrl||"",e,t)];case 1:return[2,r.sent()]}}))}))},e.prototype.live=function(e){return new n.LiveTranscription(this._credentials,this._apiUrl||"",e)},e}();t.Transcriber=a},379:function(e,t,r){"use strict";var s,i=this&&this.__extends||(s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},s(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LiveTranscription=void 0;var o=n(r(361)),a=n(r(477)),c=n(r(777)),h=r(344),l=r(408),u=function(e){function t(t,r,s){var i=e.call(this,void 0)||this;return i._socket=new c.default("wss://".concat(r,"/v1/listen?").concat(a.default.stringify(s)),{headers:{Authorization:"token ".concat(t),"User-Agent":(0,l.userAgent)()}}),i._bindSocketEvents(),i}return i(t,e),t.prototype._bindSocketEvents=function(){var e=this;this._socket.onopen=function(){e.emit("open",e)},this._socket.onclose=function(t){e.emit("close",t)},this._socket.onerror=function(t){e.emit("error",t)},this._socket.onmessage=function(t){e.emit("transcriptReceived",t.data)}},t.prototype.getReadyState=function(){return this._socket.readyState},t.prototype.send=function(e){this._socket.readyState===h.ConnectionState.OPEN?this._socket.send(e):this.emit("error","Could not send. Connection not open.")},t.prototype.finish=function(){this._socket.send(new Uint8Array(0))},t}(o.default);t.LiveTranscription=u},825:function(e,t,r){"use strict";var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,s,i,n,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,s&&(i=2&n[0]?s.return:n[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,n[1])).done)return i;switch(s=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,s=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){o.label=n[1];break}if(6===n[0]&&o.label<i[1]){o.label=i[1],i=n;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(n);break}i[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e],s=0}finally{r=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.preRecordedTranscription=void 0;var a=o(r(477)),c=r(970),h=r(98);function l(e){return!!e.url}t.preRecordedTranscription=function(e,t,r,o){return i(void 0,void 0,void 0,(function(){var i,u,d,f;return n(this,(function(n){switch(n.label){case 0:if(i=s({},o),!l(r)&&(void 0===r.mimetype||0===r.mimetype.length))throw new Error("DG: Mimetype must be provided if the source is a Buffer or a Readable");if(l(r))u=JSON.stringify(r);else if(r.buffer)u=r.buffer;else{if(!r.stream)throw new Error("Unknown TranscriptionSource type");u=r.stream}return d={},l(r)||(d.headers={"Content-Type":r.mimetype}),[4,(0,h._request)("POST",e,t,"/v1/listen?".concat(a.default.stringify(i)),u,d)];case 1:return f=n.sent(),[2,Object.assign(new c.PrerecordedTranscriptionResponse,f)]}}))}))}},970:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PrerecordedTranscriptionResponse:()=>i});var s=r(489);class i{toWebVTT(){var e,t,r,i;if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let n="WEBVTT\n\n";n+=`NOTE\nTranscription provided by Deepgram\nRequest Id: ${null===(e=this.metadata)||void 0===e?void 0:e.request_id}\nCreated: ${null===(t=this.metadata)||void 0===t?void 0:t.created}\nDuration: ${null===(r=this.metadata)||void 0===r?void 0:r.duration}\nChannels: ${null===(i=this.metadata)||void 0===i?void 0:i.channels}\n\n`;for(let e=0;e<this.results.utterances.length;e++){const t=this.results.utterances[e];n+=`${e+1}\n${(0,s.k)(t.start)} --\x3e ${(0,s.k)(t.end)}\n- ${t.transcript}\n\n`}return n}toSRT(){if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let e="";for(let t=0;t<this.results.utterances.length;t++){const r=this.results.utterances[t];e+=`${t+1}\n${(0,s.k)(r.start).replace(".",",")} --\x3e ${(0,s.k)(r.end).replace(".",",")}\n${r.transcript}\n\n`}return e}}},321:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Usage:()=>o});var s=r(477),i=r.n(s),n=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class o{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}listRequests(e,t){return n(this,void 0,void 0,(function*(){const r=Object.assign({},t);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests?${i().stringify(r)}`)}))}getRequest(e,t){return n(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests/${t}`)}))}getUsage(e,t){return n(this,void 0,void 0,(function*(){const r=Object.assign({},t);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage?${i().stringify(r)}`)}))}getFields(e,t){return n(this,void 0,void 0,(function*(){const r=Object.assign({},t);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage/fields?${i().stringify(r)}`)}))}}},408:(e,t,r)=>{"use strict";function s(){let e="@deepgram/sdk/UNKNOWN node/UNKNOWN";try{e=`@deepgram/sdk/1.7.0 node/${process.version.replace("v","")}`}catch(e){console.warn("Could not load package details")}return e}r.r(t),r.d(t,{userAgent:()=>s})},376:e=>{"use strict";e.exports={mask:(e,t,r,s,i)=>{for(var n=0;n<i;n++)r[s+n]=e[n]^t[3&n]},unmask:(e,t)=>{const r=e.length;for(var s=0;s<r;s++)e[s]^=t[3&s]}}},891:(e,t,r)=>{"use strict";try{e.exports=r(516)(__dirname)}catch(t){e.exports=r(376)}},516:(e,t,r)=>{var s=r(147),i=r(17),n=r(37),o=require,a=process.config&&process.config.variables||{},c=!!process.env.PREBUILDS_ONLY,h=process.versions.modules,l=process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":"node",u=n.arch(),d=n.platform(),f=process.env.LIBC||(function(e){return"linux"===e&&s.existsSync("/etc/alpine-release")}(d)?"musl":"glibc"),_=process.env.ARM_VERSION||("arm64"===u?"8":a.arm_version)||"",p=(process.versions.uv||"").split(".")[0];function v(e){return o(v.path(e))}function m(e){try{return s.readdirSync(e)}catch(e){return[]}}function y(e,t){var r=m(e).filter(t);return r[0]&&i.join(e,r[0])}function g(e){return/\.node$/.test(e)}function b(e){var t=e.split("-");if(2===t.length){var r=t[0],s=t[1].split("+");if(r&&s.length&&s.every(Boolean))return{name:e,platform:r,architectures:s}}}function w(e,t){return function(r){return null!=r&&r.platform===e&&r.architectures.includes(t)}}function S(e,t){return e.architectures.length-t.architectures.length}function E(e){var t=e.split("."),r={file:e,specificity:0};if("node"===t.pop()){for(var s=0;s<t.length;s++){var i=t[s];if("node"===i||"electron"===i||"node-webkit"===i)r.runtime=i;else if("napi"===i)r.napi=!0;else if("abi"===i.slice(0,3))r.abi=i.slice(3);else if("uv"===i.slice(0,2))r.uv=i.slice(2);else if("armv"===i.slice(0,4))r.armv=i.slice(4);else{if("glibc"!==i&&"musl"!==i)continue;r.libc=i}r.specificity++}return r}}function x(e,t){return function(r){return!(null==r||r.runtime!==e&&!function(e){return"node"===e.runtime&&e.napi}(r)||r.abi!==t&&!r.napi||r.uv&&r.uv!==p||r.armv&&r.armv!==_||r.libc&&r.libc!==f)}}function k(e){return function(t,r){return t.runtime!==r.runtime?t.runtime===e?-1:1:t.abi!==r.abi?t.abi?-1:1:t.specificity!==r.specificity?t.specificity>r.specificity?-1:1:0}}e.exports=v,v.path=function(e){e=i.resolve(e||".");try{var t=o(i.join(e,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[t+"_PREBUILD"]&&(e=process.env[t+"_PREBUILD"])}catch(e){}if(!c){var r=y(i.join(e,"build/Release"),g);if(r)return r;var s=y(i.join(e,"build/Debug"),g);if(s)return s}var n=O(e);if(n)return n;var a=O(i.dirname(process.execPath));if(a)return a;var v=["platform="+d,"arch="+u,"runtime="+l,"abi="+h,"uv="+p,_?"armv="+_:"","libc="+f,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"","webpack=true"].filter(Boolean).join(" ");throw new Error("No native build was found for "+v+"\n loaded from: "+e+"\n");function O(e){var t=m(i.join(e,"prebuilds")).map(b).filter(w(d,u)).sort(S)[0];if(t){var r=i.join(e,"prebuilds",t.name),s=m(r).map(E).filter(x(l,h)).sort(k(l))[0];return s?i.join(r,s.file):void 0}}},v.parseTags=E,v.matchTags=x,v.compareTags=k,v.parseTuple=b,v.matchTuple=w,v.compareTuples=S},137:e=>{"use strict";e.exports=function(e){const t=e.length;let r=0;for(;r<t;)if(0==(128&e[r]))r++;else if(192==(224&e[r])){if(r+1===t||128!=(192&e[r+1])||192==(254&e[r]))return!1;r+=2}else if(224==(240&e[r])){if(r+2>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0}},311:(e,t,r)=>{"use strict";try{e.exports=r(516)(__dirname)}catch(t){e.exports=r(137)}},777:(e,t,r)=>{"use strict";const s=r(762);s.createWebSocketStream=r(30),s.Server=r(284),s.Receiver=r(957),s.Sender=r(330),e.exports=s},977:(e,t,r)=>{"use strict";const{EMPTY_BUFFER:s}=r(872);function i(e,t){if(0===e.length)return s;if(1===e.length)return e[0];const r=Buffer.allocUnsafe(t);let i=0;for(let t=0;t<e.length;t++){const s=e[t];r.set(s,i),i+=s.length}return i<t?r.slice(0,i):r}function n(e,t,r,s,i){for(let n=0;n<i;n++)r[s+n]=e[n]^t[3&n]}function o(e,t){const r=e.length;for(let s=0;s<r;s++)e[s]^=t[3&s]}function a(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=Buffer.from(e):ArrayBuffer.isView(e)?t=Buffer.from(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}try{const t=r(891),s=t.BufferUtil||t;e.exports={concat:i,mask(e,t,r,i,o){o<48?n(e,t,r,i,o):s.mask(e,t,r,i,o)},toArrayBuffer:a,toBuffer:c,unmask(e,t){e.length<32?o(e,t):s.unmask(e,t)}}}catch(t){e.exports={concat:i,mask:n,toArrayBuffer:a,toBuffer:c,unmask:o}}},872:e=>{"use strict";e.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),EMPTY_BUFFER:Buffer.alloc(0),NOOP:()=>{}}},62:e=>{"use strict";class t{constructor(e,t){this.target=t,this.type=e}}class r extends t{constructor(e,t){super("message",t),this.data=e}}class s extends t{constructor(e,t,r){super("close",r),this.wasClean=r._closeFrameReceived&&r._closeFrameSent,this.reason=t,this.code=e}}class i extends t{constructor(e){super("open",e)}}class n extends t{constructor(e,t){super("error",t),this.message=e.message,this.error=e}}const o={addEventListener(e,t,o){if("function"!=typeof t)return;function a(e){t.call(this,new r(e,this))}function c(e,r){t.call(this,new s(e,r,this))}function h(e){t.call(this,new n(e,this))}function l(){t.call(this,new i(this))}const u=o&&o.once?"once":"on";"message"===e?(a._listener=t,this[u](e,a)):"close"===e?(c._listener=t,this[u](e,c)):"error"===e?(h._listener=t,this[u](e,h)):"open"===e?(l._listener=t,this[u](e,l)):this[u](e,t)},removeEventListener(e,t){const r=this.listeners(e);for(let s=0;s<r.length;s++)r[s]!==t&&r[s]._listener!==t||this.removeListener(e,r[s])}};e.exports=o},503:e=>{"use strict";const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function r(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}e.exports={format:function(e){return Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>[t].concat(Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(e){const s=Object.create(null);if(void 0===e||""===e)return s;let i,n,o=Object.create(null),a=!1,c=!1,h=!1,l=-1,u=-1,d=0;for(;d<e.length;d++){const f=e.charCodeAt(d);if(void 0===i)if(-1===u&&1===t[f])-1===l&&(l=d);else if(32===f||9===f)-1===u&&-1!==l&&(u=d);else{if(59!==f&&44!==f)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${d}`);-1===u&&(u=d);const t=e.slice(l,u);44===f?(r(s,t,o),o=Object.create(null)):i=t,l=u=-1}}else if(void 0===n)if(-1===u&&1===t[f])-1===l&&(l=d);else if(32===f||9===f)-1===u&&-1!==l&&(u=d);else if(59===f||44===f){if(-1===l)throw new SyntaxError(`Unexpected character at index ${d}`);-1===u&&(u=d),r(o,e.slice(l,u),!0),44===f&&(r(s,i,o),o=Object.create(null),i=void 0),l=u=-1}else{if(61!==f||-1===l||-1!==u)throw new SyntaxError(`Unexpected character at index ${d}`);n=e.slice(l,d),l=u=-1}else if(c){if(1!==t[f])throw new SyntaxError(`Unexpected character at index ${d}`);-1===l?l=d:a||(a=!0),c=!1}else if(h)if(1===t[f])-1===l&&(l=d);else if(34===f&&-1!==l)h=!1,u=d;else{if(92!==f)throw new SyntaxError(`Unexpected character at index ${d}`);c=!0}else if(34===f&&61===e.charCodeAt(d-1))h=!0;else if(-1===u&&1===t[f])-1===l&&(l=d);else if(-1===l||32!==f&&9!==f){if(59!==f&&44!==f)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${d}`);-1===u&&(u=d);let t=e.slice(l,u);a&&(t=t.replace(/\\/g,""),a=!1),r(o,n,t),44===f&&(r(s,i,o),o=Object.create(null),i=void 0),n=void 0,l=u=-1}}else-1===u&&(u=d)}if(-1===l||h)throw new SyntaxError("Unexpected end of input");-1===u&&(u=d);const f=e.slice(l,u);return void 0===i?r(s,f,o):(void 0===n?r(o,f,!0):r(o,n,a?f.replace(/\\/g,""):f),r(s,i,o)),s}}},305:e=>{"use strict";const t=Symbol("kDone"),r=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[t])}}}},196:(e,t,r)=>{"use strict";const s=r(796),i=r(977),n=r(305),{kStatusCode:o,NOOP:a}=r(872),c=Buffer.from([0,0,255,255]),h=Symbol("permessage-deflate"),l=Symbol("total-length"),u=Symbol("callback"),d=Symbol("buffers"),f=Symbol("error");let _;function p(e){this[d].push(e),this[l]+=e.length}function v(e){this[l]+=e.length,this[h]._maxPayload<1||this[l]<=this[h]._maxPayload?this[d].push(e):(this[f]=new RangeError("Max payload size exceeded"),this[f].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[f][o]=1009,this.removeListener("data",v),this.reset())}function m(e){this[h]._inflate=null,e[o]=1007,this[u](e)}e.exports=class{constructor(e,t,r){if(this._maxPayload=0|r,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!_){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;_=new n(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,r=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(r.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?r.client_max_window_bits=t.clientMaxWindowBits:!0!==r.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete r.client_max_window_bits,r}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let r=e[t];if(r.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(r=r[0],"client_max_window_bits"===t){if(!0!==r){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}else if("server_max_window_bits"===t){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==r)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}e[t]=r}))})),e}decompress(e,t,r){_.add((s=>{this._decompress(e,t,((e,t)=>{s(),r(e,t)}))}))}compress(e,t,r){_.add((s=>{this._compress(e,t,((e,t)=>{s(),r(e,t)}))}))}_decompress(e,t,r){const n=this._isServer?"client":"server";if(!this._inflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=s.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[h]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on("error",m),this._inflate.on("data",v)}this._inflate[u]=r,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush((()=>{const e=this._inflate[f];if(e)return this._inflate.close(),this._inflate=null,void r(e);const s=i.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),r(null,s)}))}_compress(e,t,r){const n=this._isServer?"server":"client";if(!this._deflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=s.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on("error",a),this._deflate.on("data",p)}this._deflate[u]=r,this._deflate.write(e),this._deflate.flush(s.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=i.concat(this._deflate[d],this._deflate[l]);t&&(e=e.slice(0,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),r(null,e)}))}}},957:(e,t,r)=>{"use strict";const{Writable:s}=r(781),i=r(196),{BINARY_TYPES:n,EMPTY_BUFFER:o,kStatusCode:a,kWebSocket:c}=r(872),{concat:h,toArrayBuffer:l,unmask:u}=r(977),{isValidStatusCode:d,isValidUTF8:f}=r(746);function _(e,t,r,s,i){const n=new e(r?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(n,_),n.code=i,n[a]=s,n}e.exports=class extends s{constructor(e,t,r,s){super(),this._binaryType=e||n[0],this[c]=void 0,this._extensions=t||{},this._isServer=!!r,this._maxPayload=0|s,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,r){if(8===this._opcode&&0==this._state)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=t.slice(e),t.slice(0,e)}const t=Buffer.allocUnsafe(e);do{const r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,_(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=64==(64&e[0]);if(t&&!this._extensions[i.extensionName])return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(t)return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,_(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,_(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,_(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,_(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,_(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,_(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,_(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,_(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,_(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&u(t,this._mask)}return this._opcode>7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,((e,r)=>{if(e)return t(e);if(r.length){if(this._messageLength+=r.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(_(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(r)}const s=this.dataMessage();if(s)return t(s);this.startLoop(t)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?h(t,e):"arraybuffer"===this._binaryType?l(h(t,e)):t,this.emit("message",r)}else{const r=h(t,e);if(!f(r))return this._loop=!1,_(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r.toString())}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,""),this.end();else{if(1===e.length)return _(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!d(t))return _(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const r=e.slice(2);if(!f(r))return _(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r.toString()),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}},330:(e,t,r)=>{"use strict";r(808),r(404);const{randomFillSync:s}=r(113),i=r(196),{EMPTY_BUFFER:n}=r(872),{isValidStatusCode:o}=r(746),{mask:a,toBuffer:c}=r(977),h=Buffer.alloc(4);class l{constructor(e,t){this._extensions=t||{},this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){const r=t.mask&&t.readOnly;let i=t.mask?6:2,n=e.length;e.length>=65536?(i+=8,n=127):e.length>125&&(i+=2,n=126);const o=Buffer.allocUnsafe(r?e.length+i:i);return o[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(o[0]|=64),o[1]=n,126===n?o.writeUInt16BE(e.length,2):127===n&&(o.writeUInt32BE(0,2),o.writeUInt32BE(e.length,6)),t.mask?(s(h,0,4),o[1]|=128,o[i-4]=h[0],o[i-3]=h[1],o[i-2]=h[2],o[i-1]=h[3],r?(a(e,h,o,i,e.length),[o]):(a(e,h,e,0,e.length),[o,e])):[o,e]}close(e,t,r,s){let i;if(void 0===e)i=n;else{if("number"!=typeof e||!o(e))throw new TypeError("First argument must be a valid error code number");if(void 0===t||""===t)i=Buffer.allocUnsafe(2),i.writeUInt16BE(e,0);else{const r=Buffer.byteLength(t);if(r>123)throw new RangeError("The message must not be greater than 123 bytes");i=Buffer.allocUnsafe(2+r),i.writeUInt16BE(e,0),i.write(t,2)}}this._deflating?this.enqueue([this.doClose,i,r,s]):this.doClose(i,r,s)}doClose(e,t,r){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:8,mask:t,readOnly:!1}),r)}ping(e,t,r){const s=c(e);if(s.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,s,t,c.readOnly,r]):this.doPing(s,t,c.readOnly,r)}doPing(e,t,r,s){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:9,mask:t,readOnly:r}),s)}pong(e,t,r){const s=c(e);if(s.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,s,t,c.readOnly,r]):this.doPong(s,t,c.readOnly,r)}doPong(e,t,r,s){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:10,mask:t,readOnly:r}),s)}send(e,t,r){const s=c(e),n=this._extensions[i.extensionName];let o=t.binary?2:1,a=t.compress;if(this._firstFragment?(this._firstFragment=!1,a&&n&&(a=s.length>=n._threshold),this._compress=a):(a=!1,o=0),t.fin&&(this._firstFragment=!0),n){const e={fin:t.fin,rsv1:a,opcode:o,mask:t.mask,readOnly:c.readOnly};this._deflating?this.enqueue([this.dispatch,s,this._compress,e,r]):this.dispatch(s,this._compress,e,r)}else this.sendFrame(l.frame(s,{fin:t.fin,rsv1:!1,opcode:o,mask:t.mask,readOnly:c.readOnly}),r)}dispatch(e,t,r,s){if(!t)return void this.sendFrame(l.frame(e,r),s);const n=this._extensions[i.extensionName];this._bufferedBytes+=e.length,this._deflating=!0,n.compress(e,r.fin,((t,i)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof s&&s(e);for(let t=0;t<this._queue.length;t++){const r=this._queue[t][4];"function"==typeof r&&r(e)}}else this._bufferedBytes-=e.length,this._deflating=!1,r.readOnly=!1,this.sendFrame(l.frame(i,r),s),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[1].length,Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[1].length,this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}e.exports=l},30:(e,t,r)=>{"use strict";const{Duplex:s}=r(781);function i(e){e.emit("close")}function n(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener("error",o),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let r=!0,a=!0;function c(){r&&e._socket.resume()}e.readyState===e.CONNECTING?e.once("open",(function(){e._receiver.removeAllListeners("drain"),e._receiver.on("drain",c)})):(e._receiver.removeAllListeners("drain"),e._receiver.on("drain",c));const h=new s({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t){h.push(t)||(r=!1,e._socket.pause())})),e.once("error",(function(e){h.destroyed||(a=!1,h.destroy(e))})),e.once("close",(function(){h.destroyed||h.push(null)})),h._destroy=function(t,r){if(e.readyState===e.CLOSED)return r(t),void process.nextTick(i,h);let s=!1;e.once("error",(function(e){s=!0,r(e)})),e.once("close",(function(){s||r(t),process.nextTick(i,h)})),a&&e.terminate()},h._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),h._readableState.endEmitted&&h.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){h._final(t)}))},h._read=function(){e.readyState!==e.OPEN||r||(r=!0,e._receiver._writableState.needDrain||e._socket.resume())},h._write=function(t,r,s){e.readyState!==e.CONNECTING?e.send(t,s):e.once("open",(function(){h._write(t,r,s)}))},h.on("end",n),h.on("error",o),h}},746:(e,t,r)=>{"use strict";function s(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999}function i(e){const t=e.length;let r=0;for(;r<t;)if(0==(128&e[r]))r++;else if(192==(224&e[r])){if(r+1===t||128!=(192&e[r+1])||192==(254&e[r]))return!1;r+=2}else if(224==(240&e[r])){if(r+2>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0}try{let t=r(311);"object"==typeof t&&(t=t.Validation.isValidUTF8),e.exports={isValidStatusCode:s,isValidUTF8:e=>e.length<150?i(e):t(e)}}catch(t){e.exports={isValidStatusCode:s,isValidUTF8:i}}},284:(e,t,r)=>{"use strict";const s=r(361),i=r(685),{createHash:n}=(r(687),r(808),r(404),r(113)),o=r(196),a=r(762),{format:c,parse:h}=r(503),{GUID:l,kWebSocket:u}=r(872),d=/^[+/0-9A-Za-z]{22}==$/;function f(e){e._state=2,e.emit("close")}function _(){this.destroy()}function p(e,t,r,s){e.writable&&(r=r||i.STATUS_CODES[t],s={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...s},e.write(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(s).map((e=>`${e}: ${s[e]}`)).join("\r\n")+"\r\n\r\n"+r)),e.removeListener("error",_),e.destroy()}function v(e){return e.trim()}e.exports=class extends s{constructor(e,t){if(super(),null==(e={maxPayload:104857600,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer(((e,t)=>{const r=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":r.length,"Content-Type":"text/plain"}),t.end(r)})),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const r of Object.keys(t))e.on(r,t[r]);return function(){for(const r of Object.keys(t))e.removeListener(r,t[r])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,r,s)=>{this.handleUpgrade(t,r,s,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(e&&this.once("close",e),2===this._state)return void process.nextTick(f,this);if(1===this._state)return;if(this._state=1,this.clients)for(const e of this.clients)e.terminate();const t=this._server;t&&(this._removeListeners(),this._removeListeners=this._server=null,null!=this.options.port)?t.close(f.bind(void 0,this)):process.nextTick(f,this)}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",_);const i=void 0!==e.headers["sec-websocket-key"]&&e.headers["sec-websocket-key"].trim(),n=+e.headers["sec-websocket-version"],a={};if("GET"!==e.method||"websocket"!==e.headers.upgrade.toLowerCase()||!i||!d.test(i)||8!==n&&13!==n||!this.shouldHandle(e))return p(t,400);if(this.options.perMessageDeflate){const r=new o(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=h(e.headers["sec-websocket-extensions"]);t[o.extensionName]&&(r.accept(t[o.extensionName]),a[o.extensionName]=r)}catch(e){return p(t,400)}}if(this.options.verifyClient){const o={origin:e.headers[8===n?"sec-websocket-origin":"origin"],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,((n,o,c,h)=>{if(!n)return p(t,o||401,c,h);this.completeUpgrade(i,a,e,t,r,s)}));if(!this.options.verifyClient(o))return p(t,401)}this.completeUpgrade(i,a,e,t,r,s)}completeUpgrade(e,t,r,s,i,h){if(!s.readable||!s.writable)return s.destroy();if(s[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return p(s,503);const d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n("sha1").update(e+l).digest("base64")}`],f=new a(null);let m=r.headers["sec-websocket-protocol"];if(m&&(m=m.split(",").map(v),m=this.options.handleProtocols?this.options.handleProtocols(m,r):m[0],m&&(d.push(`Sec-WebSocket-Protocol: ${m}`),f._protocol=m)),t[o.extensionName]){const e=t[o.extensionName].params,r=c({[o.extensionName]:[e]});d.push(`Sec-WebSocket-Extensions: ${r}`),f._extensions=t}this.emit("headers",d,r),s.write(d.concat("\r\n").join("\r\n")),s.removeListener("error",_),f.setSocket(s,i,this.options.maxPayload),this.clients&&(this.clients.add(f),f.on("close",(()=>this.clients.delete(f)))),h(f,r)}}},762:(e,t,r)=>{"use strict";const s=r(361),i=r(687),n=r(685),o=r(808),a=r(404),{randomBytes:c,createHash:h}=r(113),{Readable:l}=r(781),{URL:u}=r(310),d=r(196),f=r(957),_=r(330),{BINARY_TYPES:p,EMPTY_BUFFER:v,GUID:m,kStatusCode:y,kWebSocket:g,NOOP:b}=r(872),{addEventListener:w,removeEventListener:S}=r(62),{format:E,parse:x}=r(503),{toBuffer:k}=r(977),O=["CONNECTING","OPEN","CLOSING","CLOSED"],T=[8,13];class N extends s{constructor(e,t,r){super(),this._binaryType=p[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage="",this._closeTimer=null,this._extensions={},this._protocol="",this._readyState=N.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,Array.isArray(t)?t=t.join(", "):"object"==typeof t&&null!==t&&(r=t,t=void 0),P(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){p.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get onclose(){}set onclose(e){}get onerror(){}set onerror(e){}get onopen(){}set onopen(e){}get onmessage(){}set onmessage(e){}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){const s=new f(this.binaryType,this._extensions,this._isServer,r);this._sender=new _(e,this._extensions),this._receiver=s,this._socket=e,s[g]=this,e[g]=this,s.on("conclude",$),s.on("drain",D),s.on("error",I),s.on("message",q),s.on("ping",j),s.on("pong",A),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",W),e.on("data",G),e.on("end",F),e.on("error",V),this._readyState=N.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=N.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[d.extensionName]&&this._extensions[d.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=N.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==N.CLOSED){if(this.readyState===N.CONNECTING){const e="WebSocket was closed before the connection was established";return U(this,this._req,e)}this.readyState!==N.CLOSING?(this._readyState=N.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}ping(e,t,r){if(this.readyState===N.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===N.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||v,t,r)):R(this,e,r)}pong(e,t,r){if(this.readyState===N.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===N.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||v,t,r)):R(this,e,r)}send(e,t,r){if(this.readyState===N.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(r=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==N.OPEN)return void R(this,e,r);const s={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[d.extensionName]||(s.compress=!1),this._sender.send(e||v,s,r)}terminate(){if(this.readyState!==N.CLOSED){if(this.readyState===N.CONNECTING){const e="WebSocket was closed before the connection was established";return U(this,this._req,e)}this._socket&&(this._readyState=N.CLOSING,this._socket.destroy())}}}function P(e,t,r,s){const o={protocolVersion:T[1],maxPayload:104857600,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!T.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${T.join(", ")})`);let a;t instanceof u?(a=t,e._url=t.href):(a=new u(t),e._url=t);const l="ws+unix:"===a.protocol;if(!(a.host||l&&a.pathname))throw new Error(`Invalid URL: ${e.url}`);const f="wss:"===a.protocol||"https:"===a.protocol,_=f?443:80,p=c(16).toString("base64"),v=f?i.get:n.get;let y;if(o.createConnection=f?L:C,o.defaultPort=o.defaultPort||_,o.port=a.port||_,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket",...o.headers},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(y=new d(!0!==o.perMessageDeflate?o.perMessageDeflate:{},!1,o.maxPayload),o.headers["Sec-WebSocket-Extensions"]=E({[d.extensionName]:y.offer()})),r&&(o.headers["Sec-WebSocket-Protocol"]=r),o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),l){const e=o.path.split(":");o.socketPath=e[0],o.path=e[1]}let g=e._req=v(o);o.timeout&&g.on("timeout",(()=>{U(e,g,"Opening handshake has timed out")})),g.on("error",(t=>{null===g||g.aborted||(g=e._req=null,e._readyState=N.CLOSING,e.emit("error",t),e.emitClose())})),g.on("response",(i=>{const n=i.headers.location,a=i.statusCode;if(n&&o.followRedirects&&a>=300&&a<400){if(++e._redirects>o.maxRedirects)return void U(e,g,"Maximum redirects exceeded");g.abort();const i=new u(n,t);P(e,i,r,s)}else e.emit("unexpected-response",g,i)||U(e,g,`Unexpected server response: ${i.statusCode}`)})),g.on("upgrade",((t,s,i)=>{if(e.emit("upgrade",t),e.readyState!==N.CONNECTING)return;g=e._req=null;const n=h("sha1").update(p+m).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void U(e,s,"Invalid Sec-WebSocket-Accept header");const a=t.headers["sec-websocket-protocol"],c=(r||"").split(/, */);let l;if(!r&&a?l="Server sent a subprotocol but none was requested":r&&!a?l="Server sent no subprotocol":a&&!c.includes(a)&&(l="Server sent an invalid subprotocol"),l)return void U(e,s,l);a&&(e._protocol=a);const u=t.headers["sec-websocket-extensions"];if(void 0!==u){if(!y)return void U(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");let t;try{t=x(u)}catch(t){return void U(e,s,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(t);if(r.length){if(1!==r.length||r[0]!==d.extensionName)return void U(e,s,"Server indicated an extension that was not requested");try{y.accept(t[d.extensionName])}catch(t){return void U(e,s,"Invalid Sec-WebSocket-Extensions header")}e._extensions[d.extensionName]=y}}e.setSocket(s,i,o.maxPayload)}))}function C(e){return e.path=e.socketPath,o.connect(e)}function L(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=o.isIP(e.host)?"":e.host),a.connect(e)}function U(e,t,r){e._readyState=N.CLOSING;const s=new Error(r);Error.captureStackTrace(s,U),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",s)):(t.destroy(s),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function R(e,t,r){if(t){const r=k(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}r&&r(new Error(`WebSocket is not open: readyState ${e.readyState} (${O[e.readyState]})`))}function $(e,t){const r=this[g];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,void 0!==r._socket[g]&&(r._socket.removeListener("data",G),process.nextTick(M,r._socket),1005===e?r.close():r.close(e,t))}function D(){this[g]._socket.resume()}function I(e){const t=this[g];void 0!==t._socket[g]&&(t._socket.removeListener("data",G),process.nextTick(M,t._socket),t.close(e[y])),t.emit("error",e)}function B(){this[g].emitClose()}function q(e){this[g].emit("message",e)}function j(e){const t=this[g];t.pong(e,!t._isServer,b),t.emit("ping",e)}function A(e){this[g].emit("pong",e)}function M(e){e.resume()}function W(){const e=this[g];let t;this.removeListener("close",W),this.removeListener("data",G),this.removeListener("end",F),e._readyState=N.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[g]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",B),e._receiver.on("finish",B))}function G(e){this[g]._receiver.write(e)||this.pause()}function F(){const e=this[g];e._readyState=N.CLOSING,e._receiver.end(),this.end()}function V(){const e=this[g];this.removeListener("error",V),this.on("error",b),e&&(e._readyState=N.CLOSING,this.destroy())}Object.defineProperty(N,"CONNECTING",{enumerable:!0,value:O.indexOf("CONNECTING")}),Object.defineProperty(N.prototype,"CONNECTING",{enumerable:!0,value:O.indexOf("CONNECTING")}),Object.defineProperty(N,"OPEN",{enumerable:!0,value:O.indexOf("OPEN")}),Object.defineProperty(N.prototype,"OPEN",{enumerable:!0,value:O.indexOf("OPEN")}),Object.defineProperty(N,"CLOSING",{enumerable:!0,value:O.indexOf("CLOSING")}),Object.defineProperty(N.prototype,"CLOSING",{enumerable:!0,value:O.indexOf("CLOSING")}),Object.defineProperty(N,"CLOSED",{enumerable:!0,value:O.indexOf("CLOSED")}),Object.defineProperty(N.prototype,"CLOSED",{enumerable:!0,value:O.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","protocol","readyState","url"].forEach((e=>{Object.defineProperty(N.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(N.prototype,`on${e}`,{enumerable:!0,get(){const t=this.listeners(e);for(let e=0;e<t.length;e++)if(t[e]._listener)return t[e]._listener},set(t){const r=this.listeners(e);for(let t=0;t<r.length;t++)r[t]._listener&&this.removeListener(e,r[t]);this.addEventListener(e,t)}})})),N.prototype.addEventListener=w,N.prototype.removeEventListener=S,e.exports=N},113:e=>{"use strict";e.exports=require("crypto")},361:e=>{"use strict";e.exports=require("events")},147:e=>{"use strict";e.exports=require("fs")},685:e=>{"use strict";e.exports=require("http")},687:e=>{"use strict";e.exports=require("https")},808:e=>{"use strict";e.exports=require("net")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")},477:e=>{"use strict";e.exports=require("querystring")},781:e=>{"use strict";e.exports=require("stream")},404:e=>{"use strict";e.exports=require("tls")},310:e=>{"use strict";e.exports=require("url")},796:e=>{"use strict";e.exports=require("zlib")}},t={};function r(s){var i=t[s];if(void 0!==i)return i.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{"use strict";var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Deepgram=void 0;var t=r(986),i=r(292),n=r(319),o=r(487),a=r(321),c=r(949),h=r(359),l=r(343),u=r(647),d=r(298),f=r(98);e.Deepgram=function(e,r){this._apiKey=e,this._apiUrl=r||t.DefaultOptions.apiUrl,(0,d.validateOptions)(this._apiKey,this._apiUrl),this.keys=new i.Keys(this._apiKey,this._apiUrl,f._request),this.projects=new n.Projects(this._apiKey,this._apiUrl,f._request),this.transcription=new o.Transcriber(this._apiKey,this._apiUrl),this.usage=new a.Usage(this._apiKey,this._apiUrl,f._request),this.members=new c.Members(this._apiKey,this._apiUrl,f._request),this.invitation=new h.Invitation(this._apiKey,this._apiUrl,f._request),this.billing=new l.Billing(this._apiKey,this._apiUrl,f._request),this.scopes=new u.Scopes(this._apiKey,this._apiUrl,f._request)}})(),s})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["dg-node-sdk"]=t():e["dg-node-sdk"]=t()}(global,(()=>(()=>{var e={343:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Billing:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}listBalances(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/balances`)}))}getBalance(e,t){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/balances/${t}`)}))}}},986:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DefaultOptions:()=>s});const s={apiUrl:"api.deepgram.com"}},344:(e,t,r)=>{"use strict";var s;r.r(t),r.d(t,{ConnectionState:()=>s}),function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(s||(s={}))},298:(e,t,r)=>{"use strict";r.r(t),r.d(t,{secondsToTimestamp:()=>s.k,validateOptions:()=>i});var s=r(489);function i(e,t){if(!e||0===e.trim().length)throw new Error("DG: API key is required");if(!t||0===t.trim().length)throw new Error("DG: API url should be a valid url or not provided")}},489:(e,t,r)=>{"use strict";function s(e){return new Date(1e3*e).toISOString().substr(11,12)}r.d(t,{k:()=>s})},98:function(e,t,r){"use strict";var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t._request=void 0;var i=r(781),n=r(687),o=r(408);t._request=function(e,t,r,a,c,h){var l=function(e,t,r,n,a,c){var h={};!a||a instanceof i.Readable||(h["Content-Length"]=Buffer.byteLength(a));var l={host:t,path:r,method:n,headers:s({"User-Agent":(0,o.userAgent)(),"Content-Type":"application/json",Authorization:"token ".concat(e)},h)},u=l.headers;return c&&c.headers&&(u=s(s({},u),c.headers)),s(s(s({},l),c),{headers:u})}(t,r,a,e,c,h);return new Promise((function(e,t){try{var r=(0,n.request)(l,(function(r){var s="";r.on("data",(function(e){s+=e})),r.on("end",(function(){var i;try{i=JSON.parse(s)}catch(e){i={error:s}}r.statusCode&&r.statusCode>=400&&t("DG: ".concat(i.err_code,": ").concat(i.err_msg)),i.error&&t("DG: ".concat(s)),e(i)})),r.on("error",(function(e){t("DG: ".concat(e))}))}));r.on("error",(function(e){t("DG: ".concat(e))})),c?c instanceof i.Readable?(c.pipe(r),c.on("finish",(function(){r.end()}))):(r.write(c),r.end()):r.end()}catch(e){t("DG: ".concat(e))}}))}},359:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Invitation:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}list(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/invites`)}))}send(e,t){return s(this,void 0,void 0,(function*(){return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${e}/invites`,JSON.stringify({email:t.email,scope:t.scope}))}))}leave(e){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/leave`)}))}delete(e,t){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/invites/${t}`)}))}}},292:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Keys:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}list(e){return s(this,void 0,void 0,(function*(){return{api_keys:(yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys`)).api_keys.map((e=>Object.assign(Object.assign({},e),e.api_key)))}}))}get(e,t){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys/${t}`)}))}create(e,t,r,i){return s(this,void 0,void 0,(function*(){if(i&&void 0!==i.expirationDate&&void 0!==i.timeToLive)throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys`,JSON.stringify({comment:t,scopes:r,expiration_date:i&&i.expirationDate?i.expirationDate:void 0,time_to_live_in_seconds:i&&i.timeToLive?i.timeToLive:void 0}))}))}delete(e,t){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/keys/${t}`)}))}}},949:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Members:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}listMembers(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members`)}))}removeMember(e,t){return s(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members/${t}`)}))}}},319:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Projects:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}list(){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,this.apiPath)}))}get(e){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}`)}))}update(e,t){return s(this,void 0,void 0,(function*(){return this._request("PATCH",this._credentials,this._apiUrl,`${this.apiPath}/${e.project_id}`,JSON.stringify(t))}))}}},647:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Scopes:()=>i});var s=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class i{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}get(e,t){return s(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members/${t}/scopes`)}))}update(e,t,r){return s(this,void 0,void 0,(function*(){return this._request("PUT",this._credentials,this._apiUrl,`${this.apiPath}/${e}/members/${t}/scopes`,JSON.stringify({scope:r}))}))}}},487:function(e,t,r){"use strict";var s=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,s,i,n,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,s&&(i=2&n[0]?s.return:n[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,n[1])).done)return i;switch(s=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,s=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){o.label=n[1];break}if(6===n[0]&&o.label<i[1]){o.label=i[1],i=n;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(n);break}i[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e],s=0}finally{r=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Transcriber=void 0;var n=r(379),o=r(825),a=function(){function e(e,t){this._credentials=e,this._apiUrl=t}return e.prototype.preRecorded=function(e,t){return s(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return[4,(0,o.preRecordedTranscription)(this._credentials,this._apiUrl||"",e,t)];case 1:return[2,r.sent()]}}))}))},e.prototype.live=function(e){return new n.LiveTranscription(this._credentials,this._apiUrl||"",e)},e}();t.Transcriber=a},379:function(e,t,r){"use strict";var s,i=this&&this.__extends||(s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},s(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LiveTranscription=void 0;var o=n(r(361)),a=n(r(477)),c=n(r(777)),h=r(344),l=r(408),u=function(e){function t(t,r,s){var i=e.call(this,void 0)||this;return i._socket=new c.default("wss://".concat(r,"/v1/listen?").concat(a.default.stringify(s)),{headers:{Authorization:"token ".concat(t),"User-Agent":(0,l.userAgent)()}}),i._bindSocketEvents(),i}return i(t,e),t.prototype._bindSocketEvents=function(){var e=this;this._socket.onopen=function(){e.emit("open",e)},this._socket.onclose=function(t){e.emit("close",t)},this._socket.onerror=function(t){e.emit("error",t)},this._socket.onmessage=function(t){e.emit("transcriptReceived",t.data)}},t.prototype.getReadyState=function(){return this._socket.readyState},t.prototype.send=function(e){this._socket.readyState===h.ConnectionState.OPEN?this._socket.send(e):this.emit("error","Could not send. Connection not open.")},t.prototype.finish=function(){this._socket.send(new Uint8Array(0))},t}(o.default);t.LiveTranscription=u},825:function(e,t,r){"use strict";var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,s,i,n,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,s&&(i=2&n[0]?s.return:n[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,n[1])).done)return i;switch(s=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,s=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){o.label=n[1];break}if(6===n[0]&&o.label<i[1]){o.label=i[1],i=n;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(n);break}i[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e],s=0}finally{r=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.preRecordedTranscription=void 0;var a=o(r(477)),c=r(970),h=r(98);function l(e){return!!e.url}t.preRecordedTranscription=function(e,t,r,o){return i(void 0,void 0,void 0,(function(){var i,u,d,f;return n(this,(function(n){switch(n.label){case 0:if(i=s({},o),!l(r)&&(void 0===r.mimetype||0===r.mimetype.length))throw new Error("DG: Mimetype must be provided if the source is a Buffer or a Readable");if(l(r))u=JSON.stringify(r);else if(r.buffer)u=r.buffer;else{if(!r.stream)throw new Error("Unknown TranscriptionSource type");u=r.stream}return d={},l(r)||(d.headers={"Content-Type":r.mimetype}),[4,(0,h._request)("POST",e,t,"/v1/listen?".concat(a.default.stringify(i)),u,d)];case 1:return f=n.sent(),[2,Object.assign(new c.PrerecordedTranscriptionResponse,f)]}}))}))}},970:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PrerecordedTranscriptionResponse:()=>i});var s=r(489);class i{toWebVTT(){var e,t,r,i;if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let n="WEBVTT\n\n";n+=`NOTE\nTranscription provided by Deepgram\nRequest Id: ${null===(e=this.metadata)||void 0===e?void 0:e.request_id}\nCreated: ${null===(t=this.metadata)||void 0===t?void 0:t.created}\nDuration: ${null===(r=this.metadata)||void 0===r?void 0:r.duration}\nChannels: ${null===(i=this.metadata)||void 0===i?void 0:i.channels}\n\n`;for(let e=0;e<this.results.utterances.length;e++){const t=this.results.utterances[e];n+=`${e+1}\n${(0,s.k)(t.start)} --\x3e ${(0,s.k)(t.end)}\n- ${t.transcript}\n\n`}return n}toSRT(){if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let e="";for(let t=0;t<this.results.utterances.length;t++){const r=this.results.utterances[t];e+=`${t+1}\n${(0,s.k)(r.start).replace(".",",")} --\x3e ${(0,s.k)(r.end).replace(".",",")}\n${r.transcript}\n\n`}return e}}},321:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Usage:()=>o});var s=r(477),i=r.n(s),n=function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(e){n(e)}}function a(e){try{c(s.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))};class o{constructor(e,t,r){this._credentials=e,this._apiUrl=t,this._request=r,this.apiPath="/v1/projects"}listRequests(e,t){return n(this,void 0,void 0,(function*(){const r=Object.assign({},t);return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests?${i().stringify(r)}`)}))}getRequest(e,t){return n(this,void 0,void 0,(function*(){return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests/${t}`)}))}getUsage(e,t){return n(this,void 0,void 0,(function*(){const r=Object.assign({},t);return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage?${i().stringify(r)}`)}))}getFields(e,t){return n(this,void 0,void 0,(function*(){const r=Object.assign({},t);return yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage/fields?${i().stringify(r)}`)}))}}},408:(e,t,r)=>{"use strict";function s(){let e="@deepgram/sdk/UNKNOWN node/UNKNOWN";try{e=`@deepgram/sdk/1.9.0 node/${process.version.replace("v","")}`}catch(e){console.warn("Could not load package details")}return e}r.r(t),r.d(t,{userAgent:()=>s})},376:e=>{"use strict";e.exports={mask:(e,t,r,s,i)=>{for(var n=0;n<i;n++)r[s+n]=e[n]^t[3&n]},unmask:(e,t)=>{const r=e.length;for(var s=0;s<r;s++)e[s]^=t[3&s]}}},891:(e,t,r)=>{"use strict";try{e.exports=r(516)(__dirname)}catch(t){e.exports=r(376)}},516:(e,t,r)=>{var s=r(147),i=r(17),n=r(37),o=require,a=process.config&&process.config.variables||{},c=!!process.env.PREBUILDS_ONLY,h=process.versions.modules,l=process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":"node",u=n.arch(),d=n.platform(),f=process.env.LIBC||(function(e){return"linux"===e&&s.existsSync("/etc/alpine-release")}(d)?"musl":"glibc"),_=process.env.ARM_VERSION||("arm64"===u?"8":a.arm_version)||"",p=(process.versions.uv||"").split(".")[0];function v(e){return o(v.path(e))}function m(e){try{return s.readdirSync(e)}catch(e){return[]}}function y(e,t){var r=m(e).filter(t);return r[0]&&i.join(e,r[0])}function g(e){return/\.node$/.test(e)}function b(e){var t=e.split("-");if(2===t.length){var r=t[0],s=t[1].split("+");if(r&&s.length&&s.every(Boolean))return{name:e,platform:r,architectures:s}}}function w(e,t){return function(r){return null!=r&&r.platform===e&&r.architectures.includes(t)}}function S(e,t){return e.architectures.length-t.architectures.length}function E(e){var t=e.split("."),r={file:e,specificity:0};if("node"===t.pop()){for(var s=0;s<t.length;s++){var i=t[s];if("node"===i||"electron"===i||"node-webkit"===i)r.runtime=i;else if("napi"===i)r.napi=!0;else if("abi"===i.slice(0,3))r.abi=i.slice(3);else if("uv"===i.slice(0,2))r.uv=i.slice(2);else if("armv"===i.slice(0,4))r.armv=i.slice(4);else{if("glibc"!==i&&"musl"!==i)continue;r.libc=i}r.specificity++}return r}}function x(e,t){return function(r){return!(null==r||r.runtime!==e&&!function(e){return"node"===e.runtime&&e.napi}(r)||r.abi!==t&&!r.napi||r.uv&&r.uv!==p||r.armv&&r.armv!==_||r.libc&&r.libc!==f)}}function k(e){return function(t,r){return t.runtime!==r.runtime?t.runtime===e?-1:1:t.abi!==r.abi?t.abi?-1:1:t.specificity!==r.specificity?t.specificity>r.specificity?-1:1:0}}e.exports=v,v.path=function(e){e=i.resolve(e||".");try{var t=o(i.join(e,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[t+"_PREBUILD"]&&(e=process.env[t+"_PREBUILD"])}catch(e){}if(!c){var r=y(i.join(e,"build/Release"),g);if(r)return r;var s=y(i.join(e,"build/Debug"),g);if(s)return s}var n=O(e);if(n)return n;var a=O(i.dirname(process.execPath));if(a)return a;var v=["platform="+d,"arch="+u,"runtime="+l,"abi="+h,"uv="+p,_?"armv="+_:"","libc="+f,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"","webpack=true"].filter(Boolean).join(" ");throw new Error("No native build was found for "+v+"\n loaded from: "+e+"\n");function O(e){var t=m(i.join(e,"prebuilds")).map(b).filter(w(d,u)).sort(S)[0];if(t){var r=i.join(e,"prebuilds",t.name),s=m(r).map(E).filter(x(l,h)).sort(k(l))[0];return s?i.join(r,s.file):void 0}}},v.parseTags=E,v.matchTags=x,v.compareTags=k,v.parseTuple=b,v.matchTuple=w,v.compareTuples=S},137:e=>{"use strict";e.exports=function(e){const t=e.length;let r=0;for(;r<t;)if(0==(128&e[r]))r++;else if(192==(224&e[r])){if(r+1===t||128!=(192&e[r+1])||192==(254&e[r]))return!1;r+=2}else if(224==(240&e[r])){if(r+2>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0}},311:(e,t,r)=>{"use strict";try{e.exports=r(516)(__dirname)}catch(t){e.exports=r(137)}},777:(e,t,r)=>{"use strict";const s=r(762);s.createWebSocketStream=r(30),s.Server=r(284),s.Receiver=r(957),s.Sender=r(330),e.exports=s},977:(e,t,r)=>{"use strict";const{EMPTY_BUFFER:s}=r(872);function i(e,t){if(0===e.length)return s;if(1===e.length)return e[0];const r=Buffer.allocUnsafe(t);let i=0;for(let t=0;t<e.length;t++){const s=e[t];r.set(s,i),i+=s.length}return i<t?r.slice(0,i):r}function n(e,t,r,s,i){for(let n=0;n<i;n++)r[s+n]=e[n]^t[3&n]}function o(e,t){const r=e.length;for(let s=0;s<r;s++)e[s]^=t[3&s]}function a(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=Buffer.from(e):ArrayBuffer.isView(e)?t=Buffer.from(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}try{const t=r(891),s=t.BufferUtil||t;e.exports={concat:i,mask(e,t,r,i,o){o<48?n(e,t,r,i,o):s.mask(e,t,r,i,o)},toArrayBuffer:a,toBuffer:c,unmask(e,t){e.length<32?o(e,t):s.unmask(e,t)}}}catch(t){e.exports={concat:i,mask:n,toArrayBuffer:a,toBuffer:c,unmask:o}}},872:e=>{"use strict";e.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),EMPTY_BUFFER:Buffer.alloc(0),NOOP:()=>{}}},62:e=>{"use strict";class t{constructor(e,t){this.target=t,this.type=e}}class r extends t{constructor(e,t){super("message",t),this.data=e}}class s extends t{constructor(e,t,r){super("close",r),this.wasClean=r._closeFrameReceived&&r._closeFrameSent,this.reason=t,this.code=e}}class i extends t{constructor(e){super("open",e)}}class n extends t{constructor(e,t){super("error",t),this.message=e.message,this.error=e}}const o={addEventListener(e,t,o){if("function"!=typeof t)return;function a(e){t.call(this,new r(e,this))}function c(e,r){t.call(this,new s(e,r,this))}function h(e){t.call(this,new n(e,this))}function l(){t.call(this,new i(this))}const u=o&&o.once?"once":"on";"message"===e?(a._listener=t,this[u](e,a)):"close"===e?(c._listener=t,this[u](e,c)):"error"===e?(h._listener=t,this[u](e,h)):"open"===e?(l._listener=t,this[u](e,l)):this[u](e,t)},removeEventListener(e,t){const r=this.listeners(e);for(let s=0;s<r.length;s++)r[s]!==t&&r[s]._listener!==t||this.removeListener(e,r[s])}};e.exports=o},503:e=>{"use strict";const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function r(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}e.exports={format:function(e){return Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>[t].concat(Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(e){const s=Object.create(null);if(void 0===e||""===e)return s;let i,n,o=Object.create(null),a=!1,c=!1,h=!1,l=-1,u=-1,d=0;for(;d<e.length;d++){const f=e.charCodeAt(d);if(void 0===i)if(-1===u&&1===t[f])-1===l&&(l=d);else if(32===f||9===f)-1===u&&-1!==l&&(u=d);else{if(59!==f&&44!==f)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${d}`);-1===u&&(u=d);const t=e.slice(l,u);44===f?(r(s,t,o),o=Object.create(null)):i=t,l=u=-1}}else if(void 0===n)if(-1===u&&1===t[f])-1===l&&(l=d);else if(32===f||9===f)-1===u&&-1!==l&&(u=d);else if(59===f||44===f){if(-1===l)throw new SyntaxError(`Unexpected character at index ${d}`);-1===u&&(u=d),r(o,e.slice(l,u),!0),44===f&&(r(s,i,o),o=Object.create(null),i=void 0),l=u=-1}else{if(61!==f||-1===l||-1!==u)throw new SyntaxError(`Unexpected character at index ${d}`);n=e.slice(l,d),l=u=-1}else if(c){if(1!==t[f])throw new SyntaxError(`Unexpected character at index ${d}`);-1===l?l=d:a||(a=!0),c=!1}else if(h)if(1===t[f])-1===l&&(l=d);else if(34===f&&-1!==l)h=!1,u=d;else{if(92!==f)throw new SyntaxError(`Unexpected character at index ${d}`);c=!0}else if(34===f&&61===e.charCodeAt(d-1))h=!0;else if(-1===u&&1===t[f])-1===l&&(l=d);else if(-1===l||32!==f&&9!==f){if(59!==f&&44!==f)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${d}`);-1===u&&(u=d);let t=e.slice(l,u);a&&(t=t.replace(/\\/g,""),a=!1),r(o,n,t),44===f&&(r(s,i,o),o=Object.create(null),i=void 0),n=void 0,l=u=-1}}else-1===u&&(u=d)}if(-1===l||h)throw new SyntaxError("Unexpected end of input");-1===u&&(u=d);const f=e.slice(l,u);return void 0===i?r(s,f,o):(void 0===n?r(o,f,!0):r(o,n,a?f.replace(/\\/g,""):f),r(s,i,o)),s}}},305:e=>{"use strict";const t=Symbol("kDone"),r=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[t])}}}},196:(e,t,r)=>{"use strict";const s=r(796),i=r(977),n=r(305),{kStatusCode:o,NOOP:a}=r(872),c=Buffer.from([0,0,255,255]),h=Symbol("permessage-deflate"),l=Symbol("total-length"),u=Symbol("callback"),d=Symbol("buffers"),f=Symbol("error");let _;function p(e){this[d].push(e),this[l]+=e.length}function v(e){this[l]+=e.length,this[h]._maxPayload<1||this[l]<=this[h]._maxPayload?this[d].push(e):(this[f]=new RangeError("Max payload size exceeded"),this[f].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[f][o]=1009,this.removeListener("data",v),this.reset())}function m(e){this[h]._inflate=null,e[o]=1007,this[u](e)}e.exports=class{constructor(e,t,r){if(this._maxPayload=0|r,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!_){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;_=new n(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,r=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(r.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?r.client_max_window_bits=t.clientMaxWindowBits:!0!==r.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete r.client_max_window_bits,r}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let r=e[t];if(r.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(r=r[0],"client_max_window_bits"===t){if(!0!==r){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}else if("server_max_window_bits"===t){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==r)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}e[t]=r}))})),e}decompress(e,t,r){_.add((s=>{this._decompress(e,t,((e,t)=>{s(),r(e,t)}))}))}compress(e,t,r){_.add((s=>{this._compress(e,t,((e,t)=>{s(),r(e,t)}))}))}_decompress(e,t,r){const n=this._isServer?"client":"server";if(!this._inflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=s.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[h]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on("error",m),this._inflate.on("data",v)}this._inflate[u]=r,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush((()=>{const e=this._inflate[f];if(e)return this._inflate.close(),this._inflate=null,void r(e);const s=i.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),r(null,s)}))}_compress(e,t,r){const n=this._isServer?"server":"client";if(!this._deflate){const e=`${n}_max_window_bits`,t="number"!=typeof this.params[e]?s.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=s.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on("error",a),this._deflate.on("data",p)}this._deflate[u]=r,this._deflate.write(e),this._deflate.flush(s.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=i.concat(this._deflate[d],this._deflate[l]);t&&(e=e.slice(0,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),r(null,e)}))}}},957:(e,t,r)=>{"use strict";const{Writable:s}=r(781),i=r(196),{BINARY_TYPES:n,EMPTY_BUFFER:o,kStatusCode:a,kWebSocket:c}=r(872),{concat:h,toArrayBuffer:l,unmask:u}=r(977),{isValidStatusCode:d,isValidUTF8:f}=r(746);function _(e,t,r,s,i){const n=new e(r?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(n,_),n.code=i,n[a]=s,n}e.exports=class extends s{constructor(e,t,r,s){super(),this._binaryType=e||n[0],this[c]=void 0,this._extensions=t||{},this._isServer=!!r,this._maxPayload=0|s,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,r){if(8===this._opcode&&0==this._state)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=t.slice(e),t.slice(0,e)}const t=Buffer.allocUnsafe(e);do{const r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,_(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=64==(64&e[0]);if(t&&!this._extensions[i.extensionName])return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(t)return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,_(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,_(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,_(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,_(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,_(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,_(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,_(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,_(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,_(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,_(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&u(t,this._mask)}return this._opcode>7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,((e,r)=>{if(e)return t(e);if(r.length){if(this._messageLength+=r.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(_(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(r)}const s=this.dataMessage();if(s)return t(s);this.startLoop(t)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?h(t,e):"arraybuffer"===this._binaryType?l(h(t,e)):t,this.emit("message",r)}else{const r=h(t,e);if(!f(r))return this._loop=!1,_(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r.toString())}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,""),this.end();else{if(1===e.length)return _(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!d(t))return _(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const r=e.slice(2);if(!f(r))return _(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r.toString()),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}},330:(e,t,r)=>{"use strict";r(808),r(404);const{randomFillSync:s}=r(113),i=r(196),{EMPTY_BUFFER:n}=r(872),{isValidStatusCode:o}=r(746),{mask:a,toBuffer:c}=r(977),h=Buffer.alloc(4);class l{constructor(e,t){this._extensions=t||{},this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){const r=t.mask&&t.readOnly;let i=t.mask?6:2,n=e.length;e.length>=65536?(i+=8,n=127):e.length>125&&(i+=2,n=126);const o=Buffer.allocUnsafe(r?e.length+i:i);return o[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(o[0]|=64),o[1]=n,126===n?o.writeUInt16BE(e.length,2):127===n&&(o.writeUInt32BE(0,2),o.writeUInt32BE(e.length,6)),t.mask?(s(h,0,4),o[1]|=128,o[i-4]=h[0],o[i-3]=h[1],o[i-2]=h[2],o[i-1]=h[3],r?(a(e,h,o,i,e.length),[o]):(a(e,h,e,0,e.length),[o,e])):[o,e]}close(e,t,r,s){let i;if(void 0===e)i=n;else{if("number"!=typeof e||!o(e))throw new TypeError("First argument must be a valid error code number");if(void 0===t||""===t)i=Buffer.allocUnsafe(2),i.writeUInt16BE(e,0);else{const r=Buffer.byteLength(t);if(r>123)throw new RangeError("The message must not be greater than 123 bytes");i=Buffer.allocUnsafe(2+r),i.writeUInt16BE(e,0),i.write(t,2)}}this._deflating?this.enqueue([this.doClose,i,r,s]):this.doClose(i,r,s)}doClose(e,t,r){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:8,mask:t,readOnly:!1}),r)}ping(e,t,r){const s=c(e);if(s.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,s,t,c.readOnly,r]):this.doPing(s,t,c.readOnly,r)}doPing(e,t,r,s){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:9,mask:t,readOnly:r}),s)}pong(e,t,r){const s=c(e);if(s.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,s,t,c.readOnly,r]):this.doPong(s,t,c.readOnly,r)}doPong(e,t,r,s){this.sendFrame(l.frame(e,{fin:!0,rsv1:!1,opcode:10,mask:t,readOnly:r}),s)}send(e,t,r){const s=c(e),n=this._extensions[i.extensionName];let o=t.binary?2:1,a=t.compress;if(this._firstFragment?(this._firstFragment=!1,a&&n&&(a=s.length>=n._threshold),this._compress=a):(a=!1,o=0),t.fin&&(this._firstFragment=!0),n){const e={fin:t.fin,rsv1:a,opcode:o,mask:t.mask,readOnly:c.readOnly};this._deflating?this.enqueue([this.dispatch,s,this._compress,e,r]):this.dispatch(s,this._compress,e,r)}else this.sendFrame(l.frame(s,{fin:t.fin,rsv1:!1,opcode:o,mask:t.mask,readOnly:c.readOnly}),r)}dispatch(e,t,r,s){if(!t)return void this.sendFrame(l.frame(e,r),s);const n=this._extensions[i.extensionName];this._bufferedBytes+=e.length,this._deflating=!0,n.compress(e,r.fin,((t,i)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof s&&s(e);for(let t=0;t<this._queue.length;t++){const r=this._queue[t][4];"function"==typeof r&&r(e)}}else this._bufferedBytes-=e.length,this._deflating=!1,r.readOnly=!1,this.sendFrame(l.frame(i,r),s),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[1].length,Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[1].length,this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}e.exports=l},30:(e,t,r)=>{"use strict";const{Duplex:s}=r(781);function i(e){e.emit("close")}function n(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener("error",o),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let r=!0,a=!0;function c(){r&&e._socket.resume()}e.readyState===e.CONNECTING?e.once("open",(function(){e._receiver.removeAllListeners("drain"),e._receiver.on("drain",c)})):(e._receiver.removeAllListeners("drain"),e._receiver.on("drain",c));const h=new s({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",(function(t){h.push(t)||(r=!1,e._socket.pause())})),e.once("error",(function(e){h.destroyed||(a=!1,h.destroy(e))})),e.once("close",(function(){h.destroyed||h.push(null)})),h._destroy=function(t,r){if(e.readyState===e.CLOSED)return r(t),void process.nextTick(i,h);let s=!1;e.once("error",(function(e){s=!0,r(e)})),e.once("close",(function(){s||r(t),process.nextTick(i,h)})),a&&e.terminate()},h._final=function(t){e.readyState!==e.CONNECTING?null!==e._socket&&(e._socket._writableState.finished?(t(),h._readableState.endEmitted&&h.destroy()):(e._socket.once("finish",(function(){t()})),e.close())):e.once("open",(function(){h._final(t)}))},h._read=function(){e.readyState!==e.OPEN||r||(r=!0,e._receiver._writableState.needDrain||e._socket.resume())},h._write=function(t,r,s){e.readyState!==e.CONNECTING?e.send(t,s):e.once("open",(function(){h._write(t,r,s)}))},h.on("end",n),h.on("error",o),h}},746:(e,t,r)=>{"use strict";function s(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999}function i(e){const t=e.length;let r=0;for(;r<t;)if(0==(128&e[r]))r++;else if(192==(224&e[r])){if(r+1===t||128!=(192&e[r+1])||192==(254&e[r]))return!1;r+=2}else if(224==(240&e[r])){if(r+2>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0}try{let t=r(311);"object"==typeof t&&(t=t.Validation.isValidUTF8),e.exports={isValidStatusCode:s,isValidUTF8:e=>e.length<150?i(e):t(e)}}catch(t){e.exports={isValidStatusCode:s,isValidUTF8:i}}},284:(e,t,r)=>{"use strict";const s=r(361),i=r(685),{createHash:n}=(r(687),r(808),r(404),r(113)),o=r(196),a=r(762),{format:c,parse:h}=r(503),{GUID:l,kWebSocket:u}=r(872),d=/^[+/0-9A-Za-z]{22}==$/;function f(e){e._state=2,e.emit("close")}function _(){this.destroy()}function p(e,t,r,s){e.writable&&(r=r||i.STATUS_CODES[t],s={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...s},e.write(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(s).map((e=>`${e}: ${s[e]}`)).join("\r\n")+"\r\n\r\n"+r)),e.removeListener("error",_),e.destroy()}function v(e){return e.trim()}e.exports=class extends s{constructor(e,t){if(super(),null==(e={maxPayload:104857600,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer(((e,t)=>{const r=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":r.length,"Content-Type":"text/plain"}),t.end(r)})),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const r of Object.keys(t))e.on(r,t[r]);return function(){for(const r of Object.keys(t))e.removeListener(r,t[r])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,r,s)=>{this.handleUpgrade(t,r,s,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(e&&this.once("close",e),2===this._state)return void process.nextTick(f,this);if(1===this._state)return;if(this._state=1,this.clients)for(const e of this.clients)e.terminate();const t=this._server;t&&(this._removeListeners(),this._removeListeners=this._server=null,null!=this.options.port)?t.close(f.bind(void 0,this)):process.nextTick(f,this)}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",_);const i=void 0!==e.headers["sec-websocket-key"]&&e.headers["sec-websocket-key"].trim(),n=+e.headers["sec-websocket-version"],a={};if("GET"!==e.method||"websocket"!==e.headers.upgrade.toLowerCase()||!i||!d.test(i)||8!==n&&13!==n||!this.shouldHandle(e))return p(t,400);if(this.options.perMessageDeflate){const r=new o(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=h(e.headers["sec-websocket-extensions"]);t[o.extensionName]&&(r.accept(t[o.extensionName]),a[o.extensionName]=r)}catch(e){return p(t,400)}}if(this.options.verifyClient){const o={origin:e.headers[8===n?"sec-websocket-origin":"origin"],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,((n,o,c,h)=>{if(!n)return p(t,o||401,c,h);this.completeUpgrade(i,a,e,t,r,s)}));if(!this.options.verifyClient(o))return p(t,401)}this.completeUpgrade(i,a,e,t,r,s)}completeUpgrade(e,t,r,s,i,h){if(!s.readable||!s.writable)return s.destroy();if(s[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return p(s,503);const d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n("sha1").update(e+l).digest("base64")}`],f=new a(null);let m=r.headers["sec-websocket-protocol"];if(m&&(m=m.split(",").map(v),m=this.options.handleProtocols?this.options.handleProtocols(m,r):m[0],m&&(d.push(`Sec-WebSocket-Protocol: ${m}`),f._protocol=m)),t[o.extensionName]){const e=t[o.extensionName].params,r=c({[o.extensionName]:[e]});d.push(`Sec-WebSocket-Extensions: ${r}`),f._extensions=t}this.emit("headers",d,r),s.write(d.concat("\r\n").join("\r\n")),s.removeListener("error",_),f.setSocket(s,i,this.options.maxPayload),this.clients&&(this.clients.add(f),f.on("close",(()=>this.clients.delete(f)))),h(f,r)}}},762:(e,t,r)=>{"use strict";const s=r(361),i=r(687),n=r(685),o=r(808),a=r(404),{randomBytes:c,createHash:h}=r(113),{Readable:l}=r(781),{URL:u}=r(310),d=r(196),f=r(957),_=r(330),{BINARY_TYPES:p,EMPTY_BUFFER:v,GUID:m,kStatusCode:y,kWebSocket:g,NOOP:b}=r(872),{addEventListener:w,removeEventListener:S}=r(62),{format:E,parse:x}=r(503),{toBuffer:k}=r(977),O=["CONNECTING","OPEN","CLOSING","CLOSED"],T=[8,13];class N extends s{constructor(e,t,r){super(),this._binaryType=p[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage="",this._closeTimer=null,this._extensions={},this._protocol="",this._readyState=N.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,Array.isArray(t)?t=t.join(", "):"object"==typeof t&&null!==t&&(r=t,t=void 0),P(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){p.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get onclose(){}set onclose(e){}get onerror(){}set onerror(e){}get onopen(){}set onopen(e){}get onmessage(){}set onmessage(e){}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){const s=new f(this.binaryType,this._extensions,this._isServer,r);this._sender=new _(e,this._extensions),this._receiver=s,this._socket=e,s[g]=this,e[g]=this,s.on("conclude",$),s.on("drain",D),s.on("error",I),s.on("message",q),s.on("ping",j),s.on("pong",A),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",W),e.on("data",G),e.on("end",F),e.on("error",V),this._readyState=N.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=N.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[d.extensionName]&&this._extensions[d.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=N.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==N.CLOSED){if(this.readyState===N.CONNECTING){const e="WebSocket was closed before the connection was established";return U(this,this._req,e)}this.readyState!==N.CLOSING?(this._readyState=N.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}ping(e,t,r){if(this.readyState===N.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===N.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||v,t,r)):R(this,e,r)}pong(e,t,r){if(this.readyState===N.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===N.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||v,t,r)):R(this,e,r)}send(e,t,r){if(this.readyState===N.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(r=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==N.OPEN)return void R(this,e,r);const s={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[d.extensionName]||(s.compress=!1),this._sender.send(e||v,s,r)}terminate(){if(this.readyState!==N.CLOSED){if(this.readyState===N.CONNECTING){const e="WebSocket was closed before the connection was established";return U(this,this._req,e)}this._socket&&(this._readyState=N.CLOSING,this._socket.destroy())}}}function P(e,t,r,s){const o={protocolVersion:T[1],maxPayload:104857600,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!T.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${T.join(", ")})`);let a;t instanceof u?(a=t,e._url=t.href):(a=new u(t),e._url=t);const l="ws+unix:"===a.protocol;if(!(a.host||l&&a.pathname))throw new Error(`Invalid URL: ${e.url}`);const f="wss:"===a.protocol||"https:"===a.protocol,_=f?443:80,p=c(16).toString("base64"),v=f?i.get:n.get;let y;if(o.createConnection=f?L:C,o.defaultPort=o.defaultPort||_,o.port=a.port||_,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket",...o.headers},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(y=new d(!0!==o.perMessageDeflate?o.perMessageDeflate:{},!1,o.maxPayload),o.headers["Sec-WebSocket-Extensions"]=E({[d.extensionName]:y.offer()})),r&&(o.headers["Sec-WebSocket-Protocol"]=r),o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),l){const e=o.path.split(":");o.socketPath=e[0],o.path=e[1]}let g=e._req=v(o);o.timeout&&g.on("timeout",(()=>{U(e,g,"Opening handshake has timed out")})),g.on("error",(t=>{null===g||g.aborted||(g=e._req=null,e._readyState=N.CLOSING,e.emit("error",t),e.emitClose())})),g.on("response",(i=>{const n=i.headers.location,a=i.statusCode;if(n&&o.followRedirects&&a>=300&&a<400){if(++e._redirects>o.maxRedirects)return void U(e,g,"Maximum redirects exceeded");g.abort();const i=new u(n,t);P(e,i,r,s)}else e.emit("unexpected-response",g,i)||U(e,g,`Unexpected server response: ${i.statusCode}`)})),g.on("upgrade",((t,s,i)=>{if(e.emit("upgrade",t),e.readyState!==N.CONNECTING)return;g=e._req=null;const n=h("sha1").update(p+m).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void U(e,s,"Invalid Sec-WebSocket-Accept header");const a=t.headers["sec-websocket-protocol"],c=(r||"").split(/, */);let l;if(!r&&a?l="Server sent a subprotocol but none was requested":r&&!a?l="Server sent no subprotocol":a&&!c.includes(a)&&(l="Server sent an invalid subprotocol"),l)return void U(e,s,l);a&&(e._protocol=a);const u=t.headers["sec-websocket-extensions"];if(void 0!==u){if(!y)return void U(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");let t;try{t=x(u)}catch(t){return void U(e,s,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(t);if(r.length){if(1!==r.length||r[0]!==d.extensionName)return void U(e,s,"Server indicated an extension that was not requested");try{y.accept(t[d.extensionName])}catch(t){return void U(e,s,"Invalid Sec-WebSocket-Extensions header")}e._extensions[d.extensionName]=y}}e.setSocket(s,i,o.maxPayload)}))}function C(e){return e.path=e.socketPath,o.connect(e)}function L(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=o.isIP(e.host)?"":e.host),a.connect(e)}function U(e,t,r){e._readyState=N.CLOSING;const s=new Error(r);Error.captureStackTrace(s,U),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",s)):(t.destroy(s),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function R(e,t,r){if(t){const r=k(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}r&&r(new Error(`WebSocket is not open: readyState ${e.readyState} (${O[e.readyState]})`))}function $(e,t){const r=this[g];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,void 0!==r._socket[g]&&(r._socket.removeListener("data",G),process.nextTick(M,r._socket),1005===e?r.close():r.close(e,t))}function D(){this[g]._socket.resume()}function I(e){const t=this[g];void 0!==t._socket[g]&&(t._socket.removeListener("data",G),process.nextTick(M,t._socket),t.close(e[y])),t.emit("error",e)}function B(){this[g].emitClose()}function q(e){this[g].emit("message",e)}function j(e){const t=this[g];t.pong(e,!t._isServer,b),t.emit("ping",e)}function A(e){this[g].emit("pong",e)}function M(e){e.resume()}function W(){const e=this[g];let t;this.removeListener("close",W),this.removeListener("data",G),this.removeListener("end",F),e._readyState=N.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[g]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",B),e._receiver.on("finish",B))}function G(e){this[g]._receiver.write(e)||this.pause()}function F(){const e=this[g];e._readyState=N.CLOSING,e._receiver.end(),this.end()}function V(){const e=this[g];this.removeListener("error",V),this.on("error",b),e&&(e._readyState=N.CLOSING,this.destroy())}Object.defineProperty(N,"CONNECTING",{enumerable:!0,value:O.indexOf("CONNECTING")}),Object.defineProperty(N.prototype,"CONNECTING",{enumerable:!0,value:O.indexOf("CONNECTING")}),Object.defineProperty(N,"OPEN",{enumerable:!0,value:O.indexOf("OPEN")}),Object.defineProperty(N.prototype,"OPEN",{enumerable:!0,value:O.indexOf("OPEN")}),Object.defineProperty(N,"CLOSING",{enumerable:!0,value:O.indexOf("CLOSING")}),Object.defineProperty(N.prototype,"CLOSING",{enumerable:!0,value:O.indexOf("CLOSING")}),Object.defineProperty(N,"CLOSED",{enumerable:!0,value:O.indexOf("CLOSED")}),Object.defineProperty(N.prototype,"CLOSED",{enumerable:!0,value:O.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","protocol","readyState","url"].forEach((e=>{Object.defineProperty(N.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(N.prototype,`on${e}`,{enumerable:!0,get(){const t=this.listeners(e);for(let e=0;e<t.length;e++)if(t[e]._listener)return t[e]._listener},set(t){const r=this.listeners(e);for(let t=0;t<r.length;t++)r[t]._listener&&this.removeListener(e,r[t]);this.addEventListener(e,t)}})})),N.prototype.addEventListener=w,N.prototype.removeEventListener=S,e.exports=N},113:e=>{"use strict";e.exports=require("crypto")},361:e=>{"use strict";e.exports=require("events")},147:e=>{"use strict";e.exports=require("fs")},685:e=>{"use strict";e.exports=require("http")},687:e=>{"use strict";e.exports=require("https")},808:e=>{"use strict";e.exports=require("net")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")},477:e=>{"use strict";e.exports=require("querystring")},781:e=>{"use strict";e.exports=require("stream")},404:e=>{"use strict";e.exports=require("tls")},310:e=>{"use strict";e.exports=require("url")},796:e=>{"use strict";e.exports=require("zlib")}},t={};function r(s){var i=t[s];if(void 0!==i)return i.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{"use strict";var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Deepgram=void 0;var t=r(986),i=r(292),n=r(319),o=r(487),a=r(321),c=r(949),h=r(359),l=r(343),u=r(647),d=r(298),f=r(98);e.Deepgram=function(e,r){this._apiKey=e,this._apiUrl=r||t.DefaultOptions.apiUrl,(0,d.validateOptions)(this._apiKey,this._apiUrl),this.keys=new i.Keys(this._apiKey,this._apiUrl,f._request),this.projects=new n.Projects(this._apiKey,this._apiUrl,f._request),this.transcription=new o.Transcriber(this._apiKey,this._apiUrl),this.usage=new a.Usage(this._apiKey,this._apiUrl,f._request),this.members=new c.Members(this._apiKey,this._apiUrl,f._request),this.invitation=new h.Invitation(this._apiKey,this._apiUrl,f._request),this.billing=new l.Billing(this._apiKey,this._apiUrl,f._request),this.scopes=new u.Scopes(this._apiKey,this._apiUrl,f._request)}})(),s})()));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ParagraphGroup } from "./paragraphGroup";
|
|
2
2
|
import { WordBase } from "./wordBase";
|
|
3
|
+
import { Summary } from "./summary";
|
|
3
4
|
export declare type Alternative = {
|
|
4
5
|
/**
|
|
5
6
|
* Text of speech identified by API
|
|
@@ -13,8 +14,16 @@ export declare type Alternative = {
|
|
|
13
14
|
* Array of words included in the transcript
|
|
14
15
|
*/
|
|
15
16
|
words: Array<WordBase>;
|
|
17
|
+
/**
|
|
18
|
+
* Array of summary objects.
|
|
19
|
+
*/
|
|
20
|
+
summaries?: Array<Summary>;
|
|
16
21
|
/**
|
|
17
22
|
* Array of paragraph objects.
|
|
18
23
|
*/
|
|
19
24
|
paragraphs?: Array<ParagraphGroup>;
|
|
25
|
+
/**
|
|
26
|
+
* String indicating the detected language. eg: 'en'
|
|
27
|
+
*/
|
|
28
|
+
detected_language?: string;
|
|
20
29
|
};
|
|
@@ -145,10 +145,21 @@ export declare type PrerecordedTranscriptionOptions = {
|
|
|
145
145
|
* @see https://developers.deepgram.com/api-reference/speech-recognition-api#operation/transcribeAudio/properties/utt_split
|
|
146
146
|
*/
|
|
147
147
|
utt_split?: number;
|
|
148
|
+
/**
|
|
149
|
+
* Detects the language of the reocrded audio and passes audio through appropriate model
|
|
150
|
+
*
|
|
151
|
+
*
|
|
152
|
+
* @see https://developers.deepgram.com/api-reference/#detect-language-pr
|
|
153
|
+
*/
|
|
154
|
+
detect_language?: boolean;
|
|
148
155
|
/**
|
|
149
156
|
* Indicates whether Deepgram will split audio into paragraphs to improve transcript
|
|
150
157
|
* readability. When paragraphs is set to true, you must also set either punctuate,
|
|
151
158
|
* diarize, or multichannel to true.
|
|
152
159
|
*/
|
|
153
160
|
paragraphs?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Indicates whether Deepgram should provide summarizations of sections of the provided audio.
|
|
163
|
+
*/
|
|
164
|
+
summarize?: boolean;
|
|
154
165
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary of a section of audio provided.
|
|
3
|
+
*/
|
|
4
|
+
export declare type Summary = {
|
|
5
|
+
/**
|
|
6
|
+
* Summary of a section of the transcript
|
|
7
|
+
*/
|
|
8
|
+
summary?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Word position in transcript where the summary begins
|
|
11
|
+
*/
|
|
12
|
+
start_word?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Word position in transcript where the summary ends
|
|
15
|
+
*/
|
|
16
|
+
end_word?: number;
|
|
17
|
+
};
|