├── .github ├── FUNDING.yml └── workflows │ └── docker-image.yml ├── Dockerfile ├── LICENSE ├── README.md ├── api ├── .gitignore ├── app.js ├── custom_module │ └── sharkd_dict.js ├── package.json ├── services │ ├── root.js │ ├── upload.js │ └── web.js └── test │ ├── helper.js │ ├── plugins │ └── support.test.js │ └── services │ ├── example.test.js │ └── root.test.js ├── docker-compose.yml ├── entrypoint.sh ├── sharkd └── build.sh └── web ├── 3rdpartylicenses.txt ├── README.md ├── favicon.ico ├── ffmpeg ├── ffmpeg-core.js ├── ffmpeg-core.wasm ├── ffmpeg-core.worker.js ├── ffmpeg.min.js └── ffmpeg.min.js.map ├── index.html ├── main.986feff8587edc55.js ├── main.b20c878a2b9c1da7.js ├── polyfills.15a95d4491047316.js ├── runtime.d0d456b5f3cc9e30.js ├── scripts.a1f42204803ed064.js └── styles.df67f39de56b489e.css /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: qxip 4 | -------------------------------------------------------------------------------- /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Docker Build & Release 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | env: 8 | REGISTRY: ghcr.io 9 | IMAGE_NAME: ${{ github.repository }} 10 | 11 | jobs: 12 | build-and-push-image: 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: read 16 | packages: write 17 | 18 | steps: 19 | - name: Checkout repository 20 | uses: actions/checkout@v3 21 | 22 | - name: Overwrite UI 23 | run: | 24 | ls -alF 25 | rm -rf ./web/* 26 | curl -fsSL github.com/qxip/webshark-ui/releases/latest/download/latest.zip -O 27 | unzip latest.zip -d ./web 28 | 29 | - name: Log in to the Container registry 30 | uses: docker/login-action@v2.0.0 31 | with: 32 | registry: ${{ env.REGISTRY }} 33 | username: ${{ github.actor }} 34 | password: ${{ secrets.GH_TOKEN }} 35 | 36 | - name: Build and push 37 | uses: docker/build-push-action@v3.0.0 38 | with: 39 | context: . 40 | push: true 41 | tags: | 42 | ghcr.io/qxip/webshark:latest 43 | ghcr.io/qxip/webshark:${{ github.event.release.tag_name }} 44 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:20-bookworm as intermediate 2 | 3 | RUN apt-get update && apt-get install -y \ 4 | git sed wget unzip make python3 cmake flex bison libglib2.0-dev libgcrypt20-dev libspeex-dev libspeexdsp-dev libc-ares-dev \ 5 | && rm -rf /var/lib/apt/lists/* 6 | 7 | RUN mkdir -p /out /usr/src /var/run 8 | WORKDIR /usr/src 9 | 10 | RUN git clone --depth=1 https://github.com/qxip/node-webshark.git /usr/src/node-webshark 11 | RUN git clone --depth=1 https://gitlab.com/wireshark/wireshark.git /usr/src/wireshark 12 | 13 | WORKDIR /usr/src/wireshark 14 | RUN ../node-webshark/sharkd/build.sh 15 | 16 | WORKDIR /usr/src 17 | RUN mkdir web \ 18 | && cd web \ 19 | && wget github.com/qxip/webshark-ui/releases/latest/download/latest.zip \ 20 | && unzip latest.zip \ 21 | && rm -rf latest.zip \ 22 | && sed -i 's|href="/"|href="/webshark/"|g' index.html 23 | 24 | 25 | FROM node:20-bookworm-slim 26 | 27 | RUN apt update \ 28 | && apt install -y git libglib2.0-0 speex libspeex1 libspeexdsp1 libc-ares2 libxml2 \ 29 | && rm -rf /var/lib/apt/lists/* 30 | 31 | RUN mkdir -p /captures /usr/local/bin /usr/local/share/wireshark/ \ 32 | && chown -R node: /captures 33 | 34 | COPY --from=intermediate /usr/src/wireshark/build/run/sharkd /usr/local/bin/sharkd 35 | COPY --from=intermediate /usr/src/wireshark/build/run/colorfilters /usr/local/share/wireshark/colorfilters 36 | 37 | ENV CAPTURES_PATH=/captures/ 38 | ENV SHARKD_SOCKET=/captures/sharkd.sock 39 | 40 | COPY --chown=node . /usr/src/node-webshark 41 | COPY --from=intermediate /usr/src/web /usr/src/node-webshark/web 42 | 43 | VOLUME /captures 44 | 45 | WORKDIR /usr/src/node-webshark/api 46 | RUN npm install 47 | 48 | EXPOSE 8085 49 | ENTRYPOINT [ "/usr/src/node-webshark/entrypoint.sh" ] 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # webshark-ng 4 | 5 | **webShark** is a *Wireshark-like* webapp powered by [sharkd](https://wiki.wireshark.org/Development/sharkd) and all its dissectors 🕵️ 6 | 7 | 8 | 9 | > Client-Side RTP playback powered by WASM/ffmpeg 🚀 10 | 11 |
12 | 13 | ## Instructions 14 | Mount your PCAP content directory to location `/captures` and launch webshark 15 | 16 | #### Run with Compose 17 | ``` 18 | docker-compose up -d 19 | ``` 20 | #### Run Manually 21 | ``` 22 | docker run -ti --rm -p 8085:8085 -v $(pwd)/captures:/captures ghcr.io/qxip/webshark:latest 23 | ``` 24 | #### Usage 25 | Browse to your webshark-ng instance, ie: `http://localhost:8085/webshark` 26 | 27 |
28 | 29 | #### Credits 30 | > This program is free software based on a fork of GPLv2 [webshark](https://bitbucket.org/jwzawadzki/webshark) by [Jakub Zawadzki](https://bitbucket.org/jwzawadzki) and sponsored by [qxip](https://github.com/QXIP) 31 | 32 | > Dissections powered by tshark [sharkd](https://wiki.wireshark.org/Development/sharkd) from Wireshark Project. See [LICENSE](https://github.com/QXIP/node-webshark/blob/master/LICENSE) for details 33 | -------------------------------------------------------------------------------- /api/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | # 0x 40 | profile-* 41 | 42 | # mac files 43 | .DS_Store 44 | 45 | # vim swap files 46 | *.swp 47 | 48 | # webstorm 49 | .idea 50 | 51 | # vscode 52 | .vscode 53 | *code-workspace 54 | 55 | # clinic 56 | profile* 57 | *clinic* 58 | *flamegraph* 59 | 60 | # lock files 61 | yarn.lock 62 | package-lock.json 63 | 64 | # generated code 65 | examples/typescript-server.js 66 | test/types/index.js 67 | -------------------------------------------------------------------------------- /api/app.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const path = require('path') 4 | const AutoLoad = require('@fastify/autoload') 5 | 6 | module.exports = function (fastify, opts, next) { 7 | fastify.register(AutoLoad, { 8 | dir: path.join(__dirname, 'services'), 9 | options: Object.assign({}, opts) 10 | }) 11 | 12 | // Make sure to call next when done 13 | next() 14 | } 15 | -------------------------------------------------------------------------------- /api/custom_module/sharkd_dict.js: -------------------------------------------------------------------------------- 1 | const {PromiseSocket} = require('promise-socket'); 2 | const { spawn } = require('child_process'); 3 | const JSONStream = require('JSONStream'); 4 | const fs = require('fs'); 5 | 6 | const SHARKD_SOCKET = process.env.SHARKD_SOCKET || "/var/run/sharkd.sock"; 7 | 8 | // Make sure CAPTURES_PATH has a trailing / 9 | let _captures_path = process.env.CAPTURES_PATH || "/captures/"; 10 | if (_captures_path.at(-1) !== "/") { 11 | _captures_path += "/"; 12 | } 13 | const CAPTURES_PATH = _captures_path; 14 | delete _captures_path 15 | 16 | // newer versions of sharkd are picky about JSON types 17 | // from sharkd_session.c: struct member_attribute name_array[] 18 | const SHARKD_INTEGER_PARAMS = new Set(["frame", "ref_frame", "prev_frame", "skip", "limit", "interval"]); 19 | const SHARKD_BOOLEAN_PARAMS = new Set(["proto", "columns", "color", "bytes", "hidden"]); 20 | const SHARKD_TRUE_VALUES = new Set(["yes", "true", "1"]); 21 | 22 | var sharkd_objects = {}; 23 | var AsyncLock = require('async-lock'); 24 | var lock = new AsyncLock({timeout: 300000}); // 5 minutes timeout for the lock 25 | var sharkd_proc = null; 26 | const sleep = (waitTimeInMs) => new Promise(resolve => setTimeout(resolve, waitTimeInMs)); 27 | 28 | /** 29 | * Returns array of socket names with loaded pcap file 30 | * @returns {[string]} Array of existing sharkd sockets with loaded file 31 | */ 32 | get_loaded_sockets = function() { 33 | let return_array = []; 34 | Object.keys(sharkd_objects).forEach(function(socket_name){ 35 | if (sharkd_objects[socket_name].stream.readable) { 36 | return_array.push(socket_name); 37 | } else { 38 | sharkd_objects[socket_name].destroy(); 39 | delete sharkd_objects[socket_name]; 40 | } 41 | }); 42 | return return_array; 43 | } 44 | 45 | /** 46 | * Returns a sharkd socket with the PCAP file loaded 47 | * @param {string} capture the full path of the pcap file to load 48 | * @returns {PromiseSocket} sharkd socket with loaded file 49 | */ 50 | get_sharkd_cli = async function(capture) { 51 | let socket_name = capture.replace(CAPTURES_PATH,""); 52 | if (socket_name.startsWith("/")) { 53 | socket_name = socket_name.substr(1); 54 | } 55 | if (socket_name in sharkd_objects) { // return existing socket 56 | if (sharkd_objects[socket_name].stream.readable === false) { 57 | sharkd_objects[socket_name].destroy(); 58 | delete sharkd_objects[socket_name]; 59 | return get_sharkd_cli(capture); 60 | } 61 | return sharkd_objects[socket_name]; 62 | } else { // no socket for this capture existst, create new one 63 | let new_socket = new PromiseSocket(); 64 | new_socket.setTimeout(300000); // 5 minutes timeout per socket connection 65 | new_socket.stream.setEncoding('utf8'); 66 | try { 67 | await new_socket.connect(SHARKD_SOCKET); 68 | } 69 | catch(err) { 70 | console.log("Error trying to connect to " + SHARKD_SOCKET) 71 | console.log(err); 72 | if (sharkd_proc !== null && sharkd_proc.pid) { 73 | console.log("sharkd_proc.pid: " + sharkd_proc.pid) 74 | sharkd_proc.kill('SIGHUP'); 75 | await sleep(250); 76 | sharkd_proc = null; 77 | } 78 | try { 79 | console.log(`Trying to spawn unix:${SHARKD_SOCKET}`) 80 | sharkd_proc = spawn('sharkd', ['unix:' + SHARKD_SOCKET]); 81 | await sleep(250); 82 | if (sharkd_proc.exitCode === 1) { 83 | console.log(`Error spawning sharkd under ${SHARKD_SOCKET} / exit 1`); 84 | process.exit(1); 85 | } 86 | } catch (err_2) { 87 | console.log(`Error spawning sharkd under ${SHARKD_SOCKET} / err_2`); 88 | console.log(err_2); 89 | process.exit(1); 90 | } 91 | return get_sharkd_cli(capture); 92 | } 93 | sharkd_objects[socket_name] = new_socket; 94 | 95 | if(capture !== '') { 96 | await send_req({'method':'load', 'file': capture}, sharkd_objects[socket_name]); 97 | return sharkd_objects[socket_name]; 98 | } else { 99 | return sharkd_objects[socket_name]; 100 | } 101 | } 102 | } 103 | 104 | /** 105 | * Checks if str is a valid JSON object 106 | * @param {string} str the string to check 107 | * @returns {boolean} is str a valid JSON object 108 | */ 109 | function _str_is_json(str) { 110 | try { 111 | var json = JSON.parse(str); 112 | return (typeof json === 'object'); 113 | } catch (e) { 114 | return false; 115 | } 116 | } 117 | 118 | /** 119 | * Sends a command to the socket and return the answer as string. 120 | * If no sock is provided, one is requested from `get_sharkd_cli` using the capture file inside the request 121 | * @param {string} request the string to check 122 | * @param {PromiseSocket|null} sock optional socket to use for communication 123 | * @returns {string} data returned from sharkd as string 124 | */ 125 | let jsonrpc_id=0; 126 | send_req = async function(request, sock) { 127 | let cap_file = ''; 128 | 129 | // newer versions of sharkd require jsonrpc, add required fields to request 130 | // FIXME: should use a jsonrpc library for this 131 | request["jsonrpc"] = "2.0"; 132 | request["id"] = ++jsonrpc_id; 133 | 134 | // FIXME: should update the frontend/backend to use a POST with json 135 | // the current approach of GET params makes every value a string 136 | for (var key of Object.keys(request)) { 137 | if (SHARKD_INTEGER_PARAMS.has(key)) { 138 | if(typeof request[key] === "string" || request[key] instanceof String) { 139 | request[key] = parseInt(request[key]); 140 | } 141 | } 142 | if (SHARKD_BOOLEAN_PARAMS.has(key)) { 143 | if(typeof request[key] === "string" || request[key] instanceof String) { 144 | request[key] = SHARKD_TRUE_VALUES.has(request[key]); 145 | } 146 | } 147 | } 148 | 149 | if ("capture" in request) { 150 | if (request.capture.includes('..')) { 151 | return JSON.stringify({"err": 1, "errstr": "Nope"}); 152 | } 153 | 154 | let req_capture = request.capture; 155 | 156 | // newer versions of sharkd don't allow extraneous fields 157 | // capture is used by webshark to track connection handles 158 | delete request.capture; 159 | 160 | if (req_capture.startsWith("/")) { 161 | req_capture = req_capture.substr(1); 162 | } 163 | 164 | cap_file = `${CAPTURES_PATH}${req_capture}`; 165 | 166 | // verify that pcap exists 167 | if (fs.existsSync(cap_file) === false) { 168 | return JSON.stringify({"err": 1, "errstr": "Nope"}); 169 | } 170 | } 171 | 172 | async function _send_req_internal() { 173 | let new_sock = sock; 174 | if (typeof(new_sock) === 'undefined') { 175 | new_sock = await get_sharkd_cli(cap_file); 176 | } 177 | 178 | if (new_sock === null) { 179 | return JSON.stringify({"err": 1, "errstr": `cannot connect to sharkd using socket: ${SHARKD_SOCKET}`}); 180 | } 181 | try { 182 | await new_sock.write(JSON.stringify(request)+"\n"); 183 | } catch (err) { 184 | console.log("Error writing to sharkd socket") 185 | console.log(err) 186 | return null; 187 | } 188 | 189 | let result = await readAndParseSocket(new_sock); 190 | 191 | if ("result" in result) { 192 | result = result["result"]; 193 | } 194 | 195 | return JSON.stringify(result); 196 | } 197 | 198 | return await lock.acquire(cap_file, _send_req_internal); 199 | } 200 | 201 | /** 202 | * Reads data from the socket stream and parses it into a JSON object. 203 | * The parser will end when the stream ends, and the parsed data will be returned. 204 | * 205 | * @param {Object} socket - The socket object containing the data stream, must have a `stream` property. 206 | * @returns {Promise} A Promise that resolves to the parsed JSON data. 207 | */ 208 | async function readAndParseSocket(socket) { 209 | return new Promise((resolve, reject) => { 210 | const stream = socket.stream; 211 | const parser = JSONStream.parse(); 212 | 213 | let data = ''; 214 | 215 | stream.on('data', (chunk) => { 216 | data += chunk; 217 | parser.write(chunk); 218 | }); 219 | 220 | parser.on('data', (parsedData) => { 221 | resolve(parsedData); 222 | }); 223 | 224 | parser.on('error', (err) => { 225 | reject(err); 226 | }); 227 | 228 | stream.on('end', () => { 229 | parser.end(); 230 | }); 231 | }); 232 | } 233 | 234 | exports.get_sharkd_cli = get_sharkd_cli; 235 | exports.send_req = send_req; 236 | exports.get_loaded_sockets = get_loaded_sockets; 237 | -------------------------------------------------------------------------------- /api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webshark-api", 3 | "version": "2.0.2", 4 | "description": "webShark/sharkd API backend", 5 | "main": "app.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "tap test/**/*.test.js", 11 | "start": "npx fastify start -l info app.js -a 0.0.0.0 -p 8085", 12 | "dev": "fastify start -l info -P app.js -a 0.0.0.0 -p 8085" 13 | }, 14 | "keywords": [ 15 | "webshark" 16 | ], 17 | "author": "joviniko@gmail.com", 18 | "license": "GPLv2", 19 | "dependencies": { 20 | "@fastify/autoload": "^5.7.1", 21 | "@fastify/static": "^6.10.2", 22 | "async-lock": "^1.2.0", 23 | "fastify": "^4.21.0", 24 | "fastify-cli": "^5.8.0", 25 | "fastify-file-upload": "^4.0.0", 26 | "fastify-plugin": "^4.5.1", 27 | "glob-parent": "^6.0.2", 28 | "node-fetch": "^3.2.6", 29 | "promise-socket": "^7.0.0", 30 | "yargs-parser": "^21.1.1", 31 | "JSONStream": "^1.3.5" 32 | }, 33 | "devDependencies": { 34 | "tap": "^16.3.8" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /api/services/root.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const fs = require('fs'); 3 | const fetch = import("node-fetch"); 4 | const sharkd_dict = require('../custom_module/sharkd_dict'); 5 | const CAPTURES_PATH = process.env.CAPTURES_PATH || "/captures/"; 6 | const url_re = /^https?:\/\// 7 | 8 | const download = function(url, dest, cb) { 9 | var file = fs.createWriteStream(dest); 10 | var request = http.get(url, function(response) { 11 | response.pipe(file); 12 | file.on('finish', function() { 13 | file.close(cb); // close() is async, call cb after close completes. 14 | }); 15 | }); 16 | } 17 | 18 | 19 | module.exports = function (fastify, opts, next) { 20 | 21 | fastify.register(require('@fastify/static'), { 22 | root: CAPTURES_PATH, 23 | prefix: '/webshark//', // defeat unique prefix 24 | }) 25 | 26 | fastify.get('/', async (req, res) => { 27 | res.redirect('/webshark'); 28 | }); 29 | 30 | fastify.get('/webshark/json', function (request, reply) { 31 | 32 | if (request.query && "method" in request.query) { 33 | if (request.query.method === 'files') { 34 | let files = fs.readdirSync(CAPTURES_PATH); 35 | let results = {"files":[], "pwd": "."}; 36 | let loaded_files = sharkd_dict.get_loaded_sockets(); 37 | files.forEach( async function(pcap_file){ 38 | if (pcap_file.endsWith('.pcap')) { 39 | /* fetch URLs to local folder */ 40 | if(pcap_file.match(url_re)) { 41 | const res = await fetch(pcap_file); 42 | var filename = pcap_file.split('/').pop() 43 | const fileStream = fs.createWriteStream(CAPTURES_PATH+filename); 44 | await new Promise((resolve, reject) => { 45 | res.body.pipe(fileStream); 46 | res.body.on("error", reject); 47 | fileStream.on("finish", resolve); 48 | }); 49 | pcap_file=filename; 50 | } 51 | 52 | let pcap_stats = fs.statSync(CAPTURES_PATH + pcap_file); 53 | if (loaded_files.includes(pcap_file)) { 54 | results.files.push({"name": pcap_file, "size": pcap_stats.size, "status": {"online": true}}); 55 | } else { 56 | results.files.push({"name": pcap_file, "size": pcap_stats.size}); 57 | } 58 | } 59 | }); 60 | reply.send(JSON.stringify(results)); 61 | } else if (request.query.method === 'download') { 62 | if ("capture" in request.query) { 63 | if (request.query.capture.includes('..')) { 64 | reply.send(JSON.stringify({"err": 1, "errstr": "Nope"})); 65 | } 66 | 67 | let cap_file = request.query.capture; 68 | if (cap_file.startsWith("/")) { 69 | cap_file = cap_file.substr(1); 70 | } 71 | 72 | if ("token" in request.query) { 73 | if (request.query.token === "self") { 74 | reply.header('Content-disposition', 'attachment; filename=' + cap_file); 75 | reply.sendFile(cap_file); 76 | next(); 77 | } else { 78 | sharkd_dict.send_req(request.query).then((data) => { 79 | try { 80 | data = JSON.parse(data); 81 | reply.header('Content-Type', data.mime); 82 | reply.header('Content-disposition', 'attachment; filename="' + data.file + '"'); 83 | let buff = new Buffer(data.data, 'base64'); 84 | reply.send(buff); 85 | } catch (err) { 86 | reply.send(JSON.stringify({"err": 1, "errstr": "Nope"})); 87 | } 88 | }); 89 | } 90 | } else { 91 | reply.send(JSON.stringify({"err": 1, "errstr": "Nope"})); 92 | } 93 | } 94 | } else if ( 95 | request.query.method === 'tap' && 96 | 'tap0' in request.query && 97 | ['srt:dcerpc', 'srt:rpc', 'srt:scsi', 'rtd:megaco'].includes(request.query.tap0) // catch the four invalid requests and prevent socket failure 98 | ) { 99 | reply.send(null); 100 | } else { 101 | sharkd_dict.send_req(request.query).then((data) => { 102 | reply.send(data); 103 | }); 104 | } 105 | } 106 | }) 107 | 108 | next() 109 | } 110 | -------------------------------------------------------------------------------- /api/services/upload.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const fs = require('fs'); 4 | const fileUpload = require('fastify-file-upload'); 5 | const CAPTURES_PATH = process.env.CAPTURES_PATH || "/captures/"; 6 | 7 | module.exports = function (fastify, opts, next) { 8 | fastify.register(fileUpload); 9 | fastify.post('/webshark/upload', function (req, reply) { 10 | const files = req.raw.files 11 | let fileArr = [] 12 | for(let key in files){ 13 | if(!files[key].name||!files[key].data) return; 14 | fs.writeFile(CAPTURES_PATH+files[key].name, files[key].data, function(err) { 15 | if(err) { 16 | return console.log(err); 17 | } 18 | }); 19 | 20 | fileArr.push({ 21 | name: files[key].name, 22 | mimetype: files[key].mimetype, 23 | size: files[key].size 24 | }) 25 | } 26 | if (fileArr.length === 1) { 27 | reply.code(200).send(fileArr[0]) 28 | } else { 29 | reply.code(200).send(fileArr) 30 | } 31 | }) 32 | 33 | next() 34 | } 35 | -------------------------------------------------------------------------------- /api/services/web.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const path = require('path') 4 | 5 | module.exports = function (fastify, opts, next) { 6 | fastify.register(require('@fastify/static'), { 7 | root: path.join(__dirname, '../../web'), 8 | prefix: '/webshark', 9 | redirect: true 10 | }) 11 | 12 | next() 13 | } 14 | -------------------------------------------------------------------------------- /api/test/helper.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | // This file contains code that we reuse 4 | // between our tests. 5 | 6 | const Fastify = require('fastify') 7 | const fp = require('fastify-plugin') 8 | const App = require('../app') 9 | 10 | // Fill in this config with all the configurations 11 | // needed for testing the application 12 | function config () { 13 | return {} 14 | } 15 | 16 | // automatically build and tear down our instance 17 | function build (t) { 18 | const app = Fastify() 19 | 20 | // fastify-plugin ensures that all decorators 21 | // are exposed for testing purposes, this is 22 | // different from the production setup 23 | app.register(fp(App), config()) 24 | 25 | // tear down our app after we are done 26 | t.tearDown(app.close.bind(app)) 27 | 28 | return app 29 | } 30 | 31 | module.exports = { 32 | config, 33 | build 34 | } 35 | -------------------------------------------------------------------------------- /api/test/plugins/support.test.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const { test } = require('tap') 4 | const Fastify = require('fastify') 5 | const Support = require('../../plugins/support') 6 | 7 | test('support works standalone', (t) => { 8 | t.plan(2) 9 | const fastify = Fastify() 10 | fastify.register(Support) 11 | 12 | fastify.ready((err) => { 13 | t.error(err) 14 | t.equal(fastify.someSupport(), 'hugs') 15 | }) 16 | }) 17 | 18 | // If you prefer async/await, use the following 19 | // 20 | // test('support works standalone', async (t) => { 21 | // const fastify = Fastify() 22 | // fastify.register(Support) 23 | // 24 | // await fastify.ready() 25 | // t.equal(fastify.someSupport(), 'hugs') 26 | // }) 27 | -------------------------------------------------------------------------------- /api/test/services/example.test.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const { test } = require('tap') 4 | const { build } = require('../helper') 5 | 6 | test('example is loaded', (t) => { 7 | t.plan(2) 8 | const app = build(t) 9 | 10 | app.inject({ 11 | url: '/example' 12 | }, (err, res) => { 13 | t.error(err) 14 | t.equal(res.payload, 'this is an example') 15 | }) 16 | }) 17 | 18 | // If you prefer async/await, use the following 19 | // 20 | // test('example is loaded', async (t) => { 21 | // const app = build(t) 22 | // 23 | // const res = await app.inject({ 24 | // url: '/example' 25 | // }) 26 | // t.equal(res.payload, 'this is an example') 27 | // }) 28 | -------------------------------------------------------------------------------- /api/test/services/root.test.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const { test } = require('tap') 4 | const { build } = require('../helper') 5 | 6 | test('default root route', (t) => { 7 | t.plan(2) 8 | const app = build(t) 9 | 10 | app.inject({ 11 | url: '/' 12 | }, (err, res) => { 13 | t.error(err) 14 | t.deepEqual(JSON.parse(res.payload), { root: true }) 15 | }) 16 | }) 17 | 18 | // If you prefer async/await, use the following 19 | // 20 | // test('default root route', async (t) => { 21 | // const app = build(t) 22 | // 23 | // const res = await app.inject({ 24 | // url: '/' 25 | // }) 26 | // t.deepEqual(JSON.parse(res.payload), { root: true }) 27 | // }) 28 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | 5 | webshark: 6 | # image: ghcr.io/qxip/webshark:latest 7 | build: . 8 | container_name: webshark 9 | expose: 10 | - "8085" 11 | ports: 12 | - "8085:8085" 13 | volumes: 14 | - ./captures:/captures 15 | environment: 16 | - SHARKD_SOCKET=/home/node/sharkd.sock 17 | - CAPTURES_PATH=/captures/ 18 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # sharkd daemon fails to start if the socket already exists 4 | rm "$SHARKD_SOCKET" 5 | 6 | dir_owner=$(stat -c "%U:%G" "${CAPTURES_PATH}") 7 | 8 | if [ "x${dir_owner}" = "xroot:root" ]; then 9 | # assume CAPTURES_PATH owned by root:root is unintentional 10 | # (probably created by docker-compose) 11 | chown node: "${CAPTURES_PATH}" 12 | fi 13 | 14 | exec su node -c "npm start" 15 | -------------------------------------------------------------------------------- /sharkd/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | ## GeoIP 6 | # apt-get update && apt-get install -y libmaxminddb-dev 7 | 8 | # Update wireshark sources 9 | git pull 10 | #git reset --hard 640ded8e1d45ec3ee8594c385b1045cbaa0042a0 ## tested with this hash 11 | 12 | # Integrate sharkd 13 | #patch -p1 < ../sharkd/sharkd.patch 14 | #patch -p1 < ../sharkd/sharkd_opt_memory.patch ## optional 15 | #cp ../sharkd/*.[ch] ./ 16 | 17 | mkdir build 18 | cd build 19 | 20 | # Compile sharkd static, and without optional libraries 21 | cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_C_FLAGS_RELEASE="-O3 -pipe" \ 22 | -DENABLE_STATIC=ON -DENABLE_PLUGINS=OFF -DDISABLE_WERROR=ON \ 23 | -DBUILD_wireshark=OFF -DBUILD_tshark=OFF -DBUILD_sharkd=ON -DBUILD_dumpcap=OFF -DBUILD_capinfos=OFF \ 24 | -DBUILD_captype=OFF -DBUILD_randpkt=OFF -DBUILD_dftest=OFF -DBUILD_editcap=OFF -DBUILD_mergecap=OFF \ 25 | -DBUILD_reordercap=OFF -DBUILD_text2pcap=OFF -DBUILD_fuzzshark=OFF \ 26 | -DBUILD_androiddump=OFF -DBUILD_randpktdump=OFF -DBUILD_udpdump=OFF \ 27 | -DENABLE_PCAP=OFF -DENABLE_GNUTLS=OFF \ 28 | ../ 29 | 30 | make -j8 31 | cd run 32 | 33 | # Generate tarball in /out directory 34 | strip sharkd 35 | mkdir -p ./usr/local/bin/ ./usr/local/share/wireshark/ 36 | cp sharkd ./usr/local/bin/ 37 | # cp mmdbresolve ./usr/local/bin/ 38 | cp colorfilters ./usr/local/share/wireshark/ 39 | tar -vczf /out/sharkd.tar.gz ./usr 40 | -------------------------------------------------------------------------------- /web/README.md: -------------------------------------------------------------------------------- 1 | # webshark-demo -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QXIP/webshark/2e1f29c7bc8994b6dcb8b83625f337debca23806/web/favicon.ico -------------------------------------------------------------------------------- /web/ffmpeg/ffmpeg-core.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QXIP/webshark/2e1f29c7bc8994b6dcb8b83625f337debca23806/web/ffmpeg/ffmpeg-core.wasm -------------------------------------------------------------------------------- /web/ffmpeg/ffmpeg-core.worker.js: -------------------------------------------------------------------------------- 1 | var threadInfoStruct=0;var selfThreadId=0;var parentThreadId=0;var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:selfThreadId})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}createFFmpegCore(Module).then(function(instance){Module=instance;postMessage({"cmd":"loaded"})})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;threadInfoStruct=e.data.threadInfoStruct;Module["registerPthreadPtr"](threadInfoStruct,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0);selfThreadId=e.data.selfThreadId;parentThreadId=e.data.parentThreadId;var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);/*EM_THREAD_STATUS_RUNNING*/try{var result=Module["dynCall"]("ii",e.data.start_routine,[e.data.arg]);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){Atomics.store(Module["HEAPU32"],(threadInfoStruct+4)>>/*C_STRUCTS.pthread.threadExitCode*/2,(ex instanceof Module["ExitStatus"])?ex.status:-2);/*A custom entry specific to Emscripten denoting that the thread crashed.*/Atomics.store(Module["HEAPU32"],(threadInfoStruct+0)>>/*C_STRUCTS.pthread.threadStatus*/2,1);Module["_emscripten_futex_wake"](threadInfoStruct+0,/*C_STRUCTS.pthread.threadStatus*/2147483647);if(!(ex instanceof Module["ExitStatus"]))throw ex}}}else if(e.data.cmd==="cancel"){if(threadInfoStruct){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(threadInfoStruct){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}} 2 | -------------------------------------------------------------------------------- /web/ffmpeg/ffmpeg.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FFmpeg=t():e.FFmpeg=t()}(self,(function(){return e={497:(e,t,r)=>{var n=r(72),o=r(306).devDependencies;e.exports={corePath:"undefined"!=typeof process&&"development"===process.env.FFMPEG_ENV?n("/node_modules/@ffmpeg/core/dist/ffmpeg-core.js"):"https://unpkg.com/@ffmpeg/core@".concat(o["@ffmpeg/core"].substring(1),"/dist/ffmpeg-core.js")}},663:(e,t,r)=>{function n(e,t,r,n,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}var o=r(72),i=function(e){return new Promise((function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(e){var t=e.target.error.code;r(Error("File could not be read! Code=".concat(t)))},n.readAsArrayBuffer(e)}))};e.exports=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t,void 0!==t){e.next=3;break}return e.abrupt("return",new Uint8Array);case 3:if("string"!=typeof t){e.next=16;break}if(!/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(t)){e.next=8;break}r=atob(t.split(",")[1]).split("").map((function(e){return e.charCodeAt(0)})),e.next=14;break;case 8:return e.next=10,fetch(o(t));case 10:return n=e.sent,e.next=13,n.arrayBuffer();case 13:r=e.sent;case 14:e.next=20;break;case 16:if(!(t instanceof File||t instanceof Blob)){e.next=20;break}return e.next=19,i(t);case 19:r=e.sent;case 20:return e.abrupt("return",new Uint8Array(r));case 21:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,s,"next",e)}function s(e){n(a,o,i,c,s,"throw",e)}c(void 0)}))});return function(e){return t.apply(this,arguments)}}()},452:(e,t,r)=>{function n(e,t,r,n,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,s,"next",e)}function s(e){n(a,o,i,c,s,"throw",e)}c(void 0)}))}}var i=r(72),a=r(185).log,c=function(){var e=o(regeneratorRuntime.mark((function e(t,r){var n,o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a("info","fetch ".concat(t)),e.next=3,fetch(t);case 3:return e.next=5,e.sent.arrayBuffer();case 5:return n=e.sent,a("info","".concat(t," file size = ").concat(n.byteLength," bytes")),o=new Blob([n],{type:r}),i=URL.createObjectURL(o),a("info","".concat(t," blob URL = ").concat(i)),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();e.exports=function(){var e=o(regeneratorRuntime.mark((function e(t){var r,n,o,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof(r=t.corePath)){e.next=3;break}throw Error("corePath should be a string!");case 3:return n=i(r),e.next=6,c(n,"application/javascript");case 6:return o=e.sent,e.next=9,c(n.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm");case 9:return s=e.sent,e.next=12,c(n.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");case 12:if(u=e.sent,"undefined"!=typeof createFFmpegCore){e.next=15;break}return e.abrupt("return",new Promise((function(e){var t=document.createElement("script");t.src=o,t.type="text/javascript",t.addEventListener("load",(function r(){t.removeEventListener("load",r),a("info","ffmpeg-core.js script loaded"),e({createFFmpegCore,corePath:o,wasmPath:s,workerPath:u})})),document.getElementsByTagName("head")[0].appendChild(t)})));case 15:return a("info","ffmpeg-core.js script is loaded already"),e.abrupt("return",Promise.resolve({createFFmpegCore,corePath:o,wasmPath:s,workerPath:u}));case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},698:(e,t,r)=>{var n=r(497),o=r(452),i=r(663);e.exports={defaultOptions:n,getCreateFFmpegCore:o,fetchFile:i}},500:e=>{e.exports={defaultArgs:["./ffmpeg","-nostdin","-y"],baseOptions:{log:!1,logger:function(){},progress:function(){},corePath:""}}},906:(e,t,r)=>{function n(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=r(500),p=l.defaultArgs,h=l.baseOptions,m=r(185),g=m.setLogging,d=m.setCustomLogger,y=m.log,v=r(583),b=r(319),w=r(698),x=w.defaultOptions,j=w.getCreateFFmpegCore,E=r(306).version,F=Error("ffmpeg.wasm is not ready, make sure you have completed load().");e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=s(s(s({},h),x),e),r=t.log,o=t.logger,i=t.progress,c=f(t,["log","logger","progress"]),u=null,l=null,m=null,w=!1,O=i,P=function(e){"FFMPEG_END"===e&&null!==m&&(m(),m=null,w=!1)},L=function(e){var t=e.type,r=e.message;y(t,r),v(r,O),P(r)},k=function(){var e=a(regeneratorRuntime.mark((function e(){var t,r,n,o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(y("info","load ffmpeg-core"),null!==u){e.next=17;break}return y("info","loading ffmpeg-core"),e.next=5,j(c);case 5:return t=e.sent,r=t.createFFmpegCore,n=t.corePath,o=t.workerPath,i=t.wasmPath,e.next=12,r({mainScriptUrlOrBlob:n,printErr:function(e){return L({type:"fferr",message:e})},print:function(e){return L({type:"ffout",message:e})},locateFile:function(e,t){if("undefined"!=typeof window){if(void 0!==i&&e.endsWith("ffmpeg-core.wasm"))return i;if(void 0!==o&&e.endsWith("ffmpeg-core.worker.js"))return o}return t+e}});case 12:u=e.sent,l=u.cwrap("proxy_main","number",["number","number"]),y("info","ffmpeg-core loaded"),e.next=18;break;case 17:throw Error("ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.");case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(){return null!==u},A=function(){for(var e=arguments.length,t=new Array(e),r=0;r1?t-1:0),n=1;n")})).join(" "))),null===u)throw F;var o=null;try{var i;o=(i=u.FS)[e].apply(i,r)}catch(t){throw"readdir"===e?Error("ffmpeg.FS('readdir', '".concat(r[0],"') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')")):"readFile"===e?Error("ffmpeg.FS('readFile', '".concat(r[0],"') error. Check if the path exists")):Error("Oops, something went wrong in FS operation.")}return o},C=function(){if(null===u)throw F;w=!1,u.exit(1),u=null,l=null,m=null},R=function(e){O=e},N=function(e){d(e)};return g(r),d(o),y("info","use ffmpeg.wasm v".concat(E)),{setProgress:R,setLogger:N,setLogging:g,load:k,isLoaded:S,run:A,exit:C,FS:_}}},352:(e,t,r)=>{r(666);var n=r(906),o=r(698).fetchFile;e.exports={createFFmpeg:n,fetchFile:o}},185:e=>{var t=!1,r=function(){};e.exports={logging:t,setLogging:function(e){t=e},setCustomLogger:function(e){r=e},log:function(e,n){r({type:e,message:n}),t&&console.log("[".concat(e,"] ").concat(n))}}},319:e=>{e.exports=function(e,t){var r=e._malloc(t.length*Uint32Array.BYTES_PER_ELEMENT);return t.forEach((function(t,n){var o=e._malloc(t.length+1);e.writeAsciiToMemory(t,o),e.setValue(r+Uint32Array.BYTES_PER_ELEMENT*n,o,"i32")})),[t.length,r]}},583:e=>{function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);ra)&&(r=a)}else if(e.startsWith("frame")||e.startsWith("size")){var c=e.split("time=")[1].split(" ")[0],s=o(c);t({ratio:n=s/r,time:s})}else e.startsWith("video:")&&(t({ratio:1}),r=0)}},666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===m){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var s=f(e,t,r);if("normal"===s.type){if(n=r.done?m:p,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=m,r.method="throw",r.arg=s.arg)}}}(e,r,a),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",p="suspendedYield",h="executing",m="completed",g={};function d(){}function y(){}function v(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(S([])));x&&x!==r&&n.call(x,i)&&(b=x);var j=v.prototype=d.prototype=Object.create(b);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function F(e,t){function r(o,i,a,c){var s=f(e[o],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,c)}))}c(s.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return g;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function S(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:S(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}},72:function(e,t,r){var n,o;void 0===(o="function"==typeof(n=function(){return function(){var e=arguments.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var t=document.createElement("base");if(t.href=arguments[0],1===e)return t.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild);for(var n,o=document.createElement("a"),i=1;i{"use strict";e.exports=JSON.parse('{"name":"@ffmpeg/ffmpeg","version":"0.10.0","description":"FFmpeg WebAssembly version","main":"src/index.js","types":"src/index.d.ts","directories":{"example":"examples"},"scripts":{"start":"node scripts/server.js","build":"rimraf dist && webpack --config scripts/webpack.config.prod.js","prepublishOnly":"npm run build","lint":"eslint src","wait":"rimraf dist && wait-on http://localhost:3000/dist/ffmpeg.dev.js","test":"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser:ffmpeg test:node:all","test:node":"node --experimental-wasm-threads --experimental-wasm-bulk-memory node_modules/.bin/_mocha --exit --bail --require ./scripts/test-helper.js","test:node:all":"npm run test:node -- ./tests/*.test.js","test:browser":"mocha-headless-chrome -a allow-file-access-from-files -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000","test:browser:ffmpeg":"npm run test:browser -- -f ./tests/ffmpeg.test.html"},"browser":{"./src/node/index.js":"./src/browser/index.js"},"repository":{"type":"git","url":"git+https://github.com/ffmpegwasm/ffmpeg.wasm.git"},"keywords":["ffmpeg","WebAssembly","video"],"author":"Jerome Wu ","license":"MIT","bugs":{"url":"https://github.com/ffmpegwasm/ffmpeg.wasm/issues"},"engines":{"node":">=12.16.1"},"homepage":"https://github.com/ffmpegwasm/ffmpeg.wasm#readme","dependencies":{"is-url":"^1.2.4","node-fetch":"^2.6.1","regenerator-runtime":"^0.13.7","resolve-url":"^0.2.1"},"devDependencies":{"@babel/core":"^7.12.3","@babel/preset-env":"^7.12.1","@ffmpeg/core":"^0.10.0","@types/emscripten":"^1.39.4","babel-loader":"^8.1.0","chai":"^4.2.0","cors":"^2.8.5","eslint":"^7.12.1","eslint-config-airbnb-base":"^14.1.0","eslint-plugin-import":"^2.22.1","express":"^4.17.1","mocha":"^8.2.1","mocha-headless-chrome":"^2.0.3","npm-run-all":"^4.1.5","wait-on":"^5.3.0","webpack":"^5.3.2","webpack-cli":"^4.1.0","webpack-dev-middleware":"^4.0.0"}}')}},t={},function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(352);var e,t})); 2 | //# sourceMappingURL=ffmpeg.min.js.map -------------------------------------------------------------------------------- /web/ffmpeg/ffmpeg.min.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack://FFmpeg/webpack/universalModuleDefinition","webpack://FFmpeg/./src/browser/defaultOptions.js","webpack://FFmpeg/./src/browser/fetchFile.js","webpack://FFmpeg/./src/browser/getCreateFFmpegCore.js","webpack://FFmpeg/./src/browser/index.js","webpack://FFmpeg/./src/config.js","webpack://FFmpeg/./src/createFFmpeg.js","webpack://FFmpeg/./src/index.js","webpack://FFmpeg/./src/utils/log.js","webpack://FFmpeg/./src/utils/parseArgs.js","webpack://FFmpeg/./src/utils/parseProgress.js","webpack://FFmpeg/./node_modules/regenerator-runtime/runtime.js","webpack://FFmpeg/./node_modules/resolve-url/resolve-url.js","webpack://FFmpeg/webpack/bootstrap","webpack://FFmpeg/webpack/startup"],"names":["root","factory","exports","module","define","amd","self","resolveURL","require","devDependencies","corePath","process","env","FFMPEG_ENV","substring","readFromBlobOrFile","blob","Promise","resolve","reject","fileReader","FileReader","onload","result","onerror","code","target","error","Error","readAsArrayBuffer","_data","data","Uint8Array","test","atob","split","map","c","charCodeAt","fetch","res","arrayBuffer","File","Blob","log","toBlobURL","url","mimeType","buf","byteLength","type","blobURL","URL","createObjectURL","_corePath","coreRemotePath","replace","wasmPath","workerPath","createFFmpegCore","script","document","createElement","src","addEventListener","eventHandler","removeEventListener","getElementsByTagName","appendChild","defaultOptions","getCreateFFmpegCore","fetchFile","defaultArgs","baseOptions","logger","progress","setLogging","setCustomLogger","parseProgress","parseArgs","version","NO_LOAD","_options","logging","optProgress","options","Core","ffmpeg","runResolve","running","detectCompletion","message","parseMessage","load","mainScriptUrlOrBlob","printErr","print","locateFile","path","prefix","window","endsWith","cwrap","isLoaded","run","_args","join","args","filter","s","length","FS","method","arg","ret","e","exit","setProgress","_progress","setLogger","_logger","createFFmpeg","customLogger","_logging","console","argsPtr","_malloc","Uint32Array","BYTES_PER_ELEMENT","forEach","idx","writeAsciiToMemory","setValue","duration","ratio","ts2sec","ts","h","m","parseFloat","startsWith","d","t","time","runtime","undefined","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","create","context","Context","_invoke","state","GenStateSuspendedStart","GenStateExecuting","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","done","GenStateSuspendedYield","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","AsyncIterator","PromiseImpl","invoke","__await","then","unwrapped","previousPromise","callInvokeWithMethodAndArg","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","i","constructor","displayName","isGeneratorFunction","genFun","ctor","name","mark","setPrototypeOf","__proto__","awrap","async","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","Function","numUrls","arguments","base","href","head","insertBefore","firstChild","resolved","a","index","removeChild","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,IARnB,CASGK,MAAM,WACT,O,iBCVA,IAAMC,EAAaC,EAAQ,IACnBC,EAAoBD,EAAQ,KAA5BC,gBAKRN,EAAOD,QAAU,CACfQ,SAA8B,oBAAZC,SAAsD,gBAA3BA,QAAQC,IAAIC,WACrDN,EAAW,kDADL,yCAE4BE,EAAgB,gBAAgBK,UAAU,GAFtE,0B,uICPZ,IAAMP,EAAaC,EAAQ,IAErBO,EAAqB,SAACC,GAAD,OACzB,IAAIC,SAAQ,SAACC,EAASC,GACpB,IAAMC,EAAa,IAAIC,WACvBD,EAAWE,OAAS,WAClBJ,EAAQE,EAAWG,SAErBH,EAAWI,QAAU,YAAqC,IAAfC,EAAe,EAAlCC,OAAUC,MAASF,KACzCN,EAAOS,MAAM,gCAAD,OAAiCH,MAE/CL,EAAWS,kBAAkBb,OAIjCb,EAAOD,QAAP,e,EAAA,G,EAAA,yBAAiB,WAAO4B,GAAP,2FACXC,EAAOD,OACU,IAAVA,EAFI,yCAGN,IAAIE,YAHE,UAMM,iBAAVF,EANI,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EADAC,EAAI9N,SAASC,cAAc,KAGtB8N,EAAQ,EAAGA,EAAQT,EAASS,IACnCD,EAAEL,KAAOF,UAAUQ,GACnBF,EAAWC,EAAEL,KACbD,EAAKC,KAAOI,EAKd,OAFAH,EAAKM,YAAYR,GAEVK,KApCO,mC,s8DCJdI,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU9R,QAG3C,IAAIC,EAAS2R,EAAyBE,GAAY,CAGjD9R,QAAS,IAOV,OAHA+R,EAAoBD,GAAU3F,KAAKlM,EAAOD,QAASC,EAAQA,EAAOD,QAAS6R,GAGpE5R,EAAOD,QCjBR6R,CAAoB,K,MDFvBD","file":"ffmpeg.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FFmpeg\"] = factory();\n\telse\n\t\troot[\"FFmpeg\"] = factory();\n})(self, function() {\nreturn ","const resolveURL = require('resolve-url');\nconst { devDependencies } = require('../../package.json');\n\n/*\n * Default options for browser environment\n */\nmodule.exports = {\n corePath: (typeof process !== 'undefined' && process.env.FFMPEG_ENV === 'development')\n ? resolveURL('/node_modules/@ffmpeg/core/dist/ffmpeg-core.js')\n : `https://unpkg.com/@ffmpeg/core@${devDependencies['@ffmpeg/core'].substring(1)}/dist/ffmpeg-core.js`,\n};\n","const resolveURL = require('resolve-url');\n\nconst readFromBlobOrFile = (blob) => (\n new Promise((resolve, reject) => {\n const fileReader = new FileReader();\n fileReader.onload = () => {\n resolve(fileReader.result);\n };\n fileReader.onerror = ({ target: { error: { code } } }) => {\n reject(Error(`File could not be read! Code=${code}`));\n };\n fileReader.readAsArrayBuffer(blob);\n })\n);\n\nmodule.exports = async (_data) => {\n let data = _data;\n if (typeof _data === 'undefined') {\n return new Uint8Array();\n }\n\n if (typeof _data === 'string') {\n /* From base64 format */\n if (/data:_data\\/([a-zA-Z]*);base64,([^\"]*)/.test(_data)) {\n data = atob(_data.split(',')[1])\n .split('')\n .map((c) => c.charCodeAt(0));\n /* From remote server/URL */\n } else {\n const res = await fetch(resolveURL(_data));\n data = await res.arrayBuffer();\n }\n /* From Blob or File */\n } else if (_data instanceof File || _data instanceof Blob) {\n data = await readFromBlobOrFile(_data);\n }\n\n return new Uint8Array(data);\n};\n","/* eslint-disable no-undef */\nconst resolveURL = require('resolve-url');\nconst { log } = require('../utils/log');\n\n/*\n * Fetch data from remote URL and convert to blob URL\n * to avoid CORS issue\n */\nconst toBlobURL = async (url, mimeType) => {\n log('info', `fetch ${url}`);\n const buf = await (await fetch(url)).arrayBuffer();\n log('info', `${url} file size = ${buf.byteLength} bytes`);\n const blob = new Blob([buf], { type: mimeType });\n const blobURL = URL.createObjectURL(blob);\n log('info', `${url} blob URL = ${blobURL}`);\n return blobURL;\n};\n\nmodule.exports = async ({ corePath: _corePath }) => {\n if (typeof _corePath !== 'string') {\n throw Error('corePath should be a string!');\n }\n const coreRemotePath = resolveURL(_corePath);\n const corePath = await toBlobURL(\n coreRemotePath,\n 'application/javascript',\n );\n const wasmPath = await toBlobURL(\n coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.wasm'),\n 'application/wasm',\n );\n const workerPath = await toBlobURL(\n coreRemotePath.replace('ffmpeg-core.js', 'ffmpeg-core.worker.js'),\n 'application/javascript',\n );\n if (typeof createFFmpegCore === 'undefined') {\n return new Promise((resolve) => {\n const script = document.createElement('script');\n const eventHandler = () => {\n script.removeEventListener('load', eventHandler);\n log('info', 'ffmpeg-core.js script loaded');\n resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n };\n script.src = corePath;\n script.type = 'text/javascript';\n script.addEventListener('load', eventHandler);\n document.getElementsByTagName('head')[0].appendChild(script);\n });\n }\n log('info', 'ffmpeg-core.js script is loaded already');\n return Promise.resolve({\n createFFmpegCore,\n corePath,\n wasmPath,\n workerPath,\n });\n};\n","const defaultOptions = require('./defaultOptions');\nconst getCreateFFmpegCore = require('./getCreateFFmpegCore');\nconst fetchFile = require('./fetchFile');\n\nmodule.exports = {\n defaultOptions,\n getCreateFFmpegCore,\n fetchFile,\n};\n","module.exports = {\n defaultArgs: [\n /* args[0] is always the binary path */\n './ffmpeg',\n /* Disable interaction mode */\n '-nostdin',\n /* Force to override output file */\n '-y',\n ],\n baseOptions: {\n /* Flag to turn on/off log messages in console */\n log: false,\n /*\n * Custom logger to get ffmpeg.wasm output messages.\n * a sample logger looks like this:\n *\n * ```\n * logger = ({ type, message }) => {\n * console.log(type, message);\n * }\n * ```\n *\n * type can be one of following:\n *\n * info: internal workflow debug messages\n * fferr: ffmpeg native stderr output\n * ffout: ffmpeg native stdout output\n */\n logger: () => {},\n /*\n * Progress handler to get current progress of ffmpeg command.\n * a sample progress handler looks like this:\n *\n * ```\n * progress = ({ ratio }) => {\n * console.log(ratio);\n * }\n * ```\n *\n * ratio is a float number between 0 to 1.\n */\n progress: () => {},\n /*\n * Path to find/download ffmpeg.wasm-core,\n * this value should be overwriten by `defaultOptions` in\n * each environment.\n */\n corePath: '',\n },\n};\n","const { defaultArgs, baseOptions } = require('./config');\nconst { setLogging, setCustomLogger, log } = require('./utils/log');\nconst parseProgress = require('./utils/parseProgress');\nconst parseArgs = require('./utils/parseArgs');\nconst { defaultOptions, getCreateFFmpegCore } = require('./node');\nconst { version } = require('../package.json');\n\nconst NO_LOAD = Error('ffmpeg.wasm is not ready, make sure you have completed load().');\n\nmodule.exports = (_options = {}) => {\n const {\n log: logging,\n logger,\n progress: optProgress,\n ...options\n } = {\n ...baseOptions,\n ...defaultOptions,\n ..._options,\n };\n let Core = null;\n let ffmpeg = null;\n let runResolve = null;\n let running = false;\n let progress = optProgress;\n const detectCompletion = (message) => {\n if (message === 'FFMPEG_END' && runResolve !== null) {\n runResolve();\n runResolve = null;\n running = false;\n }\n };\n const parseMessage = ({ type, message }) => {\n log(type, message);\n parseProgress(message, progress);\n detectCompletion(message);\n };\n\n /*\n * Load ffmpeg.wasm-core script.\n * In browser environment, the ffmpeg.wasm-core script is fetch from\n * CDN and can be assign to a local path by assigning `corePath`.\n * In node environment, we use dynamic require and the default `corePath`\n * is `$ffmpeg/core`.\n *\n * Typically the load() func might take few seconds to minutes to complete,\n * better to do it as early as possible.\n *\n */\n const load = async () => {\n log('info', 'load ffmpeg-core');\n if (Core === null) {\n log('info', 'loading ffmpeg-core');\n /*\n * In node environment, all paths are undefined as there\n * is no need to set them.\n */\n const {\n createFFmpegCore,\n corePath,\n workerPath,\n wasmPath,\n } = await getCreateFFmpegCore(options);\n Core = await createFFmpegCore({\n /*\n * Assign mainScriptUrlOrBlob fixes chrome extension web worker issue\n * as there is no document.currentScript in the context of content_scripts\n */\n mainScriptUrlOrBlob: corePath,\n printErr: (message) => parseMessage({ type: 'fferr', message }),\n print: (message) => parseMessage({ type: 'ffout', message }),\n /*\n * locateFile overrides paths of files that is loaded by main script (ffmpeg-core.js).\n * It is critical for browser environment and we override both wasm and worker paths\n * as we are using blob URL instead of original URL to avoid cross origin issues.\n */\n locateFile: (path, prefix) => {\n if (typeof window !== 'undefined') {\n if (typeof wasmPath !== 'undefined'\n && path.endsWith('ffmpeg-core.wasm')) {\n return wasmPath;\n }\n if (typeof workerPath !== 'undefined'\n && path.endsWith('ffmpeg-core.worker.js')) {\n return workerPath;\n }\n }\n return prefix + path;\n },\n });\n ffmpeg = Core.cwrap('proxy_main', 'number', ['number', 'number']);\n log('info', 'ffmpeg-core loaded');\n } else {\n throw Error('ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.');\n }\n };\n\n /*\n * Determine whether the Core is loaded.\n */\n const isLoaded = () => Core !== null;\n\n /*\n * Run ffmpeg command.\n * This is the major function in ffmpeg.wasm, you can just imagine it\n * as ffmpeg native cli and what you need to pass is the same.\n *\n * For example, you can convert native command below:\n *\n * ```\n * $ ffmpeg -i video.avi -c:v libx264 video.mp4\n * ```\n *\n * To\n *\n * ```\n * await ffmpeg.run('-i', 'video.avi', '-c:v', 'libx264', 'video.mp4');\n * ```\n *\n */\n const run = (..._args) => {\n log('info', `run ffmpeg command: ${_args.join(' ')}`);\n if (Core === null) {\n throw NO_LOAD;\n } else if (running) {\n throw Error('ffmpeg.wasm can only run one command at a time');\n } else {\n running = true;\n return new Promise((resolve) => {\n const args = [...defaultArgs, ..._args].filter((s) => s.length !== 0);\n runResolve = resolve;\n ffmpeg(...parseArgs(Core, args));\n });\n }\n };\n\n /*\n * Run FS operations.\n * For input/output file of ffmpeg.wasm, it is required to save them to MEMFS\n * first so that ffmpeg.wasm is able to consume them. Here we rely on the FS\n * methods provided by Emscripten.\n *\n * Common methods to use are:\n * ffmpeg.FS('writeFile', 'video.avi', new Uint8Array(...)): writeFile writes\n * data to MEMFS. You need to use Uint8Array for binary data.\n * ffmpeg.FS('readFile', 'video.mp4'): readFile from MEMFS.\n * ffmpeg.FS('unlink', 'video.map'): delete file from MEMFS.\n *\n * For more info, check https://emscripten.org/docs/api_reference/Filesystem-API.html\n *\n */\n const FS = (method, ...args) => {\n log('info', `run FS.${method} ${args.map((arg) => (typeof arg === 'string' ? arg : `<${arg.length} bytes binary file>`)).join(' ')}`);\n if (Core === null) {\n throw NO_LOAD;\n } else {\n let ret = null;\n try {\n ret = Core.FS[method](...args);\n } catch (e) {\n if (method === 'readdir') {\n throw Error(`ffmpeg.FS('readdir', '${args[0]}') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')`);\n } else if (method === 'readFile') {\n throw Error(`ffmpeg.FS('readFile', '${args[0]}') error. Check if the path exists`);\n } else {\n throw Error('Oops, something went wrong in FS operation.');\n }\n }\n return ret;\n }\n };\n\n /**\n * forcibly terminate the ffmpeg program.\n */\n const exit = () => {\n if (Core === null) {\n throw NO_LOAD;\n } else {\n running = false;\n Core.exit(1);\n Core = null;\n ffmpeg = null;\n runResolve = null;\n }\n };\n\n const setProgress = (_progress) => {\n progress = _progress;\n };\n\n const setLogger = (_logger) => {\n setCustomLogger(_logger);\n };\n\n setLogging(logging);\n setCustomLogger(logger);\n\n log('info', `use ffmpeg.wasm v${version}`);\n\n return {\n setProgress,\n setLogger,\n setLogging,\n load,\n isLoaded,\n run,\n exit,\n FS,\n };\n};\n","require('regenerator-runtime/runtime');\nconst createFFmpeg = require('./createFFmpeg');\nconst { fetchFile } = require('./node');\n\nmodule.exports = {\n /*\n * Create ffmpeg instance.\n * Each ffmpeg instance owns an isolated MEMFS and works\n * independently.\n *\n * For example:\n *\n * ```\n * const ffmpeg = createFFmpeg({\n * log: true,\n * logger: () => {},\n * progress: () => {},\n * corePath: '',\n * })\n * ```\n *\n * For the usage of these four arguments, check config.js\n *\n */\n createFFmpeg,\n /*\n * Helper function for fetching files from various resource.\n * Sometimes the video/audio file you want to process may located\n * in a remote URL and somewhere in your local file system.\n *\n * This helper function helps you to fetch to file and return an\n * Uint8Array variable for ffmpeg.wasm to consume.\n *\n */\n fetchFile,\n};\n","let logging = false;\nlet customLogger = () => {};\n\nconst setLogging = (_logging) => {\n logging = _logging;\n};\n\nconst setCustomLogger = (logger) => {\n customLogger = logger;\n};\n\nconst log = (type, message) => {\n customLogger({ type, message });\n if (logging) {\n console.log(`[${type}] ${message}`);\n }\n};\n\nmodule.exports = {\n logging,\n setLogging,\n setCustomLogger,\n log,\n};\n","module.exports = (Core, args) => {\n const argsPtr = Core._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT);\n args.forEach((s, idx) => {\n const buf = Core._malloc(s.length + 1);\n Core.writeAsciiToMemory(s, buf);\n Core.setValue(argsPtr + (Uint32Array.BYTES_PER_ELEMENT * idx), buf, 'i32');\n });\n return [args.length, argsPtr];\n};\n","let duration = 0;\nlet ratio = 0;\n\nconst ts2sec = (ts) => {\n const [h, m, s] = ts.split(':');\n return (parseFloat(h) * 60 * 60) + (parseFloat(m) * 60) + parseFloat(s);\n};\n\nmodule.exports = (message, progress) => {\n if (typeof message === 'string') {\n if (message.startsWith(' Duration')) {\n const ts = message.split(', ')[0].split(': ')[1];\n const d = ts2sec(ts);\n progress({ duration: d, ratio });\n if (duration === 0 || duration > d) {\n duration = d;\n }\n } else if (message.startsWith('frame') || message.startsWith('size')) {\n const ts = message.split('time=')[1].split(' ')[0];\n const t = ts2sec(ts);\n ratio = t / duration;\n progress({ ratio, time: t });\n } else if (message.startsWith('video:')) {\n progress({ ratio: 1 });\n duration = 0;\n }\n }\n};\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","// Copyright 2014 Simon Lydell\r\n// X11 (“MIT”) Licensed. (See LICENSE.)\r\n\r\nvoid (function(root, factory) {\r\n if (typeof define === \"function\" && define.amd) {\r\n define(factory)\r\n } else if (typeof exports === \"object\") {\r\n module.exports = factory()\r\n } else {\r\n root.resolveUrl = factory()\r\n }\r\n}(this, function() {\r\n\r\n function resolveUrl(/* ...urls */) {\r\n var numUrls = arguments.length\r\n\r\n if (numUrls === 0) {\r\n throw new Error(\"resolveUrl requires at least one argument; got none.\")\r\n }\r\n\r\n var base = document.createElement(\"base\")\r\n base.href = arguments[0]\r\n\r\n if (numUrls === 1) {\r\n return base.href\r\n }\r\n\r\n var head = document.getElementsByTagName(\"head\")[0]\r\n head.insertBefore(base, head.firstChild)\r\n\r\n var a = document.createElement(\"a\")\r\n var resolved\r\n\r\n for (var index = 1; index < numUrls; index++) {\r\n a.href = arguments[index]\r\n resolved = a.href\r\n base.href = resolved\r\n }\r\n\r\n head.removeChild(base)\r\n\r\n return resolved\r\n }\r\n\r\n return resolveUrl\r\n\r\n}));\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(352);\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WebShark NG 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web/polyfills.15a95d4491047316.js: -------------------------------------------------------------------------------- 1 | "use strict";(self.webpackChunkwebshark=self.webpackChunkwebshark||[]).push([[429],{332:()=>{!function(e){const n=e.performance;function s(j){n&&n.mark&&n.mark(j)}function r(j,h){n&&n.measure&&n.measure(j,h)}s("Zone");const i=e.__Zone_symbol_prefix||"__zone_symbol__";function l(j){return i+j}const p=!0===e[l("forceDuplicateZoneCheck")];if(e.Zone){if(p||"function"!=typeof e.Zone.__symbol__)throw new Error("Zone already loaded.");return e.Zone}let E=(()=>{class h{static assertZonePatched(){if(e.Promise!==oe.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=h.current;for(;t.parent;)t=t.parent;return t}static get current(){return W.zone}static get currentTask(){return re}static __load_patch(t,_,P=!1){if(oe.hasOwnProperty(t)){if(!P&&p)throw Error("Already loaded patch: "+t)}else if(!e["__Zone_disable_"+t]){const L="Zone:"+t;s(L),oe[t]=_(e,h,Y),r(L,L)}}get parent(){return this._parent}get name(){return this._name}constructor(t,_){this._parent=t,this._name=_?_.name||"unnamed":"",this._properties=_&&_.properties||{},this._zoneDelegate=new v(this,this._parent&&this._parent._zoneDelegate,_)}get(t){const _=this.getZoneWith(t);if(_)return _._properties[t]}getZoneWith(t){let _=this;for(;_;){if(_._properties.hasOwnProperty(t))return _;_=_._parent}return null}fork(t){if(!t)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,t)}wrap(t,_){if("function"!=typeof t)throw new Error("Expecting function got: "+t);const P=this._zoneDelegate.intercept(this,t,_),L=this;return function(){return L.runGuarded(P,this,arguments,_)}}run(t,_,P,L){W={parent:W,zone:this};try{return this._zoneDelegate.invoke(this,t,_,P,L)}finally{W=W.parent}}runGuarded(t,_=null,P,L){W={parent:W,zone:this};try{try{return this._zoneDelegate.invoke(this,t,_,P,L)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{W=W.parent}}runTask(t,_,P){if(t.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(t.zone||J).name+"; Execution: "+this.name+")");if(t.state===G&&(t.type===Q||t.type===w))return;const L=t.state!=y;L&&t._transitionTo(y,A),t.runCount++;const a=re;re=t,W={parent:W,zone:this};try{t.type==w&&t.data&&!t.data.isPeriodic&&(t.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,t,_,P)}catch(u){if(this._zoneDelegate.handleError(this,u))throw u}}finally{t.state!==G&&t.state!==d&&(t.type==Q||t.data&&t.data.isPeriodic?L&&t._transitionTo(A,y):(t.runCount=0,this._updateTaskCount(t,-1),L&&t._transitionTo(G,y,G))),W=W.parent,re=a}}scheduleTask(t){if(t.zone&&t.zone!==this){let P=this;for(;P;){if(P===t.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${t.zone.name}`);P=P.parent}}t._transitionTo(z,G);const _=[];t._zoneDelegates=_,t._zone=this;try{t=this._zoneDelegate.scheduleTask(this,t)}catch(P){throw t._transitionTo(d,z,G),this._zoneDelegate.handleError(this,P),P}return t._zoneDelegates===_&&this._updateTaskCount(t,1),t.state==z&&t._transitionTo(A,z),t}scheduleMicroTask(t,_,P,L){return this.scheduleTask(new m(I,t,_,P,L,void 0))}scheduleMacroTask(t,_,P,L,a){return this.scheduleTask(new m(w,t,_,P,L,a))}scheduleEventTask(t,_,P,L,a){return this.scheduleTask(new m(Q,t,_,P,L,a))}cancelTask(t){if(t.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(t.zone||J).name+"; Execution: "+this.name+")");if(t.state===A||t.state===y){t._transitionTo(V,A,y);try{this._zoneDelegate.cancelTask(this,t)}catch(_){throw t._transitionTo(d,V),this._zoneDelegate.handleError(this,_),_}return this._updateTaskCount(t,-1),t._transitionTo(G,V),t.runCount=0,t}}_updateTaskCount(t,_){const P=t._zoneDelegates;-1==_&&(t._zoneDelegates=null);for(let L=0;Lj.hasTask(c,t),onScheduleTask:(j,h,c,t)=>j.scheduleTask(c,t),onInvokeTask:(j,h,c,t,_,P)=>j.invokeTask(c,t,_,P),onCancelTask:(j,h,c,t)=>j.cancelTask(c,t)};class v{constructor(h,c,t){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=h,this._parentDelegate=c,this._forkZS=t&&(t&&t.onFork?t:c._forkZS),this._forkDlgt=t&&(t.onFork?c:c._forkDlgt),this._forkCurrZone=t&&(t.onFork?this.zone:c._forkCurrZone),this._interceptZS=t&&(t.onIntercept?t:c._interceptZS),this._interceptDlgt=t&&(t.onIntercept?c:c._interceptDlgt),this._interceptCurrZone=t&&(t.onIntercept?this.zone:c._interceptCurrZone),this._invokeZS=t&&(t.onInvoke?t:c._invokeZS),this._invokeDlgt=t&&(t.onInvoke?c:c._invokeDlgt),this._invokeCurrZone=t&&(t.onInvoke?this.zone:c._invokeCurrZone),this._handleErrorZS=t&&(t.onHandleError?t:c._handleErrorZS),this._handleErrorDlgt=t&&(t.onHandleError?c:c._handleErrorDlgt),this._handleErrorCurrZone=t&&(t.onHandleError?this.zone:c._handleErrorCurrZone),this._scheduleTaskZS=t&&(t.onScheduleTask?t:c._scheduleTaskZS),this._scheduleTaskDlgt=t&&(t.onScheduleTask?c:c._scheduleTaskDlgt),this._scheduleTaskCurrZone=t&&(t.onScheduleTask?this.zone:c._scheduleTaskCurrZone),this._invokeTaskZS=t&&(t.onInvokeTask?t:c._invokeTaskZS),this._invokeTaskDlgt=t&&(t.onInvokeTask?c:c._invokeTaskDlgt),this._invokeTaskCurrZone=t&&(t.onInvokeTask?this.zone:c._invokeTaskCurrZone),this._cancelTaskZS=t&&(t.onCancelTask?t:c._cancelTaskZS),this._cancelTaskDlgt=t&&(t.onCancelTask?c:c._cancelTaskDlgt),this._cancelTaskCurrZone=t&&(t.onCancelTask?this.zone:c._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const _=t&&t.onHasTask;(_||c&&c._hasTaskZS)&&(this._hasTaskZS=_?t:b,this._hasTaskDlgt=c,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=h,t.onScheduleTask||(this._scheduleTaskZS=b,this._scheduleTaskDlgt=c,this._scheduleTaskCurrZone=this.zone),t.onInvokeTask||(this._invokeTaskZS=b,this._invokeTaskDlgt=c,this._invokeTaskCurrZone=this.zone),t.onCancelTask||(this._cancelTaskZS=b,this._cancelTaskDlgt=c,this._cancelTaskCurrZone=this.zone))}fork(h,c){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,h,c):new E(h,c)}intercept(h,c,t){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,h,c,t):c}invoke(h,c,t,_,P){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,h,c,t,_,P):c.apply(t,_)}handleError(h,c){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,h,c)}scheduleTask(h,c){let t=c;if(this._scheduleTaskZS)this._hasTaskZS&&t._zoneDelegates.push(this._hasTaskDlgtOwner),t=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,h,c),t||(t=c);else if(c.scheduleFn)c.scheduleFn(c);else{if(c.type!=I)throw new Error("Task is missing scheduleFn.");C(c)}return t}invokeTask(h,c,t,_){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,h,c,t,_):c.callback.apply(t,_)}cancelTask(h,c){let t;if(this._cancelTaskZS)t=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,h,c);else{if(!c.cancelFn)throw Error("Task is not cancelable");t=c.cancelFn(c)}return t}hasTask(h,c){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,h,c)}catch(t){this.handleError(h,t)}}_updateTaskCount(h,c){const t=this._taskCounts,_=t[h],P=t[h]=_+c;if(P<0)throw new Error("More tasks executed then were scheduled.");0!=_&&0!=P||this.hasTask(this.zone,{microTask:t.microTask>0,macroTask:t.macroTask>0,eventTask:t.eventTask>0,change:h})}}class m{constructor(h,c,t,_,P,L){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=h,this.source=c,this.data=_,this.scheduleFn=P,this.cancelFn=L,!t)throw new Error("callback is not defined");this.callback=t;const a=this;this.invoke=h===Q&&_&&_.useG?m.invokeTask:function(){return m.invokeTask.call(e,a,this,arguments)}}static invokeTask(h,c,t){h||(h=this),ee++;try{return h.runCount++,h.zone.runTask(h,c,t)}finally{1==ee&&T(),ee--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(G,z)}_transitionTo(h,c,t){if(this._state!==c&&this._state!==t)throw new Error(`${this.type} '${this.source}': can not transition to '${h}', expecting state '${c}'${t?" or '"+t+"'":""}, was '${this._state}'.`);this._state=h,h==G&&(this._zoneDelegates=null)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const M=l("setTimeout"),O=l("Promise"),N=l("then");let K,U=[],x=!1;function X(j){if(K||e[O]&&(K=e[O].resolve(0)),K){let h=K[N];h||(h=K.then),h.call(K,j)}else e[M](j,0)}function C(j){0===ee&&0===U.length&&X(T),j&&U.push(j)}function T(){if(!x){for(x=!0;U.length;){const j=U;U=[];for(let h=0;hW,onUnhandledError:q,microtaskDrainDone:q,scheduleMicroTask:C,showUncaughtError:()=>!E[l("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:q,patchMethod:()=>q,bindArguments:()=>[],patchThen:()=>q,patchMacroTask:()=>q,patchEventPrototype:()=>q,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>q,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>q,wrapWithCurrentZone:()=>q,filterProperties:()=>[],attachOriginToPatched:()=>q,_redefineProperty:()=>q,patchCallbacks:()=>q,nativeScheduleMicroTask:X};let W={parent:null,zone:new E(null,null)},re=null,ee=0;function q(){}r("Zone","Zone"),e.Zone=E}(typeof window<"u"&&window||typeof self<"u"&&self||global);const ue=Object.getOwnPropertyDescriptor,pe=Object.defineProperty,ve=Object.getPrototypeOf,Se=Object.create,it=Array.prototype.slice,Ze="addEventListener",De="removeEventListener",Oe=Zone.__symbol__(Ze),Ne=Zone.__symbol__(De),ie="true",ce="false",me=Zone.__symbol__("");function Ie(e,n){return Zone.current.wrap(e,n)}function Me(e,n,s,r,i){return Zone.current.scheduleMacroTask(e,n,s,r,i)}const H=Zone.__symbol__,be=typeof window<"u",_e=be?window:void 0,$=be&&_e||"object"==typeof self&&self||global,ct="removeAttribute";function Le(e,n){for(let s=e.length-1;s>=0;s--)"function"==typeof e[s]&&(e[s]=Ie(e[s],n+"_"+s));return e}function Ve(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&typeof e.set>"u")}const Fe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,we=!("nw"in $)&&typeof $.process<"u"&&"[object process]"==={}.toString.call($.process),Ae=!we&&!Fe&&!(!be||!_e.HTMLElement),Be=typeof $.process<"u"&&"[object process]"==={}.toString.call($.process)&&!Fe&&!(!be||!_e.HTMLElement),Pe={},Ue=function(e){if(!(e=e||$.event))return;let n=Pe[e.type];n||(n=Pe[e.type]=H("ON_PROPERTY"+e.type));const s=this||e.target||$,r=s[n];let i;return Ae&&s===_e&&"error"===e.type?(i=r&&r.call(this,e.message,e.filename,e.lineno,e.colno,e.error),!0===i&&e.preventDefault()):(i=r&&r.apply(this,arguments),null!=i&&!i&&e.preventDefault()),i};function We(e,n,s){let r=ue(e,n);if(!r&&s&&ue(s,n)&&(r={enumerable:!0,configurable:!0}),!r||!r.configurable)return;const i=H("on"+n+"patched");if(e.hasOwnProperty(i)&&e[i])return;delete r.writable,delete r.value;const l=r.get,p=r.set,E=n.slice(2);let b=Pe[E];b||(b=Pe[E]=H("ON_PROPERTY"+E)),r.set=function(v){let m=this;!m&&e===$&&(m=$),m&&("function"==typeof m[b]&&m.removeEventListener(E,Ue),p&&p.call(m,null),m[b]=v,"function"==typeof v&&m.addEventListener(E,Ue,!1))},r.get=function(){let v=this;if(!v&&e===$&&(v=$),!v)return null;const m=v[b];if(m)return m;if(l){let M=l.call(this);if(M)return r.set.call(this,M),"function"==typeof v[ct]&&v.removeAttribute(n),M}return null},pe(e,n,r),e[i]=!0}function qe(e,n,s){if(n)for(let r=0;rfunction(p,E){const b=s(p,E);return b.cbIdx>=0&&"function"==typeof E[b.cbIdx]?Me(b.name,E[b.cbIdx],b,i):l.apply(p,E)})}function le(e,n){e[H("OriginalDelegate")]=n}let Xe=!1,je=!1;function ft(){if(Xe)return je;Xe=!0;try{const e=_e.navigator.userAgent;(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/")||-1!==e.indexOf("Edge/"))&&(je=!0)}catch{}return je}Zone.__load_patch("ZoneAwarePromise",(e,n,s)=>{const r=Object.getOwnPropertyDescriptor,i=Object.defineProperty,p=s.symbol,E=[],b=!0===e[p("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],v=p("Promise"),m=p("then"),M="__creationTrace__";s.onUnhandledError=a=>{if(s.showUncaughtError()){const u=a&&a.rejection;u?console.error("Unhandled Promise rejection:",u instanceof Error?u.message:u,"; Zone:",a.zone.name,"; Task:",a.task&&a.task.source,"; Value:",u,u instanceof Error?u.stack:void 0):console.error(a)}},s.microtaskDrainDone=()=>{for(;E.length;){const a=E.shift();try{a.zone.runGuarded(()=>{throw a.throwOriginal?a.rejection:a})}catch(u){N(u)}}};const O=p("unhandledPromiseRejectionHandler");function N(a){s.onUnhandledError(a);try{const u=n[O];"function"==typeof u&&u.call(this,a)}catch{}}function U(a){return a&&a.then}function x(a){return a}function K(a){return c.reject(a)}const X=p("state"),C=p("value"),T=p("finally"),J=p("parentPromiseValue"),G=p("parentPromiseState"),z="Promise.then",A=null,y=!0,V=!1,d=0;function I(a,u){return o=>{try{Y(a,u,o)}catch(f){Y(a,!1,f)}}}const w=function(){let a=!1;return function(o){return function(){a||(a=!0,o.apply(null,arguments))}}},Q="Promise resolved with itself",oe=p("currentTaskTrace");function Y(a,u,o){const f=w();if(a===o)throw new TypeError(Q);if(a[X]===A){let k=null;try{("object"==typeof o||"function"==typeof o)&&(k=o&&o.then)}catch(R){return f(()=>{Y(a,!1,R)})(),a}if(u!==V&&o instanceof c&&o.hasOwnProperty(X)&&o.hasOwnProperty(C)&&o[X]!==A)re(o),Y(a,o[X],o[C]);else if(u!==V&&"function"==typeof k)try{k.call(o,f(I(a,u)),f(I(a,!1)))}catch(R){f(()=>{Y(a,!1,R)})()}else{a[X]=u;const R=a[C];if(a[C]=o,a[T]===T&&u===y&&(a[X]=a[G],a[C]=a[J]),u===V&&o instanceof Error){const g=n.currentTask&&n.currentTask.data&&n.currentTask.data[M];g&&i(o,oe,{configurable:!0,enumerable:!1,writable:!0,value:g})}for(let g=0;g{try{const S=a[C],Z=!!o&&T===o[T];Z&&(o[J]=S,o[G]=R);const D=u.run(g,void 0,Z&&g!==K&&g!==x?[]:[S]);Y(o,!0,D)}catch(S){Y(o,!1,S)}},o)}const j=function(){},h=e.AggregateError;class c{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(u){return Y(new this(null),y,u)}static reject(u){return Y(new this(null),V,u)}static any(u){if(!u||"function"!=typeof u[Symbol.iterator])return Promise.reject(new h([],"All promises were rejected"));const o=[];let f=0;try{for(let g of u)f++,o.push(c.resolve(g))}catch{return Promise.reject(new h([],"All promises were rejected"))}if(0===f)return Promise.reject(new h([],"All promises were rejected"));let k=!1;const R=[];return new c((g,S)=>{for(let Z=0;Z{k||(k=!0,g(D))},D=>{R.push(D),f--,0===f&&(k=!0,S(new h(R,"All promises were rejected")))})})}static race(u){let o,f,k=new this((S,Z)=>{o=S,f=Z});function R(S){o(S)}function g(S){f(S)}for(let S of u)U(S)||(S=this.resolve(S)),S.then(R,g);return k}static all(u){return c.allWithCallback(u)}static allSettled(u){return(this&&this.prototype instanceof c?this:c).allWithCallback(u,{thenCallback:f=>({status:"fulfilled",value:f}),errorCallback:f=>({status:"rejected",reason:f})})}static allWithCallback(u,o){let f,k,R=new this((D,F)=>{f=D,k=F}),g=2,S=0;const Z=[];for(let D of u){U(D)||(D=this.resolve(D));const F=S;try{D.then(B=>{Z[F]=o?o.thenCallback(B):B,g--,0===g&&f(Z)},B=>{o?(Z[F]=o.errorCallback(B),g--,0===g&&f(Z)):k(B)})}catch(B){k(B)}g++,S++}return g-=2,0===g&&f(Z),R}constructor(u){const o=this;if(!(o instanceof c))throw new Error("Must be an instanceof Promise.");o[X]=A,o[C]=[];try{const f=w();u&&u(f(I(o,y)),f(I(o,V)))}catch(f){Y(o,!1,f)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return c}then(u,o){let f=this.constructor?.[Symbol.species];(!f||"function"!=typeof f)&&(f=this.constructor||c);const k=new f(j),R=n.current;return this[X]==A?this[C].push(R,k,u,o):ee(this,R,k,u,o),k}catch(u){return this.then(null,u)}finally(u){let o=this.constructor?.[Symbol.species];(!o||"function"!=typeof o)&&(o=c);const f=new o(j);f[T]=T;const k=n.current;return this[X]==A?this[C].push(k,f,u,u):ee(this,k,f,u,u),f}}c.resolve=c.resolve,c.reject=c.reject,c.race=c.race,c.all=c.all;const t=e[v]=e.Promise;e.Promise=c;const _=p("thenPatched");function P(a){const u=a.prototype,o=r(u,"then");if(o&&(!1===o.writable||!o.configurable))return;const f=u.then;u[m]=f,a.prototype.then=function(k,R){return new c((S,Z)=>{f.call(this,S,Z)}).then(k,R)},a[_]=!0}return s.patchThen=P,t&&(P(t),ae(e,"fetch",a=>function L(a){return function(u,o){let f=a.apply(u,o);if(f instanceof c)return f;let k=f.constructor;return k[_]||P(k),f}}(a))),Promise[n.__symbol__("uncaughtPromiseErrors")]=E,c}),Zone.__load_patch("toString",e=>{const n=Function.prototype.toString,s=H("OriginalDelegate"),r=H("Promise"),i=H("Error"),l=function(){if("function"==typeof this){const v=this[s];if(v)return"function"==typeof v?n.call(v):Object.prototype.toString.call(v);if(this===Promise){const m=e[r];if(m)return n.call(m)}if(this===Error){const m=e[i];if(m)return n.call(m)}}return n.call(this)};l[s]=n,Function.prototype.toString=l;const p=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":p.call(this)}});let Ee=!1;if(typeof window<"u")try{const e=Object.defineProperty({},"passive",{get:function(){Ee=!0}});window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch{Ee=!1}const ht={useG:!0},te={},ze={},Ye=new RegExp("^"+me+"(\\w+)(true|false)$"),$e=H("propagationStopped");function Je(e,n){const s=(n?n(e):e)+ce,r=(n?n(e):e)+ie,i=me+s,l=me+r;te[e]={},te[e][ce]=i,te[e][ie]=l}function dt(e,n,s,r){const i=r&&r.add||Ze,l=r&&r.rm||De,p=r&&r.listeners||"eventListeners",E=r&&r.rmAll||"removeAllListeners",b=H(i),v="."+i+":",m="prependListener",M="."+m+":",O=function(C,T,J){if(C.isRemoved)return;const G=C.callback;let z;"object"==typeof G&&G.handleEvent&&(C.callback=y=>G.handleEvent(y),C.originalDelegate=G);try{C.invoke(C,T,[J])}catch(y){z=y}const A=C.options;return A&&"object"==typeof A&&A.once&&T[l].call(T,J.type,C.originalDelegate?C.originalDelegate:C.callback,A),z};function N(C,T,J){if(!(T=T||e.event))return;const G=C||T.target||e,z=G[te[T.type][J?ie:ce]];if(z){const A=[];if(1===z.length){const y=O(z[0],G,T);y&&A.push(y)}else{const y=z.slice();for(let V=0;V{throw V})}}}const U=function(C){return N(this,C,!1)},x=function(C){return N(this,C,!0)};function K(C,T){if(!C)return!1;let J=!0;T&&void 0!==T.useG&&(J=T.useG);const G=T&&T.vh;let z=!0;T&&void 0!==T.chkDup&&(z=T.chkDup);let A=!1;T&&void 0!==T.rt&&(A=T.rt);let y=C;for(;y&&!y.hasOwnProperty(i);)y=ve(y);if(!y&&C[i]&&(y=C),!y||y[b])return!1;const V=T&&T.eventNameToString,d={},I=y[b]=y[i],w=y[H(l)]=y[l],Q=y[H(p)]=y[p],oe=y[H(E)]=y[E];let Y;T&&T.prepend&&(Y=y[H(T.prepend)]=y[T.prepend]);const c=J?function(o){if(!d.isExisting)return I.call(d.target,d.eventName,d.capture?x:U,d.options)}:function(o){return I.call(d.target,d.eventName,o.invoke,d.options)},t=J?function(o){if(!o.isRemoved){const f=te[o.eventName];let k;f&&(k=f[o.capture?ie:ce]);const R=k&&o.target[k];if(R)for(let g=0;gfunction(i,l){i[$e]=!0,r&&r.apply(i,l)})}function Et(e,n,s,r,i){const l=Zone.__symbol__(r);if(n[l])return;const p=n[l]=n[r];n[r]=function(E,b,v){return b&&b.prototype&&i.forEach(function(m){const M=`${s}.${r}::`+m,O=b.prototype;try{if(O.hasOwnProperty(m)){const N=e.ObjectGetOwnPropertyDescriptor(O,m);N&&N.value?(N.value=e.wrapWithCurrentZone(N.value,M),e._redefineProperty(b.prototype,m,N)):O[m]&&(O[m]=e.wrapWithCurrentZone(O[m],M))}else O[m]&&(O[m]=e.wrapWithCurrentZone(O[m],M))}catch{}}),p.call(n,E,b,v)},e.attachOriginToPatched(n[r],p)}function Qe(e,n,s){if(!s||0===s.length)return n;const r=s.filter(l=>l.target===e);if(!r||0===r.length)return n;const i=r[0].ignoreProperties;return n.filter(l=>-1===i.indexOf(l))}function et(e,n,s,r){e&&qe(e,Qe(e,n,s),r)}function He(e){return Object.getOwnPropertyNames(e).filter(n=>n.startsWith("on")&&n.length>2).map(n=>n.substring(2))}Zone.__load_patch("util",(e,n,s)=>{const r=He(e);s.patchOnProperties=qe,s.patchMethod=ae,s.bindArguments=Le,s.patchMacroTask=lt;const i=n.__symbol__("BLACK_LISTED_EVENTS"),l=n.__symbol__("UNPATCHED_EVENTS");e[l]&&(e[i]=e[l]),e[i]&&(n[i]=n[l]=e[i]),s.patchEventPrototype=_t,s.patchEventTarget=dt,s.isIEOrEdge=ft,s.ObjectDefineProperty=pe,s.ObjectGetOwnPropertyDescriptor=ue,s.ObjectCreate=Se,s.ArraySlice=it,s.patchClass=ge,s.wrapWithCurrentZone=Ie,s.filterProperties=Qe,s.attachOriginToPatched=le,s._redefineProperty=Object.defineProperty,s.patchCallbacks=Et,s.getGlobalObjects=()=>({globalSources:ze,zoneSymbolEventNames:te,eventNames:r,isBrowser:Ae,isMix:Be,isNode:we,TRUE_STR:ie,FALSE_STR:ce,ZONE_SYMBOL_PREFIX:me,ADD_EVENT_LISTENER_STR:Ze,REMOVE_EVENT_LISTENER_STR:De})});const Re=H("zoneTask");function Te(e,n,s,r){let i=null,l=null;s+=r;const p={};function E(v){const m=v.data;return m.args[0]=function(){return v.invoke.apply(this,arguments)},m.handleId=i.apply(e,m.args),v}function b(v){return l.call(e,v.data.handleId)}i=ae(e,n+=r,v=>function(m,M){if("function"==typeof M[0]){const O={isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?M[1]||0:void 0,args:M},N=M[0];M[0]=function(){try{return N.apply(this,arguments)}finally{O.isPeriodic||("number"==typeof O.handleId?delete p[O.handleId]:O.handleId&&(O.handleId[Re]=null))}};const U=Me(n,M[0],O,E,b);if(!U)return U;const x=U.data.handleId;return"number"==typeof x?p[x]=U:x&&(x[Re]=U),x&&x.ref&&x.unref&&"function"==typeof x.ref&&"function"==typeof x.unref&&(U.ref=x.ref.bind(x),U.unref=x.unref.bind(x)),"number"==typeof x||x?x:U}return v.apply(e,M)}),l=ae(e,s,v=>function(m,M){const O=M[0];let N;"number"==typeof O?N=p[O]:(N=O&&O[Re],N||(N=O)),N&&"string"==typeof N.type?"notScheduled"!==N.state&&(N.cancelFn&&N.data.isPeriodic||0===N.runCount)&&("number"==typeof O?delete p[O]:O&&(O[Re]=null),N.zone.cancelTask(N)):v.apply(e,M)})}Zone.__load_patch("legacy",e=>{const n=e[Zone.__symbol__("legacyPatch")];n&&n()}),Zone.__load_patch("timers",e=>{const n="set",s="clear";Te(e,n,s,"Timeout"),Te(e,n,s,"Interval"),Te(e,n,s,"Immediate")}),Zone.__load_patch("requestAnimationFrame",e=>{Te(e,"request","cancel","AnimationFrame"),Te(e,"mozRequest","mozCancel","AnimationFrame"),Te(e,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",(e,n)=>{const s=["alert","prompt","confirm"];for(let r=0;rfunction(b,v){return n.current.run(l,e,v,E)})}),Zone.__load_patch("EventTarget",(e,n,s)=>{(function gt(e,n){n.patchEventPrototype(e,n)})(e,s),function mt(e,n){if(Zone[n.symbol("patchEventTarget")])return;const{eventNames:s,zoneSymbolEventNames:r,TRUE_STR:i,FALSE_STR:l,ZONE_SYMBOL_PREFIX:p}=n.getGlobalObjects();for(let b=0;b{ge("MutationObserver"),ge("WebKitMutationObserver")}),Zone.__load_patch("IntersectionObserver",(e,n,s)=>{ge("IntersectionObserver")}),Zone.__load_patch("FileReader",(e,n,s)=>{ge("FileReader")}),Zone.__load_patch("on_property",(e,n,s)=>{!function Tt(e,n){if(we&&!Be||Zone[e.symbol("patchEvents")])return;const s=n.__Zone_ignore_on_properties;let r=[];if(Ae){const i=window;r=r.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const l=function ut(){try{const e=_e.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch{}return!1}()?[{target:i,ignoreProperties:["error"]}]:[];et(i,He(i),s&&s.concat(l),ve(i))}r=r.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let i=0;i{!function pt(e,n){const{isBrowser:s,isMix:r}=n.getGlobalObjects();(s||r)&&e.customElements&&"customElements"in e&&n.patchCallbacks(n,e.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])}(e,s)}),Zone.__load_patch("XHR",(e,n)=>{!function b(v){const m=v.XMLHttpRequest;if(!m)return;const M=m.prototype;let N=M[Oe],U=M[Ne];if(!N){const d=v.XMLHttpRequestEventTarget;if(d){const I=d.prototype;N=I[Oe],U=I[Ne]}}const x="readystatechange",K="scheduled";function X(d){const I=d.data,w=I.target;w[l]=!1,w[E]=!1;const Q=w[i];N||(N=w[Oe],U=w[Ne]),Q&&U.call(w,x,Q);const oe=w[i]=()=>{if(w.readyState===w.DONE)if(!I.aborted&&w[l]&&d.state===K){const W=w[n.__symbol__("loadfalse")];if(0!==w.status&&W&&W.length>0){const re=d.invoke;d.invoke=function(){const ee=w[n.__symbol__("loadfalse")];for(let q=0;qfunction(d,I){return d[r]=0==I[2],d[p]=I[1],J.apply(d,I)}),z=H("fetchTaskAborting"),A=H("fetchTaskScheduling"),y=ae(M,"send",()=>function(d,I){if(!0===n.current[A]||d[r])return y.apply(d,I);{const w={target:d,url:d[p],isPeriodic:!1,args:I,aborted:!1},Q=Me("XMLHttpRequest.send",C,w,X,T);d&&!0===d[E]&&!w.aborted&&Q.state===K&&Q.invoke()}}),V=ae(M,"abort",()=>function(d,I){const w=function O(d){return d[s]}(d);if(w&&"string"==typeof w.type){if(null==w.cancelFn||w.data&&w.data.aborted)return;w.zone.cancelTask(w)}else if(!0===n.current[z])return V.apply(d,I)})}(e);const s=H("xhrTask"),r=H("xhrSync"),i=H("xhrListener"),l=H("xhrScheduled"),p=H("xhrURL"),E=H("xhrErrorBeforeScheduled")}),Zone.__load_patch("geolocation",e=>{e.navigator&&e.navigator.geolocation&&function at(e,n){const s=e.constructor.name;for(let r=0;r{const b=function(){return E.apply(this,Le(arguments,s+"."+i))};return le(b,E),b})(l)}}}(e.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",(e,n)=>{function s(r){return function(i){Ke(e,r).forEach(p=>{const E=e.PromiseRejectionEvent;if(E){const b=new E(r,{promise:i.promise,reason:i.rejection});p.invoke(b)}})}}e.PromiseRejectionEvent&&(n[H("unhandledPromiseRejectionHandler")]=s("unhandledrejection"),n[H("rejectionHandledHandler")]=s("rejectionhandled"))}),Zone.__load_patch("queueMicrotask",(e,n,s)=>{!function yt(e,n){n.patchMethod(e,"queueMicrotask",s=>function(r,i){Zone.current.scheduleMicroTask("queueMicrotask",i[0])})}(e,s)})}},ue=>{ue(ue.s=332)}]); -------------------------------------------------------------------------------- /web/runtime.d0d456b5f3cc9e30.js: -------------------------------------------------------------------------------- 1 | (()=>{"use strict";var e,i={},h={};function n(e){var l=h[e];if(void 0!==l)return l.exports;var r=h[e]={exports:{}};return i[e](r,r.exports,n),r.exports}n.m=i,e=[],n.O=(l,r,o,f)=>{if(!r){var c=1/0;for(a=0;a=f)&&Object.keys(n.O).every(d=>n.O[d](r[s]))?r.splice(s--,1):(t=!1,f0&&e[a-1][2]>f;a--)e[a]=e[a-1];e[a]=[r,o,f]},n.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),(()=>{var e={666:0};n.O.j=o=>0===e[o];var l=(o,f)=>{var s,u,[a,c,t]=f,v=0;if(a.some(b=>0!==e[b])){for(s in c)n.o(c,s)&&(n.m[s]=c[s]);if(t)var _=t(n)}for(o&&o(f);v"u"){async function T(g){if("only-if-cached"===g.cache&&"same-origin"!==g.mode)return;"no-cors"===g.mode&&(g=new Request(g.url,{cache:g.cache,credentials:"omit",headers:g.headers,integrity:g.integrity,destination:g.destination,keepalive:g.keepalive,method:g.method,mode:g.mode,redirect:g.redirect,referrer:g.referrer,referrerPolicy:g.referrerPolicy,signal:g.signal}));let p=await fetch(g).catch(r=>console.error(r));if(0===p.status)return p;const m=new Headers(p.headers);return m.set("Cross-Origin-Embedder-Policy","credentialless"),m.set("Cross-Origin-Opener-Policy","same-origin"),new Response(p.body,{status:p.status,statusText:p.statusText,headers:m})}self.addEventListener("install",()=>self.skipWaiting()),self.addEventListener("activate",g=>g.waitUntil(self.clients.claim())),self.addEventListener("fetch",function(g){g.respondWith(T(g.request))})}else!async function(){if(!1!==window.crossOriginIsolated)return;let T=await navigator.serviceWorker.register(window.document.currentScript.src).catch(g=>console.error("COOP/COEP Service Worker failed to register:",g));T&&(console.log("COOP/COEP Service Worker registered",T.scope),T.addEventListener("updatefound",()=>{console.log("Reloading page to make use of updated COOP/COEP Service Worker."),window.location.reload()}),T.active&&!navigator.serviceWorker.controller&&(console.log("Reloading page to make use of COOP/COEP Service Worker."),window.location.reload()))}();(function(T,g){"object"==typeof exports&&"object"==typeof module?module.exports=g():"function"==typeof define&&define.amd?define([],g):"object"==typeof exports?exports.FFmpeg=g():T.FFmpeg=g()})(self,function(){return T={497:(p,m,r)=>{var s=r(72),F=r(306).devDependencies;p.exports={corePath:typeof process<"u"&&"development"===process.env.FFMPEG_ENV?s("/node_modules/@ffmpeg/core/dist/ffmpeg-core.js"):"https://unpkg.com/@ffmpeg/core@".concat(F["@ffmpeg/core"].substring(1),"/dist/ffmpeg-core.js")}},663:(p,m,r)=>{function s(c,O,d,f,u,k,n){try{var E=c[k](n),y=E.value}catch(b){return void d(b)}E.done?O(y):Promise.resolve(y).then(f,u)}var c,O,F=r(72),h=function(c){return new Promise(function(O,d){var f=new FileReader;f.onload=function(){O(f.result)},f.onerror=function(u){d(Error("File could not be read! Code=".concat(u.target.error.code)))},f.readAsArrayBuffer(c)})};p.exports=(c=regeneratorRuntime.mark(function d(f){var u,k;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(u=f,void 0!==f){n.next=3;break}return n.abrupt("return",new Uint8Array);case 3:if("string"!=typeof f){n.next=16;break}if(!/data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(f)){n.next=8;break}u=atob(f.split(",")[1]).split("").map(function(E){return E.charCodeAt(0)}),n.next=14;break;case 8:return n.next=10,fetch(F(f));case 10:return k=n.sent,n.next=13,k.arrayBuffer();case 13:u=n.sent;case 14:n.next=20;break;case 16:if(!(f instanceof File||f instanceof Blob)){n.next=20;break}return n.next=19,h(f);case 19:u=n.sent;case 20:return n.abrupt("return",new Uint8Array(u));case 21:case"end":return n.stop()}},d)}),O=function(){var d=this,f=arguments;return new Promise(function(u,k){var n=c.apply(d,f);function E(b){s(n,u,k,E,y,"next",b)}function y(b){s(n,u,k,E,y,"throw",b)}E(void 0)})},function(d){return O.apply(this,arguments)})},452:(p,m,r)=>{function s(d,f,u,k,n,E,y){try{var b=d[E](y),j=b.value}catch(L){return void u(L)}b.done?f(j):Promise.resolve(j).then(k,n)}function F(d){return function(){var f=this,u=arguments;return new Promise(function(k,n){var E=d.apply(f,u);function y(j){s(E,k,n,y,b,"next",j)}function b(j){s(E,k,n,y,b,"throw",j)}y(void 0)})}}var d,h=r(72),c=r(185).log,O=(d=F(regeneratorRuntime.mark(function f(u,k){var n,E,y;return regeneratorRuntime.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c("info","fetch ".concat(u)),b.next=3,fetch(u);case 3:return b.next=5,b.sent.arrayBuffer();case 5:return n=b.sent,c("info","".concat(u," file size = ").concat(n.byteLength," bytes")),E=new Blob([n],{type:k}),y=URL.createObjectURL(E),c("info","".concat(u," blob URL = ").concat(y)),b.abrupt("return",y);case 11:case"end":return b.stop()}},f)})),function(f,u){return d.apply(this,arguments)});p.exports=function(){var d=F(regeneratorRuntime.mark(function f(u){var k,n,E,y,b;return regeneratorRuntime.wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if("string"==typeof(k=u.corePath)){j.next=3;break}throw Error("corePath should be a string!");case 3:return n=h(k),j.next=6,O(n,"application/javascript");case 6:return E=j.sent,j.next=9,O(n.replace("ffmpeg-core.js","ffmpeg-core.wasm"),"application/wasm");case 9:return y=j.sent,j.next=12,O(n.replace("ffmpeg-core.js","ffmpeg-core.worker.js"),"application/javascript");case 12:if(b=j.sent,typeof createFFmpegCore<"u"){j.next=15;break}return j.abrupt("return",new Promise(function(L){var U=document.createElement("script");U.src=E,U.type="text/javascript",U.addEventListener("load",function Y(){U.removeEventListener("load",Y),c("info","ffmpeg-core.js script loaded"),L({createFFmpegCore,corePath:E,wasmPath:y,workerPath:b})}),document.getElementsByTagName("head")[0].appendChild(U)}));case 15:return c("info","ffmpeg-core.js script is loaded already"),j.abrupt("return",Promise.resolve({createFFmpegCore,corePath:E,wasmPath:y,workerPath:b}));case 17:case"end":return j.stop()}},f)}));return function(f){return d.apply(this,arguments)}}()},698:(p,m,r)=>{var s=r(497),F=r(452),h=r(663);p.exports={defaultOptions:s,getCreateFFmpegCore:F,fetchFile:h}},500:p=>{p.exports={defaultArgs:["./ffmpeg","-nostdin","-y"],baseOptions:{log:!1,logger:function(){},progress:function(){},corePath:""}}},906:(p,m,r)=>{function s(v){return function(a){if(Array.isArray(a))return F(a)}(v)||function(a){if(typeof Symbol<"u"&&Symbol.iterator in Object(a))return Array.from(a)}(v)||function(a,w){if(a){if("string"==typeof a)return F(a,w);var x=Object.prototype.toString.call(a).slice(8,-1);return"Object"===x&&a.constructor&&(x=a.constructor.name),"Map"===x||"Set"===x?Array.from(a):"Arguments"===x||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(x)?F(a,w):void 0}}(v)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(v,a){(null==a||a>v.length)&&(a=v.length);for(var w=0,x=new Array(a);w0&&void 0!==arguments[0]?arguments[0]:{},a=d(d(d({},E),ee),v),w=a.log,x=a.logger,N=a.progress,D=function u(v,a){if(null==v)return{};var w,x,N=function(S,B){if(null==S)return{};var t,e,o={},l=Object.keys(S);for(e=0;e=0||(o[t]=S[t]);return o}(v,a);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(v);for(x=0;x=0||Object.prototype.propertyIsEnumerable.call(v,w)&&(N[w]=v[w])}return N}(a,["log","logger","progress"]),S=null,B=null,t=null,e=!1,o=N,i=function(A){var C=A.message;L(A.type,C),U(C,o),function(A){"FFMPEG_END"===A&&null!==t&&(t(),t=null,e=!1)}(C)},_=(A=function c(v){return function(){var a=this,w=arguments;return new Promise(function(x,N){var D=v.apply(a,w);function S(t){h(D,x,N,S,B,"next",t)}function B(t){h(D,x,N,S,B,"throw",t)}S(void 0)})}}(regeneratorRuntime.mark(function G(){var C,I,Q,Z,K;return regeneratorRuntime.wrap(function(V){for(;;)switch(V.prev=V.next){case 0:if(L("info","load ffmpeg-core"),null!==S){V.next=17;break}return L("info","loading ffmpeg-core"),V.next=5,te(D);case 5:return I=(C=V.sent).createFFmpegCore,Q=C.corePath,Z=C.workerPath,K=C.wasmPath,V.next=12,I({mainScriptUrlOrBlob:Q,printErr:function(X){return i({type:"fferr",message:X})},print:function(X){return i({type:"ffout",message:X})},locateFile:function(X,re){if(typeof window<"u"){if(void 0!==K&&X.endsWith("ffmpeg-core.wasm"))return K;if(void 0!==Z&&X.endsWith("ffmpeg-core.worker.js"))return Z}return re+X}});case 12:B=(S=V.sent).cwrap("proxy_main","number",["number","number"]),L("info","ffmpeg-core loaded"),V.next=18;break;case 17:throw Error("ffmpeg.wasm was loaded, you should not load it again, use ffmpeg.isLoaded() to check next time.");case 18:case"end":return V.stop()}},G)})),function(){return A.apply(this,arguments)});return b(w),j(x),L("info","use ffmpeg.wasm v".concat(q)),{setProgress:function(A){o=A},setLogger:function(A){j(A)},setLogging:b,load:_,isLoaded:function(){return null!==S},run:function(){for(var A=arguments.length,G=new Array(A),C=0;C1?G-1:0),I=1;I")}).join(" "))),null===S)throw J;var Q=null;try{var Z;Q=(Z=S.FS)[A].apply(Z,C)}catch{throw Error("readdir"===A?"ffmpeg.FS('readdir', '".concat(C[0],"') error. Check if the path exists, ex: ffmpeg.FS('readdir', '/')"):"readFile"===A?"ffmpeg.FS('readFile', '".concat(C[0],"') error. Check if the path exists"):"Oops, something went wrong in FS operation.")}return Q}}}},352:(p,m,r)=>{r(666);var s=r(906),F=r(698).fetchFile;p.exports={createFFmpeg:s,fetchFile:F}},185:p=>{var m=!1,r=function(){};p.exports={logging:m,setLogging:function(s){m=s},setCustomLogger:function(s){r=s},log:function(s,F){r({type:s,message:F}),m&&console.log("[".concat(s,"] ").concat(F))}}},319:p=>{p.exports=function(m,r){var s=m._malloc(r.length*Uint32Array.BYTES_PER_ELEMENT);return r.forEach(function(F,h){var c=m._malloc(F.length+1);m.writeAsciiToMemory(F,c),m.setValue(s+Uint32Array.BYTES_PER_ELEMENT*h,c,"i32")}),[r.length,s]}},583:p=>{function m(h,c){(null==c||c>h.length)&&(c=h.length);for(var O=0,d=new Array(c);Od)&&(r=d)}else if(h.startsWith("frame")||h.startsWith("size")){var f=h.split("time=")[1].split(" ")[0],u=F(f);c({ratio:s=u/r,time:u})}else h.startsWith("video:")&&(c({ratio:1}),r=0)}},666:p=>{var m=function(r){"use strict";var s,F=Object.prototype,h=F.hasOwnProperty,c="function"==typeof Symbol?Symbol:{},O=c.iterator||"@@iterator",d=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function u(t,e,o){return Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch{u=function(e,o,l){return e[o]=l}}function k(t,e,o,l){var M,H,P,W,_=Object.create((e&&e.prototype instanceof U?e:U).prototype),R=new D(l||[]);return _._invoke=(M=t,H=o,P=R,W=E,function(z,A){if(W===b)throw new Error("Generator is already running");if(W===j){if("throw"===z)throw A;return B()}for(P.method=z,P.arg=A;;){var G=P.delegate;if(G){var C=w(G,P);if(C){if(C===L)continue;return C}}if("next"===P.method)P.sent=P._sent=P.arg;else if("throw"===P.method){if(W===E)throw W=j,P.arg;P.dispatchException(P.arg)}else"return"===P.method&&P.abrupt("return",P.arg);W=b;var I=n(M,H,P);if("normal"===I.type){if(W=P.done?j:y,I.arg===L)continue;return{value:I.arg,done:P.done}}"throw"===I.type&&(W=j,P.method="throw",P.arg=I.arg)}}),_}function n(t,e,o){try{return{type:"normal",arg:t.call(e,o)}}catch(l){return{type:"throw",arg:l}}}r.wrap=k;var E="suspendedStart",y="suspendedYield",b="executing",j="completed",L={};function U(){}function Y(){}function $(){}var ee={};ee[O]=function(){return this};var te=Object.getPrototypeOf,q=te&&te(te(S([])));q&&q!==F&&h.call(q,O)&&(ee=q);var J=$.prototype=U.prototype=Object.create(ee);function v(t){["next","throw","return"].forEach(function(e){u(t,e,function(o){return this._invoke(e,o)})})}function a(t,e){function o(i,_,R,M){var H=n(t[i],t,_);if("throw"!==H.type){var P=H.arg,W=P.value;return W&&"object"==typeof W&&h.call(W,"__await")?e.resolve(W.__await).then(function(z){o("next",z,R,M)},function(z){o("throw",z,R,M)}):e.resolve(W).then(function(z){P.value=z,R(P)},function(z){return o("throw",z,R,M)})}M(H.arg)}var l;this._invoke=function(i,_){function R(){return new e(function(M,H){o(i,_,M,H)})}return l=l?l.then(R,R):R()}}function w(t,e){var o=t.iterator[e.method];if(o===s){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=s,w(t,e),"throw"===e.method))return L;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return L}var l=n(o,t.iterator,e.arg);if("throw"===l.type)return e.method="throw",e.arg=l.arg,e.delegate=null,L;var i=l.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=s),e.delegate=null,L):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,L)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function S(t){if(t){var e=t[O];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,l=function i(){for(;++o=0;--l){var i=this.tryEntries[l],_=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var R=h.call(i,"catchLoc"),M=h.call(i,"finallyLoc");if(R&&M){if(this.prev=0;--o){var l=this.tryEntries[o];if(l.tryLoc<=this.prev&&h.call(l,"finallyLoc")&&this.prev=0;--e){var o=this.tryEntries[e];if(o.finallyLoc===t)return this.complete(o.completion,o.afterLoc),N(o),L}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc===t){var l=o.completion;if("throw"===l.type){var i=l.arg;N(o)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,o){return this.delegate={iterator:S(t),resultName:e,nextLoc:o},"next"===this.method&&(this.arg=s),L}},r}(p.exports);try{regeneratorRuntime=m}catch{Function("r","regeneratorRuntime = r")(m)}},72:function(p,m,r){var s,F;void 0===(F="function"==typeof(s=function(){return function(){var h=arguments.length;if(0===h)throw new Error("resolveUrl requires at least one argument; got none.");var c=document.createElement("base");if(c.href=arguments[0],1===h)return c.href;var O=document.getElementsByTagName("head")[0];O.insertBefore(c,O.firstChild);for(var d,f=document.createElement("a"),u=1;u{"use strict";p.exports=JSON.parse('{"name":"@ffmpeg/ffmpeg","version":"0.10.0","description":"FFmpeg WebAssembly version","main":"src/index.js","types":"src/index.d.ts","directories":{"example":"examples"},"scripts":{"start":"node scripts/server.js","build":"rimraf dist && webpack --config scripts/webpack.config.prod.js","prepublishOnly":"npm run build","lint":"eslint src","wait":"rimraf dist && wait-on http://localhost:3000/dist/ffmpeg.dev.js","test":"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser:ffmpeg test:node:all","test:node":"node --experimental-wasm-threads --experimental-wasm-bulk-memory node_modules/.bin/_mocha --exit --bail --require ./scripts/test-helper.js","test:node:all":"npm run test:node -- ./tests/*.test.js","test:browser":"mocha-headless-chrome -a allow-file-access-from-files -a incognito -a no-sandbox -a disable-setuid-sandbox -a disable-logging -t 300000","test:browser:ffmpeg":"npm run test:browser -- -f ./tests/ffmpeg.test.html"},"browser":{"./src/node/index.js":"./src/browser/index.js"},"repository":{"type":"git","url":"git+https://github.com/ffmpegwasm/ffmpeg.wasm.git"},"keywords":["ffmpeg","WebAssembly","video"],"author":"Jerome Wu ","license":"MIT","bugs":{"url":"https://github.com/ffmpegwasm/ffmpeg.wasm/issues"},"engines":{"node":">=12.16.1"},"homepage":"https://github.com/ffmpegwasm/ffmpeg.wasm#readme","dependencies":{"is-url":"^1.2.4","node-fetch":"^2.6.1","regenerator-runtime":"^0.13.7","resolve-url":"^0.2.1"},"devDependencies":{"@babel/core":"^7.12.3","@babel/preset-env":"^7.12.1","@ffmpeg/core":"^0.10.0","@types/emscripten":"^1.39.4","babel-loader":"^8.1.0","chai":"^4.2.0","cors":"^2.8.5","eslint":"^7.12.1","eslint-config-airbnb-base":"^14.1.0","eslint-plugin-import":"^2.22.1","express":"^4.17.1","mocha":"^8.2.1","mocha-headless-chrome":"^2.0.3","npm-run-all":"^4.1.5","wait-on":"^5.3.0","webpack":"^5.3.2","webpack-cli":"^4.1.0","webpack-dev-middleware":"^4.0.0"}}')}},g={},function p(m){if(g[m])return g[m].exports;var r=g[m]={exports:{}};return T[m].call(r.exports,r,r.exports,p),r.exports}(352);var T,g}),self.crossOriginIsolated?console.log("ffmpeg::Ready!"):console.log("COOP/COEP Error! Execution blocked.");const{createFFmpeg,fetchFile}=FFmpeg,ffmpeg=createFFmpeg({log:!0,corePath:"./ffmpeg/ffmpeg-core.js",progress:({ratio:T})=>{message.innerHTML=`Complete: ${(100*T).toFixed(2)}%`}}),transcode=async(T,g,p)=>{try{console.log("Loading ffmpeg-core.js"),ffmpeg.isLoaded()||await ffmpeg.load(),console.log("Start transcoding"),ffmpeg.FS("writeFile","segment.pcap",await fetchFile(T));const m=["-f",g||"g722"];"g722"!=g&&m.push("-ar","8000"),m.push("-i","segment.pcap","-id3v2_version","3",p);const r=await ffmpeg.run(...m);console.log(r),console.log("Complete transcoding");const s=ffmpeg.FS("readFile",p);return URL.createObjectURL(new Blob([s.buffer],{type:"audio/mpeg"}))}catch(m){console.log(m)}}; --------------------------------------------------------------------------------