Spaces:
Sleeping
Sleeping
Commit
·
2434dca
1
Parent(s):
312f844
first commit
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- Dockerfile +19 -0
- src/LICENSE-MPL-2.0 +373 -0
- src/README.md +147 -0
- src/dist/gstwebrtc-api-2.0.0.esm.js +5 -0
- src/dist/gstwebrtc-api-2.0.0.esm.js.map +0 -0
- src/dist/gstwebrtc-api-2.0.0.min.js +5 -0
- src/dist/gstwebrtc-api-2.0.0.min.js.map +0 -0
- src/dist/index.html +552 -0
- src/eslint.config.mjs +78 -0
- src/index.html +556 -0
- src/jsdoc.conf.json +5 -0
- src/node_modules/.bin/acorn +1 -0
- src/node_modules/.bin/ansi-html +1 -0
- src/node_modules/.bin/browserslist +1 -0
- src/node_modules/.bin/envinfo +1 -0
- src/node_modules/.bin/eslint +1 -0
- src/node_modules/.bin/he +1 -0
- src/node_modules/.bin/html-minifier-terser +1 -0
- src/node_modules/.bin/import-local-fixture +1 -0
- src/node_modules/.bin/is-docker +1 -0
- src/node_modules/.bin/js-yaml +1 -0
- src/node_modules/.bin/jsdoc +1 -0
- src/node_modules/.bin/markdown-it +1 -0
- src/node_modules/.bin/marked +1 -0
- src/node_modules/.bin/mime +1 -0
- src/node_modules/.bin/mkdirp +1 -0
- src/node_modules/.bin/multicast-dns +1 -0
- src/node_modules/.bin/node-which +1 -0
- src/node_modules/.bin/parser +1 -0
- src/node_modules/.bin/resolve +1 -0
- src/node_modules/.bin/rimraf +1 -0
- src/node_modules/.bin/terser +1 -0
- src/node_modules/.bin/update-browserslist-db +1 -0
- src/node_modules/.bin/uuid +1 -0
- src/node_modules/.bin/webpack +1 -0
- src/node_modules/.bin/webpack-cli +1 -0
- src/node_modules/.bin/webpack-dev-server +1 -0
- src/node_modules/.cache/webpack-dev-server/server.pem +47 -0
- src/node_modules/.package-lock.json +0 -0
- src/node_modules/@aashutoshrathi/word-wrap/LICENSE +21 -0
- src/node_modules/@aashutoshrathi/word-wrap/README.md +182 -0
- src/node_modules/@aashutoshrathi/word-wrap/index.d.ts +50 -0
- src/node_modules/@aashutoshrathi/word-wrap/index.js +52 -0
- src/node_modules/@aashutoshrathi/word-wrap/package.json +81 -0
- src/node_modules/@babel/parser/CHANGELOG.md +1073 -0
- src/node_modules/@babel/parser/LICENSE +19 -0
- src/node_modules/@babel/parser/README.md +19 -0
- src/node_modules/@babel/parser/bin/babel-parser.js +15 -0
- src/node_modules/@babel/parser/index.cjs +5 -0
- src/node_modules/@babel/parser/lib/index.js +0 -0
Dockerfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Node.js runtime as a parent image
|
| 2 |
+
FROM node:20-alpine
|
| 3 |
+
|
| 4 |
+
# Set the working directory
|
| 5 |
+
WORKDIR /src
|
| 6 |
+
|
| 7 |
+
# Copy package.json and package-lock.json (if available)
|
| 8 |
+
COPY src/package*.json ./
|
| 9 |
+
|
| 10 |
+
# Install dependencies
|
| 11 |
+
RUN npm install
|
| 12 |
+
|
| 13 |
+
# Copy the rest of the application source code
|
| 14 |
+
COPY src/ ./
|
| 15 |
+
|
| 16 |
+
EXPOSE 9090
|
| 17 |
+
|
| 18 |
+
# Start the application
|
| 19 |
+
CMD ["npm", "start"]
|
src/LICENSE-MPL-2.0
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Mozilla Public License Version 2.0
|
| 2 |
+
==================================
|
| 3 |
+
|
| 4 |
+
1. Definitions
|
| 5 |
+
--------------
|
| 6 |
+
|
| 7 |
+
1.1. "Contributor"
|
| 8 |
+
means each individual or legal entity that creates, contributes to
|
| 9 |
+
the creation of, or owns Covered Software.
|
| 10 |
+
|
| 11 |
+
1.2. "Contributor Version"
|
| 12 |
+
means the combination of the Contributions of others (if any) used
|
| 13 |
+
by a Contributor and that particular Contributor's Contribution.
|
| 14 |
+
|
| 15 |
+
1.3. "Contribution"
|
| 16 |
+
means Covered Software of a particular Contributor.
|
| 17 |
+
|
| 18 |
+
1.4. "Covered Software"
|
| 19 |
+
means Source Code Form to which the initial Contributor has attached
|
| 20 |
+
the notice in Exhibit A, the Executable Form of such Source Code
|
| 21 |
+
Form, and Modifications of such Source Code Form, in each case
|
| 22 |
+
including portions thereof.
|
| 23 |
+
|
| 24 |
+
1.5. "Incompatible With Secondary Licenses"
|
| 25 |
+
means
|
| 26 |
+
|
| 27 |
+
(a) that the initial Contributor has attached the notice described
|
| 28 |
+
in Exhibit B to the Covered Software; or
|
| 29 |
+
|
| 30 |
+
(b) that the Covered Software was made available under the terms of
|
| 31 |
+
version 1.1 or earlier of the License, but not also under the
|
| 32 |
+
terms of a Secondary License.
|
| 33 |
+
|
| 34 |
+
1.6. "Executable Form"
|
| 35 |
+
means any form of the work other than Source Code Form.
|
| 36 |
+
|
| 37 |
+
1.7. "Larger Work"
|
| 38 |
+
means a work that combines Covered Software with other material, in
|
| 39 |
+
a separate file or files, that is not Covered Software.
|
| 40 |
+
|
| 41 |
+
1.8. "License"
|
| 42 |
+
means this document.
|
| 43 |
+
|
| 44 |
+
1.9. "Licensable"
|
| 45 |
+
means having the right to grant, to the maximum extent possible,
|
| 46 |
+
whether at the time of the initial grant or subsequently, any and
|
| 47 |
+
all of the rights conveyed by this License.
|
| 48 |
+
|
| 49 |
+
1.10. "Modifications"
|
| 50 |
+
means any of the following:
|
| 51 |
+
|
| 52 |
+
(a) any file in Source Code Form that results from an addition to,
|
| 53 |
+
deletion from, or modification of the contents of Covered
|
| 54 |
+
Software; or
|
| 55 |
+
|
| 56 |
+
(b) any new file in Source Code Form that contains any Covered
|
| 57 |
+
Software.
|
| 58 |
+
|
| 59 |
+
1.11. "Patent Claims" of a Contributor
|
| 60 |
+
means any patent claim(s), including without limitation, method,
|
| 61 |
+
process, and apparatus claims, in any patent Licensable by such
|
| 62 |
+
Contributor that would be infringed, but for the grant of the
|
| 63 |
+
License, by the making, using, selling, offering for sale, having
|
| 64 |
+
made, import, or transfer of either its Contributions or its
|
| 65 |
+
Contributor Version.
|
| 66 |
+
|
| 67 |
+
1.12. "Secondary License"
|
| 68 |
+
means either the GNU General Public License, Version 2.0, the GNU
|
| 69 |
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
| 70 |
+
Public License, Version 3.0, or any later versions of those
|
| 71 |
+
licenses.
|
| 72 |
+
|
| 73 |
+
1.13. "Source Code Form"
|
| 74 |
+
means the form of the work preferred for making modifications.
|
| 75 |
+
|
| 76 |
+
1.14. "You" (or "Your")
|
| 77 |
+
means an individual or a legal entity exercising rights under this
|
| 78 |
+
License. For legal entities, "You" includes any entity that
|
| 79 |
+
controls, is controlled by, or is under common control with You. For
|
| 80 |
+
purposes of this definition, "control" means (a) the power, direct
|
| 81 |
+
or indirect, to cause the direction or management of such entity,
|
| 82 |
+
whether by contract or otherwise, or (b) ownership of more than
|
| 83 |
+
fifty percent (50%) of the outstanding shares or beneficial
|
| 84 |
+
ownership of such entity.
|
| 85 |
+
|
| 86 |
+
2. License Grants and Conditions
|
| 87 |
+
--------------------------------
|
| 88 |
+
|
| 89 |
+
2.1. Grants
|
| 90 |
+
|
| 91 |
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
| 92 |
+
non-exclusive license:
|
| 93 |
+
|
| 94 |
+
(a) under intellectual property rights (other than patent or trademark)
|
| 95 |
+
Licensable by such Contributor to use, reproduce, make available,
|
| 96 |
+
modify, display, perform, distribute, and otherwise exploit its
|
| 97 |
+
Contributions, either on an unmodified basis, with Modifications, or
|
| 98 |
+
as part of a Larger Work; and
|
| 99 |
+
|
| 100 |
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
| 101 |
+
for sale, have made, import, and otherwise transfer either its
|
| 102 |
+
Contributions or its Contributor Version.
|
| 103 |
+
|
| 104 |
+
2.2. Effective Date
|
| 105 |
+
|
| 106 |
+
The licenses granted in Section 2.1 with respect to any Contribution
|
| 107 |
+
become effective for each Contribution on the date the Contributor first
|
| 108 |
+
distributes such Contribution.
|
| 109 |
+
|
| 110 |
+
2.3. Limitations on Grant Scope
|
| 111 |
+
|
| 112 |
+
The licenses granted in this Section 2 are the only rights granted under
|
| 113 |
+
this License. No additional rights or licenses will be implied from the
|
| 114 |
+
distribution or licensing of Covered Software under this License.
|
| 115 |
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
| 116 |
+
Contributor:
|
| 117 |
+
|
| 118 |
+
(a) for any code that a Contributor has removed from Covered Software;
|
| 119 |
+
or
|
| 120 |
+
|
| 121 |
+
(b) for infringements caused by: (i) Your and any other third party's
|
| 122 |
+
modifications of Covered Software, or (ii) the combination of its
|
| 123 |
+
Contributions with other software (except as part of its Contributor
|
| 124 |
+
Version); or
|
| 125 |
+
|
| 126 |
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
| 127 |
+
its Contributions.
|
| 128 |
+
|
| 129 |
+
This License does not grant any rights in the trademarks, service marks,
|
| 130 |
+
or logos of any Contributor (except as may be necessary to comply with
|
| 131 |
+
the notice requirements in Section 3.4).
|
| 132 |
+
|
| 133 |
+
2.4. Subsequent Licenses
|
| 134 |
+
|
| 135 |
+
No Contributor makes additional grants as a result of Your choice to
|
| 136 |
+
distribute the Covered Software under a subsequent version of this
|
| 137 |
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
| 138 |
+
permitted under the terms of Section 3.3).
|
| 139 |
+
|
| 140 |
+
2.5. Representation
|
| 141 |
+
|
| 142 |
+
Each Contributor represents that the Contributor believes its
|
| 143 |
+
Contributions are its original creation(s) or it has sufficient rights
|
| 144 |
+
to grant the rights to its Contributions conveyed by this License.
|
| 145 |
+
|
| 146 |
+
2.6. Fair Use
|
| 147 |
+
|
| 148 |
+
This License is not intended to limit any rights You have under
|
| 149 |
+
applicable copyright doctrines of fair use, fair dealing, or other
|
| 150 |
+
equivalents.
|
| 151 |
+
|
| 152 |
+
2.7. Conditions
|
| 153 |
+
|
| 154 |
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
| 155 |
+
in Section 2.1.
|
| 156 |
+
|
| 157 |
+
3. Responsibilities
|
| 158 |
+
-------------------
|
| 159 |
+
|
| 160 |
+
3.1. Distribution of Source Form
|
| 161 |
+
|
| 162 |
+
All distribution of Covered Software in Source Code Form, including any
|
| 163 |
+
Modifications that You create or to which You contribute, must be under
|
| 164 |
+
the terms of this License. You must inform recipients that the Source
|
| 165 |
+
Code Form of the Covered Software is governed by the terms of this
|
| 166 |
+
License, and how they can obtain a copy of this License. You may not
|
| 167 |
+
attempt to alter or restrict the recipients' rights in the Source Code
|
| 168 |
+
Form.
|
| 169 |
+
|
| 170 |
+
3.2. Distribution of Executable Form
|
| 171 |
+
|
| 172 |
+
If You distribute Covered Software in Executable Form then:
|
| 173 |
+
|
| 174 |
+
(a) such Covered Software must also be made available in Source Code
|
| 175 |
+
Form, as described in Section 3.1, and You must inform recipients of
|
| 176 |
+
the Executable Form how they can obtain a copy of such Source Code
|
| 177 |
+
Form by reasonable means in a timely manner, at a charge no more
|
| 178 |
+
than the cost of distribution to the recipient; and
|
| 179 |
+
|
| 180 |
+
(b) You may distribute such Executable Form under the terms of this
|
| 181 |
+
License, or sublicense it under different terms, provided that the
|
| 182 |
+
license for the Executable Form does not attempt to limit or alter
|
| 183 |
+
the recipients' rights in the Source Code Form under this License.
|
| 184 |
+
|
| 185 |
+
3.3. Distribution of a Larger Work
|
| 186 |
+
|
| 187 |
+
You may create and distribute a Larger Work under terms of Your choice,
|
| 188 |
+
provided that You also comply with the requirements of this License for
|
| 189 |
+
the Covered Software. If the Larger Work is a combination of Covered
|
| 190 |
+
Software with a work governed by one or more Secondary Licenses, and the
|
| 191 |
+
Covered Software is not Incompatible With Secondary Licenses, this
|
| 192 |
+
License permits You to additionally distribute such Covered Software
|
| 193 |
+
under the terms of such Secondary License(s), so that the recipient of
|
| 194 |
+
the Larger Work may, at their option, further distribute the Covered
|
| 195 |
+
Software under the terms of either this License or such Secondary
|
| 196 |
+
License(s).
|
| 197 |
+
|
| 198 |
+
3.4. Notices
|
| 199 |
+
|
| 200 |
+
You may not remove or alter the substance of any license notices
|
| 201 |
+
(including copyright notices, patent notices, disclaimers of warranty,
|
| 202 |
+
or limitations of liability) contained within the Source Code Form of
|
| 203 |
+
the Covered Software, except that You may alter any license notices to
|
| 204 |
+
the extent required to remedy known factual inaccuracies.
|
| 205 |
+
|
| 206 |
+
3.5. Application of Additional Terms
|
| 207 |
+
|
| 208 |
+
You may choose to offer, and to charge a fee for, warranty, support,
|
| 209 |
+
indemnity or liability obligations to one or more recipients of Covered
|
| 210 |
+
Software. However, You may do so only on Your own behalf, and not on
|
| 211 |
+
behalf of any Contributor. You must make it absolutely clear that any
|
| 212 |
+
such warranty, support, indemnity, or liability obligation is offered by
|
| 213 |
+
You alone, and You hereby agree to indemnify every Contributor for any
|
| 214 |
+
liability incurred by such Contributor as a result of warranty, support,
|
| 215 |
+
indemnity or liability terms You offer. You may include additional
|
| 216 |
+
disclaimers of warranty and limitations of liability specific to any
|
| 217 |
+
jurisdiction.
|
| 218 |
+
|
| 219 |
+
4. Inability to Comply Due to Statute or Regulation
|
| 220 |
+
---------------------------------------------------
|
| 221 |
+
|
| 222 |
+
If it is impossible for You to comply with any of the terms of this
|
| 223 |
+
License with respect to some or all of the Covered Software due to
|
| 224 |
+
statute, judicial order, or regulation then You must: (a) comply with
|
| 225 |
+
the terms of this License to the maximum extent possible; and (b)
|
| 226 |
+
describe the limitations and the code they affect. Such description must
|
| 227 |
+
be placed in a text file included with all distributions of the Covered
|
| 228 |
+
Software under this License. Except to the extent prohibited by statute
|
| 229 |
+
or regulation, such description must be sufficiently detailed for a
|
| 230 |
+
recipient of ordinary skill to be able to understand it.
|
| 231 |
+
|
| 232 |
+
5. Termination
|
| 233 |
+
--------------
|
| 234 |
+
|
| 235 |
+
5.1. The rights granted under this License will terminate automatically
|
| 236 |
+
if You fail to comply with any of its terms. However, if You become
|
| 237 |
+
compliant, then the rights granted under this License from a particular
|
| 238 |
+
Contributor are reinstated (a) provisionally, unless and until such
|
| 239 |
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
| 240 |
+
ongoing basis, if such Contributor fails to notify You of the
|
| 241 |
+
non-compliance by some reasonable means prior to 60 days after You have
|
| 242 |
+
come back into compliance. Moreover, Your grants from a particular
|
| 243 |
+
Contributor are reinstated on an ongoing basis if such Contributor
|
| 244 |
+
notifies You of the non-compliance by some reasonable means, this is the
|
| 245 |
+
first time You have received notice of non-compliance with this License
|
| 246 |
+
from such Contributor, and You become compliant prior to 30 days after
|
| 247 |
+
Your receipt of the notice.
|
| 248 |
+
|
| 249 |
+
5.2. If You initiate litigation against any entity by asserting a patent
|
| 250 |
+
infringement claim (excluding declaratory judgment actions,
|
| 251 |
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
| 252 |
+
directly or indirectly infringes any patent, then the rights granted to
|
| 253 |
+
You by any and all Contributors for the Covered Software under Section
|
| 254 |
+
2.1 of this License shall terminate.
|
| 255 |
+
|
| 256 |
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
| 257 |
+
end user license agreements (excluding distributors and resellers) which
|
| 258 |
+
have been validly granted by You or Your distributors under this License
|
| 259 |
+
prior to termination shall survive termination.
|
| 260 |
+
|
| 261 |
+
************************************************************************
|
| 262 |
+
* *
|
| 263 |
+
* 6. Disclaimer of Warranty *
|
| 264 |
+
* ------------------------- *
|
| 265 |
+
* *
|
| 266 |
+
* Covered Software is provided under this License on an "as is" *
|
| 267 |
+
* basis, without warranty of any kind, either expressed, implied, or *
|
| 268 |
+
* statutory, including, without limitation, warranties that the *
|
| 269 |
+
* Covered Software is free of defects, merchantable, fit for a *
|
| 270 |
+
* particular purpose or non-infringing. The entire risk as to the *
|
| 271 |
+
* quality and performance of the Covered Software is with You. *
|
| 272 |
+
* Should any Covered Software prove defective in any respect, You *
|
| 273 |
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
| 274 |
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
| 275 |
+
* essential part of this License. No use of any Covered Software is *
|
| 276 |
+
* authorized under this License except under this disclaimer. *
|
| 277 |
+
* *
|
| 278 |
+
************************************************************************
|
| 279 |
+
|
| 280 |
+
************************************************************************
|
| 281 |
+
* *
|
| 282 |
+
* 7. Limitation of Liability *
|
| 283 |
+
* -------------------------- *
|
| 284 |
+
* *
|
| 285 |
+
* Under no circumstances and under no legal theory, whether tort *
|
| 286 |
+
* (including negligence), contract, or otherwise, shall any *
|
| 287 |
+
* Contributor, or anyone who distributes Covered Software as *
|
| 288 |
+
* permitted above, be liable to You for any direct, indirect, *
|
| 289 |
+
* special, incidental, or consequential damages of any character *
|
| 290 |
+
* including, without limitation, damages for lost profits, loss of *
|
| 291 |
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
| 292 |
+
* and all other commercial damages or losses, even if such party *
|
| 293 |
+
* shall have been informed of the possibility of such damages. This *
|
| 294 |
+
* limitation of liability shall not apply to liability for death or *
|
| 295 |
+
* personal injury resulting from such party's negligence to the *
|
| 296 |
+
* extent applicable law prohibits such limitation. Some *
|
| 297 |
+
* jurisdictions do not allow the exclusion or limitation of *
|
| 298 |
+
* incidental or consequential damages, so this exclusion and *
|
| 299 |
+
* limitation may not apply to You. *
|
| 300 |
+
* *
|
| 301 |
+
************************************************************************
|
| 302 |
+
|
| 303 |
+
8. Litigation
|
| 304 |
+
-------------
|
| 305 |
+
|
| 306 |
+
Any litigation relating to this License may be brought only in the
|
| 307 |
+
courts of a jurisdiction where the defendant maintains its principal
|
| 308 |
+
place of business and such litigation shall be governed by laws of that
|
| 309 |
+
jurisdiction, without reference to its conflict-of-law provisions.
|
| 310 |
+
Nothing in this Section shall prevent a party's ability to bring
|
| 311 |
+
cross-claims or counter-claims.
|
| 312 |
+
|
| 313 |
+
9. Miscellaneous
|
| 314 |
+
----------------
|
| 315 |
+
|
| 316 |
+
This License represents the complete agreement concerning the subject
|
| 317 |
+
matter hereof. If any provision of this License is held to be
|
| 318 |
+
unenforceable, such provision shall be reformed only to the extent
|
| 319 |
+
necessary to make it enforceable. Any law or regulation which provides
|
| 320 |
+
that the language of a contract shall be construed against the drafter
|
| 321 |
+
shall not be used to construe this License against a Contributor.
|
| 322 |
+
|
| 323 |
+
10. Versions of the License
|
| 324 |
+
---------------------------
|
| 325 |
+
|
| 326 |
+
10.1. New Versions
|
| 327 |
+
|
| 328 |
+
Mozilla Foundation is the license steward. Except as provided in Section
|
| 329 |
+
10.3, no one other than the license steward has the right to modify or
|
| 330 |
+
publish new versions of this License. Each version will be given a
|
| 331 |
+
distinguishing version number.
|
| 332 |
+
|
| 333 |
+
10.2. Effect of New Versions
|
| 334 |
+
|
| 335 |
+
You may distribute the Covered Software under the terms of the version
|
| 336 |
+
of the License under which You originally received the Covered Software,
|
| 337 |
+
or under the terms of any subsequent version published by the license
|
| 338 |
+
steward.
|
| 339 |
+
|
| 340 |
+
10.3. Modified Versions
|
| 341 |
+
|
| 342 |
+
If you create software not governed by this License, and you want to
|
| 343 |
+
create a new license for such software, you may create and use a
|
| 344 |
+
modified version of this License if you rename the license and remove
|
| 345 |
+
any references to the name of the license steward (except to note that
|
| 346 |
+
such modified license differs from this License).
|
| 347 |
+
|
| 348 |
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
| 349 |
+
Licenses
|
| 350 |
+
|
| 351 |
+
If You choose to distribute Source Code Form that is Incompatible With
|
| 352 |
+
Secondary Licenses under the terms of this version of the License, the
|
| 353 |
+
notice described in Exhibit B of this License must be attached.
|
| 354 |
+
|
| 355 |
+
Exhibit A - Source Code Form License Notice
|
| 356 |
+
-------------------------------------------
|
| 357 |
+
|
| 358 |
+
This Source Code Form is subject to the terms of the Mozilla Public
|
| 359 |
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
| 360 |
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
| 361 |
+
|
| 362 |
+
If it is not possible or desirable to put the notice in a particular
|
| 363 |
+
file, then You may include the notice in a location (such as a LICENSE
|
| 364 |
+
file in a relevant directory) where a recipient would be likely to look
|
| 365 |
+
for such a notice.
|
| 366 |
+
|
| 367 |
+
You may add additional accurate notices of copyright ownership.
|
| 368 |
+
|
| 369 |
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
| 370 |
+
---------------------------------------------------------
|
| 371 |
+
|
| 372 |
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
| 373 |
+
defined by the Mozilla Public License, v. 2.0.
|
src/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gstwebrtc-api
|
| 2 |
+
|
| 3 |
+
[](https://opensource.org/licenses/MPL-2.0)
|
| 4 |
+
|
| 5 |
+
Javascript API used to integrate GStreamer WebRTC streams produced and consumed by webrtcsink and webrtcsrc elements
|
| 6 |
+
into a web browser or a mobile WebView.
|
| 7 |
+
|
| 8 |
+
This API allows a complete 360º interconnection between GStreamer and web interfaces for realtime streaming using the
|
| 9 |
+
WebRTC protocol.
|
| 10 |
+
|
| 11 |
+
This API is released under the Mozilla Public License Version 2.0 (MPL-2.0) that can be found in the LICENSE-MPL-2.0
|
| 12 |
+
file or at https://opensource.org/licenses/MPL-2.0
|
| 13 |
+
|
| 14 |
+
Copyright (C) 2022 Igalia S.L. <<info@igalia.com>><br>
|
| 15 |
+
Author: Loïc Le Page <<llepage@igalia.com>>
|
| 16 |
+
|
| 17 |
+
It includes external source code from [webrtc-adapter](https://github.com/webrtcHacks/adapter) that is embedded with
|
| 18 |
+
the API. The webrtc-adapter BSD 3-Clause license is available at
|
| 19 |
+
https://github.com/webrtcHacks/adapter/blob/master/LICENSE.md
|
| 20 |
+
|
| 21 |
+
Webrtc-adapter is Copyright (c) 2014, The WebRTC project authors, All rights reserved.<br>
|
| 22 |
+
Copyright (c) 2018, The adapter.js project authors, All rights reserved.
|
| 23 |
+
|
| 24 |
+
## Building the API
|
| 25 |
+
|
| 26 |
+
The GstWebRTC API uses [Webpack](https://webpack.js.org/) to bundle all source files and dependencies together.
|
| 27 |
+
|
| 28 |
+
You only need to install [Node.js](https://nodejs.org/en/) to run all commands.
|
| 29 |
+
|
| 30 |
+
On first time, install the dependencies by calling:
|
| 31 |
+
```shell
|
| 32 |
+
$ npm install
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
Then build the bundle by calling:
|
| 36 |
+
```shell
|
| 37 |
+
$ npm run make
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
It will build and compress the code into the *dist/* folder, there you will find the following files:
|
| 41 |
+
- *gstwebrtc-api-[version].min.js* which is the only file you need to include in your web application to use the API,
|
| 42 |
+
if you are manually adding the .js file to your webpage. It already embeds all dependencies.
|
| 43 |
+
- *gstwebrtc-api-[version].min.js.map* which is useful for debugging the API code, you need to put it in the same
|
| 44 |
+
folder as the API script on your web server if you want to allow debugging, else you can just ignore it.
|
| 45 |
+
- *gstwebrtc-api-[version].esm.js, which is the ES module variant of this library. You probably don't need to use
|
| 46 |
+
this directly - it will be automatically used by your build system if you install this package via npm. See below.
|
| 47 |
+
- *gstwebrtc-api-[version].esm.js.map* which is the source map for the ES module variant mentioned above.
|
| 48 |
+
|
| 49 |
+
The API documentation is created into the *docs/* folder. It is automatically created when building the whole API.
|
| 50 |
+
|
| 51 |
+
If you want to build the documentation only, you can call:
|
| 52 |
+
```shell
|
| 53 |
+
$ npm run docs
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
If you only want to build the API without the documentation, you can call:
|
| 57 |
+
```shell
|
| 58 |
+
$ npm run build
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Packaging the API
|
| 62 |
+
|
| 63 |
+
You can create a portable package of the API by calling:
|
| 64 |
+
```shell
|
| 65 |
+
$ npm pack
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
It will create a *gstwebrtc-api-[version].tgz* file that contains all source code, documentation and built API. This
|
| 69 |
+
portable package can be installed as a dependency in any Node.js project by calling:
|
| 70 |
+
```shell
|
| 71 |
+
$ npm install gstwebrtc-api-[version].tgz
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Testing and debugging the API
|
| 75 |
+
|
| 76 |
+
To easily test and debug the GstWebRTC API, you just need to:
|
| 77 |
+
1. launch the webrtc signalling server by calling (from the repository *gst-plugins-rs* root folder):
|
| 78 |
+
```shell
|
| 79 |
+
$ cargo run --bin gst-webrtc-signalling-server
|
| 80 |
+
```
|
| 81 |
+
2. launch the GstWebRTC API server by calling (from the *net/webrtc/gstwebrtc-api* sub-folder):
|
| 82 |
+
```shell
|
| 83 |
+
$ npm start
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
It will launch a local HTTPS server listening on port 9090 and using an automatically generated self-signed
|
| 87 |
+
certificate.
|
| 88 |
+
|
| 89 |
+
With this server you can test the reference example shipped in *index.html* from a web browser on your local computer
|
| 90 |
+
or a mobile device.
|
| 91 |
+
|
| 92 |
+
## Interconnect with GStreamer pipelines
|
| 93 |
+
|
| 94 |
+
Once the signalling and gstwebrtc-api servers launched, you can interconnect the streams produced and consumed from
|
| 95 |
+
the web browser with GStreamer pipelines using the webrtcsink and webrtcsrc elements.
|
| 96 |
+
|
| 97 |
+
### Consume a WebRTC stream produced by the gstwebrtc-api
|
| 98 |
+
|
| 99 |
+
On the web browser side, click on the *Start Capture* button and give access to the webcam. The gstwebrtc-api will
|
| 100 |
+
start producing a video stream.
|
| 101 |
+
|
| 102 |
+
The signalling server logs will show the registration of a new producer with the same *peer_id* as the *Client ID*
|
| 103 |
+
that appears on the webpage.
|
| 104 |
+
|
| 105 |
+
Then launch the following GStreamer pipeline:
|
| 106 |
+
```shell
|
| 107 |
+
$ gst-launch-1.0 playbin3 uri=gstwebrtc://[signalling server]?peer-id=[client ID of the producer]
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
Using the local signalling server, it will look like this:
|
| 111 |
+
```shell
|
| 112 |
+
$ gst-launch-1.0 playbin3 uri=gstwebrtc://127.0.0.1:8443?peer-id=e54e5d6b-f597-4e8f-bc96-2cc3765b6567
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
The underlying *uridecodebin* element recognizes the *gstwebrtc://* scheme as a WebRTC stream compatible with the
|
| 116 |
+
gstwebrtc-api and will correctly use a *webrtcsrc* element to manage this stream.
|
| 117 |
+
|
| 118 |
+
The *gstwebrtc://* scheme is used for normal WebSocket connections to the signalling server, and the *gstwebrtcs://*
|
| 119 |
+
scheme for secured connections over SSL or TLS.
|
| 120 |
+
|
| 121 |
+
### Produce a GStreamer WebRTC stream consumed by the gstwebrtc-api
|
| 122 |
+
|
| 123 |
+
Launch the following GStreamer pipeline:
|
| 124 |
+
```shell
|
| 125 |
+
$ gst-launch-1.0 videotestsrc ! agingtv ! webrtcsink meta="meta,name=native-stream"
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
By default *webrtcsink* element uses *ws://127.0.0.1:8443* for the signalling server address, so there is no need
|
| 129 |
+
for more arguments. If you're hosting the signalling server elsewhere, you can specify its address by adding
|
| 130 |
+
`signaller::uri="ws[s]://[signalling server]"` to the list of *webrtcsink* properties.
|
| 131 |
+
|
| 132 |
+
Once the GStreamer pipeline launched, you will see the registration of a new producer in the logs of the signalling
|
| 133 |
+
server and a new remote stream, with the name *native-stream*, will appear on the webpage.
|
| 134 |
+
|
| 135 |
+
You just need to click on the corresponding entry to connect as a consumer to the remote native stream.
|
| 136 |
+
|
| 137 |
+
### Produce a GStreamer interactive WebRTC stream with remote control
|
| 138 |
+
|
| 139 |
+
Launch the following GStreamer pipeline:
|
| 140 |
+
```shell
|
| 141 |
+
$ gst-launch-1.0 wpesrc location=https://gstreamer.freedesktop.org/documentation ! queue ! webrtcsink enable-control-data-channel=true meta="meta,name=web-stream"
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
Once the GStreamer pipeline launched, you will see a new producer with the name *web-stream*. When connecting to this
|
| 145 |
+
producer you will see the remote rendering of the web page. You can interact remotely with this web page, controls are
|
| 146 |
+
sent through a special WebRTC data channel while the rendering is done remotely by the
|
| 147 |
+
[wpesrc](https://gstreamer.freedesktop.org/documentation/wpe/wpesrc.html) element.
|
src/dist/gstwebrtc-api-2.0.0.esm.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*! gstwebrtc-api (https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api), MPL-2.0 License, Copyright (C) 2022 Igalia S.L. <info@igalia.com>, Author: Loïc Le Page <llepage@igalia.com> */
|
| 2 |
+
/*! Contains embedded adapter from webrtc-adapter (https://github.com/webrtcHacks/adapter), BSD 3-Clause License, Copyright (c) 2014, The WebRTC project authors. All rights reserved. Copyright (c) 2018, The adapter.js project authors. All rights reserved. */
|
| 3 |
+
|
| 4 |
+
var e={539:e=>{const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((e=>0===e.indexOf(n)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const r=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<r.length;e++)n=r[e].trim().split("="),t[n[0].trim()]=n[1];return t},t.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const r=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" ");n.profile=r[2];for(let i=3;i<r.length;i++){const o=r[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const r=t.parseRtpMap(s),i=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(r.parameters=i.length?t.parseFmtp(i[0]):{},r.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{n.headerExtensions.push(t.parseExtmap(e))}));const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach((e=>{i.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),n},t.writeRtpDescription=function(e,n){let r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=n.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((e=>{r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));let i=0;return n.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((e=>{r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){const n=[],r=t.parseRtpParameters(e),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[0][1]),r.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),n.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&a&&n.push({ssrc:a});let l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substring(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substring(5),10)*.95-16e3:void 0,n.forEach((e=>{e.maxBitrate=l}))),n},t.parseRtcpParameters=function(e){const n={},r=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const r=t.matchPrefix(e,"a=msid:");if(1===r.length)return n=r[0].substring(7).split(" "),{stream:n[0],track:n[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),r=t.matchPrefix(e,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substring(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,r){let i;const o=void 0!==n?n:2;i=e||t.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const r=t.splitLines(e);for(let e=0;e<r.length;e++)switch(r[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[e].substring(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const n=t.splitLines(e)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){const n=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const n=t.splitLines(e);for(let e=0;e<n.length;e++)if(n[e].length<2||"="!==n[e].charAt(1))return!1;return!0},e.exports=t}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{n.d(r,{Z:()=>De});var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>A,shimAddTrackRemoveTrack:()=>R,shimAddTrackRemoveTrackWithNative:()=>P,shimGetDisplayMedia:()=>v,shimGetSendersWithDtmf:()=>k,shimGetStats:()=>T,shimGetUserMedia:()=>y,shimMediaStream:()=>b,shimOnTrack:()=>S,shimPeerConnection:()=>w,shimSenderReceiverGetStats:()=>E});var t={};n.r(t),n.d(t,{shimAddTransceiver:()=>j,shimCreateAnswer:()=>F,shimCreateOffer:()=>U,shimGetDisplayMedia:()=>I,shimGetParameters:()=>N,shimGetUserMedia:()=>x,shimOnTrack:()=>O,shimPeerConnection:()=>D,shimRTCDataChannel:()=>G,shimReceiverGetStats:()=>L,shimRemoveStream:()=>H,shimSenderGetStats:()=>M});var i={};n.r(i),n.d(i,{shimAudioContext:()=>Z,shimCallbacksAPI:()=>K,shimConstraints:()=>W,shimCreateOfferLegacy:()=>B,shimGetUserMedia:()=>q,shimLocalStreamsAPI:()=>z,shimRTCIceServerUrls:()=>Y,shimRemoteStreamsAPI:()=>J,shimTrackEventTransceiver:()=>V});var o={};n.r(o),n.d(o,{removeExtmapAllowMixed:()=>ie,shimAddIceCandidateNullOrEmpty:()=>oe,shimConnectionState:()=>re,shimMaxMessageSize:()=>te,shimParameterlessSetLocalDescription:()=>se,shimRTCIceCandidate:()=>Q,shimRTCIceCandidateRelayProtocol:()=>ee,shimSendThrowTypeError:()=>ne});let s=!0,a=!0;function c(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function d(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};const o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function l(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(s=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function h(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(a=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function p(){if("object"==typeof window){if(s)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function u(e,t){a&&console.warn(e+" is deprecated, please use "+t+" instead.")}function m(e){return"[object Object]"===Object.prototype.toString.call(e)}function _(e){return m(e)?Object.keys(e).reduce((function(t,n){const r=m(e[n]),i=r?_(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[n]:i})}),{}):e}function f(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((r=>{r.endsWith("Id")?f(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((t=>{f(e,e.get(t),n)}))})))}function g(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((n=>{n.type===r&&n.trackId===t.id&&f(e,n,i)}))})),i}const C=p;function y(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach((e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=r(e.video),C("chrome: "+JSON.stringify(e)),i(e)}))}e.video=r(e.video)}return C("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,(e=>{n.webkitGetUserMedia(e,t,(e=>{r&&r(o(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function v(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function b(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function S(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.track.id)):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.id)):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else d(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function k(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function T(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{n[t]=e.stat(t)})),t[n.id]=n})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const r=function(e){n(o(i(e)))};return t.apply(this,[r,e])}return new Promise(((e,n)=>{t.apply(this,[function(t){e(o(i(t)))},n])})).then(n,r)}}function E(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>g(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),d(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>g(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach((n=>{n.track===e&&(t?r=!0:t=n)})),this.getReceivers().forEach((t=>(t.track===e&&(n?r=!0:n=t),t.track===e))),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function P(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function R(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return P(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=o(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((t=>e.track===t))&&(t=this._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function w(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function A(e,t){d(e,"negotiationneeded",(e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}function x(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){u("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function I(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function O(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function D(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return r.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(i,o)}}function M(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function L(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),d(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function H(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){u("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function G(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function j(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const n=e.length>0;n&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return r})}function N(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function F(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function z(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((n=>t.call(this,n,e))),e.getVideoTracks().forEach((n=>t.call(this,n,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach((e=>{n.includes(e.track)&&this.removeTrack(e)}))})}}function J(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}))}),t.apply(e,arguments)}}}function K(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){const r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}function q(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(W(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function W(e){return e&&void 0!==e.video?Object.assign({},e,{video:_(e.video)}):e}function Y(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];void 0===r.urls&&r.url?(u("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function V(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function B(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Z(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var X=n(539),$=n.n(X);function Q(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const n=new t(e),r=$().parseCandidate(e.candidate);for(const e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,d(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function ee(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||d(e,"icecandidate",(e=>{if(e.candidate){const t=$().parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function te(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=$().splitSections(e.sdp);return t.shift(),t.some((e=>{const t=$().parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=$().matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function ne(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},d(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function re(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function ie(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function oe(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function se(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return n.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>n.apply(this,[e])))})}!function({window:n}={},r={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const s=p,a=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=c(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=c(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=c(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(n),d={browserDetails:a,commonShim:o,extractVersion:c,disableLog:l,disableWarnings:h,sdp:X};switch(a.browser){case"chrome":if(!e||!w||!r.shimChrome)return s("Chrome shim is not included in this adapter release."),d;if(null===a.version)return s("Chrome shim can not determine version, not shimming."),d;s("adapter.js shimming chrome."),d.browserShim=e,oe(n,a),se(n),y(n,a),b(n),w(n,a),S(n),R(n,a),k(n),T(n),E(n),A(n,a),Q(n),ee(n),re(n),te(n,a),ne(n),ie(n,a);break;case"firefox":if(!t||!D||!r.shimFirefox)return s("Firefox shim is not included in this adapter release."),d;s("adapter.js shimming firefox."),d.browserShim=t,oe(n,a),se(n),x(n,a),D(n,a),O(n),H(n),M(n),L(n),G(n),j(n),N(n),U(n),F(n),Q(n),re(n),te(n,a),ne(n);break;case"safari":if(!i||!r.shimSafari)return s("Safari shim is not included in this adapter release."),d;s("adapter.js shimming safari."),d.browserShim=i,oe(n,a),se(n),Y(n),B(n),K(n),z(n),J(n),V(n),q(n),Z(n),Q(n),ee(n),te(n,a),ne(n),ie(n,a);break;default:s("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const ae=Object.freeze({meta:null,signalingServerUrl:"ws://127.0.0.1:8443",reconnectionTimeout:2500,webrtcConfig:{iceServers:[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]}]}}),ce={idle:0,connecting:1,streaming:2,closed:3};Object.freeze(ce);const de=ce;class le extends EventTarget{constructor(e,t){super(),this._peerId=e,this._sessionId="",this._comChannel=t,this._state=de.idle,this._rtcPeerConnection=null}get peerId(){return this._peerId}get sessionId(){return this._sessionId}get state(){return this._state}get rtcPeerConnection(){return this._rtcPeerConnection}close(){this._state!==de.closed&&(this._state!==de.idle&&this._comChannel&&this._sessionId&&this._comChannel.send({type:"endSession",sessionId:this._sessionId}),this._state=de.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._rtcPeerConnection&&(this._rtcPeerConnection.close(),this._rtcPeerConnection=null,this.dispatchEvent(new Event("rtcPeerConnectionChanged"))),this.dispatchEvent(new Event("closed")))}}const he=le,pe=Object.freeze({32:"space",33:"exclam",34:"quotedbl",35:"numbersign",36:"dollar",37:"percent",38:"ampersand",39:"apostrophe",40:"parenleft",41:"parenright",42:"asterisk",43:"plus",44:"comma",45:"minus",46:"period",47:"slash",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",58:"colon",59:"semicolon",60:"less",61:"equal",62:"greater",63:"question",64:"at",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"bracketleft",92:"backslash",93:"bracketright",94:"asciicircum",95:"underscore",96:"grave",97:"a",98:"b",99:"c",100:"d",101:"e",102:"f",103:"g",104:"h",105:"i",106:"j",107:"k",108:"l",109:"m",110:"n",111:"o",112:"p",113:"q",114:"r",115:"s",116:"t",117:"u",118:"v",119:"w",120:"x",121:"y",122:"z",123:"braceleft",124:"bar",125:"braceright",126:"asciitilde",160:"nobreakspace",161:"exclamdown",162:"cent",163:"sterling",164:"currency",165:"yen",166:"brokenbar",167:"section",168:"diaeresis",169:"copyright",170:"ordfeminine",171:"guillemotleft",172:"notsign",173:"hyphen",174:"registered",175:"macron",176:"degree",177:"plusminus",178:"twosuperior",179:"threesuperior",180:"acute",181:"mu",182:"paragraph",183:"periodcentered",184:"cedilla",185:"onesuperior",186:"masculine",187:"guillemotright",188:"onequarter",189:"onehalf",190:"threequarters",191:"questiondown",192:"Agrave",193:"Aacute",194:"Acircumflex",195:"Atilde",196:"Adiaeresis",197:"Aring",198:"AE",199:"Ccedilla",200:"Egrave",201:"Eacute",202:"Ecircumflex",203:"Ediaeresis",204:"Igrave",205:"Iacute",206:"Icircumflex",207:"Idiaeresis",208:"ETH",209:"Ntilde",210:"Ograve",211:"Oacute",212:"Ocircumflex",213:"Otilde",214:"Odiaeresis",215:"multiply",216:"Ooblique",217:"Ugrave",218:"Uacute",219:"Ucircumflex",220:"Udiaeresis",221:"Yacute",222:"THORN",223:"ssharp",224:"agrave",225:"aacute",226:"acircumflex",227:"atilde",228:"adiaeresis",229:"aring",230:"ae",231:"ccedilla",232:"egrave",233:"eacute",234:"ecircumflex",235:"ediaeresis",236:"igrave",237:"iacute",238:"icircumflex",239:"idiaeresis",240:"eth",241:"ntilde",242:"ograve",243:"oacute",244:"ocircumflex",245:"otilde",246:"odiaeresis",247:"division",248:"oslash",249:"ugrave",250:"uacute",251:"ucircumflex",252:"udiaeresis",253:"yacute",254:"thorn",255:"ydiaeresis",260:"Aogonek",728:"breve",321:"Lstroke",317:"Lcaron",346:"Sacute",352:"Scaron",350:"Scedilla",356:"Tcaron",377:"Zacute",381:"Zcaron",379:"Zabovedot",261:"aogonek",731:"ogonek",322:"lstroke",318:"lcaron",347:"sacute",711:"caron",353:"scaron",351:"scedilla",357:"tcaron",378:"zacute",733:"doubleacute",382:"zcaron",380:"zabovedot",340:"Racute",258:"Abreve",313:"Lacute",262:"Cacute",268:"Ccaron",280:"Eogonek",282:"Ecaron",270:"Dcaron",272:"Dstroke",323:"Nacute",327:"Ncaron",336:"Odoubleacute",344:"Rcaron",366:"Uring",368:"Udoubleacute",354:"Tcedilla",341:"racute",259:"abreve",314:"lacute",263:"cacute",269:"ccaron",281:"eogonek",283:"ecaron",271:"dcaron",273:"dstroke",324:"nacute",328:"ncaron",337:"odoubleacute",345:"rcaron",367:"uring",369:"udoubleacute",355:"tcedilla",729:"abovedot",294:"Hstroke",292:"Hcircumflex",304:"Iabovedot",286:"Gbreve",308:"Jcircumflex",295:"hstroke",293:"hcircumflex",305:"idotless",287:"gbreve",309:"jcircumflex",266:"Cabovedot",264:"Ccircumflex",288:"Gabovedot",284:"Gcircumflex",364:"Ubreve",348:"Scircumflex",267:"cabovedot",265:"ccircumflex",289:"gabovedot",285:"gcircumflex",365:"ubreve",349:"scircumflex",312:"kra",342:"Rcedilla",296:"Itilde",315:"Lcedilla",274:"Emacron",290:"Gcedilla",358:"Tslash",343:"rcedilla",297:"itilde",316:"lcedilla",275:"emacron",291:"gcedilla",359:"tslash",330:"ENG",331:"eng",256:"Amacron",302:"Iogonek",278:"Eabovedot",298:"Imacron",325:"Ncedilla",332:"Omacron",310:"Kcedilla",370:"Uogonek",360:"Utilde",362:"Umacron",257:"amacron",303:"iogonek",279:"eabovedot",299:"imacron",326:"ncedilla",333:"omacron",311:"kcedilla",371:"uogonek",361:"utilde",363:"umacron",8254:"overline",12290:"kana_fullstop",12300:"kana_openingbracket",12301:"kana_closingbracket",12289:"kana_comma",12539:"kana_conjunctive",12530:"kana_WO",12449:"kana_a",12451:"kana_i",12453:"kana_u",12455:"kana_e",12457:"kana_o",12515:"kana_ya",12517:"kana_yu",12519:"kana_yo",12483:"kana_tsu",12540:"prolongedsound",12450:"kana_A",12452:"kana_I",12454:"kana_U",12456:"kana_E",12458:"kana_O",12459:"kana_KA",12461:"kana_KI",12463:"kana_KU",12465:"kana_KE",12467:"kana_KO",12469:"kana_SA",12471:"kana_SHI",12473:"kana_SU",12475:"kana_SE",12477:"kana_SO",12479:"kana_TA",12481:"kana_CHI",12484:"kana_TSU",12486:"kana_TE",12488:"kana_TO",12490:"kana_NA",12491:"kana_NI",12492:"kana_NU",12493:"kana_NE",12494:"kana_NO",12495:"kana_HA",12498:"kana_HI",12501:"kana_FU",12504:"kana_HE",12507:"kana_HO",12510:"kana_MA",12511:"kana_MI",12512:"kana_MU",12513:"kana_ME",12514:"kana_MO",12516:"kana_YA",12518:"kana_YU",12520:"kana_YO",12521:"kana_RA",12522:"kana_RI",12523:"kana_RU",12524:"kana_RE",12525:"kana_RO",12527:"kana_WA",12531:"kana_N",12443:"voicedsound",12444:"semivoicedsound",1548:"Arabic_comma",1563:"Arabic_semicolon",1567:"Arabic_question_mark",1569:"Arabic_hamza",1570:"Arabic_maddaonalef",1571:"Arabic_hamzaonalef",1572:"Arabic_hamzaonwaw",1573:"Arabic_hamzaunderalef",1574:"Arabic_hamzaonyeh",1575:"Arabic_alef",1576:"Arabic_beh",1577:"Arabic_tehmarbuta",1578:"Arabic_teh",1579:"Arabic_theh",1580:"Arabic_jeem",1581:"Arabic_hah",1582:"Arabic_khah",1583:"Arabic_dal",1584:"Arabic_thal",1585:"Arabic_ra",1586:"Arabic_zain",1587:"Arabic_seen",1588:"Arabic_sheen",1589:"Arabic_sad",1590:"Arabic_dad",1591:"Arabic_tah",1592:"Arabic_zah",1593:"Arabic_ain",1594:"Arabic_ghain",1600:"Arabic_tatweel",1601:"Arabic_feh",1602:"Arabic_qaf",1603:"Arabic_kaf",1604:"Arabic_lam",1605:"Arabic_meem",1606:"Arabic_noon",1607:"Arabic_ha",1608:"Arabic_waw",1609:"Arabic_alefmaksura",1610:"Arabic_yeh",1611:"Arabic_fathatan",1612:"Arabic_dammatan",1613:"Arabic_kasratan",1614:"Arabic_fatha",1615:"Arabic_damma",1616:"Arabic_kasra",1617:"Arabic_shadda",1618:"Arabic_sukun",1106:"Serbian_dje",1107:"Macedonia_gje",1105:"Cyrillic_io",1108:"Ukrainian_ie",1109:"Macedonia_dse",1110:"Ukrainian_i",1111:"Ukrainian_yi",1112:"Cyrillic_je",1113:"Cyrillic_lje",1114:"Cyrillic_nje",1115:"Serbian_tshe",1116:"Macedonia_kje",1118:"Byelorussian_shortu",1119:"Cyrillic_dzhe",8470:"numerosign",1026:"Serbian_DJE",1027:"Macedonia_GJE",1025:"Cyrillic_IO",1028:"Ukrainian_IE",1029:"Macedonia_DSE",1030:"Ukrainian_I",1031:"Ukrainian_YI",1032:"Cyrillic_JE",1033:"Cyrillic_LJE",1034:"Cyrillic_NJE",1035:"Serbian_TSHE",1036:"Macedonia_KJE",1038:"Byelorussian_SHORTU",1039:"Cyrillic_DZHE",1102:"Cyrillic_yu",1072:"Cyrillic_a",1073:"Cyrillic_be",1094:"Cyrillic_tse",1076:"Cyrillic_de",1077:"Cyrillic_ie",1092:"Cyrillic_ef",1075:"Cyrillic_ghe",1093:"Cyrillic_ha",1080:"Cyrillic_i",1081:"Cyrillic_shorti",1082:"Cyrillic_ka",1083:"Cyrillic_el",1084:"Cyrillic_em",1085:"Cyrillic_en",1086:"Cyrillic_o",1087:"Cyrillic_pe",1103:"Cyrillic_ya",1088:"Cyrillic_er",1089:"Cyrillic_es",1090:"Cyrillic_te",1091:"Cyrillic_u",1078:"Cyrillic_zhe",1074:"Cyrillic_ve",1100:"Cyrillic_softsign",1099:"Cyrillic_yeru",1079:"Cyrillic_ze",1096:"Cyrillic_sha",1101:"Cyrillic_e",1097:"Cyrillic_shcha",1095:"Cyrillic_che",1098:"Cyrillic_hardsign",1070:"Cyrillic_YU",1040:"Cyrillic_A",1041:"Cyrillic_BE",1062:"Cyrillic_TSE",1044:"Cyrillic_DE",1045:"Cyrillic_IE",1060:"Cyrillic_EF",1043:"Cyrillic_GHE",1061:"Cyrillic_HA",1048:"Cyrillic_I",1049:"Cyrillic_SHORTI",1050:"Cyrillic_KA",1051:"Cyrillic_EL",1052:"Cyrillic_EM",1053:"Cyrillic_EN",1054:"Cyrillic_O",1055:"Cyrillic_PE",1071:"Cyrillic_YA",1056:"Cyrillic_ER",1057:"Cyrillic_ES",1058:"Cyrillic_TE",1059:"Cyrillic_U",1046:"Cyrillic_ZHE",1042:"Cyrillic_VE",1068:"Cyrillic_SOFTSIGN",1067:"Cyrillic_YERU",1047:"Cyrillic_ZE",1064:"Cyrillic_SHA",1069:"Cyrillic_E",1065:"Cyrillic_SHCHA",1063:"Cyrillic_CHE",1066:"Cyrillic_HARDSIGN",902:"Greek_ALPHAaccent",904:"Greek_EPSILONaccent",905:"Greek_ETAaccent",906:"Greek_IOTAaccent",938:"Greek_IOTAdiaeresis",908:"Greek_OMICRONaccent",910:"Greek_UPSILONaccent",939:"Greek_UPSILONdieresis",911:"Greek_OMEGAaccent",901:"Greek_accentdieresis",8213:"Greek_horizbar",940:"Greek_alphaaccent",941:"Greek_epsilonaccent",942:"Greek_etaaccent",943:"Greek_iotaaccent",970:"Greek_iotadieresis",912:"Greek_iotaaccentdieresis",972:"Greek_omicronaccent",973:"Greek_upsilonaccent",971:"Greek_upsilondieresis",944:"Greek_upsilonaccentdieresis",974:"Greek_omegaaccent",913:"Greek_ALPHA",914:"Greek_BETA",915:"Greek_GAMMA",916:"Greek_DELTA",917:"Greek_EPSILON",918:"Greek_ZETA",919:"Greek_ETA",920:"Greek_THETA",921:"Greek_IOTA",922:"Greek_KAPPA",923:"Greek_LAMBDA",924:"Greek_MU",925:"Greek_NU",926:"Greek_XI",927:"Greek_OMICRON",928:"Greek_PI",929:"Greek_RHO",931:"Greek_SIGMA",932:"Greek_TAU",933:"Greek_UPSILON",934:"Greek_PHI",935:"Greek_CHI",936:"Greek_PSI",937:"Greek_OMEGA",945:"Greek_alpha",946:"Greek_beta",947:"Greek_gamma",948:"Greek_delta",949:"Greek_epsilon",950:"Greek_zeta",951:"Greek_eta",952:"Greek_theta",953:"Greek_iota",954:"Greek_kappa",955:"Greek_lambda",956:"Greek_mu",957:"Greek_nu",958:"Greek_xi",959:"Greek_omicron",960:"Greek_pi",961:"Greek_rho",963:"Greek_sigma",962:"Greek_finalsmallsigma",964:"Greek_tau",965:"Greek_upsilon",966:"Greek_phi",967:"Greek_chi",968:"Greek_psi",969:"Greek_omega",9143:"leftradical",8992:"topintegral",8993:"botintegral",9121:"topleftsqbracket",9123:"botleftsqbracket",9124:"toprightsqbracket",9126:"botrightsqbracket",9115:"topleftparens",9117:"botleftparens",9118:"toprightparens",9120:"botrightparens",9128:"leftmiddlecurlybrace",9132:"rightmiddlecurlybrace",8804:"lessthanequal",8800:"notequal",8805:"greaterthanequal",8747:"integral",8756:"therefore",8733:"variation",8734:"infinity",8711:"nabla",8764:"approximate",8771:"similarequal",8660:"ifonlyif",8658:"implies",8801:"identical",8730:"radical",8834:"includedin",8835:"includes",8745:"intersection",8746:"union",8743:"logicaland",8744:"logicalor",8706:"partialderivative",402:"function",8592:"leftarrow",8593:"uparrow",8594:"rightarrow",8595:"downarrow",9670:"soliddiamond",9618:"checkerboard",9225:"ht",9228:"ff",9229:"cr",9226:"lf",9252:"nl",9227:"vt",9496:"lowrightcorner",9488:"uprightcorner",9484:"upleftcorner",9492:"lowleftcorner",9532:"crossinglines",9146:"horizlinescan1",9147:"horizlinescan3",9472:"horizlinescan5",9148:"horizlinescan7",9149:"horizlinescan9",9500:"leftt",9508:"rightt",9524:"bott",9516:"topt",9474:"vertbar",8195:"emspace",8194:"enspace",8196:"em3space",8197:"em4space",8199:"digitspace",8200:"punctspace",8201:"thinspace",8202:"hairspace",8212:"emdash",8211:"endash",9251:"signifblank",8230:"ellipsis",8229:"doubbaselinedot",8531:"onethird",8532:"twothirds",8533:"onefifth",8534:"twofifths",8535:"threefifths",8536:"fourfifths",8537:"onesixth",8538:"fivesixths",8453:"careof",8210:"figdash",10216:"leftanglebracket",10217:"rightanglebracket",8539:"oneeighth",8540:"threeeighths",8541:"fiveeighths",8542:"seveneighths",8482:"trademark",9747:"signaturemark",9665:"leftopentriangle",9655:"rightopentriangle",9647:"emopenrectangle",8216:"leftsinglequotemark",8217:"rightsinglequotemark",8220:"leftdoublequotemark",8221:"rightdoublequotemark",8478:"prescription",8242:"minutes",8243:"seconds",10013:"latincross",9644:"filledrectbullet",9664:"filledlefttribullet",9654:"filledrighttribullet",9679:"emfilledcircle",9646:"emfilledrect",9702:"enopencircbullet",9643:"enopensquarebullet",9645:"openrectbullet",9651:"opentribulletup",9661:"opentribulletdown",9734:"openstar",8226:"enfilledcircbullet",9642:"enfilledsqbullet",9650:"filledtribulletup",9660:"filledtribulletdown",9756:"leftpointer",9758:"rightpointer",9827:"club",9830:"diamond",9829:"heart",10016:"maltesecross",8224:"dagger",8225:"doubledagger",10003:"checkmark",10007:"ballotcross",9839:"musicalsharp",9837:"musicalflat",9794:"malesymbol",9792:"femalesymbol",9742:"telephone",8981:"telephonerecorder",8471:"phonographcopyright",8248:"caret",8218:"singlelowquotemark",8222:"doublelowquotemark",8869:"downtack",8970:"downstile",8728:"jot",9109:"quad",8868:"uptack",9675:"circle",8968:"upstile",8866:"lefttack",8867:"righttack",8215:"hebrew_doublelowline",1488:"hebrew_aleph",1489:"hebrew_beth",1490:"hebrew_gimmel",1491:"hebrew_daleth",1492:"hebrew_he",1493:"hebrew_waw",1494:"hebrew_zayin",1495:"hebrew_het",1496:"hebrew_teth",1497:"hebrew_yod",1498:"hebrew_finalkaph",1499:"hebrew_kaph",1500:"hebrew_lamed",1501:"hebrew_finalmem",1502:"hebrew_mem",1503:"hebrew_finalnun",1504:"hebrew_nun",1505:"hebrew_samekh",1506:"hebrew_ayin",1507:"hebrew_finalpe",1508:"hebrew_pe",1509:"hebrew_finalzadi",1510:"hebrew_zadi",1511:"hebrew_qoph",1512:"hebrew_resh",1513:"hebrew_shin",1514:"hebrew_taw",3585:"Thai_kokai",3586:"Thai_khokhai",3587:"Thai_khokhuat",3588:"Thai_khokhwai",3589:"Thai_khokhon",3590:"Thai_khorakhang",3591:"Thai_ngongu",3592:"Thai_chochan",3593:"Thai_choching",3594:"Thai_chochang",3595:"Thai_soso",3596:"Thai_chochoe",3597:"Thai_yoying",3598:"Thai_dochada",3599:"Thai_topatak",3600:"Thai_thothan",3601:"Thai_thonangmontho",3602:"Thai_thophuthao",3603:"Thai_nonen",3604:"Thai_dodek",3605:"Thai_totao",3606:"Thai_thothung",3607:"Thai_thothahan",3608:"Thai_thothong",3609:"Thai_nonu",3610:"Thai_bobaimai",3611:"Thai_popla",3612:"Thai_phophung",3613:"Thai_fofa",3614:"Thai_phophan",3615:"Thai_fofan",3616:"Thai_phosamphao",3617:"Thai_moma",3618:"Thai_yoyak",3619:"Thai_rorua",3620:"Thai_ru",3621:"Thai_loling",3622:"Thai_lu",3623:"Thai_wowaen",3624:"Thai_sosala",3625:"Thai_sorusi",3626:"Thai_sosua",3627:"Thai_hohip",3628:"Thai_lochula",3629:"Thai_oang",3630:"Thai_honokhuk",3631:"Thai_paiyannoi",3632:"Thai_saraa",3633:"Thai_maihanakat",3634:"Thai_saraaa",3635:"Thai_saraam",3636:"Thai_sarai",3637:"Thai_saraii",3638:"Thai_saraue",3639:"Thai_sarauee",3640:"Thai_sarau",3641:"Thai_sarauu",3642:"Thai_phinthu",3647:"Thai_baht",3648:"Thai_sarae",3649:"Thai_saraae",3650:"Thai_sarao",3651:"Thai_saraaimaimuan",3652:"Thai_saraaimaimalai",3653:"Thai_lakkhangyao",3654:"Thai_maiyamok",3655:"Thai_maitaikhu",3656:"Thai_maiek",3657:"Thai_maitho",3658:"Thai_maitri",3659:"Thai_maichattawa",3660:"Thai_thanthakhat",3661:"Thai_nikhahit",3664:"Thai_leksun",3665:"Thai_leknung",3666:"Thai_leksong",3667:"Thai_leksam",3668:"Thai_leksi",3669:"Thai_lekha",3670:"Thai_lekhok",3671:"Thai_lekchet",3672:"Thai_lekpaet",3673:"Thai_lekkao",12593:"Hangul_Kiyeog",12594:"Hangul_SsangKiyeog",12595:"Hangul_KiyeogSios",12596:"Hangul_Nieun",12597:"Hangul_NieunJieuj",12598:"Hangul_NieunHieuh",12599:"Hangul_Dikeud",12600:"Hangul_SsangDikeud",12601:"Hangul_Rieul",12602:"Hangul_RieulKiyeog",12603:"Hangul_RieulMieum",12604:"Hangul_RieulPieub",12605:"Hangul_RieulSios",12606:"Hangul_RieulTieut",12607:"Hangul_RieulPhieuf",12608:"Hangul_RieulHieuh",12609:"Hangul_Mieum",12610:"Hangul_Pieub",12611:"Hangul_SsangPieub",12612:"Hangul_PieubSios",12613:"Hangul_Sios",12614:"Hangul_SsangSios",12615:"Hangul_Ieung",12616:"Hangul_Jieuj",12617:"Hangul_SsangJieuj",12618:"Hangul_Cieuc",12619:"Hangul_Khieuq",12620:"Hangul_Tieut",12621:"Hangul_Phieuf",12622:"Hangul_Hieuh",12623:"Hangul_A",12624:"Hangul_AE",12625:"Hangul_YA",12626:"Hangul_YAE",12627:"Hangul_EO",12628:"Hangul_E",12629:"Hangul_YEO",12630:"Hangul_YE",12631:"Hangul_O",12632:"Hangul_WA",12633:"Hangul_WAE",12634:"Hangul_OE",12635:"Hangul_YO",12636:"Hangul_U",12637:"Hangul_WEO",12638:"Hangul_WE",12639:"Hangul_WI",12640:"Hangul_YU",12641:"Hangul_EU",12642:"Hangul_YI",12643:"Hangul_I",4520:"Hangul_J_Kiyeog",4521:"Hangul_J_SsangKiyeog",4522:"Hangul_J_KiyeogSios",4523:"Hangul_J_Nieun",4524:"Hangul_J_NieunJieuj",4525:"Hangul_J_NieunHieuh",4526:"Hangul_J_Dikeud",4527:"Hangul_J_Rieul",4528:"Hangul_J_RieulKiyeog",4529:"Hangul_J_RieulMieum",4530:"Hangul_J_RieulPieub",4531:"Hangul_J_RieulSios",4532:"Hangul_J_RieulTieut",4533:"Hangul_J_RieulPhieuf",4534:"Hangul_J_RieulHieuh",4535:"Hangul_J_Mieum",4536:"Hangul_J_Pieub",4537:"Hangul_J_PieubSios",4538:"Hangul_J_Sios",4539:"Hangul_J_SsangSios",4540:"Hangul_J_Ieung",4541:"Hangul_J_Jieuj",4542:"Hangul_J_Cieuc",4543:"Hangul_J_Khieuq",4544:"Hangul_J_Tieut",4545:"Hangul_J_Phieuf",4546:"Hangul_J_Hieuh",12653:"Hangul_RieulYeorinHieuh",12657:"Hangul_SunkyeongeumMieum",12664:"Hangul_SunkyeongeumPieub",12671:"Hangul_PanSios",12673:"Hangul_KkogjiDalrinIeung",12676:"Hangul_SunkyeongeumPhieuf",12678:"Hangul_YeorinHieuh",12685:"Hangul_AraeA",12686:"Hangul_AraeAE",4587:"Hangul_J_PanSios",4592:"Hangul_J_KkogjiDalrinIeung",4601:"Hangul_J_YeorinHieuh",338:"OE",339:"oe",376:"Ydiaeresis",8352:"EcuSign",8353:"ColonSign",8354:"CruzeiroSign",8355:"FFrancSign",8356:"LiraSign",8357:"MillSign",8358:"NairaSign",8359:"PesetaSign",8360:"RupeeSign",8361:"WonSign",8362:"NewSheqelSign",8363:"DongSign",8364:"EuroSign",768:"dead_grave",769:"dead_acute",770:"dead_circumflex",771:"dead_tilde",772:"dead_macron",774:"dead_breve",775:"dead_abovedot",776:"dead_diaeresis",778:"dead_abovering",779:"dead_doubleacute",780:"dead_caron",807:"dead_cedilla",808:"dead_ogonek",837:"dead_iota",12441:"dead_voiced_sound",12442:"dead_semivoiced_sound",8:"BackSpace",9:"Tab",10:"Linefeed",11:"Clear",13:"Return",19:"Pause",20:"Scroll_Lock",21:"Sys_Req",27:"Escape",1169:"Ukrainian_ghe_with_upturn",1168:"Ukrainian_GHE_WITH_UPTURN",1415:"Armenian_ligature_ew",1417:"Armenian_verjaket",1373:"Armenian_but",1418:"Armenian_yentamna",1372:"Armenian_amanak",1371:"Armenian_shesht",1374:"Armenian_paruyk",1329:"Armenian_AYB",1377:"Armenian_ayb",1330:"Armenian_BEN",1378:"Armenian_ben",1331:"Armenian_GIM",1379:"Armenian_gim",1332:"Armenian_DA",1380:"Armenian_da",1333:"Armenian_YECH",1381:"Armenian_yech",1334:"Armenian_ZA",1382:"Armenian_za",1335:"Armenian_E",1383:"Armenian_e",1336:"Armenian_AT",1384:"Armenian_at",1337:"Armenian_TO",1385:"Armenian_to",1338:"Armenian_ZHE",1386:"Armenian_zhe",1339:"Armenian_INI",1387:"Armenian_ini",1340:"Armenian_LYUN",1388:"Armenian_lyun",1341:"Armenian_KHE",1389:"Armenian_khe",1342:"Armenian_TSA",1390:"Armenian_tsa",1343:"Armenian_KEN",1391:"Armenian_ken",1344:"Armenian_HO",1392:"Armenian_ho",1345:"Armenian_DZA",1393:"Armenian_dza",1346:"Armenian_GHAT",1394:"Armenian_ghat",1347:"Armenian_TCHE",1395:"Armenian_tche",1348:"Armenian_MEN",1396:"Armenian_men",1349:"Armenian_HI",1397:"Armenian_hi",1350:"Armenian_NU",1398:"Armenian_nu",1351:"Armenian_SHA",1399:"Armenian_sha",1352:"Armenian_VO",1400:"Armenian_vo",1353:"Armenian_CHA",1401:"Armenian_cha",1354:"Armenian_PE",1402:"Armenian_pe",1355:"Armenian_JE",1403:"Armenian_je",1356:"Armenian_RA",1404:"Armenian_ra",1357:"Armenian_SE",1405:"Armenian_se",1358:"Armenian_VEV",1406:"Armenian_vev",1359:"Armenian_TYUN",1407:"Armenian_tyun",1360:"Armenian_RE",1408:"Armenian_re",1361:"Armenian_TSO",1409:"Armenian_tso",1362:"Armenian_VYUN",1410:"Armenian_vyun",1363:"Armenian_PYUR",1411:"Armenian_pyur",1364:"Armenian_KE",1412:"Armenian_ke",1365:"Armenian_O",1413:"Armenian_o",1366:"Armenian_FE",1414:"Armenian_fe",1370:"Armenian_apostrophe",4304:"Georgian_an",4305:"Georgian_ban",4306:"Georgian_gan",4307:"Georgian_don",4308:"Georgian_en",4309:"Georgian_vin",4310:"Georgian_zen",4311:"Georgian_tan",4312:"Georgian_in",4313:"Georgian_kan",4314:"Georgian_las",4315:"Georgian_man",4316:"Georgian_nar",4317:"Georgian_on",4318:"Georgian_par",4319:"Georgian_zhar",4320:"Georgian_rae",4321:"Georgian_san",4322:"Georgian_tar",4323:"Georgian_un",4324:"Georgian_phar",4325:"Georgian_khar",4326:"Georgian_ghan",4327:"Georgian_qar",4328:"Georgian_shin",4329:"Georgian_chin",4330:"Georgian_can",4331:"Georgian_jil",4332:"Georgian_cil",4333:"Georgian_char",4334:"Georgian_xan",4335:"Georgian_jhan",4336:"Georgian_hae",4337:"Georgian_he",4338:"Georgian_hie",4339:"Georgian_we",4340:"Georgian_har",4341:"Georgian_hoe",4342:"Georgian_fi",7682:"Babovedot",7683:"babovedot",7690:"Dabovedot",7808:"Wgrave",7810:"Wacute",7691:"dabovedot",7922:"Ygrave",7710:"Fabovedot",7711:"fabovedot",7744:"Mabovedot",7745:"mabovedot",7766:"Pabovedot",7809:"wgrave",7767:"pabovedot",7811:"wacute",7776:"Sabovedot",7923:"ygrave",7812:"Wdiaeresis",7813:"wdiaeresis",7777:"sabovedot",372:"Wcircumflex",7786:"Tabovedot",374:"Ycircumflex",373:"wcircumflex",7787:"tabovedot",375:"ycircumflex",1776:"Farsi_0",1777:"Farsi_1",1778:"Farsi_2",1779:"Farsi_3",1780:"Farsi_4",1781:"Farsi_5",1782:"Farsi_6",1783:"Farsi_7",1784:"Farsi_8",1785:"Farsi_9",1642:"Arabic_percent",1648:"Arabic_superscript_alef",1657:"Arabic_tteh",1662:"Arabic_peh",1670:"Arabic_tcheh",1672:"Arabic_ddal",1681:"Arabic_rreh",1748:"Arabic_fullstop",1632:"Arabic_0",1633:"Arabic_1",1634:"Arabic_2",1635:"Arabic_3",1636:"Arabic_4",1637:"Arabic_5",1638:"Arabic_6",1639:"Arabic_7",1640:"Arabic_8",1641:"Arabic_9",1619:"Arabic_madda_above",1620:"Arabic_hamza_above",1621:"Arabic_hamza_below",1688:"Arabic_jeh",1700:"Arabic_veh",1705:"Arabic_keheh",1711:"Arabic_gaf",1722:"Arabic_noon_ghunna",1726:"Arabic_heh_doachashmee",1740:"Farsi_yeh",1746:"Arabic_yeh_baree",1729:"Arabic_heh_goal",1170:"Cyrillic_GHE_bar",1174:"Cyrillic_ZHE_descender",1178:"Cyrillic_KA_descender",1180:"Cyrillic_KA_vertstroke",1186:"Cyrillic_EN_descender",1198:"Cyrillic_U_straight",1200:"Cyrillic_U_straight_bar",1202:"Cyrillic_HA_descender",1206:"Cyrillic_CHE_descender",1208:"Cyrillic_CHE_vertstroke",1210:"Cyrillic_SHHA",1240:"Cyrillic_SCHWA",1250:"Cyrillic_I_macron",1256:"Cyrillic_O_bar",1262:"Cyrillic_U_macron",1171:"Cyrillic_ghe_bar",1175:"Cyrillic_zhe_descender",1179:"Cyrillic_ka_descender",1181:"Cyrillic_ka_vertstroke",1187:"Cyrillic_en_descender",1199:"Cyrillic_u_straight",1201:"Cyrillic_u_straight_bar",1203:"Cyrillic_ha_descender",1207:"Cyrillic_che_descender",1209:"Cyrillic_che_vertstroke",1211:"Cyrillic_shha",1241:"Cyrillic_schwa",1251:"Cyrillic_i_macron",1257:"Cyrillic_o_bar",1263:"Cyrillic_u_macron",7818:"Xabovedot",300:"Ibreve",437:"Zstroke",486:"Gcaron",415:"Obarred",7819:"xabovedot",301:"ibreve",438:"zstroke",487:"gcaron",466:"ocaron",629:"obarred",399:"SCHWA",601:"schwa",7734:"Lbelowdot",7735:"lbelowdot",7840:"Abelowdot",7841:"abelowdot",7842:"Ahook",7843:"ahook",7844:"Acircumflexacute",7845:"acircumflexacute",7846:"Acircumflexgrave",7847:"acircumflexgrave",7848:"Acircumflexhook",7849:"acircumflexhook",7850:"Acircumflextilde",7851:"acircumflextilde",7852:"Acircumflexbelowdot",7853:"acircumflexbelowdot",7854:"Abreveacute",7855:"abreveacute",7856:"Abrevegrave",7857:"abrevegrave",7858:"Abrevehook",7859:"abrevehook",7860:"Abrevetilde",7861:"abrevetilde",7862:"Abrevebelowdot",7863:"abrevebelowdot",7864:"Ebelowdot",7865:"ebelowdot",7866:"Ehook",7867:"ehook",7868:"Etilde",7869:"etilde",7870:"Ecircumflexacute",7871:"ecircumflexacute",7872:"Ecircumflexgrave",7873:"ecircumflexgrave",7874:"Ecircumflexhook",7875:"ecircumflexhook",7876:"Ecircumflextilde",7877:"ecircumflextilde",7878:"Ecircumflexbelowdot",7879:"ecircumflexbelowdot",7880:"Ihook",7881:"ihook",7882:"Ibelowdot",7883:"ibelowdot",7884:"Obelowdot",7885:"obelowdot",7886:"Ohook",7887:"ohook",7888:"Ocircumflexacute",7889:"ocircumflexacute",7890:"Ocircumflexgrave",7891:"ocircumflexgrave",7892:"Ocircumflexhook",7893:"ocircumflexhook",7894:"Ocircumflextilde",7895:"ocircumflextilde",7896:"Ocircumflexbelowdot",7897:"ocircumflexbelowdot",7898:"Ohornacute",7899:"ohornacute",7900:"Ohorngrave",7901:"ohorngrave",7902:"Ohornhook",7903:"ohornhook",7904:"Ohorntilde",7905:"ohorntilde",7906:"Ohornbelowdot",7907:"ohornbelowdot",7908:"Ubelowdot",7909:"ubelowdot",7910:"Uhook",7911:"uhook",7912:"Uhornacute",7913:"uhornacute",7914:"Uhorngrave",7915:"uhorngrave",7916:"Uhornhook",7917:"uhornhook",7918:"Uhorntilde",7919:"uhorntilde",7920:"Uhornbelowdot",7921:"uhornbelowdot",7924:"Ybelowdot",7925:"ybelowdot",7926:"Yhook",7927:"yhook",7928:"Ytilde",7929:"ytilde",416:"Ohorn",417:"ohorn",431:"Uhorn",432:"uhorn",803:"dead_belowdot",777:"dead_hook",795:"dead_horn"}),ue=Object.freeze({AltLeft:"Alt_L",AltRight:"Alt_R",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",Backspace:"BackSpace",CapsLock:"Caps_Lock",ControlLeft:"Control_L",ControlRight:"Control_R",Enter:"Return",HyperLeft:"Hyper_L",HyperRight:"Hyper_R",NumLock:"Num_Lock",NumpadEnter:"Return",MetaLeft:"Meta_L",MetaRight:"Meta_R",PageDown:"Page_Down",PageUp:"Page_Up",ScrollLock:"Scroll_Lock",ShiftLeft:"Shift_L",ShiftRight:"Shift_R",SuperLeft:"Super_L",SuperRight:"Super_R"}),me=new Set(["Clear","Copy","Cut","Delete","End","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Home","Insert","Paste","Redo","Tab","Undo"]);function _e(e,t){var n="Unidentified";if(1===e.length){const t=e.charCodeAt(0);t in pe&&(n=pe[t])}else t in ue?n=ue[t]:me.has(t)&&(n=t);return n}const fe=Object.freeze(["wheel","contextmenu","mousemove","mousedown","mouseup","touchstart","touchend","touchmove","touchcancel","keyup","keydown"]),ge=Object.freeze({mousemove:"MouseMove",mousedown:"MouseButtonPress",mouseup:"MouseButtonRelease"}),Ce=Object.freeze({touchstart:"TouchDown",touchend:"TouchUp",touchmove:"TouchMotion",touchcancel:"TouchUp"}),ye=Object.freeze({keydown:"KeyPress",keyup:"KeyRelease"});function ve(e){const t=[];return e.altKey&&t.push("mod1-mask"),e.ctrlKey&&t.push("control-mask"),e.metaKey&&t.push("meta-mask"),e.shiftKey&&t.push("shift-mask"),t.join("+")}class be extends EventTarget{constructor(e,t){super(),this._rtcDataChannel=e,this._consumerSession=t,this._videoElement=null,this._videoElementComputedStyle=null,this._videoElementKeyboard=null,this._lastTouchEventTimestamp=0,this._requestCounter=0,e.addEventListener("close",(()=>{this._rtcDataChannel===e&&this.close()})),e.addEventListener("error",(t=>{if(this._rtcDataChannel===e){const e=t.error;this.dispatchEvent(new ErrorEvent("error",{message:e&&e.message||"Remote controller error",error:e||new Error("unknown error on the remote controller data channel")}))}})),e.addEventListener("message",(e=>{try{const t=JSON.parse(e.data);"ControlResponseMessage"===t.type?this.dispatchEvent(new CustomEvent("controlResponse",{detail:t})):"InfoMessage"===t.type&&this.dispatchEvent(new CustomEvent("info",{detail:t}))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot parse control message from signaling server",error:e}))}}))}get rtcDataChannel(){return this._rtcDataChannel}get consumerSession(){return this._consumerSession}get videoElement(){return this._videoElement}attachVideoElement(e){if(e instanceof HTMLVideoElement&&e!==this._videoElement){this._videoElement&&this.attachVideoElement(null),this._videoElement=e,this._videoElementComputedStyle=window.getComputedStyle(e);for(const t of fe)e.addEventListener(t,this);e.setAttribute("tabindex","0")}else if(null===e&&this._videoElement){const e=this._videoElement;e.removeAttribute("tabindex"),this._videoElement=null,this._videoElementComputedStyle=null,this._lastTouchEventTimestamp=0;for(const t of fe)e.removeEventListener(t,this)}}sendControlRequest(e){try{if(!e||"object"!=typeof e&&"string"!=typeof e)throw new Error("invalid request");if(!this._rtcDataChannel)throw new Error("remote controller data channel is closed");let t={id:this._requestCounter++,request:e};return this._rtcDataChannel.send(JSON.stringify(t)),t.id}catch(e){return this.dispatchEvent(new ErrorEvent("error",{message:`cannot send control message over session ${this._consumerSession.sessionId} remote controller`,error:e})),-1}}close(){this.attachVideoElement(null);const e=this._rtcDataChannel;this._rtcDataChannel=null,e&&(e.close(),this.dispatchEvent(new Event("closed")))}_sendGstNavigationEvent(e){let t={type:"navigationEvent",event:e};this.sendControlRequest(t)}_computeVideoMousePosition(e){const t={x:0,y:0};if(!this._videoElement||this._videoElement.videoWidth<=0||this._videoElement.videoHeight<=0)return t;const n=parseFloat(this._videoElementComputedStyle.paddingLeft),r=parseFloat(this._videoElementComputedStyle.paddingRight),i=parseFloat(this._videoElementComputedStyle.paddingTop),o=parseFloat(this._videoElementComputedStyle.paddingBottom);if("offsetX"in e&&"offsetY"in e)t.x=e.offsetX-n,t.y=e.offsetY-i;else{const r=this._videoElement.getBoundingClientRect(),o={left:parseFloat(this._videoElementComputedStyle.borderLeftWidth),top:parseFloat(this._videoElementComputedStyle.borderTopWidth)};t.x=e.clientX-r.left-o.left-n,t.y=e.clientY-r.top-o.top-i}const s={x:this._videoElement.clientWidth-(n+r),y:this._videoElement.clientHeight-(i+o)},a=Math.min(s.x/this._videoElement.videoWidth,s.y/this._videoElement.videoHeight);s.x=Math.max(.5*(s.x-this._videoElement.videoWidth*a),0),s.y=Math.max(.5*(s.y-this._videoElement.videoHeight*a),0);const c=0!==a?1/a:0;return t.x=(t.x-s.x)*c,t.y=(t.y-s.y)*c,t.x=Math.min(Math.max(t.x,0),this._videoElement.videoWidth),t.y=Math.min(Math.max(t.y,0),this._videoElement.videoHeight),t}handleEvent(e){if(this._videoElement)switch(e.type){case"wheel":e.preventDefault();{const t=this._computeVideoMousePosition(e);this._sendGstNavigationEvent({event:"MouseScroll",x:t.x,y:t.y,delta_x:-e.deltaX,delta_y:-e.deltaY,modifier_state:ve(e)})}break;case"contextmenu":e.preventDefault();break;case"mousemove":case"mousedown":case"mouseup":e.preventDefault();{const t=this._computeVideoMousePosition(e),n={event:ge[e.type],x:t.x,y:t.y,modifier_state:ve(e)};"mousemove"!==e.type&&(n.button=e.button+1,"mousedown"===e.type&&0===e.button&&this._videoElement.focus()),this._sendGstNavigationEvent(n)}break;case"touchstart":case"touchend":case"touchmove":case"touchcancel":for(const t of e.changedTouches){const n=this._computeVideoMousePosition(t),r={event:Ce[e.type],identifier:t.identifier,x:n.x,y:n.y,modifier_state:ve(e)};!("force"in t)||"touchstart"!==e.type&&"touchmove"!==e.type||(r.pressure=t.force),this._sendGstNavigationEvent(r)}e.timeStamp>this._lastTouchEventTimestamp&&(this._lastTouchEventTimestamp=e.timeStamp,this._sendGstNavigationEvent({event:"TouchFrame",modifier_state:ve(e)}));break;case"keyup":case"keydown":e.preventDefault();{const t={event:ye[e.type],key:_e(e.key,e.code),modifier_state:ve(e)};this._sendGstNavigationEvent(t)}}}}const Se=be;const ke=class extends he{constructor(e,t,n){super(e,t),this._streams=[],this._remoteController=null,this._pendingCandidates=[],this._mungeStereoHack=!1,this._offerOptions=n,this.addEventListener("closed",(()=>{this._streams=[],this._pendingCandidates=[],this._remoteController&&this._remoteController.close()}))}set mungeStereoHack(e){"boolean"==typeof e&&(this._mungeStereoHack=e)}get streams(){return this._streams}get remoteController(){return this._remoteController}connect(){if(!this._comChannel||this._state===de.closed)return!1;if(this._state!==de.idle)return!0;if(this._offerOptions)this.ensurePeerConnection(),this._rtcPeerConnection.createDataChannel("control"),this._rtcPeerConnection.createOffer(this._offerOptions).then((e=>{if(this._rtcPeerConnection&&e)return this._rtcPeerConnection.setLocalDescription(e);throw new Error("cannot send local offer to WebRTC peer")})).then((()=>{if(this._rtcPeerConnection&&this._comChannel){const e={type:"startSession",peerId:this._peerId,offer:this._rtcPeerConnection.localDescription.toJSON().sdp};if(!this._comChannel.send(e))throw new Error("cannot send startSession message to signaling server");this._state=de.connecting,this.dispatchEvent(new Event("stateChanged"))}})).catch((e=>{this._state!==de.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{const e={type:"startSession",peerId:this._peerId};if(!this._comChannel.send(e))return this.dispatchEvent(new ErrorEvent("error",{message:"cannot connect consumer session",error:new Error("cannot send startSession message to signaling server")})),this.close(),!1;this._state=de.connecting,this.dispatchEvent(new Event("stateChanged"))}return!0}onSessionStarted(e,t){if(this._peerId===e&&this._state===de.connecting&&!this._sessionId){console.log("Session started",this._sessionId),this._sessionId=t;for(const e of this._pendingCandidates)console.log("Sending delayed ICE with session id",this._sessionId),this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:e.toJSON()});this._pendingCandidates=[]}}ensurePeerConnection(){if(!this._rtcPeerConnection){const e=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=e,e.ontrack=t=>{if(this._rtcPeerConnection===e&&t.streams&&t.streams.length>0){this._state===de.connecting&&(this._state=de.streaming,this.dispatchEvent(new Event("stateChanged")));let e=!1;for(const n of t.streams)this._streams.includes(n)||(this._streams.push(n),e=!0);e&&this.dispatchEvent(new Event("streamsChanged"))}},e.ondatachannel=e=>{const t=e.channel;if(t&&"control"===t.label){if(this._remoteController){const e=this._remoteController;this._remoteController=null,e.close()}const e=new Se(t,this);this._remoteController=e,this.dispatchEvent(new Event("remoteControllerChanged")),e.addEventListener("closed",(()=>{this._remoteController===e&&(this._remoteController=null,this.dispatchEvent(new Event("remoteControllerChanged")))}))}},e.onicecandidate=t=>{this._rtcPeerConnection===e&&t.candidate&&this._comChannel&&(this._sessionId?(console.log("Sending ICE with session id",this._sessionId),this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:t.candidate.toJSON()})):this._pendingCandidates.push(t.candidate))},this.dispatchEvent(new Event("rtcPeerConnectionChanged"))}}mungeStereo(e,t){const n=/a=fmtp:.* sprop-stereo/g;let r=new Set;for(const t of e.matchAll(n)){const e=t[0].match(/a=fmtp:(\d+) .*/);e&&r.add(e[1])}for(const e of r){const n=new RegExp("a=fmtp:"+e+".*stereo");t.match(n)||(t=t.replaceAll("a=fmtp:"+e,"a=fmtp:"+e+" stereo=1;"))}return t}onSessionPeerMessage(e){if(this._state!==de.closed&&this._comChannel&&this._sessionId)if(this.ensurePeerConnection(),e.sdp)this._offerOptions?this._rtcPeerConnection.setRemoteDescription(e.sdp).then((()=>{console.log("done")})).catch((e=>{this._state!==de.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())})):this._rtcPeerConnection.setRemoteDescription(e.sdp).then((()=>this._rtcPeerConnection?this._rtcPeerConnection.createAnswer():null)).then((t=>this._rtcPeerConnection&&t?(this._mungeStereoHack&&(t.sdp=this.mungeStereo(e.sdp.sdp,t.sdp)),this._rtcPeerConnection.setLocalDescription(t)):null)).then((()=>{if(this._rtcPeerConnection&&this._comChannel){console.log("Sending SDP with session id",this._sessionId);const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}})).catch((e=>{this._state!==de.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{if(!e.ice)throw new Error(`invalid empty peer message received from consumer session ${this._sessionId}`);{const t=new RTCIceCandidate(e.ice);this._rtcPeerConnection.addIceCandidate(t).catch((e=>{this._state!==de.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())}))}}}};class Te extends he{constructor(e,t,n,r){super(e,n),this._sessionId=t,this._state=de.streaming;const i=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=i;for(const e of r.getTracks())i.addTrack(e,r);i.onicecandidate=e=>{this._rtcPeerConnection===i&&e.candidate&&this._comChannel&&this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:e.candidate.toJSON()})},this.dispatchEvent(new Event("rtcPeerConnectionChanged")),i.setLocalDescription().then((()=>{if(this._rtcPeerConnection===i&&this._comChannel){const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}})).catch((e=>{this._state!==de.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}))}onSessionPeerMessage(e){if(this._state!==de.closed&&this._rtcPeerConnection)if(e.sdp)this._rtcPeerConnection.setRemoteDescription(e.sdp).catch((e=>{this._state!==de.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{if(!e.ice)throw new Error(`invalid empty peer message received from producer's client session ${this._peerId}`);{const t=new RTCIceCandidate(e.ice);this._rtcPeerConnection.addIceCandidate(t).catch((e=>{this._state!==de.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())}))}}}}class Ee extends EventTarget{constructor(e,t){super(),this._comChannel=e,this._stream=t,this._state=de.idle,this._clientSessions={}}get stream(){return this._stream}get state(){return this._state}start(){if(!this._comChannel||this._state===de.closed)return!1;if(this._state!==de.idle)return!0;const e={type:"setPeerStatus",roles:["listener","producer"],meta:this._comChannel.meta};return this._comChannel.send(e)?(this._state=de.connecting,this.dispatchEvent(new Event("stateChanged")),!0):(this.dispatchEvent(new ErrorEvent("error",{message:"cannot start producer session",error:new Error("cannot register producer to signaling server")})),this.close(),!1)}close(){if(this._state!==de.closed){for(const e of this._stream.getTracks())e.stop();this._state!==de.idle&&this._comChannel&&this._comChannel.send({type:"setPeerStatus",roles:["listener"],meta:this._comChannel.meta}),this._state=de.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._stream=null;for(const e of Object.values(this._clientSessions))e.close();this._clientSessions={},this.dispatchEvent(new Event("closed"))}}onProducerRegistered(){this._state===de.connecting&&(this._state=de.streaming,this.dispatchEvent(new Event("stateChanged")))}onStartSessionMessage(e){if(this._comChannel&&this._stream&&!(e.sessionId in this._clientSessions)){const t=new Te(e.peerId,e.sessionId,this._comChannel,this._stream);this._clientSessions[e.sessionId]=t,t.addEventListener("closed",(e=>{const n=e.target.sessionId;n in this._clientSessions&&this._clientSessions[n]===t&&(delete this._clientSessions[n],this.dispatchEvent(new CustomEvent("clientConsumerRemoved",{detail:t})))})),t.addEventListener("error",(e=>{this.dispatchEvent(new ErrorEvent("error",{message:`error from client consumer ${e.target.peerId}: ${e.message}`,error:e.error}))})),this.dispatchEvent(new CustomEvent("clientConsumerAdded",{detail:t}))}}onEndSessionMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].close()}onSessionPeerMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].onSessionPeerMessage(e)}}const Pe=Ee,Re=Object.freeze({welcome:"welcome",peerStatusChanged:"peerStatusChanged",list:"list",sessionStarted:"sessionStarted",peer:"peer",startSession:"startSession",endSession:"endSession",error:"error"});function we(e,t){if(!e||"object"!=typeof e)return null;const n={id:"",meta:{}};if(e.id&&"string"==typeof e.id)n.id=e.id;else{if(!e.peerId||"string"!=typeof e.peerId)return null;n.id=e.peerId}return n.id===t?null:(e.meta&&"object"==typeof e.meta&&(n.meta=e.meta),Object.freeze(n.meta),Object.freeze(n))}class Ae extends EventTarget{constructor(e,t,n){super(),this._meta=t,this._webrtcConfig=n,this._ws=new WebSocket(e),this._ready=!1,this._channelId="",this._producerSession=null,this._consumerSessions={},this._ws.onerror=e=>{this.dispatchEvent(new ErrorEvent("error",{message:e.message||"WebSocket error",error:e.error||new Error(this._ready?"transportation error":"cannot connect to signaling server")})),this.close()},this._ws.onclose=()=>{this._ready=!1,this._channelId="",this._ws=null,this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null),this.dispatchEvent(new Event("closed"))},this._ws.onmessage=e=>{try{const n=JSON.parse(e.data);if(n&&"object"==typeof n)switch(n.type){case Re.welcome:this._channelId=n.peerId;try{this._ws.send(JSON.stringify({type:"setPeerStatus",roles:["listener"],meta:t}))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot initialize connection to signaling server",error:e})),this.close()}break;case Re.peerStatusChanged:if(n.peerId===this._channelId)!this._ready&&n.roles.includes("listener")&&(this._ready=!0,this.dispatchEvent(new Event("ready")),this.send({type:"list"})),this._producerSession&&n.roles.includes("producer")&&this._producerSession.onProducerRegistered();else{const e=we(n,this._channelId);e&&(n.roles.includes("producer")?this.dispatchEvent(new CustomEvent("producerAdded",{detail:e})):this.dispatchEvent(new CustomEvent("producerRemoved",{detail:e})))}break;case Re.list:for(const e of n.producers){const t=we(e,this._channelId);t&&this.dispatchEvent(new CustomEvent("producerAdded",{detail:t}))}break;case Re.sessionStarted:{const e=this.getConsumerSession(n.peerId);e&&(delete this._consumerSessions[n.peerId],e.onSessionStarted(n.peerId,n.sessionId),e.sessionId&&!(e.sessionId in this._consumerSessions)?this._consumerSessions[e.sessionId]=e:e.close())}break;case Re.peer:{const e=this.getConsumerSession(n.sessionId);e?e.onSessionPeerMessage(n):this._producerSession&&this._producerSession.onSessionPeerMessage(n)}break;case Re.startSession:this._producerSession&&this._producerSession.onStartSessionMessage(n);break;case Re.endSession:{const e=this.getConsumerSession(n.sessionId);e?e.close():this._producerSession&&this._producerSession.onEndSessionMessage(n)}break;case Re.error:this.dispatchEvent(new ErrorEvent("error",{message:"error received from signaling server",error:new Error(n.details)}));break;default:throw new Error(`unknown message type: "${n.type}"`)}}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot parse incoming message from signaling server",error:e}))}}}get meta(){return this._meta}get webrtcConfig(){return this._webrtcConfig}get ready(){return this._ready}get channelId(){return this._channelId}get producerSession(){return this._producerSession}createProducerSession(e){if(!(this._ready&&e instanceof MediaStream))return null;if(this._producerSession)return this._producerSession.stream===e?this._producerSession:null;const t=new Pe(this,e);return this._producerSession=t,t.addEventListener("closed",(()=>{this._producerSession===t&&(this._producerSession=null)})),t}createConsumerSession(e,t){if(!this._ready||!e||"string"!=typeof e)return null;if(t&&"object"!=typeof t&&(t=void 0),e in this._consumerSessions)return this._consumerSessions[e];for(const t of Object.values(this._consumerSessions))if(t.peerId===e)return t;const n=new ke(e,this,t);return this._consumerSessions[e]=n,n.addEventListener("closed",(e=>{let t=e.target.sessionId;t||(t=e.target.peerId),t in this._consumerSessions&&this._consumerSessions[t]===n&&delete this._consumerSessions[t]})),n}getConsumerSession(e){return e in this._consumerSessions?this._consumerSessions[e]:null}closeAllConsumerSessions(){for(const e of Object.values(this._consumerSessions))e.close();this._consumerSessions={}}send(e){if(this._ready&&e&&"object"==typeof e)try{return this._ws.send(JSON.stringify(e)),!0}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot send message to signaling server",error:e}))}return!1}close(){this._ws&&(this._ready=!1,this._channelId="",this._ws.close(),this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null))}}const xe=Ae;class Ie{constructor(e){this._channel=null,this._producers={},this._connectionListeners=[],this._producersListeners=[];const t=Object.assign({},ae);e&&"object"==typeof e&&Object.assign(t,e),"object"!=typeof t.meta&&(t.meta=null),this._config=t,this.connectChannel()}registerConnectionListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.connected||"function"!=typeof e.disconnected)&&(this._connectionListeners.includes(e)||this._connectionListeners.push(e),!0)}unregisterConnectionListener(e){const t=this._connectionListeners.indexOf(e);return t>=0&&(this._connectionListeners.splice(t,1),!0)}unregisterAllConnectionListeners(){this._connectionListeners=[]}createProducerSession(e){return this._channel?this._channel.createProducerSession(e):null}getAvailableProducers(){return Object.values(this._producers)}registerProducersListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.producerAdded||"function"!=typeof e.producerRemoved)&&(this._producersListeners.includes(e)||this._producersListeners.push(e),!0)}unregisterProducersListener(e){const t=this._producersListeners.indexOf(e);return t>=0&&(this._producersListeners.splice(t,1),!0)}unregisterAllProducersListeners(){this._producersListeners=[]}createConsumerSession(e){return this._channel?this._channel.createConsumerSession(e):null}createConsumerSessionWithOfferOptions(e,t){return this._channel?this._channel.createConsumerSession(e,t):null}connectChannel(){if(this._channel){const e=this._channel;this._channel=null,e.close();for(const e in this._producers)this.triggerProducerRemoved(e);this._producers={},this.triggerDisconnected()}this._channel=new xe(this._config.signalingServerUrl,this._config.meta,this._config.webrtcConfig),this._channel.addEventListener("error",(e=>{e.target===this._channel&&console.error(e.message,e.error)})),this._channel.addEventListener("closed",(e=>{if(e.target===this._channel){this._channel=null;for(const e in this._producers)this.triggerProducerRemoved(e);this._producers={},this.triggerDisconnected(),this._config.reconnectionTimeout>0&&window.setTimeout((()=>{this.connectChannel()}),this._config.reconnectionTimeout)}})),this._channel.addEventListener("ready",(e=>{e.target===this._channel&&this.triggerConnected(this._channel.channelId)})),this._channel.addEventListener("producerAdded",(e=>{e.target===this._channel&&this.triggerProducerAdded(e.detail)})),this._channel.addEventListener("producerRemoved",(e=>{e.target===this._channel&&this.triggerProducerRemoved(e.detail.id)}))}triggerConnected(e){for(const t of this._connectionListeners)try{t.connected(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerDisconnected(){for(const e of this._connectionListeners)try{e.disconnected()}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerProducerAdded(e){if(!(e.id in this._producers)){this._producers[e.id]=e;for(const t of this._producersListeners)try{t.producerAdded(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}}triggerProducerRemoved(e){if(e in this._producers){const t=this._producers[e];delete this._producers[e];for(const e of this._producersListeners)try{e.producerRemoved(t)}catch(e){console.error("a listener callback should not throw any exception",e)}}}}Ie.SessionState=de;const Oe=Ie;window.GstWebRTCAPI||(window.GstWebRTCAPI=Oe);const De=Oe})();var i=r.Z;export{i as default};
|
| 5 |
+
//# sourceMappingURL=gstwebrtc-api-2.0.0.esm.js.map
|
src/dist/gstwebrtc-api-2.0.0.esm.js.map
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/dist/gstwebrtc-api-2.0.0.min.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*! gstwebrtc-api (https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api), MPL-2.0 License, Copyright (C) 2022 Igalia S.L. <info@igalia.com>, Author: Loïc Le Page <llepage@igalia.com> */
|
| 2 |
+
/*! Contains embedded adapter from webrtc-adapter (https://github.com/webrtcHacks/adapter), BSD 3-Clause License, Copyright (c) 2014, The WebRTC project authors. All rights reserved. Copyright (c) 2018, The adapter.js project authors. All rights reserved. */
|
| 3 |
+
|
| 4 |
+
(()=>{"use strict";var e={539:e=>{const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((e=>0===e.indexOf(n)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const r=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<r.length;e++)n=r[e].trim().split("="),t[n[0].trim()]=n[1];return t},t.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const r=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" ");n.profile=r[2];for(let i=3;i<r.length;i++){const o=r[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const r=t.parseRtpMap(s),i=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(r.parameters=i.length?t.parseFmtp(i[0]):{},r.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),n.codecs.push(r),r.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(r.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{n.headerExtensions.push(t.parseExtmap(e))}));const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach((e=>{i.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),n},t.writeRtpDescription=function(e,n){let r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=n.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((e=>{r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));let i=0;return n.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((e=>{r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){const n=[],r=t.parseRtpParameters(e),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[0][1]),r.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),n.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&a&&n.push({ssrc:a});let l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substring(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substring(5),10)*.95-16e3:void 0,n.forEach((e=>{e.maxBitrate=l}))),n},t.parseRtcpParameters=function(e){const n={},r=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const r=t.matchPrefix(e,"a=msid:");if(1===r.length)return n=r[0].substring(7).split(" "),{stream:n[0],track:n[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),r=t.matchPrefix(e,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substring(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,r){let i;const o=void 0!==n?n:2;i=e||t.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const r=t.splitLines(e);for(let e=0;e<r.length;e++)switch(r[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[e].substring(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const n=t.splitLines(e)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){const n=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const n=t.splitLines(e);for(let e=0;e<n.length;e++)if(n[e].length<2||"="!==n[e].charAt(1))return!1;return!0},e.exports=t}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>w,shimAddTrackRemoveTrack:()=>P,shimAddTrackRemoveTrackWithNative:()=>E,shimGetDisplayMedia:()=>y,shimGetSendersWithDtmf:()=>S,shimGetStats:()=>k,shimGetUserMedia:()=>C,shimMediaStream:()=>v,shimOnTrack:()=>b,shimPeerConnection:()=>R,shimSenderReceiverGetStats:()=>T});var t={};n.r(t),n.d(t,{shimAddTransceiver:()=>G,shimCreateAnswer:()=>U,shimCreateOffer:()=>N,shimGetDisplayMedia:()=>x,shimGetParameters:()=>j,shimGetUserMedia:()=>A,shimOnTrack:()=>I,shimPeerConnection:()=>O,shimRTCDataChannel:()=>H,shimReceiverGetStats:()=>M,shimRemoveStream:()=>L,shimSenderGetStats:()=>D});var r={};n.r(r),n.d(r,{shimAudioContext:()=>B,shimCallbacksAPI:()=>J,shimConstraints:()=>q,shimCreateOfferLegacy:()=>V,shimGetUserMedia:()=>K,shimLocalStreamsAPI:()=>F,shimRTCIceServerUrls:()=>W,shimRemoteStreamsAPI:()=>z,shimTrackEventTransceiver:()=>Y});var i={};n.r(i),n.d(i,{removeExtmapAllowMixed:()=>re,shimAddIceCandidateNullOrEmpty:()=>ie,shimConnectionState:()=>ne,shimMaxMessageSize:()=>ee,shimParameterlessSetLocalDescription:()=>oe,shimRTCIceCandidate:()=>$,shimRTCIceCandidateRelayProtocol:()=>Q,shimSendThrowTypeError:()=>te});let o=!0,s=!0;function a(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function c(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};const o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function d(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(o=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function l(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(s=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function h(){if("object"==typeof window){if(o)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function p(e,t){s&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function m(e){return u(e)?Object.keys(e).reduce((function(t,n){const r=u(e[n]),i=r?m(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[n]:i})}),{}):e}function _(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((r=>{r.endsWith("Id")?_(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((t=>{_(e,e.get(t),n)}))})))}function f(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((n=>{n.type===r&&n.trackId===t.id&&_(e,n,i)}))})),i}const g=h;function C(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach((e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=r(e.video),g("chrome: "+JSON.stringify(e)),i(e)}))}e.video=r(e.video)}return g("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,(e=>{n.webkitGetUserMedia(e,t,(e=>{r&&r(o(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function y(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function v(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function b(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.track.id)):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.id)):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else c(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function S(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function k(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{n[t]=e.stat(t)})),t[n.id]=n})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const r=function(e){n(o(i(e)))};return t.apply(this,[r,e])}return new Promise(((e,n)=>{t.apply(this,[function(t){e(o(i(t)))},n])})).then(n,r)}}function T(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>f(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),c(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>f(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach((n=>{n.track===e&&(t?r=!0:t=n)})),this.getReceivers().forEach((t=>(t.track===e&&(n?r=!0:n=t),t.track===e))),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function E(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function P(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return E(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=o(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((t=>e.track===t))&&(t=this._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function R(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function w(e,t){c(e,"negotiationneeded",(e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}function A(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){p("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function x(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function I(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function O(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return r.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(i,o)}}function D(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function M(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),c(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function L(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){p("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function H(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function G(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const n=e.length>0;n&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return r})}function j(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function N(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function F(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((n=>t.call(this,n,e))),e.getVideoTracks().forEach((n=>t.call(this,n,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach((e=>{n.includes(e.track)&&this.removeTrack(e)}))})}}function z(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}))}),t.apply(e,arguments)}}}function J(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){const r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}function K(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(q(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function q(e){return e&&void 0!==e.video?Object.assign({},e,{video:m(e.video)}):e}function W(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];void 0===r.urls&&r.url?(p("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Y(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function V(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function B(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Z=n(539),X=n.n(Z);function $(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const n=new t(e),r=X().parseCandidate(e.candidate);for(const e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,c(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function Q(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||c(e,"icecandidate",(e=>{if(e.candidate){const t=X().parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function ee(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=X().splitSections(e.sdp);return t.shift(),t.some((e=>{const t=X().parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=X().matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function te(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},c(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ne(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function re(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function ie(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function oe(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return n.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>n.apply(this,[e])))})}!function({window:n}={},o={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const s=h,c=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=a(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=a(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=a(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(n),p={browserDetails:c,commonShim:i,extractVersion:a,disableLog:d,disableWarnings:l,sdp:Z};switch(c.browser){case"chrome":if(!e||!R||!o.shimChrome)return s("Chrome shim is not included in this adapter release."),p;if(null===c.version)return s("Chrome shim can not determine version, not shimming."),p;s("adapter.js shimming chrome."),p.browserShim=e,ie(n,c),oe(n),C(n,c),v(n),R(n,c),b(n),P(n,c),S(n),k(n),T(n),w(n,c),$(n),Q(n),ne(n),ee(n,c),te(n),re(n,c);break;case"firefox":if(!t||!O||!o.shimFirefox)return s("Firefox shim is not included in this adapter release."),p;s("adapter.js shimming firefox."),p.browserShim=t,ie(n,c),oe(n),A(n,c),O(n,c),I(n),L(n),D(n),M(n),H(n),G(n),j(n),N(n),U(n),$(n),ne(n),ee(n,c),te(n);break;case"safari":if(!r||!o.shimSafari)return s("Safari shim is not included in this adapter release."),p;s("adapter.js shimming safari."),p.browserShim=r,ie(n,c),oe(n),W(n),V(n),J(n),F(n),z(n),Y(n),K(n),B(n),$(n),Q(n),ee(n,c),te(n),re(n,c);break;default:s("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const se=Object.freeze({meta:null,signalingServerUrl:"ws://127.0.0.1:8443",reconnectionTimeout:2500,webrtcConfig:{iceServers:[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]}]}}),ae={idle:0,connecting:1,streaming:2,closed:3};Object.freeze(ae);const ce=ae;class de extends EventTarget{constructor(e,t){super(),this._peerId=e,this._sessionId="",this._comChannel=t,this._state=ce.idle,this._rtcPeerConnection=null}get peerId(){return this._peerId}get sessionId(){return this._sessionId}get state(){return this._state}get rtcPeerConnection(){return this._rtcPeerConnection}close(){this._state!==ce.closed&&(this._state!==ce.idle&&this._comChannel&&this._sessionId&&this._comChannel.send({type:"endSession",sessionId:this._sessionId}),this._state=ce.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._rtcPeerConnection&&(this._rtcPeerConnection.close(),this._rtcPeerConnection=null,this.dispatchEvent(new Event("rtcPeerConnectionChanged"))),this.dispatchEvent(new Event("closed")))}}const le=de,he=Object.freeze({32:"space",33:"exclam",34:"quotedbl",35:"numbersign",36:"dollar",37:"percent",38:"ampersand",39:"apostrophe",40:"parenleft",41:"parenright",42:"asterisk",43:"plus",44:"comma",45:"minus",46:"period",47:"slash",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",58:"colon",59:"semicolon",60:"less",61:"equal",62:"greater",63:"question",64:"at",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"bracketleft",92:"backslash",93:"bracketright",94:"asciicircum",95:"underscore",96:"grave",97:"a",98:"b",99:"c",100:"d",101:"e",102:"f",103:"g",104:"h",105:"i",106:"j",107:"k",108:"l",109:"m",110:"n",111:"o",112:"p",113:"q",114:"r",115:"s",116:"t",117:"u",118:"v",119:"w",120:"x",121:"y",122:"z",123:"braceleft",124:"bar",125:"braceright",126:"asciitilde",160:"nobreakspace",161:"exclamdown",162:"cent",163:"sterling",164:"currency",165:"yen",166:"brokenbar",167:"section",168:"diaeresis",169:"copyright",170:"ordfeminine",171:"guillemotleft",172:"notsign",173:"hyphen",174:"registered",175:"macron",176:"degree",177:"plusminus",178:"twosuperior",179:"threesuperior",180:"acute",181:"mu",182:"paragraph",183:"periodcentered",184:"cedilla",185:"onesuperior",186:"masculine",187:"guillemotright",188:"onequarter",189:"onehalf",190:"threequarters",191:"questiondown",192:"Agrave",193:"Aacute",194:"Acircumflex",195:"Atilde",196:"Adiaeresis",197:"Aring",198:"AE",199:"Ccedilla",200:"Egrave",201:"Eacute",202:"Ecircumflex",203:"Ediaeresis",204:"Igrave",205:"Iacute",206:"Icircumflex",207:"Idiaeresis",208:"ETH",209:"Ntilde",210:"Ograve",211:"Oacute",212:"Ocircumflex",213:"Otilde",214:"Odiaeresis",215:"multiply",216:"Ooblique",217:"Ugrave",218:"Uacute",219:"Ucircumflex",220:"Udiaeresis",221:"Yacute",222:"THORN",223:"ssharp",224:"agrave",225:"aacute",226:"acircumflex",227:"atilde",228:"adiaeresis",229:"aring",230:"ae",231:"ccedilla",232:"egrave",233:"eacute",234:"ecircumflex",235:"ediaeresis",236:"igrave",237:"iacute",238:"icircumflex",239:"idiaeresis",240:"eth",241:"ntilde",242:"ograve",243:"oacute",244:"ocircumflex",245:"otilde",246:"odiaeresis",247:"division",248:"oslash",249:"ugrave",250:"uacute",251:"ucircumflex",252:"udiaeresis",253:"yacute",254:"thorn",255:"ydiaeresis",260:"Aogonek",728:"breve",321:"Lstroke",317:"Lcaron",346:"Sacute",352:"Scaron",350:"Scedilla",356:"Tcaron",377:"Zacute",381:"Zcaron",379:"Zabovedot",261:"aogonek",731:"ogonek",322:"lstroke",318:"lcaron",347:"sacute",711:"caron",353:"scaron",351:"scedilla",357:"tcaron",378:"zacute",733:"doubleacute",382:"zcaron",380:"zabovedot",340:"Racute",258:"Abreve",313:"Lacute",262:"Cacute",268:"Ccaron",280:"Eogonek",282:"Ecaron",270:"Dcaron",272:"Dstroke",323:"Nacute",327:"Ncaron",336:"Odoubleacute",344:"Rcaron",366:"Uring",368:"Udoubleacute",354:"Tcedilla",341:"racute",259:"abreve",314:"lacute",263:"cacute",269:"ccaron",281:"eogonek",283:"ecaron",271:"dcaron",273:"dstroke",324:"nacute",328:"ncaron",337:"odoubleacute",345:"rcaron",367:"uring",369:"udoubleacute",355:"tcedilla",729:"abovedot",294:"Hstroke",292:"Hcircumflex",304:"Iabovedot",286:"Gbreve",308:"Jcircumflex",295:"hstroke",293:"hcircumflex",305:"idotless",287:"gbreve",309:"jcircumflex",266:"Cabovedot",264:"Ccircumflex",288:"Gabovedot",284:"Gcircumflex",364:"Ubreve",348:"Scircumflex",267:"cabovedot",265:"ccircumflex",289:"gabovedot",285:"gcircumflex",365:"ubreve",349:"scircumflex",312:"kra",342:"Rcedilla",296:"Itilde",315:"Lcedilla",274:"Emacron",290:"Gcedilla",358:"Tslash",343:"rcedilla",297:"itilde",316:"lcedilla",275:"emacron",291:"gcedilla",359:"tslash",330:"ENG",331:"eng",256:"Amacron",302:"Iogonek",278:"Eabovedot",298:"Imacron",325:"Ncedilla",332:"Omacron",310:"Kcedilla",370:"Uogonek",360:"Utilde",362:"Umacron",257:"amacron",303:"iogonek",279:"eabovedot",299:"imacron",326:"ncedilla",333:"omacron",311:"kcedilla",371:"uogonek",361:"utilde",363:"umacron",8254:"overline",12290:"kana_fullstop",12300:"kana_openingbracket",12301:"kana_closingbracket",12289:"kana_comma",12539:"kana_conjunctive",12530:"kana_WO",12449:"kana_a",12451:"kana_i",12453:"kana_u",12455:"kana_e",12457:"kana_o",12515:"kana_ya",12517:"kana_yu",12519:"kana_yo",12483:"kana_tsu",12540:"prolongedsound",12450:"kana_A",12452:"kana_I",12454:"kana_U",12456:"kana_E",12458:"kana_O",12459:"kana_KA",12461:"kana_KI",12463:"kana_KU",12465:"kana_KE",12467:"kana_KO",12469:"kana_SA",12471:"kana_SHI",12473:"kana_SU",12475:"kana_SE",12477:"kana_SO",12479:"kana_TA",12481:"kana_CHI",12484:"kana_TSU",12486:"kana_TE",12488:"kana_TO",12490:"kana_NA",12491:"kana_NI",12492:"kana_NU",12493:"kana_NE",12494:"kana_NO",12495:"kana_HA",12498:"kana_HI",12501:"kana_FU",12504:"kana_HE",12507:"kana_HO",12510:"kana_MA",12511:"kana_MI",12512:"kana_MU",12513:"kana_ME",12514:"kana_MO",12516:"kana_YA",12518:"kana_YU",12520:"kana_YO",12521:"kana_RA",12522:"kana_RI",12523:"kana_RU",12524:"kana_RE",12525:"kana_RO",12527:"kana_WA",12531:"kana_N",12443:"voicedsound",12444:"semivoicedsound",1548:"Arabic_comma",1563:"Arabic_semicolon",1567:"Arabic_question_mark",1569:"Arabic_hamza",1570:"Arabic_maddaonalef",1571:"Arabic_hamzaonalef",1572:"Arabic_hamzaonwaw",1573:"Arabic_hamzaunderalef",1574:"Arabic_hamzaonyeh",1575:"Arabic_alef",1576:"Arabic_beh",1577:"Arabic_tehmarbuta",1578:"Arabic_teh",1579:"Arabic_theh",1580:"Arabic_jeem",1581:"Arabic_hah",1582:"Arabic_khah",1583:"Arabic_dal",1584:"Arabic_thal",1585:"Arabic_ra",1586:"Arabic_zain",1587:"Arabic_seen",1588:"Arabic_sheen",1589:"Arabic_sad",1590:"Arabic_dad",1591:"Arabic_tah",1592:"Arabic_zah",1593:"Arabic_ain",1594:"Arabic_ghain",1600:"Arabic_tatweel",1601:"Arabic_feh",1602:"Arabic_qaf",1603:"Arabic_kaf",1604:"Arabic_lam",1605:"Arabic_meem",1606:"Arabic_noon",1607:"Arabic_ha",1608:"Arabic_waw",1609:"Arabic_alefmaksura",1610:"Arabic_yeh",1611:"Arabic_fathatan",1612:"Arabic_dammatan",1613:"Arabic_kasratan",1614:"Arabic_fatha",1615:"Arabic_damma",1616:"Arabic_kasra",1617:"Arabic_shadda",1618:"Arabic_sukun",1106:"Serbian_dje",1107:"Macedonia_gje",1105:"Cyrillic_io",1108:"Ukrainian_ie",1109:"Macedonia_dse",1110:"Ukrainian_i",1111:"Ukrainian_yi",1112:"Cyrillic_je",1113:"Cyrillic_lje",1114:"Cyrillic_nje",1115:"Serbian_tshe",1116:"Macedonia_kje",1118:"Byelorussian_shortu",1119:"Cyrillic_dzhe",8470:"numerosign",1026:"Serbian_DJE",1027:"Macedonia_GJE",1025:"Cyrillic_IO",1028:"Ukrainian_IE",1029:"Macedonia_DSE",1030:"Ukrainian_I",1031:"Ukrainian_YI",1032:"Cyrillic_JE",1033:"Cyrillic_LJE",1034:"Cyrillic_NJE",1035:"Serbian_TSHE",1036:"Macedonia_KJE",1038:"Byelorussian_SHORTU",1039:"Cyrillic_DZHE",1102:"Cyrillic_yu",1072:"Cyrillic_a",1073:"Cyrillic_be",1094:"Cyrillic_tse",1076:"Cyrillic_de",1077:"Cyrillic_ie",1092:"Cyrillic_ef",1075:"Cyrillic_ghe",1093:"Cyrillic_ha",1080:"Cyrillic_i",1081:"Cyrillic_shorti",1082:"Cyrillic_ka",1083:"Cyrillic_el",1084:"Cyrillic_em",1085:"Cyrillic_en",1086:"Cyrillic_o",1087:"Cyrillic_pe",1103:"Cyrillic_ya",1088:"Cyrillic_er",1089:"Cyrillic_es",1090:"Cyrillic_te",1091:"Cyrillic_u",1078:"Cyrillic_zhe",1074:"Cyrillic_ve",1100:"Cyrillic_softsign",1099:"Cyrillic_yeru",1079:"Cyrillic_ze",1096:"Cyrillic_sha",1101:"Cyrillic_e",1097:"Cyrillic_shcha",1095:"Cyrillic_che",1098:"Cyrillic_hardsign",1070:"Cyrillic_YU",1040:"Cyrillic_A",1041:"Cyrillic_BE",1062:"Cyrillic_TSE",1044:"Cyrillic_DE",1045:"Cyrillic_IE",1060:"Cyrillic_EF",1043:"Cyrillic_GHE",1061:"Cyrillic_HA",1048:"Cyrillic_I",1049:"Cyrillic_SHORTI",1050:"Cyrillic_KA",1051:"Cyrillic_EL",1052:"Cyrillic_EM",1053:"Cyrillic_EN",1054:"Cyrillic_O",1055:"Cyrillic_PE",1071:"Cyrillic_YA",1056:"Cyrillic_ER",1057:"Cyrillic_ES",1058:"Cyrillic_TE",1059:"Cyrillic_U",1046:"Cyrillic_ZHE",1042:"Cyrillic_VE",1068:"Cyrillic_SOFTSIGN",1067:"Cyrillic_YERU",1047:"Cyrillic_ZE",1064:"Cyrillic_SHA",1069:"Cyrillic_E",1065:"Cyrillic_SHCHA",1063:"Cyrillic_CHE",1066:"Cyrillic_HARDSIGN",902:"Greek_ALPHAaccent",904:"Greek_EPSILONaccent",905:"Greek_ETAaccent",906:"Greek_IOTAaccent",938:"Greek_IOTAdiaeresis",908:"Greek_OMICRONaccent",910:"Greek_UPSILONaccent",939:"Greek_UPSILONdieresis",911:"Greek_OMEGAaccent",901:"Greek_accentdieresis",8213:"Greek_horizbar",940:"Greek_alphaaccent",941:"Greek_epsilonaccent",942:"Greek_etaaccent",943:"Greek_iotaaccent",970:"Greek_iotadieresis",912:"Greek_iotaaccentdieresis",972:"Greek_omicronaccent",973:"Greek_upsilonaccent",971:"Greek_upsilondieresis",944:"Greek_upsilonaccentdieresis",974:"Greek_omegaaccent",913:"Greek_ALPHA",914:"Greek_BETA",915:"Greek_GAMMA",916:"Greek_DELTA",917:"Greek_EPSILON",918:"Greek_ZETA",919:"Greek_ETA",920:"Greek_THETA",921:"Greek_IOTA",922:"Greek_KAPPA",923:"Greek_LAMBDA",924:"Greek_MU",925:"Greek_NU",926:"Greek_XI",927:"Greek_OMICRON",928:"Greek_PI",929:"Greek_RHO",931:"Greek_SIGMA",932:"Greek_TAU",933:"Greek_UPSILON",934:"Greek_PHI",935:"Greek_CHI",936:"Greek_PSI",937:"Greek_OMEGA",945:"Greek_alpha",946:"Greek_beta",947:"Greek_gamma",948:"Greek_delta",949:"Greek_epsilon",950:"Greek_zeta",951:"Greek_eta",952:"Greek_theta",953:"Greek_iota",954:"Greek_kappa",955:"Greek_lambda",956:"Greek_mu",957:"Greek_nu",958:"Greek_xi",959:"Greek_omicron",960:"Greek_pi",961:"Greek_rho",963:"Greek_sigma",962:"Greek_finalsmallsigma",964:"Greek_tau",965:"Greek_upsilon",966:"Greek_phi",967:"Greek_chi",968:"Greek_psi",969:"Greek_omega",9143:"leftradical",8992:"topintegral",8993:"botintegral",9121:"topleftsqbracket",9123:"botleftsqbracket",9124:"toprightsqbracket",9126:"botrightsqbracket",9115:"topleftparens",9117:"botleftparens",9118:"toprightparens",9120:"botrightparens",9128:"leftmiddlecurlybrace",9132:"rightmiddlecurlybrace",8804:"lessthanequal",8800:"notequal",8805:"greaterthanequal",8747:"integral",8756:"therefore",8733:"variation",8734:"infinity",8711:"nabla",8764:"approximate",8771:"similarequal",8660:"ifonlyif",8658:"implies",8801:"identical",8730:"radical",8834:"includedin",8835:"includes",8745:"intersection",8746:"union",8743:"logicaland",8744:"logicalor",8706:"partialderivative",402:"function",8592:"leftarrow",8593:"uparrow",8594:"rightarrow",8595:"downarrow",9670:"soliddiamond",9618:"checkerboard",9225:"ht",9228:"ff",9229:"cr",9226:"lf",9252:"nl",9227:"vt",9496:"lowrightcorner",9488:"uprightcorner",9484:"upleftcorner",9492:"lowleftcorner",9532:"crossinglines",9146:"horizlinescan1",9147:"horizlinescan3",9472:"horizlinescan5",9148:"horizlinescan7",9149:"horizlinescan9",9500:"leftt",9508:"rightt",9524:"bott",9516:"topt",9474:"vertbar",8195:"emspace",8194:"enspace",8196:"em3space",8197:"em4space",8199:"digitspace",8200:"punctspace",8201:"thinspace",8202:"hairspace",8212:"emdash",8211:"endash",9251:"signifblank",8230:"ellipsis",8229:"doubbaselinedot",8531:"onethird",8532:"twothirds",8533:"onefifth",8534:"twofifths",8535:"threefifths",8536:"fourfifths",8537:"onesixth",8538:"fivesixths",8453:"careof",8210:"figdash",10216:"leftanglebracket",10217:"rightanglebracket",8539:"oneeighth",8540:"threeeighths",8541:"fiveeighths",8542:"seveneighths",8482:"trademark",9747:"signaturemark",9665:"leftopentriangle",9655:"rightopentriangle",9647:"emopenrectangle",8216:"leftsinglequotemark",8217:"rightsinglequotemark",8220:"leftdoublequotemark",8221:"rightdoublequotemark",8478:"prescription",8242:"minutes",8243:"seconds",10013:"latincross",9644:"filledrectbullet",9664:"filledlefttribullet",9654:"filledrighttribullet",9679:"emfilledcircle",9646:"emfilledrect",9702:"enopencircbullet",9643:"enopensquarebullet",9645:"openrectbullet",9651:"opentribulletup",9661:"opentribulletdown",9734:"openstar",8226:"enfilledcircbullet",9642:"enfilledsqbullet",9650:"filledtribulletup",9660:"filledtribulletdown",9756:"leftpointer",9758:"rightpointer",9827:"club",9830:"diamond",9829:"heart",10016:"maltesecross",8224:"dagger",8225:"doubledagger",10003:"checkmark",10007:"ballotcross",9839:"musicalsharp",9837:"musicalflat",9794:"malesymbol",9792:"femalesymbol",9742:"telephone",8981:"telephonerecorder",8471:"phonographcopyright",8248:"caret",8218:"singlelowquotemark",8222:"doublelowquotemark",8869:"downtack",8970:"downstile",8728:"jot",9109:"quad",8868:"uptack",9675:"circle",8968:"upstile",8866:"lefttack",8867:"righttack",8215:"hebrew_doublelowline",1488:"hebrew_aleph",1489:"hebrew_beth",1490:"hebrew_gimmel",1491:"hebrew_daleth",1492:"hebrew_he",1493:"hebrew_waw",1494:"hebrew_zayin",1495:"hebrew_het",1496:"hebrew_teth",1497:"hebrew_yod",1498:"hebrew_finalkaph",1499:"hebrew_kaph",1500:"hebrew_lamed",1501:"hebrew_finalmem",1502:"hebrew_mem",1503:"hebrew_finalnun",1504:"hebrew_nun",1505:"hebrew_samekh",1506:"hebrew_ayin",1507:"hebrew_finalpe",1508:"hebrew_pe",1509:"hebrew_finalzadi",1510:"hebrew_zadi",1511:"hebrew_qoph",1512:"hebrew_resh",1513:"hebrew_shin",1514:"hebrew_taw",3585:"Thai_kokai",3586:"Thai_khokhai",3587:"Thai_khokhuat",3588:"Thai_khokhwai",3589:"Thai_khokhon",3590:"Thai_khorakhang",3591:"Thai_ngongu",3592:"Thai_chochan",3593:"Thai_choching",3594:"Thai_chochang",3595:"Thai_soso",3596:"Thai_chochoe",3597:"Thai_yoying",3598:"Thai_dochada",3599:"Thai_topatak",3600:"Thai_thothan",3601:"Thai_thonangmontho",3602:"Thai_thophuthao",3603:"Thai_nonen",3604:"Thai_dodek",3605:"Thai_totao",3606:"Thai_thothung",3607:"Thai_thothahan",3608:"Thai_thothong",3609:"Thai_nonu",3610:"Thai_bobaimai",3611:"Thai_popla",3612:"Thai_phophung",3613:"Thai_fofa",3614:"Thai_phophan",3615:"Thai_fofan",3616:"Thai_phosamphao",3617:"Thai_moma",3618:"Thai_yoyak",3619:"Thai_rorua",3620:"Thai_ru",3621:"Thai_loling",3622:"Thai_lu",3623:"Thai_wowaen",3624:"Thai_sosala",3625:"Thai_sorusi",3626:"Thai_sosua",3627:"Thai_hohip",3628:"Thai_lochula",3629:"Thai_oang",3630:"Thai_honokhuk",3631:"Thai_paiyannoi",3632:"Thai_saraa",3633:"Thai_maihanakat",3634:"Thai_saraaa",3635:"Thai_saraam",3636:"Thai_sarai",3637:"Thai_saraii",3638:"Thai_saraue",3639:"Thai_sarauee",3640:"Thai_sarau",3641:"Thai_sarauu",3642:"Thai_phinthu",3647:"Thai_baht",3648:"Thai_sarae",3649:"Thai_saraae",3650:"Thai_sarao",3651:"Thai_saraaimaimuan",3652:"Thai_saraaimaimalai",3653:"Thai_lakkhangyao",3654:"Thai_maiyamok",3655:"Thai_maitaikhu",3656:"Thai_maiek",3657:"Thai_maitho",3658:"Thai_maitri",3659:"Thai_maichattawa",3660:"Thai_thanthakhat",3661:"Thai_nikhahit",3664:"Thai_leksun",3665:"Thai_leknung",3666:"Thai_leksong",3667:"Thai_leksam",3668:"Thai_leksi",3669:"Thai_lekha",3670:"Thai_lekhok",3671:"Thai_lekchet",3672:"Thai_lekpaet",3673:"Thai_lekkao",12593:"Hangul_Kiyeog",12594:"Hangul_SsangKiyeog",12595:"Hangul_KiyeogSios",12596:"Hangul_Nieun",12597:"Hangul_NieunJieuj",12598:"Hangul_NieunHieuh",12599:"Hangul_Dikeud",12600:"Hangul_SsangDikeud",12601:"Hangul_Rieul",12602:"Hangul_RieulKiyeog",12603:"Hangul_RieulMieum",12604:"Hangul_RieulPieub",12605:"Hangul_RieulSios",12606:"Hangul_RieulTieut",12607:"Hangul_RieulPhieuf",12608:"Hangul_RieulHieuh",12609:"Hangul_Mieum",12610:"Hangul_Pieub",12611:"Hangul_SsangPieub",12612:"Hangul_PieubSios",12613:"Hangul_Sios",12614:"Hangul_SsangSios",12615:"Hangul_Ieung",12616:"Hangul_Jieuj",12617:"Hangul_SsangJieuj",12618:"Hangul_Cieuc",12619:"Hangul_Khieuq",12620:"Hangul_Tieut",12621:"Hangul_Phieuf",12622:"Hangul_Hieuh",12623:"Hangul_A",12624:"Hangul_AE",12625:"Hangul_YA",12626:"Hangul_YAE",12627:"Hangul_EO",12628:"Hangul_E",12629:"Hangul_YEO",12630:"Hangul_YE",12631:"Hangul_O",12632:"Hangul_WA",12633:"Hangul_WAE",12634:"Hangul_OE",12635:"Hangul_YO",12636:"Hangul_U",12637:"Hangul_WEO",12638:"Hangul_WE",12639:"Hangul_WI",12640:"Hangul_YU",12641:"Hangul_EU",12642:"Hangul_YI",12643:"Hangul_I",4520:"Hangul_J_Kiyeog",4521:"Hangul_J_SsangKiyeog",4522:"Hangul_J_KiyeogSios",4523:"Hangul_J_Nieun",4524:"Hangul_J_NieunJieuj",4525:"Hangul_J_NieunHieuh",4526:"Hangul_J_Dikeud",4527:"Hangul_J_Rieul",4528:"Hangul_J_RieulKiyeog",4529:"Hangul_J_RieulMieum",4530:"Hangul_J_RieulPieub",4531:"Hangul_J_RieulSios",4532:"Hangul_J_RieulTieut",4533:"Hangul_J_RieulPhieuf",4534:"Hangul_J_RieulHieuh",4535:"Hangul_J_Mieum",4536:"Hangul_J_Pieub",4537:"Hangul_J_PieubSios",4538:"Hangul_J_Sios",4539:"Hangul_J_SsangSios",4540:"Hangul_J_Ieung",4541:"Hangul_J_Jieuj",4542:"Hangul_J_Cieuc",4543:"Hangul_J_Khieuq",4544:"Hangul_J_Tieut",4545:"Hangul_J_Phieuf",4546:"Hangul_J_Hieuh",12653:"Hangul_RieulYeorinHieuh",12657:"Hangul_SunkyeongeumMieum",12664:"Hangul_SunkyeongeumPieub",12671:"Hangul_PanSios",12673:"Hangul_KkogjiDalrinIeung",12676:"Hangul_SunkyeongeumPhieuf",12678:"Hangul_YeorinHieuh",12685:"Hangul_AraeA",12686:"Hangul_AraeAE",4587:"Hangul_J_PanSios",4592:"Hangul_J_KkogjiDalrinIeung",4601:"Hangul_J_YeorinHieuh",338:"OE",339:"oe",376:"Ydiaeresis",8352:"EcuSign",8353:"ColonSign",8354:"CruzeiroSign",8355:"FFrancSign",8356:"LiraSign",8357:"MillSign",8358:"NairaSign",8359:"PesetaSign",8360:"RupeeSign",8361:"WonSign",8362:"NewSheqelSign",8363:"DongSign",8364:"EuroSign",768:"dead_grave",769:"dead_acute",770:"dead_circumflex",771:"dead_tilde",772:"dead_macron",774:"dead_breve",775:"dead_abovedot",776:"dead_diaeresis",778:"dead_abovering",779:"dead_doubleacute",780:"dead_caron",807:"dead_cedilla",808:"dead_ogonek",837:"dead_iota",12441:"dead_voiced_sound",12442:"dead_semivoiced_sound",8:"BackSpace",9:"Tab",10:"Linefeed",11:"Clear",13:"Return",19:"Pause",20:"Scroll_Lock",21:"Sys_Req",27:"Escape",1169:"Ukrainian_ghe_with_upturn",1168:"Ukrainian_GHE_WITH_UPTURN",1415:"Armenian_ligature_ew",1417:"Armenian_verjaket",1373:"Armenian_but",1418:"Armenian_yentamna",1372:"Armenian_amanak",1371:"Armenian_shesht",1374:"Armenian_paruyk",1329:"Armenian_AYB",1377:"Armenian_ayb",1330:"Armenian_BEN",1378:"Armenian_ben",1331:"Armenian_GIM",1379:"Armenian_gim",1332:"Armenian_DA",1380:"Armenian_da",1333:"Armenian_YECH",1381:"Armenian_yech",1334:"Armenian_ZA",1382:"Armenian_za",1335:"Armenian_E",1383:"Armenian_e",1336:"Armenian_AT",1384:"Armenian_at",1337:"Armenian_TO",1385:"Armenian_to",1338:"Armenian_ZHE",1386:"Armenian_zhe",1339:"Armenian_INI",1387:"Armenian_ini",1340:"Armenian_LYUN",1388:"Armenian_lyun",1341:"Armenian_KHE",1389:"Armenian_khe",1342:"Armenian_TSA",1390:"Armenian_tsa",1343:"Armenian_KEN",1391:"Armenian_ken",1344:"Armenian_HO",1392:"Armenian_ho",1345:"Armenian_DZA",1393:"Armenian_dza",1346:"Armenian_GHAT",1394:"Armenian_ghat",1347:"Armenian_TCHE",1395:"Armenian_tche",1348:"Armenian_MEN",1396:"Armenian_men",1349:"Armenian_HI",1397:"Armenian_hi",1350:"Armenian_NU",1398:"Armenian_nu",1351:"Armenian_SHA",1399:"Armenian_sha",1352:"Armenian_VO",1400:"Armenian_vo",1353:"Armenian_CHA",1401:"Armenian_cha",1354:"Armenian_PE",1402:"Armenian_pe",1355:"Armenian_JE",1403:"Armenian_je",1356:"Armenian_RA",1404:"Armenian_ra",1357:"Armenian_SE",1405:"Armenian_se",1358:"Armenian_VEV",1406:"Armenian_vev",1359:"Armenian_TYUN",1407:"Armenian_tyun",1360:"Armenian_RE",1408:"Armenian_re",1361:"Armenian_TSO",1409:"Armenian_tso",1362:"Armenian_VYUN",1410:"Armenian_vyun",1363:"Armenian_PYUR",1411:"Armenian_pyur",1364:"Armenian_KE",1412:"Armenian_ke",1365:"Armenian_O",1413:"Armenian_o",1366:"Armenian_FE",1414:"Armenian_fe",1370:"Armenian_apostrophe",4304:"Georgian_an",4305:"Georgian_ban",4306:"Georgian_gan",4307:"Georgian_don",4308:"Georgian_en",4309:"Georgian_vin",4310:"Georgian_zen",4311:"Georgian_tan",4312:"Georgian_in",4313:"Georgian_kan",4314:"Georgian_las",4315:"Georgian_man",4316:"Georgian_nar",4317:"Georgian_on",4318:"Georgian_par",4319:"Georgian_zhar",4320:"Georgian_rae",4321:"Georgian_san",4322:"Georgian_tar",4323:"Georgian_un",4324:"Georgian_phar",4325:"Georgian_khar",4326:"Georgian_ghan",4327:"Georgian_qar",4328:"Georgian_shin",4329:"Georgian_chin",4330:"Georgian_can",4331:"Georgian_jil",4332:"Georgian_cil",4333:"Georgian_char",4334:"Georgian_xan",4335:"Georgian_jhan",4336:"Georgian_hae",4337:"Georgian_he",4338:"Georgian_hie",4339:"Georgian_we",4340:"Georgian_har",4341:"Georgian_hoe",4342:"Georgian_fi",7682:"Babovedot",7683:"babovedot",7690:"Dabovedot",7808:"Wgrave",7810:"Wacute",7691:"dabovedot",7922:"Ygrave",7710:"Fabovedot",7711:"fabovedot",7744:"Mabovedot",7745:"mabovedot",7766:"Pabovedot",7809:"wgrave",7767:"pabovedot",7811:"wacute",7776:"Sabovedot",7923:"ygrave",7812:"Wdiaeresis",7813:"wdiaeresis",7777:"sabovedot",372:"Wcircumflex",7786:"Tabovedot",374:"Ycircumflex",373:"wcircumflex",7787:"tabovedot",375:"ycircumflex",1776:"Farsi_0",1777:"Farsi_1",1778:"Farsi_2",1779:"Farsi_3",1780:"Farsi_4",1781:"Farsi_5",1782:"Farsi_6",1783:"Farsi_7",1784:"Farsi_8",1785:"Farsi_9",1642:"Arabic_percent",1648:"Arabic_superscript_alef",1657:"Arabic_tteh",1662:"Arabic_peh",1670:"Arabic_tcheh",1672:"Arabic_ddal",1681:"Arabic_rreh",1748:"Arabic_fullstop",1632:"Arabic_0",1633:"Arabic_1",1634:"Arabic_2",1635:"Arabic_3",1636:"Arabic_4",1637:"Arabic_5",1638:"Arabic_6",1639:"Arabic_7",1640:"Arabic_8",1641:"Arabic_9",1619:"Arabic_madda_above",1620:"Arabic_hamza_above",1621:"Arabic_hamza_below",1688:"Arabic_jeh",1700:"Arabic_veh",1705:"Arabic_keheh",1711:"Arabic_gaf",1722:"Arabic_noon_ghunna",1726:"Arabic_heh_doachashmee",1740:"Farsi_yeh",1746:"Arabic_yeh_baree",1729:"Arabic_heh_goal",1170:"Cyrillic_GHE_bar",1174:"Cyrillic_ZHE_descender",1178:"Cyrillic_KA_descender",1180:"Cyrillic_KA_vertstroke",1186:"Cyrillic_EN_descender",1198:"Cyrillic_U_straight",1200:"Cyrillic_U_straight_bar",1202:"Cyrillic_HA_descender",1206:"Cyrillic_CHE_descender",1208:"Cyrillic_CHE_vertstroke",1210:"Cyrillic_SHHA",1240:"Cyrillic_SCHWA",1250:"Cyrillic_I_macron",1256:"Cyrillic_O_bar",1262:"Cyrillic_U_macron",1171:"Cyrillic_ghe_bar",1175:"Cyrillic_zhe_descender",1179:"Cyrillic_ka_descender",1181:"Cyrillic_ka_vertstroke",1187:"Cyrillic_en_descender",1199:"Cyrillic_u_straight",1201:"Cyrillic_u_straight_bar",1203:"Cyrillic_ha_descender",1207:"Cyrillic_che_descender",1209:"Cyrillic_che_vertstroke",1211:"Cyrillic_shha",1241:"Cyrillic_schwa",1251:"Cyrillic_i_macron",1257:"Cyrillic_o_bar",1263:"Cyrillic_u_macron",7818:"Xabovedot",300:"Ibreve",437:"Zstroke",486:"Gcaron",415:"Obarred",7819:"xabovedot",301:"ibreve",438:"zstroke",487:"gcaron",466:"ocaron",629:"obarred",399:"SCHWA",601:"schwa",7734:"Lbelowdot",7735:"lbelowdot",7840:"Abelowdot",7841:"abelowdot",7842:"Ahook",7843:"ahook",7844:"Acircumflexacute",7845:"acircumflexacute",7846:"Acircumflexgrave",7847:"acircumflexgrave",7848:"Acircumflexhook",7849:"acircumflexhook",7850:"Acircumflextilde",7851:"acircumflextilde",7852:"Acircumflexbelowdot",7853:"acircumflexbelowdot",7854:"Abreveacute",7855:"abreveacute",7856:"Abrevegrave",7857:"abrevegrave",7858:"Abrevehook",7859:"abrevehook",7860:"Abrevetilde",7861:"abrevetilde",7862:"Abrevebelowdot",7863:"abrevebelowdot",7864:"Ebelowdot",7865:"ebelowdot",7866:"Ehook",7867:"ehook",7868:"Etilde",7869:"etilde",7870:"Ecircumflexacute",7871:"ecircumflexacute",7872:"Ecircumflexgrave",7873:"ecircumflexgrave",7874:"Ecircumflexhook",7875:"ecircumflexhook",7876:"Ecircumflextilde",7877:"ecircumflextilde",7878:"Ecircumflexbelowdot",7879:"ecircumflexbelowdot",7880:"Ihook",7881:"ihook",7882:"Ibelowdot",7883:"ibelowdot",7884:"Obelowdot",7885:"obelowdot",7886:"Ohook",7887:"ohook",7888:"Ocircumflexacute",7889:"ocircumflexacute",7890:"Ocircumflexgrave",7891:"ocircumflexgrave",7892:"Ocircumflexhook",7893:"ocircumflexhook",7894:"Ocircumflextilde",7895:"ocircumflextilde",7896:"Ocircumflexbelowdot",7897:"ocircumflexbelowdot",7898:"Ohornacute",7899:"ohornacute",7900:"Ohorngrave",7901:"ohorngrave",7902:"Ohornhook",7903:"ohornhook",7904:"Ohorntilde",7905:"ohorntilde",7906:"Ohornbelowdot",7907:"ohornbelowdot",7908:"Ubelowdot",7909:"ubelowdot",7910:"Uhook",7911:"uhook",7912:"Uhornacute",7913:"uhornacute",7914:"Uhorngrave",7915:"uhorngrave",7916:"Uhornhook",7917:"uhornhook",7918:"Uhorntilde",7919:"uhorntilde",7920:"Uhornbelowdot",7921:"uhornbelowdot",7924:"Ybelowdot",7925:"ybelowdot",7926:"Yhook",7927:"yhook",7928:"Ytilde",7929:"ytilde",416:"Ohorn",417:"ohorn",431:"Uhorn",432:"uhorn",803:"dead_belowdot",777:"dead_hook",795:"dead_horn"}),pe=Object.freeze({AltLeft:"Alt_L",AltRight:"Alt_R",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",Backspace:"BackSpace",CapsLock:"Caps_Lock",ControlLeft:"Control_L",ControlRight:"Control_R",Enter:"Return",HyperLeft:"Hyper_L",HyperRight:"Hyper_R",NumLock:"Num_Lock",NumpadEnter:"Return",MetaLeft:"Meta_L",MetaRight:"Meta_R",PageDown:"Page_Down",PageUp:"Page_Up",ScrollLock:"Scroll_Lock",ShiftLeft:"Shift_L",ShiftRight:"Shift_R",SuperLeft:"Super_L",SuperRight:"Super_R"}),ue=new Set(["Clear","Copy","Cut","Delete","End","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Home","Insert","Paste","Redo","Tab","Undo"]);function me(e,t){var n="Unidentified";if(1===e.length){const t=e.charCodeAt(0);t in he&&(n=he[t])}else t in pe?n=pe[t]:ue.has(t)&&(n=t);return n}const _e=Object.freeze(["wheel","contextmenu","mousemove","mousedown","mouseup","touchstart","touchend","touchmove","touchcancel","keyup","keydown"]),fe=Object.freeze({mousemove:"MouseMove",mousedown:"MouseButtonPress",mouseup:"MouseButtonRelease"}),ge=Object.freeze({touchstart:"TouchDown",touchend:"TouchUp",touchmove:"TouchMotion",touchcancel:"TouchUp"}),Ce=Object.freeze({keydown:"KeyPress",keyup:"KeyRelease"});function ye(e){const t=[];return e.altKey&&t.push("mod1-mask"),e.ctrlKey&&t.push("control-mask"),e.metaKey&&t.push("meta-mask"),e.shiftKey&&t.push("shift-mask"),t.join("+")}class ve extends EventTarget{constructor(e,t){super(),this._rtcDataChannel=e,this._consumerSession=t,this._videoElement=null,this._videoElementComputedStyle=null,this._videoElementKeyboard=null,this._lastTouchEventTimestamp=0,this._requestCounter=0,e.addEventListener("close",(()=>{this._rtcDataChannel===e&&this.close()})),e.addEventListener("error",(t=>{if(this._rtcDataChannel===e){const e=t.error;this.dispatchEvent(new ErrorEvent("error",{message:e&&e.message||"Remote controller error",error:e||new Error("unknown error on the remote controller data channel")}))}})),e.addEventListener("message",(e=>{try{const t=JSON.parse(e.data);"ControlResponseMessage"===t.type?this.dispatchEvent(new CustomEvent("controlResponse",{detail:t})):"InfoMessage"===t.type&&this.dispatchEvent(new CustomEvent("info",{detail:t}))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot parse control message from signaling server",error:e}))}}))}get rtcDataChannel(){return this._rtcDataChannel}get consumerSession(){return this._consumerSession}get videoElement(){return this._videoElement}attachVideoElement(e){if(e instanceof HTMLVideoElement&&e!==this._videoElement){this._videoElement&&this.attachVideoElement(null),this._videoElement=e,this._videoElementComputedStyle=window.getComputedStyle(e);for(const t of _e)e.addEventListener(t,this);e.setAttribute("tabindex","0")}else if(null===e&&this._videoElement){const e=this._videoElement;e.removeAttribute("tabindex"),this._videoElement=null,this._videoElementComputedStyle=null,this._lastTouchEventTimestamp=0;for(const t of _e)e.removeEventListener(t,this)}}sendControlRequest(e){try{if(!e||"object"!=typeof e&&"string"!=typeof e)throw new Error("invalid request");if(!this._rtcDataChannel)throw new Error("remote controller data channel is closed");let t={id:this._requestCounter++,request:e};return this._rtcDataChannel.send(JSON.stringify(t)),t.id}catch(e){return this.dispatchEvent(new ErrorEvent("error",{message:`cannot send control message over session ${this._consumerSession.sessionId} remote controller`,error:e})),-1}}close(){this.attachVideoElement(null);const e=this._rtcDataChannel;this._rtcDataChannel=null,e&&(e.close(),this.dispatchEvent(new Event("closed")))}_sendGstNavigationEvent(e){let t={type:"navigationEvent",event:e};this.sendControlRequest(t)}_computeVideoMousePosition(e){const t={x:0,y:0};if(!this._videoElement||this._videoElement.videoWidth<=0||this._videoElement.videoHeight<=0)return t;const n=parseFloat(this._videoElementComputedStyle.paddingLeft),r=parseFloat(this._videoElementComputedStyle.paddingRight),i=parseFloat(this._videoElementComputedStyle.paddingTop),o=parseFloat(this._videoElementComputedStyle.paddingBottom);if("offsetX"in e&&"offsetY"in e)t.x=e.offsetX-n,t.y=e.offsetY-i;else{const r=this._videoElement.getBoundingClientRect(),o={left:parseFloat(this._videoElementComputedStyle.borderLeftWidth),top:parseFloat(this._videoElementComputedStyle.borderTopWidth)};t.x=e.clientX-r.left-o.left-n,t.y=e.clientY-r.top-o.top-i}const s={x:this._videoElement.clientWidth-(n+r),y:this._videoElement.clientHeight-(i+o)},a=Math.min(s.x/this._videoElement.videoWidth,s.y/this._videoElement.videoHeight);s.x=Math.max(.5*(s.x-this._videoElement.videoWidth*a),0),s.y=Math.max(.5*(s.y-this._videoElement.videoHeight*a),0);const c=0!==a?1/a:0;return t.x=(t.x-s.x)*c,t.y=(t.y-s.y)*c,t.x=Math.min(Math.max(t.x,0),this._videoElement.videoWidth),t.y=Math.min(Math.max(t.y,0),this._videoElement.videoHeight),t}handleEvent(e){if(this._videoElement)switch(e.type){case"wheel":e.preventDefault();{const t=this._computeVideoMousePosition(e);this._sendGstNavigationEvent({event:"MouseScroll",x:t.x,y:t.y,delta_x:-e.deltaX,delta_y:-e.deltaY,modifier_state:ye(e)})}break;case"contextmenu":e.preventDefault();break;case"mousemove":case"mousedown":case"mouseup":e.preventDefault();{const t=this._computeVideoMousePosition(e),n={event:fe[e.type],x:t.x,y:t.y,modifier_state:ye(e)};"mousemove"!==e.type&&(n.button=e.button+1,"mousedown"===e.type&&0===e.button&&this._videoElement.focus()),this._sendGstNavigationEvent(n)}break;case"touchstart":case"touchend":case"touchmove":case"touchcancel":for(const t of e.changedTouches){const n=this._computeVideoMousePosition(t),r={event:ge[e.type],identifier:t.identifier,x:n.x,y:n.y,modifier_state:ye(e)};!("force"in t)||"touchstart"!==e.type&&"touchmove"!==e.type||(r.pressure=t.force),this._sendGstNavigationEvent(r)}e.timeStamp>this._lastTouchEventTimestamp&&(this._lastTouchEventTimestamp=e.timeStamp,this._sendGstNavigationEvent({event:"TouchFrame",modifier_state:ye(e)}));break;case"keyup":case"keydown":e.preventDefault();{const t={event:Ce[e.type],key:me(e.key,e.code),modifier_state:ye(e)};this._sendGstNavigationEvent(t)}}}}const be=ve;const Se=class extends le{constructor(e,t,n){super(e,t),this._streams=[],this._remoteController=null,this._pendingCandidates=[],this._mungeStereoHack=!1,this._offerOptions=n,this.addEventListener("closed",(()=>{this._streams=[],this._pendingCandidates=[],this._remoteController&&this._remoteController.close()}))}set mungeStereoHack(e){"boolean"==typeof e&&(this._mungeStereoHack=e)}get streams(){return this._streams}get remoteController(){return this._remoteController}connect(){if(!this._comChannel||this._state===ce.closed)return!1;if(this._state!==ce.idle)return!0;if(this._offerOptions)this.ensurePeerConnection(),this._rtcPeerConnection.createDataChannel("control"),this._rtcPeerConnection.createOffer(this._offerOptions).then((e=>{if(this._rtcPeerConnection&&e)return this._rtcPeerConnection.setLocalDescription(e);throw new Error("cannot send local offer to WebRTC peer")})).then((()=>{if(this._rtcPeerConnection&&this._comChannel){const e={type:"startSession",peerId:this._peerId,offer:this._rtcPeerConnection.localDescription.toJSON().sdp};if(!this._comChannel.send(e))throw new Error("cannot send startSession message to signaling server");this._state=ce.connecting,this.dispatchEvent(new Event("stateChanged"))}})).catch((e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{const e={type:"startSession",peerId:this._peerId};if(!this._comChannel.send(e))return this.dispatchEvent(new ErrorEvent("error",{message:"cannot connect consumer session",error:new Error("cannot send startSession message to signaling server")})),this.close(),!1;this._state=ce.connecting,this.dispatchEvent(new Event("stateChanged"))}return!0}onSessionStarted(e,t){if(this._peerId===e&&this._state===ce.connecting&&!this._sessionId){console.log("Session started",this._sessionId),this._sessionId=t;for(const e of this._pendingCandidates)console.log("Sending delayed ICE with session id",this._sessionId),this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:e.toJSON()});this._pendingCandidates=[]}}ensurePeerConnection(){if(!this._rtcPeerConnection){const e=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=e,e.ontrack=t=>{if(this._rtcPeerConnection===e&&t.streams&&t.streams.length>0){this._state===ce.connecting&&(this._state=ce.streaming,this.dispatchEvent(new Event("stateChanged")));let e=!1;for(const n of t.streams)this._streams.includes(n)||(this._streams.push(n),e=!0);e&&this.dispatchEvent(new Event("streamsChanged"))}},e.ondatachannel=e=>{const t=e.channel;if(t&&"control"===t.label){if(this._remoteController){const e=this._remoteController;this._remoteController=null,e.close()}const e=new be(t,this);this._remoteController=e,this.dispatchEvent(new Event("remoteControllerChanged")),e.addEventListener("closed",(()=>{this._remoteController===e&&(this._remoteController=null,this.dispatchEvent(new Event("remoteControllerChanged")))}))}},e.onicecandidate=t=>{this._rtcPeerConnection===e&&t.candidate&&this._comChannel&&(this._sessionId?(console.log("Sending ICE with session id",this._sessionId),this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:t.candidate.toJSON()})):this._pendingCandidates.push(t.candidate))},this.dispatchEvent(new Event("rtcPeerConnectionChanged"))}}mungeStereo(e,t){const n=/a=fmtp:.* sprop-stereo/g;let r=new Set;for(const t of e.matchAll(n)){const e=t[0].match(/a=fmtp:(\d+) .*/);e&&r.add(e[1])}for(const e of r){const n=new RegExp("a=fmtp:"+e+".*stereo");t.match(n)||(t=t.replaceAll("a=fmtp:"+e,"a=fmtp:"+e+" stereo=1;"))}return t}onSessionPeerMessage(e){if(this._state!==ce.closed&&this._comChannel&&this._sessionId)if(this.ensurePeerConnection(),e.sdp)this._offerOptions?this._rtcPeerConnection.setRemoteDescription(e.sdp).then((()=>{console.log("done")})).catch((e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())})):this._rtcPeerConnection.setRemoteDescription(e.sdp).then((()=>this._rtcPeerConnection?this._rtcPeerConnection.createAnswer():null)).then((t=>this._rtcPeerConnection&&t?(this._mungeStereoHack&&(t.sdp=this.mungeStereo(e.sdp.sdp,t.sdp)),this._rtcPeerConnection.setLocalDescription(t)):null)).then((()=>{if(this._rtcPeerConnection&&this._comChannel){console.log("Sending SDP with session id",this._sessionId);const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}})).catch((e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{if(!e.ice)throw new Error(`invalid empty peer message received from consumer session ${this._sessionId}`);{const t=new RTCIceCandidate(e.ice);this._rtcPeerConnection.addIceCandidate(t).catch((e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())}))}}}};class ke extends le{constructor(e,t,n,r){super(e,n),this._sessionId=t,this._state=ce.streaming;const i=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=i;for(const e of r.getTracks())i.addTrack(e,r);i.onicecandidate=e=>{this._rtcPeerConnection===i&&e.candidate&&this._comChannel&&this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:e.candidate.toJSON()})},this.dispatchEvent(new Event("rtcPeerConnectionChanged")),i.setLocalDescription().then((()=>{if(this._rtcPeerConnection===i&&this._comChannel){const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}})).catch((e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}))}onSessionPeerMessage(e){if(this._state!==ce.closed&&this._rtcPeerConnection)if(e.sdp)this._rtcPeerConnection.setRemoteDescription(e.sdp).catch((e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{if(!e.ice)throw new Error(`invalid empty peer message received from producer's client session ${this._peerId}`);{const t=new RTCIceCandidate(e.ice);this._rtcPeerConnection.addIceCandidate(t).catch((e=>{this._state!==ce.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())}))}}}}class Te extends EventTarget{constructor(e,t){super(),this._comChannel=e,this._stream=t,this._state=ce.idle,this._clientSessions={}}get stream(){return this._stream}get state(){return this._state}start(){if(!this._comChannel||this._state===ce.closed)return!1;if(this._state!==ce.idle)return!0;const e={type:"setPeerStatus",roles:["listener","producer"],meta:this._comChannel.meta};return this._comChannel.send(e)?(this._state=ce.connecting,this.dispatchEvent(new Event("stateChanged")),!0):(this.dispatchEvent(new ErrorEvent("error",{message:"cannot start producer session",error:new Error("cannot register producer to signaling server")})),this.close(),!1)}close(){if(this._state!==ce.closed){for(const e of this._stream.getTracks())e.stop();this._state!==ce.idle&&this._comChannel&&this._comChannel.send({type:"setPeerStatus",roles:["listener"],meta:this._comChannel.meta}),this._state=ce.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._stream=null;for(const e of Object.values(this._clientSessions))e.close();this._clientSessions={},this.dispatchEvent(new Event("closed"))}}onProducerRegistered(){this._state===ce.connecting&&(this._state=ce.streaming,this.dispatchEvent(new Event("stateChanged")))}onStartSessionMessage(e){if(this._comChannel&&this._stream&&!(e.sessionId in this._clientSessions)){const t=new ke(e.peerId,e.sessionId,this._comChannel,this._stream);this._clientSessions[e.sessionId]=t,t.addEventListener("closed",(e=>{const n=e.target.sessionId;n in this._clientSessions&&this._clientSessions[n]===t&&(delete this._clientSessions[n],this.dispatchEvent(new CustomEvent("clientConsumerRemoved",{detail:t})))})),t.addEventListener("error",(e=>{this.dispatchEvent(new ErrorEvent("error",{message:`error from client consumer ${e.target.peerId}: ${e.message}`,error:e.error}))})),this.dispatchEvent(new CustomEvent("clientConsumerAdded",{detail:t}))}}onEndSessionMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].close()}onSessionPeerMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].onSessionPeerMessage(e)}}const Ee=Te,Pe=Object.freeze({welcome:"welcome",peerStatusChanged:"peerStatusChanged",list:"list",sessionStarted:"sessionStarted",peer:"peer",startSession:"startSession",endSession:"endSession",error:"error"});function Re(e,t){if(!e||"object"!=typeof e)return null;const n={id:"",meta:{}};if(e.id&&"string"==typeof e.id)n.id=e.id;else{if(!e.peerId||"string"!=typeof e.peerId)return null;n.id=e.peerId}return n.id===t?null:(e.meta&&"object"==typeof e.meta&&(n.meta=e.meta),Object.freeze(n.meta),Object.freeze(n))}class we extends EventTarget{constructor(e,t,n){super(),this._meta=t,this._webrtcConfig=n,this._ws=new WebSocket(e),this._ready=!1,this._channelId="",this._producerSession=null,this._consumerSessions={},this._ws.onerror=e=>{this.dispatchEvent(new ErrorEvent("error",{message:e.message||"WebSocket error",error:e.error||new Error(this._ready?"transportation error":"cannot connect to signaling server")})),this.close()},this._ws.onclose=()=>{this._ready=!1,this._channelId="",this._ws=null,this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null),this.dispatchEvent(new Event("closed"))},this._ws.onmessage=e=>{try{const n=JSON.parse(e.data);if(n&&"object"==typeof n)switch(n.type){case Pe.welcome:this._channelId=n.peerId;try{this._ws.send(JSON.stringify({type:"setPeerStatus",roles:["listener"],meta:t}))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot initialize connection to signaling server",error:e})),this.close()}break;case Pe.peerStatusChanged:if(n.peerId===this._channelId)!this._ready&&n.roles.includes("listener")&&(this._ready=!0,this.dispatchEvent(new Event("ready")),this.send({type:"list"})),this._producerSession&&n.roles.includes("producer")&&this._producerSession.onProducerRegistered();else{const e=Re(n,this._channelId);e&&(n.roles.includes("producer")?this.dispatchEvent(new CustomEvent("producerAdded",{detail:e})):this.dispatchEvent(new CustomEvent("producerRemoved",{detail:e})))}break;case Pe.list:for(const e of n.producers){const t=Re(e,this._channelId);t&&this.dispatchEvent(new CustomEvent("producerAdded",{detail:t}))}break;case Pe.sessionStarted:{const e=this.getConsumerSession(n.peerId);e&&(delete this._consumerSessions[n.peerId],e.onSessionStarted(n.peerId,n.sessionId),e.sessionId&&!(e.sessionId in this._consumerSessions)?this._consumerSessions[e.sessionId]=e:e.close())}break;case Pe.peer:{const e=this.getConsumerSession(n.sessionId);e?e.onSessionPeerMessage(n):this._producerSession&&this._producerSession.onSessionPeerMessage(n)}break;case Pe.startSession:this._producerSession&&this._producerSession.onStartSessionMessage(n);break;case Pe.endSession:{const e=this.getConsumerSession(n.sessionId);e?e.close():this._producerSession&&this._producerSession.onEndSessionMessage(n)}break;case Pe.error:this.dispatchEvent(new ErrorEvent("error",{message:"error received from signaling server",error:new Error(n.details)}));break;default:throw new Error(`unknown message type: "${n.type}"`)}}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot parse incoming message from signaling server",error:e}))}}}get meta(){return this._meta}get webrtcConfig(){return this._webrtcConfig}get ready(){return this._ready}get channelId(){return this._channelId}get producerSession(){return this._producerSession}createProducerSession(e){if(!(this._ready&&e instanceof MediaStream))return null;if(this._producerSession)return this._producerSession.stream===e?this._producerSession:null;const t=new Ee(this,e);return this._producerSession=t,t.addEventListener("closed",(()=>{this._producerSession===t&&(this._producerSession=null)})),t}createConsumerSession(e,t){if(!this._ready||!e||"string"!=typeof e)return null;if(t&&"object"!=typeof t&&(t=void 0),e in this._consumerSessions)return this._consumerSessions[e];for(const t of Object.values(this._consumerSessions))if(t.peerId===e)return t;const n=new Se(e,this,t);return this._consumerSessions[e]=n,n.addEventListener("closed",(e=>{let t=e.target.sessionId;t||(t=e.target.peerId),t in this._consumerSessions&&this._consumerSessions[t]===n&&delete this._consumerSessions[t]})),n}getConsumerSession(e){return e in this._consumerSessions?this._consumerSessions[e]:null}closeAllConsumerSessions(){for(const e of Object.values(this._consumerSessions))e.close();this._consumerSessions={}}send(e){if(this._ready&&e&&"object"==typeof e)try{return this._ws.send(JSON.stringify(e)),!0}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot send message to signaling server",error:e}))}return!1}close(){this._ws&&(this._ready=!1,this._channelId="",this._ws.close(),this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null))}}const Ae=we;class xe{constructor(e){this._channel=null,this._producers={},this._connectionListeners=[],this._producersListeners=[];const t=Object.assign({},se);e&&"object"==typeof e&&Object.assign(t,e),"object"!=typeof t.meta&&(t.meta=null),this._config=t,this.connectChannel()}registerConnectionListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.connected||"function"!=typeof e.disconnected)&&(this._connectionListeners.includes(e)||this._connectionListeners.push(e),!0)}unregisterConnectionListener(e){const t=this._connectionListeners.indexOf(e);return t>=0&&(this._connectionListeners.splice(t,1),!0)}unregisterAllConnectionListeners(){this._connectionListeners=[]}createProducerSession(e){return this._channel?this._channel.createProducerSession(e):null}getAvailableProducers(){return Object.values(this._producers)}registerProducersListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.producerAdded||"function"!=typeof e.producerRemoved)&&(this._producersListeners.includes(e)||this._producersListeners.push(e),!0)}unregisterProducersListener(e){const t=this._producersListeners.indexOf(e);return t>=0&&(this._producersListeners.splice(t,1),!0)}unregisterAllProducersListeners(){this._producersListeners=[]}createConsumerSession(e){return this._channel?this._channel.createConsumerSession(e):null}createConsumerSessionWithOfferOptions(e,t){return this._channel?this._channel.createConsumerSession(e,t):null}connectChannel(){if(this._channel){const e=this._channel;this._channel=null,e.close();for(const e in this._producers)this.triggerProducerRemoved(e);this._producers={},this.triggerDisconnected()}this._channel=new Ae(this._config.signalingServerUrl,this._config.meta,this._config.webrtcConfig),this._channel.addEventListener("error",(e=>{e.target===this._channel&&console.error(e.message,e.error)})),this._channel.addEventListener("closed",(e=>{if(e.target===this._channel){this._channel=null;for(const e in this._producers)this.triggerProducerRemoved(e);this._producers={},this.triggerDisconnected(),this._config.reconnectionTimeout>0&&window.setTimeout((()=>{this.connectChannel()}),this._config.reconnectionTimeout)}})),this._channel.addEventListener("ready",(e=>{e.target===this._channel&&this.triggerConnected(this._channel.channelId)})),this._channel.addEventListener("producerAdded",(e=>{e.target===this._channel&&this.triggerProducerAdded(e.detail)})),this._channel.addEventListener("producerRemoved",(e=>{e.target===this._channel&&this.triggerProducerRemoved(e.detail.id)}))}triggerConnected(e){for(const t of this._connectionListeners)try{t.connected(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerDisconnected(){for(const e of this._connectionListeners)try{e.disconnected()}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerProducerAdded(e){if(!(e.id in this._producers)){this._producers[e.id]=e;for(const t of this._producersListeners)try{t.producerAdded(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}}triggerProducerRemoved(e){if(e in this._producers){const t=this._producers[e];delete this._producers[e];for(const e of this._producersListeners)try{e.producerRemoved(t)}catch(e){console.error("a listener callback should not throw any exception",e)}}}}xe.SessionState=ce;const Ie=xe;window.GstWebRTCAPI||(window.GstWebRTCAPI=Ie)})()})();
|
| 5 |
+
//# sourceMappingURL=gstwebrtc-api-2.0.0.min.js.map
|
src/dist/gstwebrtc-api-2.0.0.min.js.map
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/dist/index.html
ADDED
|
@@ -0,0 +1,552 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>GstWebRTC API</title>
|
| 8 |
+
<style>
|
| 9 |
+
body {
|
| 10 |
+
background-color: #3a3f44;
|
| 11 |
+
color: #c8c8c8;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
section {
|
| 15 |
+
border-top: 2px solid #272b30;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
main {
|
| 19 |
+
border-bottom: 2px solid #272b30;
|
| 20 |
+
padding-bottom: 1em;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.button {
|
| 24 |
+
cursor: pointer;
|
| 25 |
+
border-radius: 10px;
|
| 26 |
+
user-select: none;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.button:disabled {
|
| 30 |
+
cursor: default;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
button.button {
|
| 34 |
+
box-shadow: 4px 4px 14px 1px #272b30;
|
| 35 |
+
border: none;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.spinner {
|
| 39 |
+
display: inline-block;
|
| 40 |
+
position: absolute;
|
| 41 |
+
width: 80px;
|
| 42 |
+
height: 80px;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.spinner>div {
|
| 46 |
+
box-sizing: border-box;
|
| 47 |
+
display: block;
|
| 48 |
+
position: absolute;
|
| 49 |
+
width: 64px;
|
| 50 |
+
height: 64px;
|
| 51 |
+
margin: 8px;
|
| 52 |
+
border: 8px solid #fff;
|
| 53 |
+
border-radius: 50%;
|
| 54 |
+
animation: spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
| 55 |
+
border-color: #fff transparent transparent transparent;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.spinner div:nth-child(1) {
|
| 59 |
+
animation-delay: -0.45s;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.spinner div:nth-child(2) {
|
| 63 |
+
animation-delay: -0.3s;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.spinner div:nth-child(3) {
|
| 67 |
+
animation-delay: -0.15s;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
@keyframes spinner {
|
| 71 |
+
0% {
|
| 72 |
+
transform: rotate(0deg);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
100% {
|
| 76 |
+
transform: rotate(360deg);
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
video:focus-visible,
|
| 81 |
+
video:focus {
|
| 82 |
+
outline: none;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
div.video,
|
| 86 |
+
div.offer-options,
|
| 87 |
+
div.request-box {
|
| 88 |
+
position: relative;
|
| 89 |
+
margin: 1em;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/*
|
| 93 |
+
div.request-box {
|
| 94 |
+
display: none;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
#remote-streams>li.streaming.has-remote-control .request-box {
|
| 98 |
+
display: block;
|
| 99 |
+
}*/
|
| 100 |
+
|
| 101 |
+
div.video>div.fullscreen {
|
| 102 |
+
position: absolute;
|
| 103 |
+
top: 0;
|
| 104 |
+
right: 0;
|
| 105 |
+
width: 2.6em;
|
| 106 |
+
height: 2.6em;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
div.video>div.fullscreen>span {
|
| 110 |
+
position: absolute;
|
| 111 |
+
top: 0.3em;
|
| 112 |
+
right: 0.4em;
|
| 113 |
+
font-size: 1.5em;
|
| 114 |
+
font-weight: bolder;
|
| 115 |
+
cursor: pointer;
|
| 116 |
+
user-select: none;
|
| 117 |
+
display: none;
|
| 118 |
+
text-shadow: 1px 1px 4px #272b30;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
div.video>video {
|
| 122 |
+
width: 320px;
|
| 123 |
+
height: 240px;
|
| 124 |
+
background-color: #202020;
|
| 125 |
+
border-radius: 15px;
|
| 126 |
+
box-shadow: 4px 4px 14px 1px #272b30;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
div.video>.spinner {
|
| 130 |
+
top: 80px;
|
| 131 |
+
left: 120px;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
#capture {
|
| 135 |
+
padding-top: 1.2em;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
#capture>.button {
|
| 139 |
+
vertical-align: top;
|
| 140 |
+
margin-top: 1.5em;
|
| 141 |
+
margin-left: 1em;
|
| 142 |
+
background-color: #98d35e;
|
| 143 |
+
width: 5em;
|
| 144 |
+
height: 5em;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
#capture>.client-id {
|
| 148 |
+
display: block;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
#capture>.client-id::before {
|
| 152 |
+
content: "Client ID:";
|
| 153 |
+
margin-right: 0.5em;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
#capture.has-session>.button {
|
| 157 |
+
background-color: #e36868;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
#capture>.button::after {
|
| 161 |
+
content: "Start Capture";
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
#capture.has-session>.button::after {
|
| 165 |
+
content: "Stop Capture";
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
#capture .spinner {
|
| 169 |
+
display: none;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
#capture.starting .spinner {
|
| 173 |
+
display: inline-block;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
#remote-streams {
|
| 177 |
+
list-style: none;
|
| 178 |
+
padding-left: 1em;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
#remote-streams>li .button::before {
|
| 182 |
+
content: "\2799";
|
| 183 |
+
padding-right: 0.2em;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
#remote-streams>li.has-session .button::before {
|
| 187 |
+
content: "\2798";
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
#remote-streams>li div.video {
|
| 191 |
+
display: none;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
#remote-streams>li.has-session div.video {
|
| 195 |
+
display: inline-block;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
#remote-streams>li.streaming .spinner {
|
| 199 |
+
display: none;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
#remote-streams>li.streaming>div.video>div.fullscreen:hover>span {
|
| 203 |
+
display: block;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
#remote-streams .remote-control {
|
| 207 |
+
display: none;
|
| 208 |
+
position: absolute;
|
| 209 |
+
top: 0.2em;
|
| 210 |
+
left: 0.3em;
|
| 211 |
+
font-size: 1.8em;
|
| 212 |
+
font-weight: bolder;
|
| 213 |
+
animation: blink 1s ease-in-out infinite alternate;
|
| 214 |
+
text-shadow: 1px 1px 4px #272b30;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
@keyframes blink {
|
| 218 |
+
to {
|
| 219 |
+
opacity: 0;
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
#remote-streams>li.streaming.has-remote-control .remote-control {
|
| 224 |
+
display: block;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
#remote-streams>li.streaming.has-remote-control>div.video>video {
|
| 228 |
+
width: 640px;
|
| 229 |
+
height: 480px;
|
| 230 |
+
}
|
| 231 |
+
</style>
|
| 232 |
+
<script>
|
| 233 |
+
function initCapture(api) {
|
| 234 |
+
const captureSection = document.getElementById("capture");
|
| 235 |
+
const clientIdElement = captureSection.querySelector(".client-id");
|
| 236 |
+
const videoElement = captureSection.getElementsByTagName("video")[0];
|
| 237 |
+
|
| 238 |
+
const listener = {
|
| 239 |
+
connected: function (clientId) { clientIdElement.textContent = clientId; },
|
| 240 |
+
disconnected: function () { clientIdElement.textContent = "none"; }
|
| 241 |
+
};
|
| 242 |
+
api.registerConnectionListener(listener);
|
| 243 |
+
|
| 244 |
+
document.getElementById("capture-button").addEventListener("click", (event) => {
|
| 245 |
+
event.preventDefault();
|
| 246 |
+
|
| 247 |
+
if (captureSection._producerSession) {
|
| 248 |
+
captureSection._producerSession.close();
|
| 249 |
+
} else if (!captureSection.classList.contains("starting")) {
|
| 250 |
+
captureSection.classList.add("starting");
|
| 251 |
+
|
| 252 |
+
const constraints = {
|
| 253 |
+
video: { width: 1280, height: 720 }
|
| 254 |
+
};
|
| 255 |
+
navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
|
| 256 |
+
const session = api.createProducerSession(stream);
|
| 257 |
+
if (session) {
|
| 258 |
+
captureSection._producerSession = session;
|
| 259 |
+
|
| 260 |
+
session.addEventListener("error", (event) => {
|
| 261 |
+
if (captureSection._producerSession === session) {
|
| 262 |
+
console.error(event.message, event.error);
|
| 263 |
+
}
|
| 264 |
+
});
|
| 265 |
+
|
| 266 |
+
session.addEventListener("closed", () => {
|
| 267 |
+
if (captureSection._producerSession === session) {
|
| 268 |
+
videoElement.pause();
|
| 269 |
+
videoElement.srcObject = null;
|
| 270 |
+
captureSection.classList.remove("has-session", "starting");
|
| 271 |
+
delete captureSection._producerSession;
|
| 272 |
+
}
|
| 273 |
+
});
|
| 274 |
+
|
| 275 |
+
session.addEventListener("stateChanged", (event) => {
|
| 276 |
+
if ((captureSection._producerSession === session) &&
|
| 277 |
+
(event.target.state === GstWebRTCAPI.SessionState.streaming)) {
|
| 278 |
+
videoElement.srcObject = stream;
|
| 279 |
+
videoElement.play().catch(() => { });
|
| 280 |
+
captureSection.classList.remove("starting");
|
| 281 |
+
}
|
| 282 |
+
});
|
| 283 |
+
|
| 284 |
+
session.addEventListener("clientConsumerAdded", (event) => {
|
| 285 |
+
if (captureSection._producerSession === session) {
|
| 286 |
+
console.info(`client consumer added: ${event.detail.peerId}`);
|
| 287 |
+
}
|
| 288 |
+
});
|
| 289 |
+
|
| 290 |
+
session.addEventListener("clientConsumerRemoved", (event) => {
|
| 291 |
+
if (captureSection._producerSession === session) {
|
| 292 |
+
console.info(`client consumer removed: ${event.detail.peerId}`);
|
| 293 |
+
}
|
| 294 |
+
});
|
| 295 |
+
|
| 296 |
+
captureSection.classList.add("has-session");
|
| 297 |
+
session.start();
|
| 298 |
+
} else {
|
| 299 |
+
for (const track of stream.getTracks()) {
|
| 300 |
+
track.stop();
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
captureSection.classList.remove("starting");
|
| 304 |
+
}
|
| 305 |
+
}).catch((error) => {
|
| 306 |
+
console.error("cannot have access to webcam and microphone", error);
|
| 307 |
+
captureSection.classList.remove("starting");
|
| 308 |
+
});
|
| 309 |
+
}
|
| 310 |
+
});
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
function initRemoteStreams(api) {
|
| 314 |
+
const remoteStreamsElement = document.getElementById("remote-streams");
|
| 315 |
+
|
| 316 |
+
const listener = {
|
| 317 |
+
producerAdded: function (producer) {
|
| 318 |
+
const producerId = producer.id
|
| 319 |
+
if (!document.getElementById(producerId)) {
|
| 320 |
+
remoteStreamsElement.insertAdjacentHTML("beforeend",
|
| 321 |
+
`<li id="${producerId}">
|
| 322 |
+
<div class="button">${producer.meta.name || producerId}
|
| 323 |
+
</div>
|
| 324 |
+
<div class="offer-options">
|
| 325 |
+
<textarea rows="5" cols="50" placeholder="offer options, empty to answer. For example:\n{\n "offerToReceiveAudio": 1\n "offerToReceiveVideo": 1\n}\n"></textarea>
|
| 326 |
+
</div>
|
| 327 |
+
<div class="request-box">
|
| 328 |
+
<textarea rows="4" cols="50" placeholder="JSON request to send over"></textarea>
|
| 329 |
+
<button disabled="enable">Submit request</button>
|
| 330 |
+
</div>
|
| 331 |
+
<div class="video">
|
| 332 |
+
<div class="spinner">
|
| 333 |
+
<div></div>
|
| 334 |
+
<div></div>
|
| 335 |
+
<div></div>
|
| 336 |
+
<div></div>
|
| 337 |
+
</div>
|
| 338 |
+
<span class="remote-control">©</span>
|
| 339 |
+
<video></video>
|
| 340 |
+
<div class="fullscreen"><span title="Toggle fullscreen">▢</span></div>
|
| 341 |
+
</div>
|
| 342 |
+
<div class="video">
|
| 343 |
+
<div class="spinner">
|
| 344 |
+
<div></div>
|
| 345 |
+
<div></div>
|
| 346 |
+
<div></div>
|
| 347 |
+
<div></div>
|
| 348 |
+
</div>
|
| 349 |
+
<span class="remote-control">©</span>
|
| 350 |
+
<video></video>
|
| 351 |
+
<div class="fullscreen"><span title="Toggle fullscreen">▢</span></div>
|
| 352 |
+
</div>
|
| 353 |
+
</li>`);
|
| 354 |
+
|
| 355 |
+
const entryElement = document.getElementById(producerId);
|
| 356 |
+
const videoElement = entryElement.getElementsByTagName("video")[0];
|
| 357 |
+
const videoRightElement = entryElement.getElementsByTagName("video")[1];
|
| 358 |
+
const offerTextareaElement = entryElement.getElementsByTagName("textarea")[0];
|
| 359 |
+
const requestTextAreaElement = entryElement.getElementsByTagName("textarea")[1];
|
| 360 |
+
const submitRequestButtonElement = entryElement.getElementsByTagName("button")[0];
|
| 361 |
+
|
| 362 |
+
submitRequestButtonElement.addEventListener("click", (event) => {
|
| 363 |
+
try {
|
| 364 |
+
let request = requestTextAreaElement.value;
|
| 365 |
+
let id = entryElement._consumerSession.remoteController.sendControlRequest(request);
|
| 366 |
+
} catch (ex) {
|
| 367 |
+
console.error("Failed to parse mix matrix:", ex);
|
| 368 |
+
return;
|
| 369 |
+
}
|
| 370 |
+
});
|
| 371 |
+
|
| 372 |
+
videoElement.addEventListener("playing", () => {
|
| 373 |
+
if (entryElement.classList.contains("has-session")) {
|
| 374 |
+
entryElement.classList.add("streaming");
|
| 375 |
+
}
|
| 376 |
+
});
|
| 377 |
+
|
| 378 |
+
videoRightElement.addEventListener("playing", () => {
|
| 379 |
+
if (entryElement.classList.contains("has-session")) {
|
| 380 |
+
entryElement.classList.add("streaming");
|
| 381 |
+
}
|
| 382 |
+
});
|
| 383 |
+
|
| 384 |
+
entryElement.addEventListener("click", (event) => {
|
| 385 |
+
event.preventDefault();
|
| 386 |
+
if (!event.target.classList.contains("button")) {
|
| 387 |
+
return;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
if (entryElement._consumerSession) {
|
| 391 |
+
entryElement._consumerSession.close();
|
| 392 |
+
} else {
|
| 393 |
+
let session = null;
|
| 394 |
+
if (offerTextareaElement.value == '') {
|
| 395 |
+
session = api.createConsumerSession(producerId);
|
| 396 |
+
} else {
|
| 397 |
+
try {
|
| 398 |
+
let offerOptions = JSON.parse(offerTextareaElement.value);
|
| 399 |
+
session = api.createConsumerSessionWithOfferOptions(producerId, offerOptions);
|
| 400 |
+
} catch (ex) {
|
| 401 |
+
console.error("Failed to parse offer options:", ex);
|
| 402 |
+
return;
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
if (session) {
|
| 406 |
+
entryElement._consumerSession = session;
|
| 407 |
+
|
| 408 |
+
session.mungeStereoHack = true;
|
| 409 |
+
|
| 410 |
+
session.addEventListener("error", (event) => {
|
| 411 |
+
if (entryElement._consumerSession === session) {
|
| 412 |
+
console.error(event.message, event.error);
|
| 413 |
+
}
|
| 414 |
+
});
|
| 415 |
+
|
| 416 |
+
session.addEventListener("closed", () => {
|
| 417 |
+
if (entryElement._consumerSession === session) {
|
| 418 |
+
videoElement.pause();
|
| 419 |
+
videoElement.srcObject = null;
|
| 420 |
+
videoRightElement.pause();
|
| 421 |
+
videoRightElement.srcObject = null;
|
| 422 |
+
entryElement.classList.remove("has-session", "streaming", "has-remote-control");
|
| 423 |
+
delete entryElement._consumerSession;
|
| 424 |
+
}
|
| 425 |
+
});
|
| 426 |
+
|
| 427 |
+
session.addEventListener("streamsChanged", () => {
|
| 428 |
+
if (entryElement._consumerSession === session) {
|
| 429 |
+
const streams = session.streams;
|
| 430 |
+
if (streams.length > 0) {
|
| 431 |
+
videoElement.srcObject = streams[0];
|
| 432 |
+
videoElement.play().catch(() => { });
|
| 433 |
+
|
| 434 |
+
const originalStream = streams[0];
|
| 435 |
+
let desiredVideoTrack = null;
|
| 436 |
+
|
| 437 |
+
let nb_video_tracks = 0;
|
| 438 |
+
// Iterate through the tracks to find the desired video track
|
| 439 |
+
originalStream.getTracks().forEach((track) => {
|
| 440 |
+
if (track.kind === 'video') {
|
| 441 |
+
// You can add more conditions here to select the specific track you want
|
| 442 |
+
// For example, check track.label or track.id
|
| 443 |
+
desiredVideoTrack = track;
|
| 444 |
+
nb_video_tracks++;
|
| 445 |
+
}
|
| 446 |
+
});
|
| 447 |
+
|
| 448 |
+
if (desiredVideoTrack && nb_video_tracks > 1) {
|
| 449 |
+
// Create a new MediaStream with only the desired video track
|
| 450 |
+
const newStream = new MediaStream([desiredVideoTrack]);
|
| 451 |
+
|
| 452 |
+
// Assign the new stream to the video element
|
| 453 |
+
videoRightElement.srcObject = newStream;
|
| 454 |
+
videoRightElement.play().catch(() => { });
|
| 455 |
+
} else {
|
| 456 |
+
console.warn("No video track found in the stream.");
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
}
|
| 460 |
+
}
|
| 461 |
+
});
|
| 462 |
+
|
| 463 |
+
session.addEventListener("remoteControllerChanged", () => {
|
| 464 |
+
if (entryElement._consumerSession === session) {
|
| 465 |
+
const remoteController = session.remoteController;
|
| 466 |
+
if (remoteController) {
|
| 467 |
+
entryElement.classList.add("has-remote-control");
|
| 468 |
+
submitRequestButtonElement.disabled = false;
|
| 469 |
+
remoteController.attachVideoElement(videoElement);
|
| 470 |
+
remoteController.addEventListener("info", (e) => {
|
| 471 |
+
console.log("Received info message from producer: ", e.detail);
|
| 472 |
+
});
|
| 473 |
+
} else {
|
| 474 |
+
entryElement.classList.remove("has-remote-control");
|
| 475 |
+
submitRequestButtonElement.disabled = true;
|
| 476 |
+
}
|
| 477 |
+
}
|
| 478 |
+
});
|
| 479 |
+
|
| 480 |
+
entryElement.classList.add("has-session");
|
| 481 |
+
session.connect();
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
});
|
| 485 |
+
}
|
| 486 |
+
},
|
| 487 |
+
|
| 488 |
+
producerRemoved: function (producer) {
|
| 489 |
+
const element = document.getElementById(producer.id);
|
| 490 |
+
if (element) {
|
| 491 |
+
if (element._consumerSession) {
|
| 492 |
+
element._consumerSession.close();
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
element.remove();
|
| 496 |
+
}
|
| 497 |
+
}
|
| 498 |
+
};
|
| 499 |
+
|
| 500 |
+
api.registerProducersListener(listener);
|
| 501 |
+
for (const producer of api.getAvailableProducers()) {
|
| 502 |
+
listener.producerAdded(producer);
|
| 503 |
+
}
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
window.addEventListener("DOMContentLoaded", () => {
|
| 507 |
+
document.addEventListener("click", (event) => {
|
| 508 |
+
if (event.target.matches("div.video>div.fullscreen:hover>span")) {
|
| 509 |
+
event.preventDefault();
|
| 510 |
+
event.target.parentNode.previousElementSibling.requestFullscreen();
|
| 511 |
+
}
|
| 512 |
+
});
|
| 513 |
+
|
| 514 |
+
const signalingProtocol = window.location.protocol.startsWith("https") ? "wss" : "ws";
|
| 515 |
+
const gstWebRTCConfig = {
|
| 516 |
+
meta: { name: `WebClient-${Date.now()}` },
|
| 517 |
+
signalingServerUrl: `${signalingProtocol}://${window.location.hostname}:8443`,
|
| 518 |
+
};
|
| 519 |
+
|
| 520 |
+
const api = new GstWebRTCAPI(gstWebRTCConfig);
|
| 521 |
+
initCapture(api);
|
| 522 |
+
initRemoteStreams(api);
|
| 523 |
+
});
|
| 524 |
+
</script>
|
| 525 |
+
<script src="gstwebrtc-api-2.0.0.min.js"></script></head>
|
| 526 |
+
|
| 527 |
+
<body>
|
| 528 |
+
<header>
|
| 529 |
+
<h1>GstWebRTC API</h1>
|
| 530 |
+
</header>
|
| 531 |
+
<main>
|
| 532 |
+
<section id="capture">
|
| 533 |
+
<span class="client-id">none</span>
|
| 534 |
+
<button class="button" id="capture-button"></button>
|
| 535 |
+
<div class="video">
|
| 536 |
+
<div class="spinner">
|
| 537 |
+
<div></div>
|
| 538 |
+
<div></div>
|
| 539 |
+
<div></div>
|
| 540 |
+
<div></div>
|
| 541 |
+
</div>
|
| 542 |
+
<video></video>
|
| 543 |
+
</div>
|
| 544 |
+
</section>
|
| 545 |
+
<section>
|
| 546 |
+
<h1>Remote Streams</h1>
|
| 547 |
+
<ul id="remote-streams"></ul>
|
| 548 |
+
</section>
|
| 549 |
+
</main>
|
| 550 |
+
</body>
|
| 551 |
+
|
| 552 |
+
</html>
|
src/eslint.config.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import jsdoc from "eslint-plugin-jsdoc";
|
| 2 |
+
import globals from "globals";
|
| 3 |
+
import path from "node:path";
|
| 4 |
+
import { fileURLToPath } from "node:url";
|
| 5 |
+
import js from "@eslint/js";
|
| 6 |
+
import { FlatCompat } from "@eslint/eslintrc";
|
| 7 |
+
|
| 8 |
+
const __filename = fileURLToPath(import.meta.url);
|
| 9 |
+
const __dirname = path.dirname(__filename);
|
| 10 |
+
const compat = new FlatCompat({
|
| 11 |
+
baseDirectory: __dirname,
|
| 12 |
+
recommendedConfig: js.configs.recommended,
|
| 13 |
+
allConfig: js.configs.all
|
| 14 |
+
});
|
| 15 |
+
|
| 16 |
+
export default [
|
| 17 |
+
...compat.extends("eslint:recommended"),
|
| 18 |
+
{
|
| 19 |
+
plugins: {
|
| 20 |
+
jsdoc,
|
| 21 |
+
},
|
| 22 |
+
|
| 23 |
+
languageOptions: {
|
| 24 |
+
globals: {
|
| 25 |
+
...globals.browser,
|
| 26 |
+
},
|
| 27 |
+
|
| 28 |
+
ecmaVersion: 2018,
|
| 29 |
+
sourceType: "module",
|
| 30 |
+
},
|
| 31 |
+
|
| 32 |
+
rules: {
|
| 33 |
+
"getter-return": "error",
|
| 34 |
+
"no-await-in-loop": "error",
|
| 35 |
+
"no-console": "off",
|
| 36 |
+
"no-extra-parens": "off",
|
| 37 |
+
"no-template-curly-in-string": "error",
|
| 38 |
+
"consistent-return": "error",
|
| 39 |
+
curly: "error",
|
| 40 |
+
eqeqeq: "error",
|
| 41 |
+
"no-eval": "error",
|
| 42 |
+
"no-extra-bind": "error",
|
| 43 |
+
"no-invalid-this": "error",
|
| 44 |
+
"no-labels": "error",
|
| 45 |
+
"no-lone-blocks": "error",
|
| 46 |
+
"no-loop-func": "error",
|
| 47 |
+
"no-multi-spaces": "error",
|
| 48 |
+
"no-return-assign": "error",
|
| 49 |
+
"no-return-await": "error",
|
| 50 |
+
"no-self-compare": "error",
|
| 51 |
+
"no-throw-literal": "error",
|
| 52 |
+
"no-unused-expressions": "error",
|
| 53 |
+
"no-useless-call": "error",
|
| 54 |
+
"no-useless-concat": "error",
|
| 55 |
+
"no-useless-return": "error",
|
| 56 |
+
"no-void": "error",
|
| 57 |
+
"no-shadow": "error",
|
| 58 |
+
"block-spacing": "error",
|
| 59 |
+
|
| 60 |
+
"brace-style": ["error", "1tbs", {
|
| 61 |
+
allowSingleLine: true,
|
| 62 |
+
}],
|
| 63 |
+
|
| 64 |
+
camelcase: "error",
|
| 65 |
+
"comma-dangle": "error",
|
| 66 |
+
"eol-last": "error",
|
| 67 |
+
indent: ["error", 2],
|
| 68 |
+
"linebreak-style": "error",
|
| 69 |
+
"new-parens": "error",
|
| 70 |
+
"no-lonely-if": "error",
|
| 71 |
+
"no-multiple-empty-lines": "error",
|
| 72 |
+
"no-trailing-spaces": "error",
|
| 73 |
+
quotes: "error",
|
| 74 |
+
semi: "error",
|
| 75 |
+
"jsdoc/no-undefined-types": "error",
|
| 76 |
+
},
|
| 77 |
+
},
|
| 78 |
+
];
|
src/index.html
ADDED
|
@@ -0,0 +1,556 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>GstWebRTC API</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
background-color: #3a3f44;
|
| 10 |
+
color: #c8c8c8;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
section {
|
| 14 |
+
border-top: 2px solid #272b30;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
main {
|
| 18 |
+
border-bottom: 2px solid #272b30;
|
| 19 |
+
padding-bottom: 1em;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.button {
|
| 23 |
+
cursor: pointer;
|
| 24 |
+
border-radius: 10px;
|
| 25 |
+
user-select: none;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.button:disabled {
|
| 29 |
+
cursor: default;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
button.button {
|
| 33 |
+
box-shadow: 4px 4px 14px 1px #272b30;
|
| 34 |
+
border: none;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.spinner {
|
| 38 |
+
display: inline-block;
|
| 39 |
+
position: absolute;
|
| 40 |
+
width: 80px;
|
| 41 |
+
height: 80px;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
.spinner>div {
|
| 45 |
+
box-sizing: border-box;
|
| 46 |
+
display: block;
|
| 47 |
+
position: absolute;
|
| 48 |
+
width: 64px;
|
| 49 |
+
height: 64px;
|
| 50 |
+
margin: 8px;
|
| 51 |
+
border: 8px solid #fff;
|
| 52 |
+
border-radius: 50%;
|
| 53 |
+
animation: spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
| 54 |
+
border-color: #fff transparent transparent transparent;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.spinner div:nth-child(1) {
|
| 58 |
+
animation-delay: -0.45s;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.spinner div:nth-child(2) {
|
| 62 |
+
animation-delay: -0.3s;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.spinner div:nth-child(3) {
|
| 66 |
+
animation-delay: -0.15s;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
@keyframes spinner {
|
| 70 |
+
0% {
|
| 71 |
+
transform: rotate(0deg);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
100% {
|
| 75 |
+
transform: rotate(360deg);
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
video:focus-visible,
|
| 80 |
+
video:focus {
|
| 81 |
+
outline: none;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
div.video, div.offer-options, div.request-box {
|
| 85 |
+
position: relative;
|
| 86 |
+
margin: 1em;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
div.request-box {
|
| 90 |
+
display: none;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
#remote-streams>li.streaming.has-remote-control .request-box {
|
| 94 |
+
display: block;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
div.video>div.fullscreen {
|
| 98 |
+
position: absolute;
|
| 99 |
+
top: 0;
|
| 100 |
+
right: 0;
|
| 101 |
+
width: 2.6em;
|
| 102 |
+
height: 2.6em;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
div.video>div.fullscreen>span {
|
| 106 |
+
position: absolute;
|
| 107 |
+
top: 0.3em;
|
| 108 |
+
right: 0.4em;
|
| 109 |
+
font-size: 1.5em;
|
| 110 |
+
font-weight: bolder;
|
| 111 |
+
cursor: pointer;
|
| 112 |
+
user-select: none;
|
| 113 |
+
display: none;
|
| 114 |
+
text-shadow: 1px 1px 4px #272b30;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
div.video>video {
|
| 118 |
+
width: 320px;
|
| 119 |
+
height: 240px;
|
| 120 |
+
background-color: #202020;
|
| 121 |
+
border-radius: 15px;
|
| 122 |
+
box-shadow: 4px 4px 14px 1px #272b30;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
div.video>.spinner {
|
| 126 |
+
top: 80px;
|
| 127 |
+
left: 120px;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
#capture {
|
| 131 |
+
padding-top: 1.2em;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
#capture>.button {
|
| 135 |
+
vertical-align: top;
|
| 136 |
+
margin-top: 1.5em;
|
| 137 |
+
margin-left: 1em;
|
| 138 |
+
background-color: #98d35e;
|
| 139 |
+
width: 5em;
|
| 140 |
+
height: 5em;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
#capture>.client-id {
|
| 144 |
+
display: block;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
#capture>.client-id::before {
|
| 148 |
+
content: "Client ID:";
|
| 149 |
+
margin-right: 0.5em;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
#capture.has-session>.button {
|
| 153 |
+
background-color: #e36868;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
#capture>.button::after {
|
| 157 |
+
content: "Start Capture";
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
#capture.has-session>.button::after {
|
| 161 |
+
content: "Stop Capture";
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
#capture .spinner {
|
| 165 |
+
display: none;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
#capture.starting .spinner {
|
| 169 |
+
display: inline-block;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
#remote-streams {
|
| 173 |
+
list-style: none;
|
| 174 |
+
padding-left: 1em;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
#remote-streams>li .button::before {
|
| 178 |
+
content: "\2799";
|
| 179 |
+
padding-right: 0.2em;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
#remote-streams>li.has-session .button::before {
|
| 183 |
+
content: "\2798";
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
#remote-streams>li div.video {
|
| 187 |
+
display: none;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
#remote-streams>li.has-session div.video {
|
| 191 |
+
display: inline-block;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
#remote-streams>li.streaming .spinner {
|
| 195 |
+
display: none;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
#remote-streams>li.streaming>div.video>div.fullscreen:hover>span {
|
| 199 |
+
display: block;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
#remote-streams .remote-control {
|
| 203 |
+
display: none;
|
| 204 |
+
position: absolute;
|
| 205 |
+
top: 0.2em;
|
| 206 |
+
left: 0.3em;
|
| 207 |
+
font-size: 1.8em;
|
| 208 |
+
font-weight: bolder;
|
| 209 |
+
animation: blink 1s ease-in-out infinite alternate;
|
| 210 |
+
text-shadow: 1px 1px 4px #272b30;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
#available-consumers .button {
|
| 214 |
+
background-color: #98d35e;
|
| 215 |
+
border: none;
|
| 216 |
+
padding: 0.5em 0.8em;
|
| 217 |
+
margin-left: 1em;
|
| 218 |
+
font-size: 0.8em;
|
| 219 |
+
cursor: pointer;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
#available-consumers .button.hidden {
|
| 223 |
+
display: none;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
@keyframes blink {
|
| 227 |
+
to {
|
| 228 |
+
opacity: 0;
|
| 229 |
+
}
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
#remote-streams>li.streaming.has-remote-control .remote-control {
|
| 233 |
+
display: block;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
#remote-streams>li.streaming.has-remote-control>div.video>video {
|
| 237 |
+
width: 640px;
|
| 238 |
+
height: 480px;
|
| 239 |
+
}
|
| 240 |
+
</style>
|
| 241 |
+
<script>
|
| 242 |
+
function startCapture(api, consumerId) {
|
| 243 |
+
const captureSection = document.getElementById("capture");
|
| 244 |
+
const videoElement = captureSection.getElementsByTagName("video")[0];
|
| 245 |
+
const consumerButtons = document.querySelectorAll("#available-consumers .button");
|
| 246 |
+
|
| 247 |
+
consumerButtons.forEach(button => button.classList.add("hidden"));
|
| 248 |
+
|
| 249 |
+
if (captureSection._producerSession) {
|
| 250 |
+
captureSection._producerSession.close();
|
| 251 |
+
} else if (!captureSection.classList.contains("starting")) {
|
| 252 |
+
captureSection.classList.add("starting");
|
| 253 |
+
|
| 254 |
+
const constraints = {
|
| 255 |
+
video: { width: 1280, height: 720 }
|
| 256 |
+
};
|
| 257 |
+
navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
|
| 258 |
+
const session = consumerId ?
|
| 259 |
+
api.createProducerSessionForConsumer(stream, consumerId) :
|
| 260 |
+
api.createProducerSession(stream);
|
| 261 |
+
|
| 262 |
+
if (session) {
|
| 263 |
+
captureSection._producerSession = session;
|
| 264 |
+
|
| 265 |
+
session.addEventListener("error", (event) => {
|
| 266 |
+
if (captureSection._producerSession === session) {
|
| 267 |
+
console.error(event.message, event.error);
|
| 268 |
+
}
|
| 269 |
+
});
|
| 270 |
+
|
| 271 |
+
session.addEventListener("closed", () => {
|
| 272 |
+
if (captureSection._producerSession === session) {
|
| 273 |
+
videoElement.pause();
|
| 274 |
+
videoElement.srcObject = null;
|
| 275 |
+
captureSection.classList.remove("has-session", "starting");
|
| 276 |
+
delete captureSection._producerSession;
|
| 277 |
+
|
| 278 |
+
consumerButtons.forEach(button => button.classList.remove("hidden"));
|
| 279 |
+
}
|
| 280 |
+
});
|
| 281 |
+
|
| 282 |
+
session.addEventListener("stateChanged", (event) => {
|
| 283 |
+
if ((captureSection._producerSession === session) &&
|
| 284 |
+
(event.target.state === GstWebRTCAPI.SessionState.streaming)) {
|
| 285 |
+
videoElement.srcObject = stream;
|
| 286 |
+
videoElement.play().catch(() => {});
|
| 287 |
+
captureSection.classList.remove("starting");
|
| 288 |
+
}
|
| 289 |
+
});
|
| 290 |
+
|
| 291 |
+
session.addEventListener("clientConsumerAdded", (event) => {
|
| 292 |
+
if (captureSection._producerSession === session) {
|
| 293 |
+
console.info(`client consumer added: ${event.detail.peerId}`);
|
| 294 |
+
}
|
| 295 |
+
});
|
| 296 |
+
|
| 297 |
+
session.addEventListener("clientConsumerRemoved", (event) => {
|
| 298 |
+
if (captureSection._producerSession === session) {
|
| 299 |
+
console.info(`client consumer removed: ${event.detail.peerId}`);
|
| 300 |
+
}
|
| 301 |
+
});
|
| 302 |
+
|
| 303 |
+
captureSection.classList.add("has-session");
|
| 304 |
+
session.start();
|
| 305 |
+
} else {
|
| 306 |
+
for (const track of stream.getTracks()) {
|
| 307 |
+
track.stop();
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
captureSection.classList.remove("starting");
|
| 311 |
+
}
|
| 312 |
+
}).catch((error) => {
|
| 313 |
+
console.error("cannot have access to webcam and microphone", error);
|
| 314 |
+
captureSection.classList.remove("starting");
|
| 315 |
+
});
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
function initCapture(api) {
|
| 319 |
+
const captureSection = document.getElementById("capture");
|
| 320 |
+
const clientIdElement = captureSection.querySelector(".client-id");
|
| 321 |
+
const videoElement = captureSection.getElementsByTagName("video")[0];
|
| 322 |
+
const consumerListElement = document.getElementById("available-consumers");
|
| 323 |
+
|
| 324 |
+
const listener = {
|
| 325 |
+
connected: function(clientId) { clientIdElement.textContent = clientId; },
|
| 326 |
+
disconnected: function() { clientIdElement.textContent = "none"; }
|
| 327 |
+
};
|
| 328 |
+
api.registerConnectionListener(listener);
|
| 329 |
+
|
| 330 |
+
api.registerPeerListener({
|
| 331 |
+
consumerAdded: function(consumer) {
|
| 332 |
+
const li = document.createElement("li");
|
| 333 |
+
li.id = `consumer-${consumer.id}`;
|
| 334 |
+
li.textContent = consumer.meta.name || consumer.id;
|
| 335 |
+
|
| 336 |
+
const btn = document.createElement("button");
|
| 337 |
+
btn.className = "button";
|
| 338 |
+
btn.textContent = "Start capture";
|
| 339 |
+
btn.addEventListener("click", () => {
|
| 340 |
+
startCapture(api, consumer.id);
|
| 341 |
+
});
|
| 342 |
+
|
| 343 |
+
li.appendChild(btn);
|
| 344 |
+
consumerListElement.appendChild(li);
|
| 345 |
+
},
|
| 346 |
+
consumerRemoved: function(consumer) {
|
| 347 |
+
const li = document.getElementById(`consumer-${consumer.id}`);
|
| 348 |
+
if (li) li.remove();
|
| 349 |
+
}
|
| 350 |
+
});
|
| 351 |
+
|
| 352 |
+
document.getElementById("capture-button").addEventListener("click", (event) => {
|
| 353 |
+
event.preventDefault();
|
| 354 |
+
startCapture(api, null);
|
| 355 |
+
});
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
function initRemoteStreams(api) {
|
| 359 |
+
const remoteStreamsElement = document.getElementById("remote-streams");
|
| 360 |
+
|
| 361 |
+
const listener = {
|
| 362 |
+
producerAdded: function(producer) {
|
| 363 |
+
const producerId = producer.id
|
| 364 |
+
if (!document.getElementById(producerId)) {
|
| 365 |
+
remoteStreamsElement.insertAdjacentHTML("beforeend",
|
| 366 |
+
`<li id="${producerId}">
|
| 367 |
+
<div class="button">${producer.meta.name || producerId}
|
| 368 |
+
</div>
|
| 369 |
+
<div class="offer-options">
|
| 370 |
+
<textarea rows="5" cols="50" placeholder="offer options, empty to answer. For example:\n{\n "offerToReceiveAudio": 1\n "offerToReceiveVideo": 1\n}\n"></textarea>
|
| 371 |
+
</div>
|
| 372 |
+
<div class="request-box">
|
| 373 |
+
<textarea rows="4" cols="50" placeholder="JSON request to send over"></textarea>
|
| 374 |
+
<button disabled="disabled">Submit request</button>
|
| 375 |
+
</div>
|
| 376 |
+
<div class="video">
|
| 377 |
+
<div class="spinner">
|
| 378 |
+
<div></div>
|
| 379 |
+
<div></div>
|
| 380 |
+
<div></div>
|
| 381 |
+
<div></div>
|
| 382 |
+
</div>
|
| 383 |
+
<span class="remote-control">©</span>
|
| 384 |
+
<video></video>
|
| 385 |
+
<div class="fullscreen"><span title="Toggle fullscreen">▢</span></div>
|
| 386 |
+
</div>
|
| 387 |
+
</li>`);
|
| 388 |
+
|
| 389 |
+
const entryElement = document.getElementById(producerId);
|
| 390 |
+
const videoElement = entryElement.getElementsByTagName("video")[0];
|
| 391 |
+
const offerTextareaElement = entryElement.getElementsByTagName("textarea")[0];
|
| 392 |
+
const requestTextAreaElement = entryElement.getElementsByTagName("textarea")[1];
|
| 393 |
+
const submitRequestButtonElement = entryElement.getElementsByTagName("button")[0];
|
| 394 |
+
|
| 395 |
+
submitRequestButtonElement.addEventListener("click", (event) => {
|
| 396 |
+
try {
|
| 397 |
+
let request = requestTextAreaElement.value;
|
| 398 |
+
let id = entryElement._consumerSession.remoteController.sendControlRequest(request);
|
| 399 |
+
} catch (ex) {
|
| 400 |
+
console.error("Failed to parse mix matrix:", ex);
|
| 401 |
+
return;
|
| 402 |
+
}
|
| 403 |
+
});
|
| 404 |
+
|
| 405 |
+
videoElement.addEventListener("playing", () => {
|
| 406 |
+
if (entryElement.classList.contains("has-session")) {
|
| 407 |
+
entryElement.classList.add("streaming");
|
| 408 |
+
}
|
| 409 |
+
});
|
| 410 |
+
|
| 411 |
+
entryElement.addEventListener("click", (event) => {
|
| 412 |
+
event.preventDefault();
|
| 413 |
+
if (!event.target.classList.contains("button")) {
|
| 414 |
+
return;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
if (entryElement._consumerSession) {
|
| 418 |
+
entryElement._consumerSession.close();
|
| 419 |
+
} else {
|
| 420 |
+
let session = null;
|
| 421 |
+
if (offerTextareaElement.value == '') {
|
| 422 |
+
session = api.createConsumerSession(producerId);
|
| 423 |
+
} else {
|
| 424 |
+
try {
|
| 425 |
+
let offerOptions = JSON.parse(offerTextareaElement.value);
|
| 426 |
+
session = api.createConsumerSessionWithOfferOptions(producerId, offerOptions);
|
| 427 |
+
} catch (ex) {
|
| 428 |
+
console.error("Failed to parse offer options:", ex);
|
| 429 |
+
return;
|
| 430 |
+
}
|
| 431 |
+
}
|
| 432 |
+
if (session) {
|
| 433 |
+
entryElement._consumerSession = session;
|
| 434 |
+
|
| 435 |
+
session.mungeStereoHack = true;
|
| 436 |
+
|
| 437 |
+
session.addEventListener("error", (event) => {
|
| 438 |
+
if (entryElement._consumerSession === session) {
|
| 439 |
+
console.error(event.message, event.error);
|
| 440 |
+
}
|
| 441 |
+
});
|
| 442 |
+
|
| 443 |
+
session.addEventListener("closed", () => {
|
| 444 |
+
if (entryElement._consumerSession === session) {
|
| 445 |
+
videoElement.pause();
|
| 446 |
+
videoElement.srcObject = null;
|
| 447 |
+
entryElement.classList.remove("has-session", "streaming", "has-remote-control");
|
| 448 |
+
delete entryElement._consumerSession;
|
| 449 |
+
}
|
| 450 |
+
});
|
| 451 |
+
|
| 452 |
+
session.addEventListener("streamsChanged", () => {
|
| 453 |
+
if (entryElement._consumerSession === session) {
|
| 454 |
+
const streams = session.streams;
|
| 455 |
+
if (streams.length > 0) {
|
| 456 |
+
videoElement.srcObject = streams[0];
|
| 457 |
+
videoElement.play().catch(() => {});
|
| 458 |
+
}
|
| 459 |
+
}
|
| 460 |
+
});
|
| 461 |
+
|
| 462 |
+
session.addEventListener("remoteControllerChanged", () => {
|
| 463 |
+
if (entryElement._consumerSession === session) {
|
| 464 |
+
const remoteController = session.remoteController;
|
| 465 |
+
if (remoteController) {
|
| 466 |
+
entryElement.classList.add("has-remote-control");
|
| 467 |
+
submitRequestButtonElement.disabled = false;
|
| 468 |
+
remoteController.attachVideoElement(videoElement);
|
| 469 |
+
remoteController.addEventListener("info", (e) => {
|
| 470 |
+
console.log("Received info message from producer: ", e.detail);
|
| 471 |
+
});
|
| 472 |
+
} else {
|
| 473 |
+
entryElement.classList.remove("has-remote-control");
|
| 474 |
+
submitRequestButtonElement.disabled = true;
|
| 475 |
+
}
|
| 476 |
+
}
|
| 477 |
+
});
|
| 478 |
+
|
| 479 |
+
entryElement.classList.add("has-session");
|
| 480 |
+
session.connect();
|
| 481 |
+
}
|
| 482 |
+
}
|
| 483 |
+
});
|
| 484 |
+
}
|
| 485 |
+
},
|
| 486 |
+
|
| 487 |
+
producerRemoved: function(producer) {
|
| 488 |
+
const element = document.getElementById(producer.id);
|
| 489 |
+
if (element) {
|
| 490 |
+
if (element._consumerSession) {
|
| 491 |
+
element._consumerSession.close();
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
element.remove();
|
| 495 |
+
}
|
| 496 |
+
}
|
| 497 |
+
};
|
| 498 |
+
|
| 499 |
+
api.registerPeerListener(listener);
|
| 500 |
+
for (const producer of api.getAvailableProducers()) {
|
| 501 |
+
listener.producerAdded(producer);
|
| 502 |
+
}
|
| 503 |
+
}
|
| 504 |
+
|
| 505 |
+
window.addEventListener("DOMContentLoaded", () => {
|
| 506 |
+
document.addEventListener("click", (event) => {
|
| 507 |
+
if (event.target.matches("div.video>div.fullscreen:hover>span")) {
|
| 508 |
+
event.preventDefault();
|
| 509 |
+
event.target.parentNode.previousElementSibling.requestFullscreen();
|
| 510 |
+
}
|
| 511 |
+
});
|
| 512 |
+
|
| 513 |
+
const signalingProtocol = window.location.protocol.startsWith("https") ? "wss" : "ws";
|
| 514 |
+
const gstWebRTCConfig = {
|
| 515 |
+
meta: { name: `WebClient-${Date.now()}` },
|
| 516 |
+
signalingServerUrl: `${signalingProtocol}://${window.location.hostname}:8443`,
|
| 517 |
+
};
|
| 518 |
+
|
| 519 |
+
const api = new GstWebRTCAPI(gstWebRTCConfig);
|
| 520 |
+
initCapture(api);
|
| 521 |
+
initRemoteStreams(api);
|
| 522 |
+
});
|
| 523 |
+
</script>
|
| 524 |
+
</head>
|
| 525 |
+
<body>
|
| 526 |
+
<header>
|
| 527 |
+
<h1>GstWebRTC API</h1>
|
| 528 |
+
</header>
|
| 529 |
+
<main>
|
| 530 |
+
<section id="capture">
|
| 531 |
+
<span class="client-id">none</span>
|
| 532 |
+
<button class="button" id="capture-button"></button>
|
| 533 |
+
<div class="video">
|
| 534 |
+
<div class="spinner">
|
| 535 |
+
<div></div>
|
| 536 |
+
<div></div>
|
| 537 |
+
<div></div>
|
| 538 |
+
<div></div>
|
| 539 |
+
</div>
|
| 540 |
+
<video>
|
| 541 |
+
</video>
|
| 542 |
+
</div>
|
| 543 |
+
</section>
|
| 544 |
+
<section>
|
| 545 |
+
<h1>Remote streams</h1>
|
| 546 |
+
<ul id="remote-streams">
|
| 547 |
+
</ul>
|
| 548 |
+
</section>
|
| 549 |
+
<section>
|
| 550 |
+
<h1>Available consumers</h1>
|
| 551 |
+
<ul id="available-consumers">
|
| 552 |
+
</ul>
|
| 553 |
+
</section>
|
| 554 |
+
</main>
|
| 555 |
+
</body>
|
| 556 |
+
</html>
|
src/jsdoc.conf.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"plugins": [
|
| 3 |
+
"node_modules/jsdoc-tsimport-plugin/index.js"
|
| 4 |
+
]
|
| 5 |
+
}
|
src/node_modules/.bin/acorn
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../acorn/bin/acorn
|
src/node_modules/.bin/ansi-html
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../ansi-html-community/bin/ansi-html
|
src/node_modules/.bin/browserslist
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../browserslist/cli.js
|
src/node_modules/.bin/envinfo
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../envinfo/dist/cli.js
|
src/node_modules/.bin/eslint
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../eslint/bin/eslint.js
|
src/node_modules/.bin/he
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../he/bin/he
|
src/node_modules/.bin/html-minifier-terser
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../html-minifier-terser/cli.js
|
src/node_modules/.bin/import-local-fixture
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../import-local/fixtures/cli.js
|
src/node_modules/.bin/is-docker
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../is-docker/cli.js
|
src/node_modules/.bin/js-yaml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../js-yaml/bin/js-yaml.js
|
src/node_modules/.bin/jsdoc
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../jsdoc/jsdoc.js
|
src/node_modules/.bin/markdown-it
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../markdown-it/bin/markdown-it.js
|
src/node_modules/.bin/marked
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../marked/bin/marked.js
|
src/node_modules/.bin/mime
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../mime/cli.js
|
src/node_modules/.bin/mkdirp
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../mkdirp/bin/cmd.js
|
src/node_modules/.bin/multicast-dns
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../multicast-dns/cli.js
|
src/node_modules/.bin/node-which
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../which/bin/node-which
|
src/node_modules/.bin/parser
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../@babel/parser/bin/babel-parser.js
|
src/node_modules/.bin/resolve
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../resolve/bin/resolve
|
src/node_modules/.bin/rimraf
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../rimraf/dist/cjs/src/bin.js
|
src/node_modules/.bin/terser
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../terser/bin/terser
|
src/node_modules/.bin/update-browserslist-db
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../update-browserslist-db/cli.js
|
src/node_modules/.bin/uuid
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../uuid/dist/bin/uuid
|
src/node_modules/.bin/webpack
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../webpack/bin/webpack.js
|
src/node_modules/.bin/webpack-cli
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../webpack-cli/bin/cli.js
|
src/node_modules/.bin/webpack-dev-server
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
../webpack-dev-server/bin/webpack-dev-server.js
|
src/node_modules/.cache/webpack-dev-server/server.pem
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-----BEGIN RSA PRIVATE KEY-----
|
| 2 |
+
MIIEpAIBAAKCAQEAks62CG121rZMxBe8kX5Oj/S74IAZ9M3TWFGJZLeyFS4DZzav
|
| 3 |
+
Gw6jZyUkYALNbvWgq8hzr+UyfLFurb/j0pR//vaJ8MQJ//HXR0HrTQAIy4ASVAPV
|
| 4 |
+
Scmz4wDB6+UCev4DMgy4mVTZfQPKUmTjO1JYzpJmaQwl3f5ir4ZSPuckdPew7awI
|
| 5 |
+
VagBMIlgfBG7etV8dt8JVWvmt+J8Qw8EtB0KeCeK7XRTNJPfm2tjqo4Mxj3L3Lij
|
| 6 |
+
a2KFjwkS9wNFzYIdGX+g58h0aDjDr5VRAhWO/TMJ81Kz6KVITSGsyub+Ku4tZ5H+
|
| 7 |
+
ZG3OPSMUvwbbxnEl2ING3/85KNHwXRXdognDEQIDAQABAoIBAANF25vt3VAxe54E
|
| 8 |
+
SbRcapHV5t2dG38IOuvJUxDhUcV8O3AQ0Xfu5EyRkNlZXKU6cYLc5tvbNiw+nCkg
|
| 9 |
+
WdrVK9KWQlphU3f+1zHf7cgPXfLT+8ye0oGo7xNKrjgVKKBPcwipzRCBilD5vXgn
|
| 10 |
+
ZsO4/PD7hXAWeM5lfEOdoO4lMuxO2++ExAUk5/h+8u1UjiMorXDmCKWCknedkQdV
|
| 11 |
+
/5TJfQSGFJas2SVbOeXJlxpUfHAyw0bd4hS3tGCVR1M5RjSbb8+wnH4rqdf/S1gA
|
| 12 |
+
EIy67wP0u+nZZyRXmPy2zjxGy58nAmRRaGQYPtYQBISLHfQ70NmTvm1mWhyYGoQE
|
| 13 |
+
Qrxs4uECgYEAx7tT7DQeGJvUc+se/lnwYvbJJzzQqyjgA29d3STTsQkXw4iwOqyn
|
| 14 |
+
6juesxanu7J1klt66s/hpKTsakFB9ceTMlPO3o2TGEafAxLFINbgBmRvHuhPdhAc
|
| 15 |
+
XBNRhS7uVuOHBeVs8ppRLlKnqC1uJgIbw1Rpb0Pfvvto2W083JvehfECgYEAvCp6
|
| 16 |
+
ntXTb1PQi33zkNaXqLQNVWQNiBKiTCoJD64zJGhEDMcbAwrOy6NIBwcFsBwrDNtq
|
| 17 |
+
ec7eN/qQ17YC8WfuHvmciJ0MJiXY5sTM2a5v5FG3OhrpqWgi49OcinW8dojVbvXr
|
| 18 |
+
lS3zESkMbBvqg5J1obMkA833aq4n4SLD0D+3byECgYEAj553ETDEt2NOGHBoH/Ni
|
| 19 |
+
NHdKW2mSjpDcy/uHnh3+Dp4ANX0TY42FTJvEWPigcgo4Gp6nOzNyCGcDDMCSAn6Y
|
| 20 |
+
rKaw6T0aGWmmq5oSn7OC8XXEpY/cm4OoMNk/VCpT/aysCaRYe/ZVC58pqXfJbZE0
|
| 21 |
+
j3ciPXyr5fN4CGhRTDzUfLECgYAehqWt7vKGNQq4Fo7VCHtCGzOujrTDRoKd6JPf
|
| 22 |
+
v1r8pQ2lJQf0zmQOFUcyHKmHkIpLY606ZZ0XZ8bnt9dyYnH3BHeokhHOfoVZqsOw
|
| 23 |
+
7OOqHrei7YrKuOIwI7xZmhAhCsHVZn/5i6LLPeWOBFlfTvtWaEGHfHqPDAHcPE+Y
|
| 24 |
+
ET4pAQKBgQCQWwNE6MJeEE9ptn/74B2J+XpFKlyEy8ikAC9L6lUAW321wjRfCWHG
|
| 25 |
+
UUHD38RSH+h9dLs0mWV4oMKjO1pIDx7TjqMnK7Vb2BhRsqHNenHeCeTI26RzqLJB
|
| 26 |
+
XoJx+Q5k70gjWALOc6NSi91fqGY7UNwRBUltPJLS5BpXpdPztJGKvA==
|
| 27 |
+
-----END RSA PRIVATE KEY-----
|
| 28 |
+
-----BEGIN CERTIFICATE-----
|
| 29 |
+
MIIDWzCCAkOgAwIBAgIJM4sofnhbvP4rMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
|
| 30 |
+
BAMTCWxvY2FsaG9zdDAeFw0yNTA0MDMxMzUzNDFaFw0yNTA1MDMxMzUzNDFaMBQx
|
| 31 |
+
EjAQBgNVBAMTCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
| 32 |
+
ggEBAJLOtghtdta2TMQXvJF+To/0u+CAGfTN01hRiWS3shUuA2c2rxsOo2clJGAC
|
| 33 |
+
zW71oKvIc6/lMnyxbq2/49KUf/72ifDECf/x10dB600ACMuAElQD1UnJs+MAwevl
|
| 34 |
+
Anr+AzIMuJlU2X0DylJk4ztSWM6SZmkMJd3+Yq+GUj7nJHT3sO2sCFWoATCJYHwR
|
| 35 |
+
u3rVfHbfCVVr5rfifEMPBLQdCngniu10UzST35trY6qODMY9y9y4o2tihY8JEvcD
|
| 36 |
+
Rc2CHRl/oOfIdGg4w6+VUQIVjv0zCfNSs+ilSE0hrMrm/iruLWeR/mRtzj0jFL8G
|
| 37 |
+
28ZxJdiDRt//OSjR8F0V3aIJwxECAwEAAaOBrzCBrDAMBgNVHRMEBTADAQH/MAsG
|
| 38 |
+
A1UdDwQEAwIC9DAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUF
|
| 39 |
+
BwMDBggrBgEFBQcDCDBcBgNVHREEVTBTgglsb2NhbGhvc3SCFWxvY2FsaG9zdC5s
|
| 40 |
+
b2NhbGRvbWFpboIGbHZoLm1lgggqLmx2aC5tZYIFWzo6MV2HBH8AAAGHEP6AAAAA
|
| 41 |
+
AAAAAAAAAAAAAAEwDQYJKoZIhvcNAQELBQADggEBAEQNnQP4SnRrRovVqqWIZdyQ
|
| 42 |
+
w27skIJrGD+M2MP2Pc8lukbjqESfmzxIS0457N+Eh+hVArKYV2+UIZkcJ2JHKNOb
|
| 43 |
+
8JCoaZIycdOgoEovmpyT1UEkaQpnGdVgq85j+9iuqOk14Do/g263EZ1XuPp0J+xg
|
| 44 |
+
F/rTYIzwRIhVAFq56HiDA4xtCS+eAWVZcsBS6qZeuArcHROFYOCCUQ/SQtdfE8hU
|
| 45 |
+
+i3NbcWU/kZHRbjX+wUscUz8VNz3xuupA3r7I1XN44bNCo6rj08F52KziTt/EIZ1
|
| 46 |
+
4iAlipBcL3WC6yZV2mvxHVc2QPd6fNj4OoVDdEuUzMD9XSPthxh6pPmPuIl5at0=
|
| 47 |
+
-----END CERTIFICATE-----
|
src/node_modules/.package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/node_modules/@aashutoshrathi/word-wrap/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014-2016, Jon Schlinkert
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
src/node_modules/@aashutoshrathi/word-wrap/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# word-wrap [](https://www.npmjs.com/package/word-wrap) [](https://npmjs.org/package/word-wrap) [](https://npmjs.org/package/word-wrap) [](https://travis-ci.org/jonschlinkert/word-wrap)
|
| 2 |
+
|
| 3 |
+
> Wrap words to a specified length.
|
| 4 |
+
|
| 5 |
+
## Install
|
| 6 |
+
|
| 7 |
+
Install with [npm](https://www.npmjs.com/):
|
| 8 |
+
|
| 9 |
+
```sh
|
| 10 |
+
$ npm install --save word-wrap
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
## Usage
|
| 14 |
+
|
| 15 |
+
```js
|
| 16 |
+
var wrap = require('word-wrap');
|
| 17 |
+
|
| 18 |
+
wrap('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
Results in:
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
Lorem ipsum dolor sit amet, consectetur adipiscing
|
| 25 |
+
elit, sed do eiusmod tempor incididunt ut labore
|
| 26 |
+
et dolore magna aliqua. Ut enim ad minim veniam,
|
| 27 |
+
quis nostrud exercitation ullamco laboris nisi ut
|
| 28 |
+
aliquip ex ea commodo consequat.
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## Options
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
|
| 35 |
+
### options.width
|
| 36 |
+
|
| 37 |
+
Type: `Number`
|
| 38 |
+
|
| 39 |
+
Default: `50`
|
| 40 |
+
|
| 41 |
+
The width of the text before wrapping to a new line.
|
| 42 |
+
|
| 43 |
+
**Example:**
|
| 44 |
+
|
| 45 |
+
```js
|
| 46 |
+
wrap(str, {width: 60});
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
### options.indent
|
| 50 |
+
|
| 51 |
+
Type: `String`
|
| 52 |
+
|
| 53 |
+
Default: `` (none)
|
| 54 |
+
|
| 55 |
+
The string to use at the beginning of each line.
|
| 56 |
+
|
| 57 |
+
**Example:**
|
| 58 |
+
|
| 59 |
+
```js
|
| 60 |
+
wrap(str, {indent: ' '});
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### options.newline
|
| 64 |
+
|
| 65 |
+
Type: `String`
|
| 66 |
+
|
| 67 |
+
Default: `\n`
|
| 68 |
+
|
| 69 |
+
The string to use at the end of each line.
|
| 70 |
+
|
| 71 |
+
**Example:**
|
| 72 |
+
|
| 73 |
+
```js
|
| 74 |
+
wrap(str, {newline: '\n\n'});
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### options.escape
|
| 78 |
+
|
| 79 |
+
Type: `function`
|
| 80 |
+
|
| 81 |
+
Default: `function(str){return str;}`
|
| 82 |
+
|
| 83 |
+
An escape function to run on each line after splitting them.
|
| 84 |
+
|
| 85 |
+
**Example:**
|
| 86 |
+
|
| 87 |
+
```js
|
| 88 |
+
var xmlescape = require('xml-escape');
|
| 89 |
+
wrap(str, {
|
| 90 |
+
escape: function(string){
|
| 91 |
+
return xmlescape(string);
|
| 92 |
+
}
|
| 93 |
+
});
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
### options.trim
|
| 97 |
+
|
| 98 |
+
Type: `Boolean`
|
| 99 |
+
|
| 100 |
+
Default: `false`
|
| 101 |
+
|
| 102 |
+
Trim trailing whitespace from the returned string. This option is included since `.trim()` would also strip the leading indentation from the first line.
|
| 103 |
+
|
| 104 |
+
**Example:**
|
| 105 |
+
|
| 106 |
+
```js
|
| 107 |
+
wrap(str, {trim: true});
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
### options.cut
|
| 111 |
+
|
| 112 |
+
Type: `Boolean`
|
| 113 |
+
|
| 114 |
+
Default: `false`
|
| 115 |
+
|
| 116 |
+
Break a word between any two letters when the word is longer than the specified width.
|
| 117 |
+
|
| 118 |
+
**Example:**
|
| 119 |
+
|
| 120 |
+
```js
|
| 121 |
+
wrap(str, {cut: true});
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
## About
|
| 125 |
+
|
| 126 |
+
### Related projects
|
| 127 |
+
|
| 128 |
+
* [common-words](https://www.npmjs.com/package/common-words): Updated list (JSON) of the 100 most common words in the English language. Useful for… [more](https://github.com/jonschlinkert/common-words) | [homepage](https://github.com/jonschlinkert/common-words "Updated list (JSON) of the 100 most common words in the English language. Useful for excluding these words from arrays.")
|
| 129 |
+
* [shuffle-words](https://www.npmjs.com/package/shuffle-words): Shuffle the words in a string and optionally the letters in each word using the… [more](https://github.com/jonschlinkert/shuffle-words) | [homepage](https://github.com/jonschlinkert/shuffle-words "Shuffle the words in a string and optionally the letters in each word using the Fisher-Yates algorithm. Useful for creating test fixtures, benchmarking samples, etc.")
|
| 130 |
+
* [unique-words](https://www.npmjs.com/package/unique-words): Return the unique words in a string or array. | [homepage](https://github.com/jonschlinkert/unique-words "Return the unique words in a string or array.")
|
| 131 |
+
* [wordcount](https://www.npmjs.com/package/wordcount): Count the words in a string. Support for english, CJK and Cyrillic. | [homepage](https://github.com/jonschlinkert/wordcount "Count the words in a string. Support for english, CJK and Cyrillic.")
|
| 132 |
+
|
| 133 |
+
### Contributing
|
| 134 |
+
|
| 135 |
+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
| 136 |
+
|
| 137 |
+
### Contributors
|
| 138 |
+
|
| 139 |
+
| **Commits** | **Contributor** |
|
| 140 |
+
| --- | --- |
|
| 141 |
+
| 43 | [jonschlinkert](https://github.com/jonschlinkert) |
|
| 142 |
+
| 2 | [lordvlad](https://github.com/lordvlad) |
|
| 143 |
+
| 2 | [hildjj](https://github.com/hildjj) |
|
| 144 |
+
| 1 | [danilosampaio](https://github.com/danilosampaio) |
|
| 145 |
+
| 1 | [2fd](https://github.com/2fd) |
|
| 146 |
+
| 1 | [toddself](https://github.com/toddself) |
|
| 147 |
+
| 1 | [wolfgang42](https://github.com/wolfgang42) |
|
| 148 |
+
| 1 | [zachhale](https://github.com/zachhale) |
|
| 149 |
+
|
| 150 |
+
### Building docs
|
| 151 |
+
|
| 152 |
+
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
| 153 |
+
|
| 154 |
+
To generate the readme, run the following command:
|
| 155 |
+
|
| 156 |
+
```sh
|
| 157 |
+
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
### Running tests
|
| 161 |
+
|
| 162 |
+
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
| 163 |
+
|
| 164 |
+
```sh
|
| 165 |
+
$ npm install && npm test
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
### Author
|
| 169 |
+
|
| 170 |
+
**Jon Schlinkert**
|
| 171 |
+
|
| 172 |
+
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
| 173 |
+
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
| 174 |
+
|
| 175 |
+
### License
|
| 176 |
+
|
| 177 |
+
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
| 178 |
+
Released under the [MIT License](LICENSE).
|
| 179 |
+
|
| 180 |
+
***
|
| 181 |
+
|
| 182 |
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 02, 2017._
|
src/node_modules/@aashutoshrathi/word-wrap/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Wrap words to a specified length.
|
| 3 |
+
*/
|
| 4 |
+
export = wrap;
|
| 5 |
+
|
| 6 |
+
declare function wrap(str: string, options?: wrap.IOptions): string;
|
| 7 |
+
|
| 8 |
+
declare namespace wrap {
|
| 9 |
+
export interface IOptions {
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* The width of the text before wrapping to a new line.
|
| 13 |
+
* @default ´50´
|
| 14 |
+
*/
|
| 15 |
+
width?: number;
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* The string to use at the beginning of each line.
|
| 19 |
+
* @default ´´ (none)
|
| 20 |
+
*/
|
| 21 |
+
indent?: string;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* The string to use at the end of each line.
|
| 25 |
+
* @default ´\n´
|
| 26 |
+
*/
|
| 27 |
+
newline?: string;
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* An escape function to run on each line after splitting them.
|
| 31 |
+
* @default (str: string) => string;
|
| 32 |
+
*/
|
| 33 |
+
escape?: (str: string) => string;
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Trim trailing whitespace from the returned string.
|
| 37 |
+
* This option is included since .trim() would also strip
|
| 38 |
+
* the leading indentation from the first line.
|
| 39 |
+
* @default true
|
| 40 |
+
*/
|
| 41 |
+
trim?: boolean;
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Break a word between any two letters when the word is longer
|
| 45 |
+
* than the specified width.
|
| 46 |
+
* @default false
|
| 47 |
+
*/
|
| 48 |
+
cut?: boolean;
|
| 49 |
+
}
|
| 50 |
+
}
|
src/node_modules/@aashutoshrathi/word-wrap/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* word-wrap <https://github.com/jonschlinkert/word-wrap>
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) 2014-2023, Jon Schlinkert.
|
| 5 |
+
* Released under the MIT License.
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
function trimTabAndSpaces(str) {
|
| 9 |
+
const lines = str.split('\n');
|
| 10 |
+
const trimmedLines = lines.map((line) => line.trimEnd());
|
| 11 |
+
return trimmedLines.join('\n');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
module.exports = function(str, options) {
|
| 15 |
+
options = options || {};
|
| 16 |
+
if (str == null) {
|
| 17 |
+
return str;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
var width = options.width || 50;
|
| 21 |
+
var indent = (typeof options.indent === 'string')
|
| 22 |
+
? options.indent
|
| 23 |
+
: '';
|
| 24 |
+
|
| 25 |
+
var newline = options.newline || '\n' + indent;
|
| 26 |
+
var escape = typeof options.escape === 'function'
|
| 27 |
+
? options.escape
|
| 28 |
+
: identity;
|
| 29 |
+
|
| 30 |
+
var regexString = '.{1,' + width + '}';
|
| 31 |
+
if (options.cut !== true) {
|
| 32 |
+
regexString += '([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)';
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
var re = new RegExp(regexString, 'g');
|
| 36 |
+
var lines = str.match(re) || [];
|
| 37 |
+
var result = indent + lines.map(function(line) {
|
| 38 |
+
if (line.slice(-1) === '\n') {
|
| 39 |
+
line = line.slice(0, line.length - 1);
|
| 40 |
+
}
|
| 41 |
+
return escape(line);
|
| 42 |
+
}).join(newline);
|
| 43 |
+
|
| 44 |
+
if (options.trim === true) {
|
| 45 |
+
result = trimTabAndSpaces(result);
|
| 46 |
+
}
|
| 47 |
+
return result;
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
function identity(str) {
|
| 51 |
+
return str;
|
| 52 |
+
}
|
src/node_modules/@aashutoshrathi/word-wrap/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@aashutoshrathi/word-wrap",
|
| 3 |
+
"description": "Wrap words to a specified length.",
|
| 4 |
+
"version": "1.2.6",
|
| 5 |
+
"homepage": "https://github.com/aashutoshrathi/word-wrap",
|
| 6 |
+
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
| 7 |
+
"contributors": [
|
| 8 |
+
"Aashutosh Rathi <aashutoshrathi@gmail.com>",
|
| 9 |
+
"Danilo Sampaio <danilo.sampaio@gmail.com> (localhost:8080)",
|
| 10 |
+
"Fede Ramirez <i@2fd.me> (https://2fd.github.io)",
|
| 11 |
+
"Joe Hildebrand <joe-github@cursive.net> (https://twitter.com/hildjj)",
|
| 12 |
+
"Jon Schlinkert <jon.schlinkert@sellside.com> (http://twitter.com/jonschlinkert)",
|
| 13 |
+
"Todd Kennedy (https://tck.io)",
|
| 14 |
+
"Waldemar Reusch (https://github.com/lordvlad)",
|
| 15 |
+
"Wolfgang Faust (http://www.linestarve.com)",
|
| 16 |
+
"Zach Hale <zachhale@gmail.com> (http://zachhale.com)"
|
| 17 |
+
],
|
| 18 |
+
"repository": {
|
| 19 |
+
"type": "git",
|
| 20 |
+
"url": "git+https://github.com/aashutoshrathi/word-wrap.git"
|
| 21 |
+
},
|
| 22 |
+
"bugs": {
|
| 23 |
+
"url": "https://github.com/aashutoshrathi/word-wrap/issues"
|
| 24 |
+
},
|
| 25 |
+
"license": "MIT",
|
| 26 |
+
"files": [
|
| 27 |
+
"index.js",
|
| 28 |
+
"index.d.ts"
|
| 29 |
+
],
|
| 30 |
+
"main": "index.js",
|
| 31 |
+
"engines": {
|
| 32 |
+
"node": ">=0.10.0"
|
| 33 |
+
},
|
| 34 |
+
"scripts": {
|
| 35 |
+
"test": "mocha"
|
| 36 |
+
},
|
| 37 |
+
"devDependencies": {
|
| 38 |
+
"gulp-format-md": "^0.1.11",
|
| 39 |
+
"mocha": "^10.2.0"
|
| 40 |
+
},
|
| 41 |
+
"keywords": [
|
| 42 |
+
"break",
|
| 43 |
+
"carriage",
|
| 44 |
+
"line",
|
| 45 |
+
"new-line",
|
| 46 |
+
"newline",
|
| 47 |
+
"return",
|
| 48 |
+
"soft",
|
| 49 |
+
"text",
|
| 50 |
+
"word",
|
| 51 |
+
"word-wrap",
|
| 52 |
+
"words",
|
| 53 |
+
"wrap"
|
| 54 |
+
],
|
| 55 |
+
"typings": "index.d.ts",
|
| 56 |
+
"verb": {
|
| 57 |
+
"toc": false,
|
| 58 |
+
"layout": "default",
|
| 59 |
+
"tasks": [
|
| 60 |
+
"readme"
|
| 61 |
+
],
|
| 62 |
+
"plugins": [
|
| 63 |
+
"gulp-format-md"
|
| 64 |
+
],
|
| 65 |
+
"lint": {
|
| 66 |
+
"reflinks": true
|
| 67 |
+
},
|
| 68 |
+
"related": {
|
| 69 |
+
"list": [
|
| 70 |
+
"common-words",
|
| 71 |
+
"shuffle-words",
|
| 72 |
+
"unique-words",
|
| 73 |
+
"wordcount"
|
| 74 |
+
]
|
| 75 |
+
},
|
| 76 |
+
"reflinks": [
|
| 77 |
+
"verb",
|
| 78 |
+
"verb-generate-readme"
|
| 79 |
+
]
|
| 80 |
+
}
|
| 81 |
+
}
|
src/node_modules/@babel/parser/CHANGELOG.md
ADDED
|
@@ -0,0 +1,1073 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
> **Tags:**
|
| 4 |
+
> - :boom: [Breaking Change]
|
| 5 |
+
> - :eyeglasses: [Spec Compliance]
|
| 6 |
+
> - :rocket: [New Feature]
|
| 7 |
+
> - :bug: [Bug Fix]
|
| 8 |
+
> - :memo: [Documentation]
|
| 9 |
+
> - :house: [Internal]
|
| 10 |
+
> - :nail_care: [Polish]
|
| 11 |
+
|
| 12 |
+
> Semver Policy: https://github.com/babel/babel/tree/main/packages/babel-parser#semver
|
| 13 |
+
|
| 14 |
+
_Note: Gaps between patch versions are faulty, broken or test releases._
|
| 15 |
+
|
| 16 |
+
See the [Babel Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) for the pre-6.8.0 version Changelog.
|
| 17 |
+
|
| 18 |
+
## 6.17.1 (2017-05-10)
|
| 19 |
+
|
| 20 |
+
### :bug: Bug Fix
|
| 21 |
+
* Fix typo in flow spread operator error (Brian Ng)
|
| 22 |
+
* Fixed invalid number literal parsing ([#473](https://github.com/babel/babylon/pull/473)) (Alex Kuzmenko)
|
| 23 |
+
* Fix number parser ([#433](https://github.com/babel/babylon/pull/433)) (Alex Kuzmenko)
|
| 24 |
+
* Ensure non pattern shorthand props are checked for reserved words ([#479](https://github.com/babel/babylon/pull/479)) (Brian Ng)
|
| 25 |
+
* Remove jsx context when parsing arrow functions ([#475](https://github.com/babel/babylon/pull/475)) (Brian Ng)
|
| 26 |
+
* Allow super in class properties ([#499](https://github.com/babel/babylon/pull/499)) (Brian Ng)
|
| 27 |
+
* Allow flow class field to be named constructor ([#510](https://github.com/babel/babylon/pull/510)) (Brian Ng)
|
| 28 |
+
|
| 29 |
+
## 6.17.0 (2017-04-20)
|
| 30 |
+
|
| 31 |
+
### :bug: Bug Fix
|
| 32 |
+
* Cherry-pick #418 to 6.x ([#476](https://github.com/babel/babylon/pull/476)) (Sebastian McKenzie)
|
| 33 |
+
* Add support for invalid escapes in tagged templates ([#274](https://github.com/babel/babylon/pull/274)) (Kevin Gibbons)
|
| 34 |
+
* Throw error if new.target is used outside of a function ([#402](https://github.com/babel/babylon/pull/402)) (Brian Ng)
|
| 35 |
+
* Fix parsing of class properties ([#351](https://github.com/babel/babylon/pull/351)) (Kevin Gibbons)
|
| 36 |
+
* Fix parsing yield with dynamicImport ([#383](https://github.com/babel/babylon/pull/383)) (Brian Ng)
|
| 37 |
+
* Ensure consistent start args for parseParenItem ([#386](https://github.com/babel/babylon/pull/386)) (Brian Ng)
|
| 38 |
+
|
| 39 |
+
## 7.0.0-beta.8 (2017-04-04)
|
| 40 |
+
|
| 41 |
+
### New Feature
|
| 42 |
+
* Add support for flow type spread (#418) (Conrad Buck)
|
| 43 |
+
* Allow statics in flow interfaces (#427) (Brian Ng)
|
| 44 |
+
|
| 45 |
+
### Bug Fix
|
| 46 |
+
* Fix predicate attachment to match flow parser (#428) (Brian Ng)
|
| 47 |
+
* Add extra.raw back to JSXText and JSXAttribute (#344) (Alex Rattray)
|
| 48 |
+
* Fix rest parameters with array and objects (#424) (Brian Ng)
|
| 49 |
+
* Fix number parser (#433) (Alex Kuzmenko)
|
| 50 |
+
|
| 51 |
+
### Docs
|
| 52 |
+
* Fix CONTRIBUTING.md [skip ci] (#432) (Alex Kuzmenko)
|
| 53 |
+
|
| 54 |
+
### Internal
|
| 55 |
+
* Use babel-register script when running babel smoke tests (#442) (Brian Ng)
|
| 56 |
+
|
| 57 |
+
## 7.0.0-beta.7 (2017-03-22)
|
| 58 |
+
|
| 59 |
+
### Spec Compliance
|
| 60 |
+
* Remove babylon plugin for template revision since it's stage-4 (#426) (Henry Zhu)
|
| 61 |
+
|
| 62 |
+
### Bug Fix
|
| 63 |
+
|
| 64 |
+
* Fix push-pop logic in flow (#405) (Daniel Tschinder)
|
| 65 |
+
|
| 66 |
+
## 7.0.0-beta.6 (2017-03-21)
|
| 67 |
+
|
| 68 |
+
### New Feature
|
| 69 |
+
* Add support for invalid escapes in tagged templates (#274) (Kevin Gibbons)
|
| 70 |
+
|
| 71 |
+
### Polish
|
| 72 |
+
* Improves error message when super is called outside of constructor (#408) (Arshabh Kumar Agarwal)
|
| 73 |
+
|
| 74 |
+
### Docs
|
| 75 |
+
|
| 76 |
+
* [7.0] Moved value field in spec from ObjectMember to ObjectProperty as ObjectMethod's don't have it (#415) [skip ci] (James Browning)
|
| 77 |
+
|
| 78 |
+
## 7.0.0-beta.5 (2017-03-21)
|
| 79 |
+
|
| 80 |
+
### Bug Fix
|
| 81 |
+
* Throw error if new.target is used outside of a function (#402) (Brian Ng)
|
| 82 |
+
* Fix parsing of class properties (#351) (Kevin Gibbons)
|
| 83 |
+
|
| 84 |
+
### Other
|
| 85 |
+
* Test runner: Detect extra property in 'actual' but not in 'expected'. (#407) (Andy)
|
| 86 |
+
* Optimize travis builds (#419) (Daniel Tschinder)
|
| 87 |
+
* Update codecov to 2.0 (#412) (Daniel Tschinder)
|
| 88 |
+
* Fix spec for ClassMethod: It doesn't have a function, it *is* a function. (#406) [skip ci] (Andy)
|
| 89 |
+
* Changed Non-existent RestPattern to RestElement which is what is actually parsed (#409) [skip ci] (James Browning)
|
| 90 |
+
* Upgrade flow to 0.41 (Daniel Tschinder)
|
| 91 |
+
* Fix watch command (#403) (Brian Ng)
|
| 92 |
+
* Update yarn lock (Daniel Tschinder)
|
| 93 |
+
* Fix watch command (#403) (Brian Ng)
|
| 94 |
+
* chore(package): update flow-bin to version 0.41.0 (#395) (greenkeeper[bot])
|
| 95 |
+
* Add estree test for correct order of directives (Daniel Tschinder)
|
| 96 |
+
* Add DoExpression to spec (#364) (Alex Kuzmenko)
|
| 97 |
+
* Mention cloning of repository in CONTRIBUTING.md (#391) [skip ci] (Sumedh Nimkarde)
|
| 98 |
+
* Explain how to run only one test (#389) [skip ci] (Aaron Ang)
|
| 99 |
+
|
| 100 |
+
## 7.0.0-beta.4 (2017-03-01)
|
| 101 |
+
|
| 102 |
+
* Don't consume async when checking for async func decl (#377) (Brian Ng)
|
| 103 |
+
* add `ranges` option [skip ci] (Henry Zhu)
|
| 104 |
+
* Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) (Andrew Levine)
|
| 105 |
+
|
| 106 |
+
## 7.0.0-beta.3 (2017-02-28)
|
| 107 |
+
|
| 108 |
+
- [7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement (#384)
|
| 109 |
+
- Merge changes from 6.x
|
| 110 |
+
|
| 111 |
+
## 7.0.0-beta.2 (2017-02-20)
|
| 112 |
+
|
| 113 |
+
- estree: correctly change literals in all cases (#368) (Daniel Tschinder)
|
| 114 |
+
|
| 115 |
+
## 7.0.0-beta.1 (2017-02-20)
|
| 116 |
+
|
| 117 |
+
- Fix negative number literal typeannotations (#366) (Daniel Tschinder)
|
| 118 |
+
- Update contributing with more test info [skip ci] (#355) (Brian Ng)
|
| 119 |
+
|
| 120 |
+
## 7.0.0-beta.0 (2017-02-15)
|
| 121 |
+
|
| 122 |
+
- Reintroduce Variance node (#333) (Daniel Tschinder)
|
| 123 |
+
- Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#332) (Charles Pick)
|
| 124 |
+
- [7.0] Remove ForAwaitStatement, add await flag to ForOfStatement (#349) (Brandon Dail)
|
| 125 |
+
- chore(package): update ava to version 0.18.0 (#345) (greenkeeper[bot])
|
| 126 |
+
- chore(package): update babel-plugin-istanbul to version 4.0.0 (#350) (greenkeeper[bot])
|
| 127 |
+
- Change location of ObjectTypeIndexer to match flow (#228) (Daniel Tschinder)
|
| 128 |
+
- Rename flow AST Type ExistentialTypeParam to ExistsTypeAnnotation (#322) (Toru Kobayashi)
|
| 129 |
+
- Revert "Temporary rollback for erroring on trailing comma with spread (#154)" (#290) (Daniel Tschinder)
|
| 130 |
+
- Remove classConstructorCall plugin (#291) (Brian Ng)
|
| 131 |
+
- Update yarn.lock (Daniel Tschinder)
|
| 132 |
+
- Update cross-env to 3.x (Daniel Tschinder)
|
| 133 |
+
- [7.0] Remove node 0.10, 0.12 and 5 from Travis (#284) (Sergey Rubanov)
|
| 134 |
+
- Remove `String.fromCodePoint` shim (#279) (Mathias Bynens)
|
| 135 |
+
|
| 136 |
+
## 6.16.1 (2017-02-23)
|
| 137 |
+
|
| 138 |
+
### :bug: Regression
|
| 139 |
+
|
| 140 |
+
- Revert "Fix export default async function to be FunctionDeclaration" ([#375](https://github.com/babel/babylon/pull/375))
|
| 141 |
+
|
| 142 |
+
Need to modify Babel for this AST node change, so moving to 7.0.
|
| 143 |
+
|
| 144 |
+
- Revert "Don't parse class properties without initializers when classProperties plugin is disabled, and Flow is enabled" ([#376](https://github.com/babel/babylon/pull/376))
|
| 145 |
+
|
| 146 |
+
[react-native](https://github.com/facebook/react-native/issues/12542) broke with this so we reverted.
|
| 147 |
+
|
| 148 |
+
## 6.16.0 (2017-02-23)
|
| 149 |
+
|
| 150 |
+
### :rocket: New Feature
|
| 151 |
+
|
| 152 |
+
***ESTree*** compatibility as plugin ([#277](https://github.com/babel/babylon/pull/277)) (Daniel Tschinder)
|
| 153 |
+
|
| 154 |
+
We finally introduce a new compatibility layer for ESTree. To put babylon into ESTree-compatible mode the new plugin `estree` can be enabled. In this mode the parser will output an AST that is compliant to the specs of [ESTree](https://github.com/estree/estree/)
|
| 155 |
+
|
| 156 |
+
We highly recommend everyone who uses babylon outside of babel to use this plugin. This will make it much easier for users to switch between different ESTree-compatible parsers. We so far tested several projects with different parsers and exchanged their parser to babylon and in nearly all cases it worked out of the box. Some other estree-compatible parsers include `acorn`, `esprima`, `espree`, `flow-parser`, etc.
|
| 157 |
+
|
| 158 |
+
To enable `estree` mode simply add the plugin in the config:
|
| 159 |
+
```json
|
| 160 |
+
{
|
| 161 |
+
"plugins": [ "estree" ]
|
| 162 |
+
}
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
If you want to migrate your project from non-ESTree mode to ESTree, have a look at our [Readme](https://github.com/babel/babylon/#output), where all deviations are mentioned.
|
| 166 |
+
|
| 167 |
+
Add a parseExpression public method ([#213](https://github.com/babel/babylon/pull/213)) (jeromew)
|
| 168 |
+
|
| 169 |
+
Babylon exports a new function to parse a single expression
|
| 170 |
+
|
| 171 |
+
```js
|
| 172 |
+
import { parseExpression } from 'babylon';
|
| 173 |
+
|
| 174 |
+
const ast = parseExpression('x || y && z', options);
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
The returned AST will only consist of the expression. The options are the same as for `parse()`
|
| 178 |
+
|
| 179 |
+
Add startLine option ([#346](https://github.com/babel/babylon/pull/346)) (Raphael Mu)
|
| 180 |
+
|
| 181 |
+
A new option was added to babylon allowing to change the initial linenumber for the first line which is usually `1`.
|
| 182 |
+
Changing this for example to `100` will make line `1` of the input source to be marked as line `100`, line `2` as `101`, line `3` as `102`, ...
|
| 183 |
+
|
| 184 |
+
Function predicate declaration ([#103](https://github.com/babel/babylon/pull/103)) (Panagiotis Vekris)
|
| 185 |
+
|
| 186 |
+
Added support for function predicates which flow introduced in version 0.33.0
|
| 187 |
+
|
| 188 |
+
```js
|
| 189 |
+
declare function is_number(x: mixed): boolean %checks(typeof x === "number");
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
Allow imports in declare module ([#315](https://github.com/babel/babylon/pull/315)) (Daniel Tschinder)
|
| 193 |
+
|
| 194 |
+
Added support for imports within module declarations which flow introduced in version 0.37.0
|
| 195 |
+
|
| 196 |
+
```js
|
| 197 |
+
declare module "C" {
|
| 198 |
+
import type { DT } from "D";
|
| 199 |
+
declare export type CT = { D: DT };
|
| 200 |
+
}
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
### :eyeglasses: Spec Compliance
|
| 204 |
+
|
| 205 |
+
Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons)
|
| 206 |
+
|
| 207 |
+
This example now correctly throws an error when there is a semicolon after the decorator:
|
| 208 |
+
|
| 209 |
+
```js
|
| 210 |
+
class A {
|
| 211 |
+
@a;
|
| 212 |
+
foo(){}
|
| 213 |
+
}
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
Keywords are not allowed as local specifier ([#307](https://github.com/babel/babylon/pull/307)) (Daniel Tschinder)
|
| 217 |
+
|
| 218 |
+
Using keywords in imports is not allowed anymore:
|
| 219 |
+
|
| 220 |
+
```js
|
| 221 |
+
import { default } from "foo";
|
| 222 |
+
import { a as debugger } from "foo";
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
Do not allow overwritting of primitive types ([#314](https://github.com/babel/babylon/pull/314)) (Daniel Tschinder)
|
| 226 |
+
|
| 227 |
+
In flow it is now forbidden to overwrite the primitive types `"any"`, `"mixed"`, `"empty"`, `"bool"`, `"boolean"`, `"number"`, `"string"`, `"void"` and `"null"` with your own type declaration.
|
| 228 |
+
|
| 229 |
+
Disallow import type { type a } from … ([#305](https://github.com/babel/babylon/pull/305)) (Daniel Tschinder)
|
| 230 |
+
|
| 231 |
+
The following code now correctly throws an error
|
| 232 |
+
|
| 233 |
+
```js
|
| 234 |
+
import type { type a } from "foo";
|
| 235 |
+
```
|
| 236 |
+
|
| 237 |
+
Don't parse class properties without initializers when classProperties is disabled and Flow is enabled ([#300](https://github.com/babel/babylon/pull/300)) (Andrew Levine)
|
| 238 |
+
|
| 239 |
+
Ensure that you enable the `classProperties` plugin in order to enable correct parsing of class properties. Prior to this version it was possible to parse them by enabling the `flow` plugin but this was not intended the behaviour.
|
| 240 |
+
|
| 241 |
+
If you enable the flow plugin you can only define the type of the class properties, but not initialize them.
|
| 242 |
+
|
| 243 |
+
Fix export default async function to be FunctionDeclaration ([#324](https://github.com/babel/babylon/pull/324)) (Daniel Tschinder)
|
| 244 |
+
|
| 245 |
+
Parsing the following code now returns a `FunctionDeclaration` AST node instead of `FunctionExpression`.
|
| 246 |
+
|
| 247 |
+
```js
|
| 248 |
+
export default async function bar() {};
|
| 249 |
+
```
|
| 250 |
+
|
| 251 |
+
### :nail_care: Polish
|
| 252 |
+
|
| 253 |
+
Improve error message on attempt to destructure named import ([#288](https://github.com/babel/babylon/pull/288)) (Brian Ng)
|
| 254 |
+
|
| 255 |
+
### :bug: Bug Fix
|
| 256 |
+
|
| 257 |
+
Fix negative number literal typeannotations ([#366](https://github.com/babel/babylon/pull/366)) (Daniel Tschinder)
|
| 258 |
+
|
| 259 |
+
Ensure takeDecorators is called on exported class ([#358](https://github.com/babel/babylon/pull/358)) (Brian Ng)
|
| 260 |
+
|
| 261 |
+
ESTree: correctly change literals in all cases ([#368](https://github.com/babel/babylon/pull/368)) (Daniel Tschinder)
|
| 262 |
+
|
| 263 |
+
Correctly convert RestProperty to Assignable ([#339](https://github.com/babel/babylon/pull/339)) (Daniel Tschinder)
|
| 264 |
+
|
| 265 |
+
Fix #321 by allowing question marks in type params ([#338](https://github.com/babel/babylon/pull/338)) (Daniel Tschinder)
|
| 266 |
+
|
| 267 |
+
Fix #336 by correctly setting arrow-param ([#337](https://github.com/babel/babylon/pull/337)) (Daniel Tschinder)
|
| 268 |
+
|
| 269 |
+
Fix parse error when destructuring `set` with default value ([#317](https://github.com/babel/babylon/pull/317)) (Brian Ng)
|
| 270 |
+
|
| 271 |
+
Fix ObjectTypeCallProperty static ([#298](https://github.com/babel/babylon/pull/298)) (Dan Harper)
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
### :house: Internal
|
| 275 |
+
|
| 276 |
+
Fix generator-method-with-computed-name spec ([#360](https://github.com/babel/babylon/pull/360)) (Alex Rattray)
|
| 277 |
+
|
| 278 |
+
Fix flow type-parameter-declaration test with unintended semantic ([#361](https://github.com/babel/babylon/pull/361)) (Alex Rattray)
|
| 279 |
+
|
| 280 |
+
Cleanup and splitup parser functions ([#295](https://github.com/babel/babylon/pull/295)) (Daniel Tschinder)
|
| 281 |
+
|
| 282 |
+
chore(package): update flow-bin to version 0.38.0 ([#313](https://github.com/babel/babylon/pull/313)) (greenkeeper[bot])
|
| 283 |
+
|
| 284 |
+
Call inner function instead of 1:1 copy to plugin ([#294](https://github.com/babel/babylon/pull/294)) (Daniel Tschinder)
|
| 285 |
+
|
| 286 |
+
Update eslint-config-babel to the latest version 🚀 ([#299](https://github.com/babel/babylon/pull/299)) (greenkeeper[bot])
|
| 287 |
+
|
| 288 |
+
Update eslint-config-babel to the latest version 🚀 ([#293](https://github.com/babel/babylon/pull/293)) (greenkeeper[bot])
|
| 289 |
+
|
| 290 |
+
devDeps: remove eslint-plugin-babel ([#292](https://github.com/babel/babylon/pull/292)) (Kai Cataldo)
|
| 291 |
+
|
| 292 |
+
Correct indent eslint rule config ([#276](https://github.com/babel/babylon/pull/276)) (Daniel Tschinder)
|
| 293 |
+
|
| 294 |
+
Fail tests that have expected.json and throws-option ([#285](https://github.com/babel/babylon/pull/285)) (Daniel Tschinder)
|
| 295 |
+
|
| 296 |
+
### :memo: Documentation
|
| 297 |
+
|
| 298 |
+
Update contributing with more test info [skip ci] ([#355](https://github.com/babel/babylon/pull/355)) (Brian Ng)
|
| 299 |
+
|
| 300 |
+
Update API documentation ([#330](https://github.com/babel/babylon/pull/330)) (Timothy Gu)
|
| 301 |
+
|
| 302 |
+
Added keywords to package.json ([#323](https://github.com/babel/babylon/pull/323)) (Dmytro)
|
| 303 |
+
|
| 304 |
+
AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon/pull/318)) (Mathias Bynens)
|
| 305 |
+
|
| 306 |
+
## 6.15.0 (2017-01-10)
|
| 307 |
+
|
| 308 |
+
### :eyeglasses: Spec Compliance
|
| 309 |
+
|
| 310 |
+
Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison)
|
| 311 |
+
|
| 312 |
+
This change implements flows new shorthand import syntax
|
| 313 |
+
and where previously you had to write this code:
|
| 314 |
+
|
| 315 |
+
```js
|
| 316 |
+
import {someValue} from "blah";
|
| 317 |
+
import type {someType} from "blah";
|
| 318 |
+
import typeof {someOtherValue} from "blah";
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
you can now write it like this:
|
| 322 |
+
|
| 323 |
+
```js
|
| 324 |
+
import {
|
| 325 |
+
someValue,
|
| 326 |
+
type someType,
|
| 327 |
+
typeof someOtherValue,
|
| 328 |
+
} from "blah";
|
| 329 |
+
```
|
| 330 |
+
|
| 331 |
+
For more information look at [this](https://github.com/facebook/flow/pull/2890) pull request.
|
| 332 |
+
|
| 333 |
+
flow: allow leading pipes in all positions ([#256](https://github.com/babel/babylon/pull/256)) (Vladimir Kurchatkin)
|
| 334 |
+
|
| 335 |
+
This change now allows a leading pipe everywhere types can be used:
|
| 336 |
+
```js
|
| 337 |
+
var f = (x): | 1 | 2 => 1;
|
| 338 |
+
```
|
| 339 |
+
|
| 340 |
+
Throw error when exporting non-declaration ([#241](https://github.com/babel/babylon/pull/241)) (Kai Cataldo)
|
| 341 |
+
|
| 342 |
+
Previously babylon parsed the following exports, although they are not valid:
|
| 343 |
+
```js
|
| 344 |
+
export typeof foo;
|
| 345 |
+
export new Foo();
|
| 346 |
+
export function() {};
|
| 347 |
+
export for (;;);
|
| 348 |
+
export while(foo);
|
| 349 |
+
```
|
| 350 |
+
|
| 351 |
+
### :bug: Bug Fix
|
| 352 |
+
|
| 353 |
+
Don't set inType flag when parsing property names ([#266](https://github.com/babel/babylon/pull/266)) (Vladimir Kurchatkin)
|
| 354 |
+
|
| 355 |
+
This fixes parsing of this case:
|
| 356 |
+
|
| 357 |
+
```js
|
| 358 |
+
const map = {
|
| 359 |
+
[age <= 17] : 'Too young'
|
| 360 |
+
};
|
| 361 |
+
```
|
| 362 |
+
|
| 363 |
+
Fix source location for JSXEmptyExpression nodes (fixes #248) ([#249](https://github.com/babel/babylon/pull/249)) (James Long)
|
| 364 |
+
|
| 365 |
+
The following case produced an invalid AST
|
| 366 |
+
```js
|
| 367 |
+
<div>{/* foo */}</div>
|
| 368 |
+
```
|
| 369 |
+
|
| 370 |
+
Use fromCodePoint to convert high value unicode entities ([#243](https://github.com/babel/babylon/pull/243)) (Ryan Duffy)
|
| 371 |
+
|
| 372 |
+
When high value unicode entities (e.g. 💩) were used in the input source code they are now correctly encoded in the resulting AST.
|
| 373 |
+
|
| 374 |
+
Rename folder to avoid Windows-illegal characters ([#281](https://github.com/babel/babylon/pull/281)) (Ryan Plant)
|
| 375 |
+
|
| 376 |
+
Allow this.state.clone() when parsing decorators ([#262](https://github.com/babel/babylon/pull/262)) (Alex Rattray)
|
| 377 |
+
|
| 378 |
+
### :house: Internal
|
| 379 |
+
|
| 380 |
+
User external-helpers ([#254](https://github.com/babel/babylon/pull/254)) (Daniel Tschinder)
|
| 381 |
+
|
| 382 |
+
Add watch script for dev ([#234](https://github.com/babel/babylon/pull/234)) (Kai Cataldo)
|
| 383 |
+
|
| 384 |
+
Freeze current plugins list for "*" option, and remove from README.md ([#245](https://github.com/babel/babylon/pull/245)) (Andrew Levine)
|
| 385 |
+
|
| 386 |
+
Prepare tests for multiple fixture runners. ([#240](https://github.com/babel/babylon/pull/240)) (Daniel Tschinder)
|
| 387 |
+
|
| 388 |
+
Add some test coverage for decorators stage-0 plugin ([#250](https://github.com/babel/babylon/pull/250)) (Andrew Levine)
|
| 389 |
+
|
| 390 |
+
Refactor tokenizer types file ([#263](https://github.com/babel/babylon/pull/263)) (Sven SAULEAU)
|
| 391 |
+
|
| 392 |
+
Update eslint-config-babel to the latest version 🚀 ([#273](https://github.com/babel/babylon/pull/273)) (greenkeeper[bot])
|
| 393 |
+
|
| 394 |
+
chore(package): update rollup to version 0.41.0 ([#272](https://github.com/babel/babylon/pull/272)) (greenkeeper[bot])
|
| 395 |
+
|
| 396 |
+
chore(package): update flow-bin to version 0.37.0 ([#255](https://github.com/babel/babylon/pull/255)) (greenkeeper[bot])
|
| 397 |
+
|
| 398 |
+
## 6.14.1 (2016-11-17)
|
| 399 |
+
|
| 400 |
+
### :bug: Bug Fix
|
| 401 |
+
|
| 402 |
+
Allow `"plugins": ["*"]` ([#229](https://github.com/babel/babylon/pull/229)) (Daniel Tschinder)
|
| 403 |
+
|
| 404 |
+
```js
|
| 405 |
+
{
|
| 406 |
+
"plugins": ["*"]
|
| 407 |
+
}
|
| 408 |
+
```
|
| 409 |
+
|
| 410 |
+
Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer.
|
| 411 |
+
|
| 412 |
+
## 6.14.0 (2016-11-16)
|
| 413 |
+
|
| 414 |
+
### :eyeglasses: Spec Compliance
|
| 415 |
+
|
| 416 |
+
Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo)
|
| 417 |
+
|
| 418 |
+
[11.6.2.2 Future Reserved Words](http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words)
|
| 419 |
+
|
| 420 |
+
Babylon will throw for more reserved words such as `enum` or `await` (in strict mode).
|
| 421 |
+
|
| 422 |
+
```
|
| 423 |
+
class enum {} // throws
|
| 424 |
+
class await {} // throws in strict mode (module)
|
| 425 |
+
```
|
| 426 |
+
|
| 427 |
+
Optional names for function types and object type indexers ([#197](https://github.com/babel/babylon/pull/197)) (Gabe Levi)
|
| 428 |
+
|
| 429 |
+
So where you used to have to write
|
| 430 |
+
|
| 431 |
+
```js
|
| 432 |
+
type A = (x: string, y: boolean) => number;
|
| 433 |
+
type B = (z: string) => number;
|
| 434 |
+
type C = { [key: string]: number };
|
| 435 |
+
```
|
| 436 |
+
|
| 437 |
+
you can now write (with flow 0.34.0)
|
| 438 |
+
|
| 439 |
+
```js
|
| 440 |
+
type A = (string, boolean) => number;
|
| 441 |
+
type B = string => number;
|
| 442 |
+
type C = { [string]: number };
|
| 443 |
+
```
|
| 444 |
+
|
| 445 |
+
Parse flow nested array type annotations like `number[][]` ([#219](https://github.com/babel/babylon/pull/219)) (Bernhard Häussner)
|
| 446 |
+
|
| 447 |
+
Supports these form now of specifying array types:
|
| 448 |
+
|
| 449 |
+
```js
|
| 450 |
+
var a: number[][][][];
|
| 451 |
+
var b: string[][];
|
| 452 |
+
```
|
| 453 |
+
|
| 454 |
+
### :bug: Bug Fix
|
| 455 |
+
|
| 456 |
+
Correctly eat semicolon at the end of `DelcareModuleExports` ([#223](https://github.com/babel/babylon/pull/223)) (Daniel Tschinder)
|
| 457 |
+
|
| 458 |
+
```
|
| 459 |
+
declare module "foo" { declare module.exports: number }
|
| 460 |
+
declare module "foo" { declare module.exports: number; } // also allowed now
|
| 461 |
+
```
|
| 462 |
+
|
| 463 |
+
### :house: Internal
|
| 464 |
+
|
| 465 |
+
* Count Babel tests towards Babylon code coverage ([#182](https://github.com/babel/babylon/pull/182)) (Moti Zilberman)
|
| 466 |
+
* Fix strange line endings ([#214](https://github.com/babel/babylon/pull/214)) (Thomas Grainger)
|
| 467 |
+
* Add node 7 (Daniel Tschinder)
|
| 468 |
+
* chore(package): update flow-bin to version 0.34.0 ([#204](https://github.com/babel/babylon/pull/204)) (Greenkeeper)
|
| 469 |
+
|
| 470 |
+
## v6.13.1 (2016-10-26)
|
| 471 |
+
|
| 472 |
+
### :nail_care: Polish
|
| 473 |
+
|
| 474 |
+
- Use rollup for bundling to speed up startup time ([#190](https://github.com/babel/babylon/pull/190)) ([@drewml](https://github.com/DrewML))
|
| 475 |
+
|
| 476 |
+
```js
|
| 477 |
+
const babylon = require('babylon');
|
| 478 |
+
const ast = babylon.parse('var foo = "lol";');
|
| 479 |
+
```
|
| 480 |
+
|
| 481 |
+
With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph.
|
| 482 |
+
|
| 483 |
+
**Without bundling**
|
| 484 |
+

|
| 485 |
+
|
| 486 |
+
**With bundling**
|
| 487 |
+

|
| 488 |
+
|
| 489 |
+
- add clean command [skip ci] ([#201](https://github.com/babel/babylon/pull/201)) (Henry Zhu)
|
| 490 |
+
- add ForAwaitStatement (async generator already added) [skip ci] ([#196](https://github.com/babel/babylon/pull/196)) (Henry Zhu)
|
| 491 |
+
|
| 492 |
+
## v6.13.0 (2016-10-21)
|
| 493 |
+
|
| 494 |
+
### :eyeglasses: Spec Compliance
|
| 495 |
+
|
| 496 |
+
Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman)
|
| 497 |
+
|
| 498 |
+
> See https://flowtype.org/docs/variance.html for more information
|
| 499 |
+
|
| 500 |
+
```js
|
| 501 |
+
type T = { +p: T };
|
| 502 |
+
interface T { -p: T };
|
| 503 |
+
declare class T { +[k:K]: V };
|
| 504 |
+
class T { -[k:K]: V };
|
| 505 |
+
class C2 { +p: T = e };
|
| 506 |
+
```
|
| 507 |
+
|
| 508 |
+
Raise error on duplicate definition of __proto__ ([#183](https://github.com/babel/babylon/pull/183)) (Moti Zilberman)
|
| 509 |
+
|
| 510 |
+
```js
|
| 511 |
+
({ __proto__: 1, __proto__: 2 }) // Throws an error now
|
| 512 |
+
```
|
| 513 |
+
|
| 514 |
+
### :bug: Bug Fix
|
| 515 |
+
|
| 516 |
+
Flow: Allow class properties to be named `static` ([#184](https://github.com/babel/babylon/pull/184)) (Moti Zilberman)
|
| 517 |
+
|
| 518 |
+
```js
|
| 519 |
+
declare class A {
|
| 520 |
+
static: T;
|
| 521 |
+
}
|
| 522 |
+
```
|
| 523 |
+
|
| 524 |
+
Allow "async" as identifier for object literal property shorthand ([#187](https://github.com/babel/babylon/pull/187)) (Andrew Levine)
|
| 525 |
+
|
| 526 |
+
```js
|
| 527 |
+
var foo = { async, bar };
|
| 528 |
+
```
|
| 529 |
+
|
| 530 |
+
### :nail_care: Polish
|
| 531 |
+
|
| 532 |
+
Fix flowtype and add inType to state ([#189](https://github.com/babel/babylon/pull/189)) (Daniel Tschinder)
|
| 533 |
+
|
| 534 |
+
> This improves the performance slightly (because of hidden classes)
|
| 535 |
+
|
| 536 |
+
### :house: Internal
|
| 537 |
+
|
| 538 |
+
Fix .gitattributes line ending setting ([#191](https://github.com/babel/babylon/pull/191)) (Moti Zilberman)
|
| 539 |
+
|
| 540 |
+
Increase test coverage ([#175](https://github.com/babel/babylon/pull/175) (Moti Zilberman)
|
| 541 |
+
|
| 542 |
+
Readd missin .eslinignore for IDEs (Daniel Tschinder)
|
| 543 |
+
|
| 544 |
+
Error on missing expected.json fixture in CI ([#188](https://github.com/babel/babylon/pull/188)) (Moti Zilberman)
|
| 545 |
+
|
| 546 |
+
Add .gitattributes and .editorconfig for LF line endings ([#179](https://github.com/babel/babylon/pull/179)) (Moti Zilberman)
|
| 547 |
+
|
| 548 |
+
Fixes two tests that are failing after the merge of #172 ([#177](https://github.com/babel/babylon/pull/177)) (Moti Zilberman)
|
| 549 |
+
|
| 550 |
+
## v6.12.0 (2016-10-14)
|
| 551 |
+
|
| 552 |
+
### :eyeglasses: Spec Compliance
|
| 553 |
+
|
| 554 |
+
Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler)
|
| 555 |
+
|
| 556 |
+
#### Dynamic Import
|
| 557 |
+
|
| 558 |
+
- Proposal Repo: https://github.com/domenic/proposal-dynamic-import
|
| 559 |
+
- Championed by [@domenic](https://github.com/domenic)
|
| 560 |
+
- stage-2
|
| 561 |
+
- [sept-28 tc39 notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#113a-import)
|
| 562 |
+
|
| 563 |
+
> This repository contains a proposal for adding a "function-like" import() module loading syntactic form to JavaScript
|
| 564 |
+
|
| 565 |
+
```js
|
| 566 |
+
import(`./section-modules/${link.dataset.entryModule}.js`)
|
| 567 |
+
.then(module => {
|
| 568 |
+
module.loadPageInto(main);
|
| 569 |
+
})
|
| 570 |
+
```
|
| 571 |
+
|
| 572 |
+
Add EmptyTypeAnnotation ([#171](https://github.com/babel/babylon/pull/171)) (Sam Goldman)
|
| 573 |
+
|
| 574 |
+
#### EmptyTypeAnnotation
|
| 575 |
+
|
| 576 |
+
Just wasn't covered before.
|
| 577 |
+
|
| 578 |
+
```js
|
| 579 |
+
type T = empty;
|
| 580 |
+
```
|
| 581 |
+
|
| 582 |
+
### :bug: Bug Fix
|
| 583 |
+
|
| 584 |
+
Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels)
|
| 585 |
+
|
| 586 |
+
```js
|
| 587 |
+
// was failing due to sparse array
|
| 588 |
+
export const { foo: [ ,, qux7 ] } = bar;
|
| 589 |
+
```
|
| 590 |
+
|
| 591 |
+
Allow keyword in Flow object declaration property names with type parameters ([#146](https://github.com/babel/babylon/pull/146)) (Dan Harper)
|
| 592 |
+
|
| 593 |
+
```js
|
| 594 |
+
declare class X {
|
| 595 |
+
foobar<T>(): void;
|
| 596 |
+
static foobar<T>(): void;
|
| 597 |
+
}
|
| 598 |
+
```
|
| 599 |
+
|
| 600 |
+
Allow keyword in object/class property names with Flow type parameters ([#145](https://github.com/babel/babylon/pull/145)) (Dan Harper)
|
| 601 |
+
|
| 602 |
+
```js
|
| 603 |
+
class Foo {
|
| 604 |
+
delete<T>(item: T): T {
|
| 605 |
+
return item;
|
| 606 |
+
}
|
| 607 |
+
}
|
| 608 |
+
```
|
| 609 |
+
|
| 610 |
+
Allow typeAnnotations for yield expressions ([#174](https://github.com/babel/babylon/pull/174))) (Daniel Tschinder)
|
| 611 |
+
|
| 612 |
+
```js
|
| 613 |
+
function *foo() {
|
| 614 |
+
const x = (yield 5: any);
|
| 615 |
+
}
|
| 616 |
+
```
|
| 617 |
+
|
| 618 |
+
### :nail_care: Polish
|
| 619 |
+
|
| 620 |
+
Annotate more errors with expected token ([#172](https://github.com/babel/babylon/pull/172))) (Moti Zilberman)
|
| 621 |
+
|
| 622 |
+
```js
|
| 623 |
+
// Unexpected token, expected ; (1:6)
|
| 624 |
+
{ set 1 }
|
| 625 |
+
```
|
| 626 |
+
|
| 627 |
+
### :house: Internal
|
| 628 |
+
|
| 629 |
+
Remove kcheck ([#173](https://github.com/babel/babylon/pull/173))) (Daniel Tschinder)
|
| 630 |
+
|
| 631 |
+
Also run flow, linting, babel tests on separate instances (add back node 0.10)
|
| 632 |
+
|
| 633 |
+
## v6.11.6 (2016-10-12)
|
| 634 |
+
|
| 635 |
+
### :bug: Bug Fix/Regression
|
| 636 |
+
|
| 637 |
+
Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels)
|
| 638 |
+
|
| 639 |
+
```js
|
| 640 |
+
// was failing with `Cannot read property 'type' of null` because of null identifiers
|
| 641 |
+
export const { foo: [ ,, qux7 ] } = bar;
|
| 642 |
+
```
|
| 643 |
+
|
| 644 |
+
## v6.11.5 (2016-10-12)
|
| 645 |
+
|
| 646 |
+
### :eyeglasses: Spec Compliance
|
| 647 |
+
|
| 648 |
+
Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo)
|
| 649 |
+
|
| 650 |
+
```js
|
| 651 |
+
// `foo` has already been exported. Exported identifiers must be unique. (2:20)
|
| 652 |
+
export function foo() {};
|
| 653 |
+
export const { a: [{foo}] } = bar;
|
| 654 |
+
```
|
| 655 |
+
|
| 656 |
+
Fix: Check for duplicate named exports in exported rest elements/properties ([#164](https://github.com/babel/babylon/pull/164)) (Kai Cataldo)
|
| 657 |
+
|
| 658 |
+
```js
|
| 659 |
+
// `foo` has already been exported. Exported identifiers must be unique. (2:22)
|
| 660 |
+
export const foo = 1;
|
| 661 |
+
export const [bar, ...foo] = baz;
|
| 662 |
+
```
|
| 663 |
+
|
| 664 |
+
### :bug: Bug Fix
|
| 665 |
+
|
| 666 |
+
Fix: Allow identifier `async` for default param in arrow expression ([#165](https://github.com/babel/babylon/pull/165)) (Kai Cataldo)
|
| 667 |
+
|
| 668 |
+
```js
|
| 669 |
+
// this is ok now
|
| 670 |
+
const test = ({async = true}) => {};
|
| 671 |
+
```
|
| 672 |
+
|
| 673 |
+
### :nail_care: Polish
|
| 674 |
+
|
| 675 |
+
Babylon will now print out the token it's expecting if there's a `SyntaxError` ([#150](https://github.com/babel/babylon/pull/150)) (Daniel Tschinder)
|
| 676 |
+
|
| 677 |
+
```bash
|
| 678 |
+
# So in the case of a missing ending curly (`}`)
|
| 679 |
+
Module build failed: SyntaxError: Unexpected token, expected } (30:0)
|
| 680 |
+
28 | }
|
| 681 |
+
29 |
|
| 682 |
+
> 30 |
|
| 683 |
+
| ^
|
| 684 |
+
```
|
| 685 |
+
|
| 686 |
+
## v6.11.4 (2016-10-03)
|
| 687 |
+
|
| 688 |
+
Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu)
|
| 689 |
+
|
| 690 |
+
## v6.11.3 (2016-10-01)
|
| 691 |
+
|
| 692 |
+
### :eyeglasses: Spec Compliance
|
| 693 |
+
|
| 694 |
+
Add static errors for object rest (#149) ([@danez](https://github.com/danez))
|
| 695 |
+
|
| 696 |
+
> https://github.com/sebmarkbage/ecmascript-rest-spread
|
| 697 |
+
|
| 698 |
+
Object rest copies the *rest* of properties from the right hand side `obj` starting from the left to right.
|
| 699 |
+
|
| 700 |
+
```js
|
| 701 |
+
let { x, y, ...z } = { x: 1, y: 2, z: 3 };
|
| 702 |
+
// x = 1
|
| 703 |
+
// y = 2
|
| 704 |
+
// z = { z: 3 }
|
| 705 |
+
```
|
| 706 |
+
|
| 707 |
+
#### New Syntax Errors:
|
| 708 |
+
|
| 709 |
+
**SyntaxError**: The rest element has to be the last element when destructuring (1:10)
|
| 710 |
+
```bash
|
| 711 |
+
> 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3};
|
| 712 |
+
| ^
|
| 713 |
+
# Previous behavior:
|
| 714 |
+
# x = { x: 1, y: 2, z: 3 }
|
| 715 |
+
# y = 2
|
| 716 |
+
# z = 3
|
| 717 |
+
```
|
| 718 |
+
|
| 719 |
+
Before, this was just a more verbose way of shallow copying `obj` since it doesn't actually do what you think.
|
| 720 |
+
|
| 721 |
+
**SyntaxError**: Cannot have multiple rest elements when destructuring (1:13)
|
| 722 |
+
|
| 723 |
+
```bash
|
| 724 |
+
> 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3};
|
| 725 |
+
| ^
|
| 726 |
+
# Previous behavior:
|
| 727 |
+
# x = 1
|
| 728 |
+
# y = { y: 2, z: 3 }
|
| 729 |
+
# z = { y: 2, z: 3 }
|
| 730 |
+
```
|
| 731 |
+
|
| 732 |
+
Before y and z would just be the same value anyway so there is no reason to need to have both.
|
| 733 |
+
|
| 734 |
+
**SyntaxError**: A trailing comma is not permitted after the rest element (1:16)
|
| 735 |
+
|
| 736 |
+
```js
|
| 737 |
+
let { x, y, ...z, } = obj;
|
| 738 |
+
```
|
| 739 |
+
|
| 740 |
+
The rationale for this is that the use case for trailing comma is that you can add something at the end without affecting the line above. Since a RestProperty always has to be the last property it doesn't make sense.
|
| 741 |
+
|
| 742 |
+
---
|
| 743 |
+
|
| 744 |
+
get / set are valid property names in default assignment (#142) ([@jezell](https://github.com/jezell))
|
| 745 |
+
|
| 746 |
+
```js
|
| 747 |
+
// valid
|
| 748 |
+
function something({ set = null, get = null }) {}
|
| 749 |
+
```
|
| 750 |
+
|
| 751 |
+
## v6.11.2 (2016-09-23)
|
| 752 |
+
|
| 753 |
+
### Bug Fix
|
| 754 |
+
|
| 755 |
+
- [#139](https://github.com/babel/babylon/issues/139) Don't do the duplicate check if not an identifier (#140) @hzoo
|
| 756 |
+
|
| 757 |
+
```js
|
| 758 |
+
// regression with duplicate export check
|
| 759 |
+
SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13)
|
| 760 |
+
20 |
|
| 761 |
+
21 | export const { rhythm } = typography;
|
| 762 |
+
> 22 | export const { TypographyStyle } = typography
|
| 763 |
+
```
|
| 764 |
+
|
| 765 |
+
Bail out for now, and make a change to account for destructuring in the next release.
|
| 766 |
+
|
| 767 |
+
## 6.11.1 (2016-09-22)
|
| 768 |
+
|
| 769 |
+
### Bug Fix
|
| 770 |
+
- [#137](https://github.com/babel/babylon/pull/137) - Fix a regression with duplicate exports - it was erroring on all keys in `Object.prototype`. @danez
|
| 771 |
+
|
| 772 |
+
```javascript
|
| 773 |
+
export toString from './toString';
|
| 774 |
+
```
|
| 775 |
+
|
| 776 |
+
```bash
|
| 777 |
+
`toString` has already been exported. Exported identifiers must be unique. (1:7)
|
| 778 |
+
> 1 | export toString from './toString';
|
| 779 |
+
| ^
|
| 780 |
+
2 |
|
| 781 |
+
```
|
| 782 |
+
|
| 783 |
+
## 6.11.0 (2016-09-22)
|
| 784 |
+
|
| 785 |
+
### Spec Compliance (will break CI)
|
| 786 |
+
|
| 787 |
+
- Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo
|
| 788 |
+
|
| 789 |
+
```js
|
| 790 |
+
// Only one default export allowed per module. (2:9)
|
| 791 |
+
export default function() {};
|
| 792 |
+
export { foo as default };
|
| 793 |
+
|
| 794 |
+
// Only one default export allowed per module. (2:0)
|
| 795 |
+
export default {};
|
| 796 |
+
export default function() {};
|
| 797 |
+
|
| 798 |
+
// `Foo` has already been exported. Exported identifiers must be unique. (2:0)
|
| 799 |
+
export { Foo };
|
| 800 |
+
export class Foo {};
|
| 801 |
+
```
|
| 802 |
+
|
| 803 |
+
### New Feature (Syntax)
|
| 804 |
+
|
| 805 |
+
- Add support for computed class property names ([#121](https://github.com/babel/babylon/pull/121)) @motiz88
|
| 806 |
+
|
| 807 |
+
```js
|
| 808 |
+
// AST
|
| 809 |
+
interface ClassProperty <: Node {
|
| 810 |
+
type: "ClassProperty";
|
| 811 |
+
key: Identifier;
|
| 812 |
+
value: Expression;
|
| 813 |
+
computed: boolean; // added
|
| 814 |
+
}
|
| 815 |
+
```
|
| 816 |
+
|
| 817 |
+
```js
|
| 818 |
+
// with "plugins": ["classProperties"]
|
| 819 |
+
class Foo {
|
| 820 |
+
[x]
|
| 821 |
+
['y']
|
| 822 |
+
}
|
| 823 |
+
|
| 824 |
+
class Bar {
|
| 825 |
+
[p]
|
| 826 |
+
[m] () {}
|
| 827 |
+
}
|
| 828 |
+
```
|
| 829 |
+
|
| 830 |
+
### Bug Fix
|
| 831 |
+
|
| 832 |
+
- Fix `static` property falling through in the declare class Flow AST ([#135](https://github.com/babel/babylon/pull/135)) @danharper
|
| 833 |
+
|
| 834 |
+
```js
|
| 835 |
+
declare class X {
|
| 836 |
+
a: number;
|
| 837 |
+
static b: number; // static
|
| 838 |
+
c: number; // this was being marked as static in the AST as well
|
| 839 |
+
}
|
| 840 |
+
```
|
| 841 |
+
|
| 842 |
+
### Polish
|
| 843 |
+
|
| 844 |
+
- Rephrase "assigning/binding to rvalue" errors to include context ([#119](https://github.com/babel/babylon/pull/119)) @motiz88
|
| 845 |
+
|
| 846 |
+
```js
|
| 847 |
+
// Used to error with:
|
| 848 |
+
// SyntaxError: Assigning to rvalue (1:0)
|
| 849 |
+
|
| 850 |
+
// Now:
|
| 851 |
+
// Invalid left-hand side in assignment expression (1:0)
|
| 852 |
+
3 = 4
|
| 853 |
+
|
| 854 |
+
// Invalid left-hand side in for-in statement (1:5)
|
| 855 |
+
for (+i in {});
|
| 856 |
+
```
|
| 857 |
+
|
| 858 |
+
### Internal
|
| 859 |
+
|
| 860 |
+
- Fix call to `this.parseMaybeAssign` with correct arguments ([#133](https://github.com/babel/babylon/pull/133)) @danez
|
| 861 |
+
- Add semver note to changelog ([#131](https://github.com/babel/babylon/pull/131)) @hzoo
|
| 862 |
+
|
| 863 |
+
## 6.10.0 (2016-09-19)
|
| 864 |
+
|
| 865 |
+
> We plan to include some spec compliance bugs in patch versions. An example was the multiple default exports issue.
|
| 866 |
+
|
| 867 |
+
### Spec Compliance
|
| 868 |
+
|
| 869 |
+
* Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu)
|
| 870 |
+
|
| 871 |
+
> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. https://tc39.github.io/ecma262/2016/#sec-function-definitions-static-semantics-early-errors
|
| 872 |
+
|
| 873 |
+
More Context: [tc39-notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-07/july-29.md#611-the-scope-of-use-strict-with-respect-to-destructuring-in-parameter-lists)
|
| 874 |
+
|
| 875 |
+
For example:
|
| 876 |
+
|
| 877 |
+
```js
|
| 878 |
+
// this errors because it uses destructuring and default parameters
|
| 879 |
+
// in a function with a "use strict" directive
|
| 880 |
+
function a([ option1, option2 ] = []) {
|
| 881 |
+
"use strict";
|
| 882 |
+
}
|
| 883 |
+
```
|
| 884 |
+
|
| 885 |
+
The solution would be to use a top level "use strict" or to remove the destructuring or default parameters when using a function + "use strict" or to.
|
| 886 |
+
|
| 887 |
+
### New Feature
|
| 888 |
+
|
| 889 |
+
* Exact object type annotations for Flow plugin ([#104](https://github.com/babel/babylon/pull/104)) (Basil Hosmer)
|
| 890 |
+
|
| 891 |
+
Added to flow in https://github.com/facebook/flow/commit/c710c40aa2a115435098d6c0dfeaadb023cd39b8
|
| 892 |
+
|
| 893 |
+
Looks like:
|
| 894 |
+
|
| 895 |
+
```js
|
| 896 |
+
var a : {| x: number, y: string |} = { x: 0, y: 'foo' };
|
| 897 |
+
```
|
| 898 |
+
|
| 899 |
+
### Bug Fixes
|
| 900 |
+
|
| 901 |
+
* Include `typeParameter` location in `ArrowFunctionExpression` ([#126](https://github.com/babel/babylon/pull/126)) (Daniel Tschinder)
|
| 902 |
+
* Error on invalid flow type annotation with default assignment ([#122](https://github.com/babel/babylon/pull/122)) (Dan Harper)
|
| 903 |
+
* Fix Flow return types on arrow functions ([#124](https://github.com/babel/babylon/pull/124)) (Dan Harper)
|
| 904 |
+
|
| 905 |
+
### Misc
|
| 906 |
+
|
| 907 |
+
* Add tests for export extensions ([#127](https://github.com/babel/babylon/pull/127)) (Daniel Tschinder)
|
| 908 |
+
* Fix Contributing guidelines [skip ci] (Daniel Tschinder)
|
| 909 |
+
|
| 910 |
+
## 6.9.2 (2016-09-09)
|
| 911 |
+
|
| 912 |
+
The only change is to remove the `babel-runtime` dependency by compiling with Babel's ES2015 loose mode. So using babylon standalone should be smaller.
|
| 913 |
+
|
| 914 |
+
## 6.9.1 (2016-08-23)
|
| 915 |
+
|
| 916 |
+
This release contains mainly small bugfixes but also updates babylons default mode to es2017. The features for `exponentiationOperator`, `asyncFunctions` and `trailingFunctionCommas` which previously needed to be activated via plugin are now enabled by default and the plugins are now no-ops.
|
| 917 |
+
|
| 918 |
+
### Bug Fixes
|
| 919 |
+
|
| 920 |
+
- Fix issues with default object params in async functions ([#96](https://github.com/babel/babylon/pull/96)) @danez
|
| 921 |
+
- Fix issues with flow-types and async function ([#95](https://github.com/babel/babylon/pull/95)) @danez
|
| 922 |
+
- Fix arrow functions with destructuring, types & default value ([#94](https://github.com/babel/babylon/pull/94)) @danharper
|
| 923 |
+
- Fix declare class with qualified type identifier ([#97](https://github.com/babel/babylon/pull/97)) @danez
|
| 924 |
+
- Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas plugins and enable them by default ([#98](https://github.com/babel/babylon/pull/98)) @danez
|
| 925 |
+
|
| 926 |
+
## 6.9.0 (2016-08-16)
|
| 927 |
+
|
| 928 |
+
### New syntax support
|
| 929 |
+
|
| 930 |
+
- Add JSX spread children ([#42](https://github.com/babel/babylon/pull/42)) @calebmer
|
| 931 |
+
|
| 932 |
+
(Be aware that React is not going to support this syntax)
|
| 933 |
+
|
| 934 |
+
```js
|
| 935 |
+
<div>
|
| 936 |
+
{...todos.map(todo => <Todo key={todo.id} todo={todo}/>)}
|
| 937 |
+
</div>
|
| 938 |
+
```
|
| 939 |
+
|
| 940 |
+
- Add support for declare module.exports ([#72](https://github.com/babel/babylon/pull/72)) @danez
|
| 941 |
+
|
| 942 |
+
```js
|
| 943 |
+
declare module "foo" {
|
| 944 |
+
declare module.exports: {}
|
| 945 |
+
}
|
| 946 |
+
```
|
| 947 |
+
|
| 948 |
+
### New Features
|
| 949 |
+
|
| 950 |
+
- If supplied, attach filename property to comment node loc. ([#80](https://github.com/babel/babylon/pull/80)) @divmain
|
| 951 |
+
- Add identifier name to node loc field ([#90](https://github.com/babel/babylon/pull/90)) @kittens
|
| 952 |
+
|
| 953 |
+
### Bug Fixes
|
| 954 |
+
|
| 955 |
+
- Fix exponential operator to behave according to spec ([#75](https://github.com/babel/babylon/pull/75)) @danez
|
| 956 |
+
- Fix lookahead to not add comments to arrays which are not cloned ([#76](https://github.com/babel/babylon/pull/76)) @danez
|
| 957 |
+
- Fix accidental fall-through in Flow type parsing. ([#82](https://github.com/babel/babylon/pull/82)) @xiemaisi
|
| 958 |
+
- Only allow declares inside declare module ([#73](https://github.com/babel/babylon/pull/73)) @danez
|
| 959 |
+
- Small fix for parsing type parameter declarations ([#83](https://github.com/babel/babylon/pull/83)) @gabelevi
|
| 960 |
+
- Fix arrow param locations with flow types ([#57](https://github.com/babel/babylon/pull/57)) @danez
|
| 961 |
+
- Fixes SyntaxError position with flow optional type ([#65](https://github.com/babel/babylon/pull/65)) @danez
|
| 962 |
+
|
| 963 |
+
### Internal
|
| 964 |
+
|
| 965 |
+
- Add codecoverage to tests @danez
|
| 966 |
+
- Fix tests to not save expected output if we expect the test to fail @danez
|
| 967 |
+
- Make a shallow clone of babel for testing @danez
|
| 968 |
+
- chore(package): update cross-env to version 2.0.0 ([#77](https://github.com/babel/babylon/pull/77)) @greenkeeperio-bot
|
| 969 |
+
- chore(package): update ava to version 0.16.0 ([#86](https://github.com/babel/babylon/pull/86)) @greenkeeperio-bot
|
| 970 |
+
- chore(package): update babel-plugin-istanbul to version 2.0.0 ([#89](https://github.com/babel/babylon/pull/89)) @greenkeeperio-bot
|
| 971 |
+
- chore(package): update nyc to version 8.0.0 ([#88](https://github.com/babel/babylon/pull/88)) @greenkeeperio-bot
|
| 972 |
+
|
| 973 |
+
## 6.8.4 (2016-07-06)
|
| 974 |
+
|
| 975 |
+
### Bug Fixes
|
| 976 |
+
|
| 977 |
+
- Fix the location of params, when flow and default value used ([#68](https://github.com/babel/babylon/pull/68)) @danez
|
| 978 |
+
|
| 979 |
+
## 6.8.3 (2016-07-02)
|
| 980 |
+
|
| 981 |
+
### Bug Fixes
|
| 982 |
+
|
| 983 |
+
- Fix performance regression introduced in 6.8.2 with conditionals ([#63](https://github.com/babel/babylon/pull/63)) @danez
|
| 984 |
+
|
| 985 |
+
## 6.8.2 (2016-06-24)
|
| 986 |
+
|
| 987 |
+
### Bug Fixes
|
| 988 |
+
|
| 989 |
+
- Fix parse error with yielding jsx elements in generators `function* it() { yield <a></a>; }` ([#31](https://github.com/babel/babylon/pull/31)) @eldereal
|
| 990 |
+
- When cloning nodes do not clone its comments ([#24](https://github.com/babel/babylon/pull/24)) @danez
|
| 991 |
+
- Fix parse errors when using arrow functions with an spread element and return type `(...props): void => {}` ([#10](https://github.com/babel/babylon/pull/10)) @danez
|
| 992 |
+
- Fix leading comments added from previous node ([#23](https://github.com/babel/babylon/pull/23)) @danez
|
| 993 |
+
- Fix parse errors with flow's optional arguments `(arg?) => {}` ([#19](https://github.com/babel/babylon/pull/19)) @danez
|
| 994 |
+
- Support negative numeric type literals @kittens
|
| 995 |
+
- Remove line terminator restriction after await keyword @kittens
|
| 996 |
+
- Remove grouped type arrow restriction as it seems flow no longer has it @kittens
|
| 997 |
+
- Fix parse error with generic methods that have the name `get` or `set` `class foo { get() {} }` ([#55](https://github.com/babel/babylon/pull/55)) @vkurchatkin
|
| 998 |
+
- Fix parse error with arrow functions that have flow type parameter declarations `<T>(x: T): T => x;` ([#54](https://github.com/babel/babylon/pull/54)) @gabelevi
|
| 999 |
+
|
| 1000 |
+
### Documentation
|
| 1001 |
+
|
| 1002 |
+
- Document AST differences from ESTree ([#41](https://github.com/babel/babylon/pull/41)) @nene
|
| 1003 |
+
- Move ast spec from babel/babel ([#46](https://github.com/babel/babylon/pull/46)) @hzoo
|
| 1004 |
+
|
| 1005 |
+
### Internal
|
| 1006 |
+
|
| 1007 |
+
- Enable skipped tests ([#16](https://github.com/babel/babylon/pull/16)) @danez
|
| 1008 |
+
- Add script to test latest version of babylon with babel ([#21](https://github.com/babel/babylon/pull/21)) @danez
|
| 1009 |
+
- Upgrade test runner ava @kittens
|
| 1010 |
+
- Add missing generate-identifier-regex script @kittens
|
| 1011 |
+
- Rename parser context types @kittens
|
| 1012 |
+
- Add node v6 to travis testing @hzoo
|
| 1013 |
+
- Update to Unicode v9 ([#45](https://github.com/babel/babylon/pull/45)) @mathiasbynens
|
| 1014 |
+
|
| 1015 |
+
## 6.8.1 (2016-06-06)
|
| 1016 |
+
|
| 1017 |
+
### New Feature
|
| 1018 |
+
|
| 1019 |
+
- Parse type parameter declarations with defaults like `type Foo<T = string> = T`
|
| 1020 |
+
|
| 1021 |
+
### Bug Fixes
|
| 1022 |
+
- Type parameter declarations need 1 or more type parameters.
|
| 1023 |
+
- The existential type `*` is not a valid type parameter.
|
| 1024 |
+
- The existential type `*` is a primary type
|
| 1025 |
+
|
| 1026 |
+
### Spec Compliance
|
| 1027 |
+
- The param list for type parameter declarations now consists of `TypeParameter` nodes
|
| 1028 |
+
- New `TypeParameter` AST Node (replaces using the `Identifier` node before)
|
| 1029 |
+
|
| 1030 |
+
```
|
| 1031 |
+
interface TypeParameter <: Node {
|
| 1032 |
+
bound: TypeAnnotation;
|
| 1033 |
+
default: TypeAnnotation;
|
| 1034 |
+
name: string;
|
| 1035 |
+
variance: "plus" | "minus";
|
| 1036 |
+
}
|
| 1037 |
+
```
|
| 1038 |
+
|
| 1039 |
+
## 6.8.0 (2016-05-02)
|
| 1040 |
+
|
| 1041 |
+
#### New Feature
|
| 1042 |
+
|
| 1043 |
+
##### Parse Method Parameter Decorators ([#12](https://github.com/babel/babylon/pull/12))
|
| 1044 |
+
|
| 1045 |
+
> [Method Parameter Decorators](https://goo.gl/8MmCMG) is now a TC39 [stage 0 proposal](https://github.com/tc39/ecma262/blob/master/stage0.md).
|
| 1046 |
+
|
| 1047 |
+
Examples:
|
| 1048 |
+
|
| 1049 |
+
```js
|
| 1050 |
+
class Foo {
|
| 1051 |
+
constructor(@foo() x, @bar({ a: 123 }) @baz() y) {}
|
| 1052 |
+
}
|
| 1053 |
+
|
| 1054 |
+
export default function func(@foo() x, @bar({ a: 123 }) @baz() y) {}
|
| 1055 |
+
|
| 1056 |
+
var obj = {
|
| 1057 |
+
method(@foo() x, @bar({ a: 123 }) @baz() y) {}
|
| 1058 |
+
};
|
| 1059 |
+
```
|
| 1060 |
+
|
| 1061 |
+
##### Parse for-await statements (w/ `asyncGenerators` plugin) ([#17](https://github.com/babel/babylon/pull/17))
|
| 1062 |
+
|
| 1063 |
+
There is also a new node type, `ForAwaitStatement`.
|
| 1064 |
+
|
| 1065 |
+
> [Async generators and for-await](https://github.com/tc39/proposal-async-iteration) are now a [stage 2 proposal](https://github.com/tc39/ecma262#current-proposals).
|
| 1066 |
+
|
| 1067 |
+
Example:
|
| 1068 |
+
|
| 1069 |
+
```js
|
| 1070 |
+
async function f() {
|
| 1071 |
+
for await (let x of y);
|
| 1072 |
+
}
|
| 1073 |
+
```
|
src/node_modules/@babel/parser/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (C) 2012-2014 by various contributors (see AUTHORS)
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
in the Software without restriction, including without limitation the rights
|
| 6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
furnished to do so, subject to the following conditions:
|
| 9 |
+
|
| 10 |
+
The above copyright notice and this permission notice shall be included in
|
| 11 |
+
all copies or substantial portions of the Software.
|
| 12 |
+
|
| 13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 19 |
+
THE SOFTWARE.
|
src/node_modules/@babel/parser/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# @babel/parser
|
| 2 |
+
|
| 3 |
+
> A JavaScript parser
|
| 4 |
+
|
| 5 |
+
See our website [@babel/parser](https://babeljs.io/docs/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%22+is%3Aopen) associated with this package.
|
| 6 |
+
|
| 7 |
+
## Install
|
| 8 |
+
|
| 9 |
+
Using npm:
|
| 10 |
+
|
| 11 |
+
```sh
|
| 12 |
+
npm install --save-dev @babel/parser
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
or using yarn:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
yarn add @babel/parser --dev
|
| 19 |
+
```
|
src/node_modules/@babel/parser/bin/babel-parser.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
/* eslint no-var: 0 */
|
| 3 |
+
|
| 4 |
+
var parser = require("..");
|
| 5 |
+
var fs = require("fs");
|
| 6 |
+
|
| 7 |
+
var filename = process.argv[2];
|
| 8 |
+
if (!filename) {
|
| 9 |
+
console.error("no filename specified");
|
| 10 |
+
} else {
|
| 11 |
+
var file = fs.readFileSync(filename, "utf8");
|
| 12 |
+
var ast = parser.parse(file);
|
| 13 |
+
|
| 14 |
+
console.log(JSON.stringify(ast, null, " "));
|
| 15 |
+
}
|
src/node_modules/@babel/parser/index.cjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
try {
|
| 2 |
+
module.exports = require("./lib/index.cjs");
|
| 3 |
+
} catch {
|
| 4 |
+
module.exports = require("./lib/index.js");
|
| 5 |
+
}
|
src/node_modules/@babel/parser/lib/index.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|