mirror of
https://github.com/neon443/neon443.github.io.git
synced 2026-11-30 20:54:50 +00:00
forgot that 4 of them were git repos :skull
This commit is contained in:
1 parent
689c1e3167
commit
2a8ef5aec9
149 files changed
+45223
No files matched your search
@@ -0,0 +1,130 @@
|
||||
window.compileEPK = function() {
|
||||
let old = false;
|
||||
|
||||
// https://stackoverflow.com/a/18639903/6917520
|
||||
|
||||
const crc32 = (function() {
|
||||
let table = new Uint32Array(256);
|
||||
|
||||
for (let i = 256; i--;) {
|
||||
let tmp = i;
|
||||
|
||||
for (let k = 8; k--;) {
|
||||
tmp = tmp & 1 ? 3988292384 ^ tmp >>> 1 : tmp >>> 1;
|
||||
}
|
||||
|
||||
table[i] = tmp;
|
||||
}
|
||||
|
||||
return function(data) {
|
||||
let crc = -1;
|
||||
|
||||
for (let i = 0, l = data.length; i < l; i++) {
|
||||
crc = crc >>> 8 ^ table[crc & 255 ^ data[i]];
|
||||
}
|
||||
|
||||
return (crc ^ -1) >>> 0;
|
||||
};
|
||||
})();
|
||||
|
||||
function concatTypedArrays(a, b) {
|
||||
const c = new (a.constructor)(a.length + b.length);
|
||||
c.set(a, 0);
|
||||
c.set(b, a.length);
|
||||
return c;
|
||||
}
|
||||
|
||||
const textEncoder = new TextEncoder();
|
||||
function generateLongArray(num) {
|
||||
return Uint8Array.of((num >>> 56) & 0xFF, (num >>> 48) & 0xFF, (num >>> 40) & 0xFF, (num >>> 32) & 0xFF, (num >>> 24) & 0xFF, (num >>> 16) & 0xFF, (num >>> 8) & 0xFF, num & 0xFF);
|
||||
}
|
||||
function generateIntArray(num) {
|
||||
return Uint8Array.of((num >>> 24) & 0xFF, (num >>> 16) & 0xFF, (num >>> 8) & 0xFF, num & 0xFF);
|
||||
}
|
||||
function generateShortArray(num) {
|
||||
return Uint8Array.of((num >>> 8) & 0xFF, num & 0xFF);
|
||||
}
|
||||
function generateUTF(str) {
|
||||
return concatTypedArrays(generateShortArray(str.length), textEncoder.encode(str));
|
||||
}
|
||||
function generateUTFByte(str) {
|
||||
return concatTypedArrays(Uint8Array.of(str.length), textEncoder.encode(str));
|
||||
}
|
||||
|
||||
let comment = '# eaglercraft package file - generated with ayunWebEPK by ayunami2000';
|
||||
|
||||
let commentNew = '\n\n # Eagler EPK v2.0 (c) $$YEAR$$ Calder Young\n # generated with ayunWebEPK by ayunami2000';
|
||||
|
||||
let baseEPK = textEncoder.encode('EAGPKG!!');
|
||||
|
||||
baseEPK = concatTypedArrays(baseEPK, generateUTF(comment));
|
||||
|
||||
let baseEPKNew = textEncoder.encode('EAGPKG$$');
|
||||
|
||||
baseEPKNew = concatTypedArrays(baseEPKNew, generateUTFByte('ver2.0'));
|
||||
|
||||
baseEPKNew = concatTypedArrays(baseEPKNew, generateUTFByte('my-cool.epk'));
|
||||
|
||||
let currentEPK = null;
|
||||
|
||||
function processFile(name, type, file) {
|
||||
if (old) {
|
||||
currentEPK = currentEPK == null ? generateUTF('<file>') : concatTypedArrays(currentEPK, generateUTF('<file>'));
|
||||
currentEPK = concatTypedArrays(currentEPK, generateUTF(name));
|
||||
currentEPK = concatTypedArrays(currentEPK, new Uint8Array(sha1.arrayBuffer(file.buffer)));
|
||||
currentEPK = concatTypedArrays(currentEPK, generateIntArray(file.byteLength));
|
||||
currentEPK = concatTypedArrays(currentEPK, file);
|
||||
currentEPK = concatTypedArrays(currentEPK, generateUTF('</file>'));
|
||||
} else {
|
||||
currentEPK = concatTypedArrays(currentEPK, textEncoder.encode(type));
|
||||
currentEPK = concatTypedArrays(currentEPK, generateUTFByte(name));
|
||||
currentEPK = concatTypedArrays(currentEPK, generateIntArray(file.byteLength + 5));
|
||||
currentEPK = concatTypedArrays(currentEPK, generateIntArray(crc32(file)));
|
||||
currentEPK = concatTypedArrays(currentEPK, file);
|
||||
currentEPK = concatTypedArrays(currentEPK, textEncoder.encode(':>'));
|
||||
}
|
||||
}
|
||||
|
||||
function wrapItUp(size) {
|
||||
if (old) {
|
||||
currentEPK = concatTypedArrays(currentEPK, generateUTF(' end'));
|
||||
currentEPK = concatTypedArrays(baseEPK, new Uint8Array(pako.deflate(currentEPK, { level: 9 })));
|
||||
} else {
|
||||
let currBaseEPK = baseEPKNew;
|
||||
currBaseEPK = concatTypedArrays(currBaseEPK, generateUTF(commentNew.replace('$$YEAR$$', new Date().getFullYear())));
|
||||
currBaseEPK = concatTypedArrays(currBaseEPK, generateLongArray(Date.now()));
|
||||
currBaseEPK = concatTypedArrays(currBaseEPK, generateIntArray(size + 1));
|
||||
currBaseEPK = concatTypedArrays(currBaseEPK, Uint8Array.of(90));
|
||||
currentEPK = concatTypedArrays(currentEPK, textEncoder.encode('END$'));
|
||||
currentEPK = concatTypedArrays(currBaseEPK, new Uint8Array(pako.deflate(currentEPK, { level: 9 })));
|
||||
currentEPK = concatTypedArrays(currentEPK, textEncoder.encode(':::YEE:>'));
|
||||
}
|
||||
const blob = new Blob([ currentEPK ], { type: 'application/octet-stream' });
|
||||
currentEPK = null;
|
||||
old = false;
|
||||
return blob;
|
||||
}
|
||||
|
||||
return async function(files, oldMode, fileev) {
|
||||
let onfile = function() {};
|
||||
if (fileev != null) {
|
||||
onfile = fileev;
|
||||
}
|
||||
currentEPK = null;
|
||||
old = oldMode;
|
||||
// files is same format as output from decompiler
|
||||
if (!old) {
|
||||
currentEPK = textEncoder.encode('HEAD');
|
||||
currentEPK = concatTypedArrays(currentEPK, generateUTFByte('file-type'));
|
||||
const fileType = 'epk/resources';
|
||||
currentEPK = concatTypedArrays(currentEPK, generateIntArray(fileType.length));
|
||||
currentEPK = concatTypedArrays(currentEPK, textEncoder.encode(fileType));
|
||||
currentEPK = concatTypedArrays(currentEPK, Uint8Array.of(62));
|
||||
}
|
||||
for (const file of files) {
|
||||
processFile(file.name, file.type, new Uint8Array(await file.data.arrayBuffer()));
|
||||
onfile();
|
||||
}
|
||||
return wrapItUp(files.length);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,256 @@
|
||||
window.decompileEPK = function() {
|
||||
let currentOffset = 0;
|
||||
|
||||
let numFiles = 0;
|
||||
|
||||
let onfile = function() {};
|
||||
|
||||
function detectOldHeader(epkData) {
|
||||
const oldHeader = "EAGPKG!!";
|
||||
for (let i = 0; i < oldHeader.length; i++) {
|
||||
if (epkData[i] != oldHeader.charCodeAt(i)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function readASCII(epkData) {
|
||||
const len = read(epkData);
|
||||
let str = "";
|
||||
for (let i = 0; i < len; i++) {
|
||||
str += String.fromCharCode(read(epkData));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function read(epkData) {
|
||||
return epkData[currentOffset++];
|
||||
}
|
||||
|
||||
function skip(num) {
|
||||
currentOffset += num;
|
||||
}
|
||||
|
||||
function loadShort(epkData) {
|
||||
return (read(epkData) << 8) | read(epkData);
|
||||
}
|
||||
|
||||
function loadInt(epkData) {
|
||||
return (read(epkData) << 24) | (read(epkData) << 16) | (read(epkData) << 8) | read(epkData);
|
||||
}
|
||||
|
||||
function readUTF(epkData) {
|
||||
const len = loadShort(epkData);
|
||||
let str = "";
|
||||
for (let i = 0; i < len; i++) {
|
||||
str += String.fromCharCode(read(epkData));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/18639903/6917520
|
||||
|
||||
const crc32 = (function() {
|
||||
let table = new Uint32Array(256);
|
||||
|
||||
for (let i = 256; i--;) {
|
||||
let tmp = i;
|
||||
|
||||
for (let k = 8; k--;) {
|
||||
tmp = tmp & 1 ? 3988292384 ^ tmp >>> 1 : tmp >>> 1;
|
||||
}
|
||||
|
||||
table[i] = tmp;
|
||||
}
|
||||
|
||||
return function(data) {
|
||||
let crc = -1;
|
||||
|
||||
for (let i = 0, l = data.length; i < l; i++) {
|
||||
crc = crc >>> 8 ^ table[crc & 255 ^ data[i]];
|
||||
}
|
||||
|
||||
return (crc ^ -1) >>> 0;
|
||||
};
|
||||
})();
|
||||
|
||||
function decompileOld(epkData) {
|
||||
readUTF(epkData);
|
||||
|
||||
try {
|
||||
let zData = pako.inflate(epkData.slice(currentOffset));
|
||||
currentOffset = 0;
|
||||
return readFilesOld(zData);
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function decompileNew(epkData) {
|
||||
const vers = readASCII(epkData);
|
||||
|
||||
if (!vers.startsWith("ver2.")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
skip(read(epkData));
|
||||
skip(loadShort(epkData));
|
||||
skip(8);
|
||||
|
||||
numFiles = loadInt(epkData);
|
||||
|
||||
const compressionType = String.fromCharCode(read(epkData));
|
||||
|
||||
let zData = epkData.slice(currentOffset);
|
||||
|
||||
if (compressionType == "Z" || compressionType == "G") {
|
||||
try {
|
||||
zData = pako.inflate(zData);
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
} else if (compressionType == "0") {
|
||||
// do nothing
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
currentOffset = 0;
|
||||
|
||||
return readFilesNew(zData);
|
||||
}
|
||||
|
||||
function readFilesOld(data) {
|
||||
let files = [];
|
||||
|
||||
let file;
|
||||
while ((file = readFileOld(data)) != null) {
|
||||
if (file == -1) return null;
|
||||
files.push(file);
|
||||
onfile();
|
||||
}
|
||||
|
||||
onfile = function() {};
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
function readFileOld(data) {
|
||||
const s = readUTF(data);
|
||||
if (s == " end") {
|
||||
return null;
|
||||
} else if (s != "<file>") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const path = readUTF(data);
|
||||
|
||||
skip(20);
|
||||
|
||||
const len = loadInt(data);
|
||||
const blob = new Blob([data.slice(currentOffset, currentOffset + len)]);
|
||||
skip(len);
|
||||
if (readUTF(data) != "</file>") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return {
|
||||
type: "FILE",
|
||||
name: path,
|
||||
data: blob
|
||||
};
|
||||
}
|
||||
|
||||
function readFilesNew(data) {
|
||||
let files = [];
|
||||
|
||||
let file;
|
||||
while ((file = readFileNew(data)) != null) {
|
||||
if (file == -1) return null;
|
||||
files.push(file);
|
||||
onfile();
|
||||
}
|
||||
|
||||
onfile = function() {};
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
function readFileNew(data) {
|
||||
const type = String.fromCharCode(read(data), read(data), read(data), read(data));
|
||||
|
||||
if (numFiles == 0) {
|
||||
if (type != "END$") {
|
||||
return -1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (type == "END$") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const name = readASCII(data);
|
||||
const len = loadInt(data);
|
||||
let blob = null;
|
||||
|
||||
if (type == "FILE") {
|
||||
if (len < 5) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const crc = loadInt(data);
|
||||
const blobBuffer = data.slice(currentOffset, currentOffset + len - 5);
|
||||
skip(len - 5);
|
||||
blob = new Blob([blobBuffer]);
|
||||
|
||||
if (crc != (crc32(blobBuffer) | 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (read(data) != 58) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
blob = new Blob([data.slice(currentOffset, currentOffset + len)]);
|
||||
skip(len);
|
||||
}
|
||||
|
||||
if (read(data) != 62) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
numFiles--;
|
||||
|
||||
return {
|
||||
type: type,
|
||||
name: name,
|
||||
data: blob
|
||||
};
|
||||
}
|
||||
|
||||
return async function(rawBuffer, fileev) {
|
||||
if (fileev != null) {
|
||||
onfile = fileev;
|
||||
}
|
||||
|
||||
let epkData = new Uint8Array(rawBuffer);
|
||||
|
||||
if (detectOldHeader(epkData)) {
|
||||
epkData = epkData.slice(8);
|
||||
return decompileOld(epkData);
|
||||
}
|
||||
|
||||
const header = "EAGPKG$$";
|
||||
for (let i = 0; i < header.length; i++) {
|
||||
if (epkData[i] != header.charCodeAt(i)) return null;
|
||||
}
|
||||
|
||||
const endCode = ":::YEE:>";
|
||||
for (let i = 0; i < endCode.length; i++) {
|
||||
if (epkData[epkData.length - 8 + i] != endCode.charCodeAt(i)) return null;
|
||||
}
|
||||
|
||||
epkData = epkData.slice(8, -8);
|
||||
return decompileNew(epkData);
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2022, ayunami2000
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,8 @@
|
||||
# ayunWebEPK
|
||||
Compile EPK files in your browser!
|
||||
|
||||
Utilizes:
|
||||
- [JSZip](https://github.com/Stuk/jszip)
|
||||
- [pako](https://github.com/nodeca/pako)
|
||||
- [js-sha1](https://github.com/emn178/js-sha1)
|
||||
- [Nunito Font](https://fonts.google.com/specimen/Nunito)
|
||||
@@ -0,0 +1,329 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WebEPK</title>
|
||||
<script src="jszip.min.js"></script>
|
||||
<script src="pako.min.js"></script>
|
||||
<script src="sha1.min.js"></script>
|
||||
<script src="EPKDecompiler.js"></script>
|
||||
<script src="EPKCompiler.js"></script>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
a:not([href]) {
|
||||
display: none;
|
||||
}
|
||||
*, ::file-selector-button {
|
||||
font-family: 'Nunito', sans-serif;
|
||||
}
|
||||
body {
|
||||
background-color: #111111;
|
||||
color: #dddddd;
|
||||
}
|
||||
input[disabled], button[disabled] {
|
||||
opacity: 0.8;
|
||||
}
|
||||
input[type=checkbox] {
|
||||
-webkit-appearance: initial;
|
||||
-moz-appearance: initial;
|
||||
appearance: initial;
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
margin: 0;
|
||||
}
|
||||
input[type=checkbox]:checked {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
input[type=checkbox]:before {
|
||||
content: ':>';
|
||||
text-align: center;
|
||||
color: #dddddd;
|
||||
margin-left: 0.3em;
|
||||
}
|
||||
input[type=checkbox]:checked:before {
|
||||
color: #343434;
|
||||
}
|
||||
input[type=checkbox]:after {
|
||||
content: 'No';
|
||||
color: #dddddd;
|
||||
margin-left: 0.6em;
|
||||
}
|
||||
input[type=checkbox]:checked:after {
|
||||
content: 'Yes';
|
||||
}
|
||||
@supports (-webkit-touch-callout: none) or (background: -webkit-named-image(i)) {
|
||||
input[type=checkbox]:after {
|
||||
content: 'no';
|
||||
}
|
||||
input[type=checkbox]:checked:after {
|
||||
content: 'yes';
|
||||
}
|
||||
}
|
||||
@supports (-moz-appearance: none) {
|
||||
input[type=checkbox]:after {
|
||||
content: 'No.';
|
||||
}
|
||||
input[type=checkbox]:checked:after {
|
||||
content: 'Yes.';
|
||||
}
|
||||
}
|
||||
::file-selector-button, progress, input[type=checkbox], button, select, input[type=text] {
|
||||
background-color: #343434;
|
||||
color: #eeeeee;
|
||||
border: 1px solid #eeeeee;
|
||||
border-radius: 4px;
|
||||
}
|
||||
a, input[type=file] {
|
||||
color: #dddddd;
|
||||
}
|
||||
progress {
|
||||
height: 1em;
|
||||
}
|
||||
progress, ::-webkit-file-upload-button {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
progress[value="0"][max="1"] {
|
||||
display: none;
|
||||
}
|
||||
::-moz-progress-bar {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
::-webkit-progress-value {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
::-webkit-progress-bar {
|
||||
background-color: #343434;
|
||||
border-radius: 4px;
|
||||
}
|
||||
#editor.modei pre, #editor.modei audio, #editor.modea pre, #editor.modea img, #editor.modet img, #editor.modet audio, #editor.model {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<sub><a href=".">Want to compile one instead?</a></sub>
|
||||
<br>
|
||||
<sub><a href="decompile.html">Want to decompile one instead?</a></sub>
|
||||
<h1>WebEPK</h1>
|
||||
<p>Customize EPK files in your browser!</p>
|
||||
Select base .EPK: <input type="file" onchange="selectFile(this);" accept=".epk">
|
||||
<br>
|
||||
Compile to legacy format: <input type="checkbox">
|
||||
<br>
|
||||
<button onclick="compileIt(document.querySelector('input[type=file]'));" disabled>Compile it!</button>
|
||||
<br>
|
||||
<br>
|
||||
<progress value="0" max="1"></progress>
|
||||
<a download="my-cool.epk">Download your EPK!</a>
|
||||
<div id="editor" class="model">
|
||||
<input type="text" placeholder="Search or enter file name...">
|
||||
<select></select>
|
||||
<button onclick="createFile(this.previousElementSibling.previousElementSibling.value);" disabled>Create file...</button>
|
||||
<button onclick="deleteCurrentFile();">Delete file...</button>
|
||||
<br>
|
||||
<h3></h3>
|
||||
Change this file: <input type="file" onchange="changeFile(this);">
|
||||
<br>
|
||||
<img>
|
||||
<audio controls></audio>
|
||||
<pre></pre>
|
||||
</div>
|
||||
<script>
|
||||
const downloadLink = document.querySelectorAll('a')[2];
|
||||
const progressBar = document.querySelector('progress');
|
||||
const oldBox = document.querySelector('input[type=checkbox]');
|
||||
const compileBtn = document.querySelector('button');
|
||||
const editor = document.getElementById('editor');
|
||||
const dropdown = document.querySelector('select');
|
||||
const editorName = editor.querySelector('h3');
|
||||
const editorImage = editor.querySelector('img');
|
||||
const editorAudio = editor.querySelector('audio');
|
||||
const editorText = editor.querySelector('pre');
|
||||
const editorSearch = editor.querySelector('input[type=text]');
|
||||
|
||||
editorSearch.value = '';
|
||||
|
||||
// https://stackoverflow.com/a/68703218/6917520
|
||||
|
||||
function prefix(words) {
|
||||
// check border cases size 1 array and empty first word)
|
||||
if (!words[0] || words.length == 1) return words[0] || "";
|
||||
let i = 0;
|
||||
// while all words have the same character at position i, increment i
|
||||
while(words[0][i] && words.every(w => w[i] === words[0][i]))
|
||||
i++;
|
||||
|
||||
// prefix is the substring from the beginning to the last successfully checked i
|
||||
return words[0].substr(0, i);
|
||||
}
|
||||
|
||||
let epkFiles = [];
|
||||
let selectedFile = 0;
|
||||
|
||||
function selectFile(fileElem) {
|
||||
epkFiles.length = 0;
|
||||
downloadLink.removeAttribute('href');
|
||||
fileElem.disabled = true;
|
||||
if (fileElem.files.length > 0) {
|
||||
const epkFile = fileElem.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
window.decompileEPK()(e.target.result, function() {
|
||||
progressBar.max++;
|
||||
progressBar.value++;
|
||||
}).then(function(fileList) {
|
||||
if (fileList == null) {
|
||||
alert('Invalid EPK!');
|
||||
fileElem.value = '';
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
fileElem.removeAttribute('disabled');
|
||||
return;
|
||||
}
|
||||
fileElem.value = '';
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
fileElem.removeAttribute('disabled');
|
||||
epkFiles = fileList;
|
||||
editor.className = '';
|
||||
refreshDropdown();
|
||||
compileBtn.removeAttribute('disabled');
|
||||
});
|
||||
};
|
||||
reader.readAsArrayBuffer(epkFile);
|
||||
} else {
|
||||
fileElem.removeAttribute('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function compileIt(fileElem) {
|
||||
compileBtn.disabled = true;
|
||||
fileElem.disabled = true;
|
||||
oldBox.disabled = true;
|
||||
progressBar.value = 0;
|
||||
progressBar.max = epkFiles.length;
|
||||
window.compileEPK()(epkFiles, oldBox.checked, function() {
|
||||
progressBar.value++;
|
||||
}).then(blob => {
|
||||
if (blob == null) {
|
||||
alert('Invalid EPK!');
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
oldBox.removeAttribute('disabled');
|
||||
fileElem.removeAttribute('disabled');
|
||||
return;
|
||||
}
|
||||
downloadLink.href = window.URL.createObjectURL(blob);
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
oldBox.removeAttribute('disabled');
|
||||
fileElem.removeAttribute('disabled');
|
||||
compileBtn.removeAttribute('disabled');
|
||||
});
|
||||
}
|
||||
|
||||
function filterDropdown(str) {
|
||||
str = str.trim().toLowerCase();
|
||||
const queries = str.split(' ');
|
||||
const opts = [...dropdown.querySelectorAll('option')];
|
||||
let oldValue = dropdown.value;
|
||||
let selectedOne = false;
|
||||
for (const opt of opts) {
|
||||
opt.selected = false;
|
||||
opt.hidden = true;
|
||||
const lowerOptText = opt.text.toLowerCase();
|
||||
if (lowerOptText == str) {
|
||||
if (selectedOne) {
|
||||
selectedOne.selected = false;
|
||||
}
|
||||
selectedOne = opt;
|
||||
opt.selected = true;
|
||||
opt.hidden = false;
|
||||
continue;
|
||||
}
|
||||
for (const query of queries) {
|
||||
if (lowerOptText.includes(query)) {
|
||||
if (!selectedOne) {
|
||||
selectedOne = opt;
|
||||
opt.selected = true;
|
||||
}
|
||||
opt.hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dropdown.value != oldValue) {
|
||||
dropdown.onchange();
|
||||
}
|
||||
}
|
||||
|
||||
dropdown.onchange = function() {
|
||||
selectedFile = dropdown.value;
|
||||
const fileItem = epkFiles[selectedFile];
|
||||
editorName.innerText = fileItem.name;
|
||||
const lowerName = fileItem.name.toLowerCase();
|
||||
if (lowerName.endsWith('.mp3') || lowerName.endsWith('.ogg')) {
|
||||
editor.className = 'modea';
|
||||
editorAudio.src = window.URL.createObjectURL(fileItem.data);
|
||||
} else if (lowerName.endsWith('.png')) {
|
||||
editor.className = 'modei';
|
||||
editorImage.src = window.URL.createObjectURL(fileItem.data);
|
||||
} else {
|
||||
editor.className = 'modet';
|
||||
fileItem.data.text().then(t => {
|
||||
editorText.innerText = t;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function refreshDropdown() {
|
||||
dropdown.innerHTML = '';
|
||||
for (const fileInd in epkFiles) {
|
||||
if (epkFiles[fileInd].type != 'FILE') {
|
||||
continue;
|
||||
}
|
||||
dropdown.add(new Option(epkFiles[fileInd].name, fileInd, false, fileInd == 0));
|
||||
}
|
||||
dropdown.onchange();
|
||||
editorSearch.oninput();
|
||||
}
|
||||
|
||||
function deleteCurrentFile() {
|
||||
epkFiles.splice(selectedFile, 1);
|
||||
refreshDropdown();
|
||||
}
|
||||
|
||||
function createFile(name) {
|
||||
epkFiles.push({
|
||||
type: 'FILE',
|
||||
name: name,
|
||||
data: new Blob([])
|
||||
});
|
||||
refreshDropdown();
|
||||
}
|
||||
|
||||
function changeFile(fileElem) {
|
||||
if (fileElem.files.length > 0) {
|
||||
epkFiles[selectedFile].data = fileElem.files[0];
|
||||
fileElem.value = '';
|
||||
dropdown.onchange();
|
||||
}
|
||||
}
|
||||
|
||||
editorSearch.oninput = function() {
|
||||
filterDropdown(editorSearch.value);
|
||||
if (this.value != '' && epkFiles[this.nextElementSibling.value].name.toLowerCase() != this.value.toLowerCase()) {
|
||||
editorSearch.nextElementSibling.nextElementSibling.removeAttribute('disabled');
|
||||
} else {
|
||||
editorSearch.nextElementSibling.nextElementSibling.disabled = true;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,119 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WebEPK</title>
|
||||
<script src="jszip.min.js"></script>
|
||||
<script src="pako_inflate.min.js"></script>
|
||||
<script src="EPKDecompiler.js"></script>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
a:not([href]) {
|
||||
display: none;
|
||||
}
|
||||
*, ::file-selector-button {
|
||||
font-family: 'Nunito', sans-serif;
|
||||
}
|
||||
body {
|
||||
background-color: #111111;
|
||||
color: #dddddd;
|
||||
}
|
||||
input[disabled] {
|
||||
opacity: 0.8;
|
||||
}
|
||||
::file-selector-button, progress {
|
||||
background-color: #343434;
|
||||
color: #eeeeee;
|
||||
border: 1px solid #eeeeee;
|
||||
border-radius: 4px;
|
||||
}
|
||||
a, input[type=file] {
|
||||
color: #dddddd;
|
||||
}
|
||||
progress {
|
||||
height: 1em;
|
||||
}
|
||||
progress, ::-webkit-file-upload-button {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
progress[value="0"][max="1"] {
|
||||
display: none;
|
||||
}
|
||||
::-moz-progress-bar {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
::-webkit-progress-value {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
::-webkit-progress-bar {
|
||||
background-color: #343434;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<sub><a href=".">Want to compile one instead?</a></sub>
|
||||
<br>
|
||||
<sub><a href="builder.html">Want to create one instead?</a></sub>
|
||||
<h1>WebEPK</h1>
|
||||
<p>Decompile EPK files in your browser!</p>
|
||||
Select .EPK file: <input type="file" onchange="selectFile(this);" accept=".epk">
|
||||
<br>
|
||||
<progress value="0" max="1"></progress>
|
||||
<a download="my-cool.zip">Download as a ZIP!</a>
|
||||
<script>
|
||||
const downloadLink = document.querySelectorAll('a')[2];
|
||||
const progressBar = document.querySelector('progress');
|
||||
|
||||
function selectFile(fileElem) {
|
||||
downloadLink.removeAttribute('href');
|
||||
fileElem.disabled = true;
|
||||
if (fileElem.files.length > 0) {
|
||||
const epkFile = fileElem.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
window.decompileEPK()(e.target.result, function() {
|
||||
progressBar.max++;
|
||||
progressBar.value++;
|
||||
}).then(function(fileList) {
|
||||
if (fileList == null) {
|
||||
alert('Invalid EPK!');
|
||||
fileElem.value = '';
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
fileElem.removeAttribute('disabled');
|
||||
return;
|
||||
}
|
||||
const zip = new JSZip();
|
||||
progressBar.max = fileList.length;
|
||||
progressBar.value = 0;
|
||||
for (const file of fileList) {
|
||||
progressBar.value++;
|
||||
if (file.type != 'FILE') continue;
|
||||
zip.file(file.name, file.data);
|
||||
}
|
||||
|
||||
zip.generateAsync({type: 'blob'}).then(function(content) {
|
||||
downloadLink.href = window.URL.createObjectURL(content);
|
||||
fileElem.value = '';
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
fileElem.removeAttribute('disabled');
|
||||
});
|
||||
});
|
||||
};
|
||||
reader.readAsArrayBuffer(epkFile);
|
||||
} else {
|
||||
fileElem.removeAttribute('disabled');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,215 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WebEPK</title>
|
||||
<script src="jszip.min.js"></script>
|
||||
<script src="pako_deflate.min.js"></script>
|
||||
<script src="sha1.min.js"></script>
|
||||
<script src="EPKCompiler.js"></script>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
a:not([href]) {
|
||||
display: none;
|
||||
}
|
||||
*, ::file-selector-button {
|
||||
font-family: 'Nunito', sans-serif;
|
||||
}
|
||||
body {
|
||||
background-color: #111111;
|
||||
color: #dddddd;
|
||||
}
|
||||
input[disabled] {
|
||||
opacity: 0.8;
|
||||
}
|
||||
input[type=checkbox] {
|
||||
-webkit-appearance: initial;
|
||||
-moz-appearance: initial;
|
||||
appearance: initial;
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
margin: 0;
|
||||
}
|
||||
input[type=checkbox]:checked {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
input[type=checkbox]:before {
|
||||
content: ':>';
|
||||
text-align: center;
|
||||
color: #dddddd;
|
||||
margin-left: 0.3em;
|
||||
}
|
||||
input[type=checkbox]:checked:before {
|
||||
color: #343434;
|
||||
}
|
||||
input[type=checkbox]:after {
|
||||
content: 'No';
|
||||
color: #dddddd;
|
||||
margin-left: 0.6em;
|
||||
}
|
||||
input[type=checkbox]:checked:after {
|
||||
content: 'Yes';
|
||||
}
|
||||
@supports (-webkit-touch-callout: none) or (background: -webkit-named-image(i)) {
|
||||
input[type=checkbox]:after {
|
||||
content: 'no';
|
||||
}
|
||||
input[type=checkbox]:checked:after {
|
||||
content: 'yes';
|
||||
}
|
||||
}
|
||||
@supports (-moz-appearance: none) {
|
||||
input[type=checkbox]:after {
|
||||
content: 'No.';
|
||||
}
|
||||
input[type=checkbox]:checked:after {
|
||||
content: 'Yes.';
|
||||
}
|
||||
}
|
||||
::file-selector-button, progress, input[type=checkbox] {
|
||||
background-color: #343434;
|
||||
color: #eeeeee;
|
||||
border: 1px solid #eeeeee;
|
||||
border-radius: 4px;
|
||||
}
|
||||
a, input[type=file] {
|
||||
color: #dddddd;
|
||||
}
|
||||
progress {
|
||||
height: 1em;
|
||||
}
|
||||
progress, ::-webkit-file-upload-button {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
progress[value="0"][max="1"] {
|
||||
display: none;
|
||||
}
|
||||
::-moz-progress-bar {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
::-webkit-progress-value {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
::-webkit-progress-bar {
|
||||
background-color: #343434;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<sub><a href="decompile.html">Want to decompile one instead?</a></sub>
|
||||
<br>
|
||||
<sub><a href="builder.html">Want to create one instead?</a></sub>
|
||||
<h1>WebEPK</h1>
|
||||
<p>Compile EPK files in your browser!</p>
|
||||
Use legacy format: <input type="checkbox">
|
||||
<br>
|
||||
Select resources folder: <input type="file" onchange="selectFile(this);" directory webkitdirectory>
|
||||
<br>
|
||||
<i>~or~</i>
|
||||
<br>
|
||||
Select .ZIP archive of resources: <input type="file" onchange="selectFile(this);" accept=".zip">
|
||||
<br>
|
||||
<progress value="0" max="1"></progress>
|
||||
<a download="my-cool.epk">Download your EPK!</a>
|
||||
<script>
|
||||
const downloadLink = document.querySelectorAll('a')[2];
|
||||
const progressBar = document.querySelector('progress');
|
||||
const fileElems = document.querySelectorAll('input[type=file]');
|
||||
const oldBox = document.querySelector('input[type=checkbox]');
|
||||
|
||||
// https://stackoverflow.com/a/68703218/6917520
|
||||
|
||||
function prefix(words) {
|
||||
// check border cases size 1 array and empty first word)
|
||||
if (!words[0] || words.length == 1) return words[0] || "";
|
||||
let i = 0;
|
||||
// while all words have the same character at position i, increment i
|
||||
while(words[0][i] && words.every(w => w[i] === words[0][i]))
|
||||
i++;
|
||||
|
||||
// prefix is the substring from the beginning to the last successfully checked i
|
||||
return words[0].substr(0, i);
|
||||
}
|
||||
|
||||
function selectFile(fileElem) {
|
||||
downloadLink.removeAttribute('href');
|
||||
fileElems.forEach(elem => elem.disabled = true);
|
||||
oldBox.disabled = true;
|
||||
const fileArr = [];
|
||||
if (fileElem.files.length == 1) {
|
||||
const zipFile = fileElem.files[0];
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
const zip = new JSZip();
|
||||
zip.loadAsync(e.target.result).then(function(zip) {
|
||||
progressBar.max = Object.keys(zip.files).length;
|
||||
const stripFolder = prefix(Object.keys(zip.files));
|
||||
let i = 0;
|
||||
for (let fileName in zip.files) {
|
||||
if (fileName.endsWith('/')) {
|
||||
progressBar.value = i++;
|
||||
if (i == progressBar.max) {
|
||||
finishIt(fileElem, fileArr, oldBox.checked);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
zip.files[fileName].async('blob').then(function(data) {
|
||||
fileArr.push({
|
||||
type: 'FILE',
|
||||
name: stripFolder.length == 0 ? fileName : fileName.slice(fileName.indexOf(stripFolder) + stripFolder.length),
|
||||
data: data
|
||||
});
|
||||
progressBar.value = i++;
|
||||
if (i == progressBar.max) {
|
||||
finishIt(fileElem, fileArr, oldBox.checked);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
reader.readAsArrayBuffer(zipFile);
|
||||
} else if (fileElem.files.length > 1) {
|
||||
progressBar.max = fileElem.files.length;
|
||||
const stripFolder = prefix(Object.values(fileElem.files).map(file => file.webkitRelativePath));
|
||||
let i = 0;
|
||||
for (let file of fileElem.files) {
|
||||
const fileName = file.webkitRelativePath;
|
||||
fileArr.push({
|
||||
type: 'FILE',
|
||||
name: stripFolder.length == 0 ? fileName : fileName.slice(fileName.indexOf(stripFolder) + stripFolder.length),
|
||||
data: file
|
||||
});
|
||||
progressBar.value = i++;
|
||||
if (i == progressBar.max) {
|
||||
finishIt(fileElem, fileArr, oldBox.checked);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fileElems.forEach(elem => elem.removeAttribute('disabled'));
|
||||
oldBox.removeAttribute('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function finishIt(fileElem, fileArr, old) {
|
||||
progressBar.value = 0;
|
||||
window.compileEPK()(fileArr, old, function() {
|
||||
progressBar.value++;
|
||||
}).then(blob => {
|
||||
downloadLink.href = window.URL.createObjectURL(blob);
|
||||
currentEPK = null;
|
||||
fileElem.value = '';
|
||||
progressBar.value = 0;
|
||||
progressBar.max = 1;
|
||||
fileElems.forEach(elem => elem.removeAttribute('disabled'));
|
||||
oldBox.removeAttribute('disabled');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
/*!
|
||||
|
||||
JSZip v3.10.0 - A JavaScript class for generating and reading zip files
|
||||
<http://stuartk.com/jszip>
|
||||
|
||||
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
|
||||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
|
||||
|
||||
JSZip uses the library pako released under the MIT license :
|
||||
https://github.com/nodeca/pako/blob/main/LICENSE
|
||||
*/
|
||||
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=e()}}(function(){return function s(a,o,h){function u(r,e){if(!o[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return u(t||e)},i,i.exports,s,a,o,h)}return o[r].exports}for(var l="function"==typeof require&&require,e=0;e<h.length;e++)u(h[e]);return u}({1:[function(e,t,r){"use strict";var d=e("./utils"),c=e("./support"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,i,s,a,o,h=[],u=0,l=e.length,f=l,c="string"!==d.getTypeOf(e);u<e.length;)f=l-u,n=c?(t=e[u++],r=u<l?e[u++]:0,u<l?e[u++]:0):(t=e.charCodeAt(u++),r=u<l?e.charCodeAt(u++):0,u<l?e.charCodeAt(u++):0),i=t>>2,s=(3&t)<<4|r>>4,a=1<f?(15&r)<<2|n>>6:64,o=2<f?63&n:64,h.push(p.charAt(i)+p.charAt(s)+p.charAt(a)+p.charAt(o));return h.join("")},r.decode=function(e){var t,r,n,i,s,a,o=0,h=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var l,f=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===p.charAt(64)&&f--,e.charAt(e.length-2)===p.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=c.uint8array?new Uint8Array(0|f):new Array(0|f);o<e.length;)t=p.indexOf(e.charAt(o++))<<2|(i=p.indexOf(e.charAt(o++)))>>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),l[h++]=t,64!==s&&(l[h++]=r),64!==a&&(l[h++]=n);return l}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(e){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),a=e("./stream/GenericWorker"),o=n?"uint8array":"array";function h(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=functLine truncated
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={})}(this,(function(t){"use strict";function e(t){let e=t.length;for(;--e>=0;)t[e]=0}const a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),l=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),o=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);const _=new Array(60);e(_);const f=new Array(512);e(f);const c=new Array(256);e(c);const u=new Array(29);e(u);const w=new Array(n);function b(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}let g,p,m;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(w);const v=t=>t<256?f[t]:f[256+(t>>>7)],y=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},x=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},z=(t,e,a)=>{x(t,a[2*e],a[2*e+1])},A=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},E=(t,e,a)=>{const i=new Array(16);let n,r,l=0;for(n=1;n<=s;n++)i[n]=l=l+a[n-1]<<1;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=A(i[e]++,e))}},R=t=>{let e;for(e=0;e<i;e++)t.dyn_ltree[2*e]=0;for(e=0;e<n;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},Z=t=>{t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},U=(t,e,a,i)=>{const n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a]},S=(t,e,a)=>{const i=t.heap[a];let n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=i},D=(t,e,i)=>{let n,s,o,h,d=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*d]<<8|t.pending_buf[t.d_buf+2*d+1],s=t.pending_buf[t.l_buf+d],d++,0===n?z(t,s,e):(o=c[s],z(t,o+a+1,e),h=r[o],0!==h&&(s-=u[o],x(t,s,h)),n--,o=v(n),z(t,o,i),h=l[o],0!==h&&(n-=w[o],x(t,n,h)))}while(d<t.last_lit);z(t,256,e)},T=(t,e)=>{const a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;let l,o,h,d=-1;for(t.heap_len=0,t.heap_max=573,l=0;l<r;l++)0!==a[2*l]?(t.heap[++t.heap_len]=d=l,t.depth[l]=0):a[2*l+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);for(e.max_code=d,l=t.heap_len>>1;l>=1;l--)S(t,a,l);h=r;do{l=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),o=t.heap[1],t.heap[--t.heap_max]=l,t.heap[--t.heap_max]=o,a[2*h]=a[2*l]+a[2*o],t.depth[h]=(t.depth[l]>=t.depth[o]?t.depth[l]:t.depth[o])+1,a[2*l+1]=a[2*o+1]=h,t.heap[1]=h++,S(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,h=e.stat_desc.max_length;let d,_,f,c,u,w,b=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,b++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=o&&(u=l[_-o]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==b){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,b-=2}while(b>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--)}})(t,e),E(a,d,t.bl_count)},O=(t,e,a)=>{let i,n,s=-1,r=e[1],l=0,o=7,h=4;for(0===r&&(o=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++l<o&&n===r||(l<h?t.bl_tree[2*n]+=l:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):l<=10?t.bl_tree[34]++:t.bl_tree[36]++,l=0,s=n,0===r?(o=138,h=3):n===r?(o=6,h=3):(o=7,h=4))},I=(t,e,a)=>{let i,n,s=-1,r=e[1],l=0,o=7,h=4;for(0===r&&(o=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++l<o&&n===r)){if(l<h)do{z(t,n,t.bl_tree)}while(0!=--l);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),l--),z(t,16,t.bl_tree),x(t,l-3,2)):l<=10?(z(t,17,t.bl_tree),x(t,l-3,3)):(z(t,18,t.bl_tree),x(t,l-11,7));l=0,s=n,0===r?(o=138,h=3):n===r?(o=6,h=3):(o=7,h=4)}};let F=!1;const L=(t,e,a,i)=>{x(t,0+(i?1:0),3),((t,e,a,i)=>{Z(t),i&&(y(t,a),y(t,~a)),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a})(t,e,a,!0)};var N={_tr_init:t=>{F||((()=>{let t,e,a,h,k;const v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<<r[h];t++)c[a++]=h;for(c[a-1]=h,k=0,h=0;h<16;h++)for(w[h]=k,t=0;t<1<<l[h];t++)f[k++]=h;for(k>>=7;h<n;h++)for(w[h]=k<<7,t=0;t<1<<l[h]-7;t++)f[256+k++]=h;for(e=0;e<=s;e++)v[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,v[8]++;for(;t<=255;)d[2*t+1]=9,t++,v[9]++;for(;t<=279;)d[2*t+1]=7,t++,v[7]++;for(;t<=287;)d[2*t+1]=8,t++,v[8]++;for(E(d,287,v),t=0;t<Line truncated
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={})}(this,(function(t){"use strict";function e(t){let e=t.length;for(;--e>=0;)t[e]=0}const a=256,n=286,r=30,i=15,s=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),_=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);e(o);const d=new Array(60);e(d);const u=new Array(512);e(u);const f=new Array(256);e(f);const c=new Array(29);e(c);const p=new Array(r);function g(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}let w,b,m;function v(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(p);const y=t=>t<256?u[t]:u[256+(t>>>7)],z=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},k=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,z(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},x=(t,e,a)=>{k(t,a[2*e],a[2*e+1])},A=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},E=(t,e,a)=>{const n=new Array(16);let r,s,_=0;for(r=1;r<=i;r++)n[r]=_=_+a[r-1]<<1;for(s=0;s<=e;s++){let e=t[2*s+1];0!==e&&(t[2*s]=A(n[e]++,e))}},Z=t=>{let e;for(e=0;e<n;e++)t.dyn_ltree[2*e]=0;for(e=0;e<r;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},R=t=>{t.bi_valid>8?z(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},U=(t,e,a,n)=>{const r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]},S=(t,e,a)=>{const n=t.heap[a];let r=a<<1;for(;r<=t.heap_len&&(r<t.heap_len&&U(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!U(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n},T=(t,e,n)=>{let r,i,l,h,o=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],i=t.pending_buf[t.l_buf+o],o++,0===r?x(t,i,e):(l=f[i],x(t,l+a+1,e),h=s[l],0!==h&&(i-=c[l],k(t,i,h)),r--,l=y(r),x(t,l,n),h=_[l],0!==h&&(r-=p[l],k(t,r,h)))}while(o<t.last_lit);x(t,256,e)},L=(t,e)=>{const a=e.dyn_tree,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,s=e.stat_desc.elems;let _,l,h,o=-1;for(t.heap_len=0,t.heap_max=573,_=0;_<s;_++)0!==a[2*_]?(t.heap[++t.heap_len]=o=_,t.depth[_]=0):a[2*_+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=o<2?++o:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,r&&(t.static_len-=n[2*h+1]);for(e.max_code=o,_=t.heap_len>>1;_>=1;_--)S(t,a,_);h=s;do{_=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=_,t.heap[--t.heap_max]=l,a[2*h]=a[2*_]+a[2*l],t.depth[h]=(t.depth[_]>=t.depth[l]?t.depth[_]:t.depth[l])+1,a[2*_+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,n=e.max_code,r=e.stat_desc.static_tree,s=e.stat_desc.has_stree,_=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;let o,d,u,f,c,p,g=0;for(f=0;f<=i;f++)t.bl_count[f]=0;for(a[2*t.heap[t.heap_max]+1]=0,o=t.heap_max+1;o<573;o++)d=t.heap[o],f=a[2*a[2*d+1]+1]+1,f>h&&(f=h,g++),a[2*d+1]=f,d>n||(t.bl_count[f]++,c=0,d>=l&&(c=_[d-l]),p=a[2*d],t.opt_len+=p*(f+c),s&&(t.static_len+=p*(r[2*d+1]+c)));if(0!==g){do{for(f=h-1;0===t.bl_count[f];)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[h]--,g-=2}while(g>0);for(f=h;0!==f;f--)for(d=t.bl_count[f];0!==d;)u=t.heap[--o],u>n||(a[2*u+1]!==f&&(t.opt_len+=(f-a[2*u+1])*a[2*u],a[2*u+1]=f),d--)}})(t,e),E(a,o,t.bl_count)},F=(t,e,a)=>{let n,r,i=-1,s=e[1],_=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=s,s=e[2*(n+1)+1],++_<l&&r===s||(_<h?t.bl_tree[2*r]+=_:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[32]++):_<=10?t.bl_tree[34]++:t.bl_tree[36]++,_=0,i=r,0===s?(l=138,h=3):r===s?(l=6,h=3):(l=7,h=4))},O=(t,e,a)=>{let n,r,i=-1,s=e[1],_=0,l=7,h=4;for(0===s&&(l=138,h=3),n=0;n<=a;n++)if(r=s,s=e[2*(n+1)+1],!(++_<l&&r===s)){if(_<h)do{x(t,r,t.bl_tree)}while(0!=--_);else 0!==r?(r!==i&&(x(t,r,t.bl_tree),_--),x(t,16,t.bl_tree),k(t,_-3,2)):_<=10?(x(t,17,t.bl_tree),k(t,_-3,3)):(x(t,18,t.bl_tree),k(t,_-11,7));_=0,i=r,0===s?(l=138,h=3):r===s?(l=6,h=3):(l=7,h=4)}};let D=!1;const N=(t,e,a,n)=>{k(t,0+(n?1:0),3),((t,e,a,n)=>{R(t),n&&(z(t,a),z(t,~a)),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a})(t,e,a,!0)};var I={_tr_init:t=>{D||((()=>{let t,e,a,h,v;const y=new Array(16);for(a=0,h=0;h<28;h++)for(c[h]=a,t=0;t<1<<s[h];t++)f[a++]=h;for(f[a-1]=h,v=0,h=0;h<16;h++)for(p[h]=v,t=0;t<1<<_[h];t++)u[v++]=h;for(v>>=7;h<r;h++)for(p[h]=v<<7,t=0;t<1<<_[h]-7;t++)u[256+v++]=h;for(e=0;e<=i;e++)y[e]=0;for(t=0;t<=143;)o[2*t+1]=8,t++,y[8]++;for(;t<=255;)o[2*t+1]=9,t++,y[9]++;for(;t<=279;)o[2*t+1]=7,t++,y[7]++;for(;t<=287;)o[2*t+1]=8,t++,y[8]++;for(E(o,287,y),t=0;t<Line truncated
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(this,(function(e){"use strict";var t=(e,t,i,n)=>{let a=65535&e|0,r=e>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{a=a+t[n++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16|0};const i=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var n=(e,t,n,a)=>{const r=i,o=a+n;e^=-1;for(let i=a;i<o;i++)e=e>>>8^r[255&(e^t[i])];return-1^e};var a=function(e,t){let i,n,a,r,o,s,l,d,f,c,h,u,w,b,k,m,_,g,p,v,x,y,E,R;const A=e.state;i=e.next_in,E=e.input,n=i+(e.avail_in-5),a=e.next_out,R=e.output,r=a-(t-e.avail_out),o=a+(e.avail_out-257),s=A.dmax,l=A.wsize,d=A.whave,f=A.wnext,c=A.window,h=A.hold,u=A.bits,w=A.lencode,b=A.distcode,k=(1<<A.lenbits)-1,m=(1<<A.distbits)-1;e:do{u<15&&(h+=E[i++]<<u,u+=8,h+=E[i++]<<u,u+=8),_=w[h&k];t:for(;;){if(g=_>>>24,h>>>=g,u-=g,g=_>>>16&255,0===g)R[a++]=65535&_;else{if(!(16&g)){if(0==(64&g)){_=w[(65535&_)+(h&(1<<g)-1)];continue t}if(32&g){A.mode=12;break e}e.msg="invalid literal/length code",A.mode=30;break e}p=65535&_,g&=15,g&&(u<g&&(h+=E[i++]<<u,u+=8),p+=h&(1<<g)-1,h>>>=g,u-=g),u<15&&(h+=E[i++]<<u,u+=8,h+=E[i++]<<u,u+=8),_=b[h&m];i:for(;;){if(g=_>>>24,h>>>=g,u-=g,g=_>>>16&255,!(16&g)){if(0==(64&g)){_=b[(65535&_)+(h&(1<<g)-1)];continue i}e.msg="invalid distance code",A.mode=30;break e}if(v=65535&_,g&=15,u<g&&(h+=E[i++]<<u,u+=8,u<g&&(h+=E[i++]<<u,u+=8)),v+=h&(1<<g)-1,v>s){e.msg="invalid distance too far back",A.mode=30;break e}if(h>>>=g,u-=g,g=a-r,v>g){if(g=v-g,g>d&&A.sane){e.msg="invalid distance too far back",A.mode=30;break e}if(x=0,y=c,0===f){if(x+=l-g,g<p){p-=g;do{R[a++]=c[x++]}while(--g);x=a-v,y=R}}else if(f<g){if(x+=l+f-g,g-=f,g<p){p-=g;do{R[a++]=c[x++]}while(--g);if(x=0,f<p){g=f,p-=g;do{R[a++]=c[x++]}while(--g);x=a-v,y=R}}}else if(x+=f-g,g<p){p-=g;do{R[a++]=c[x++]}while(--g);x=a-v,y=R}for(;p>2;)R[a++]=y[x++],R[a++]=y[x++],R[a++]=y[x++],p-=3;p&&(R[a++]=y[x++],p>1&&(R[a++]=y[x++]))}else{x=a-v;do{R[a++]=R[x++],R[a++]=R[x++],R[a++]=R[x++],p-=3}while(p>2);p&&(R[a++]=R[x++],p>1&&(R[a++]=R[x++]))}break}}break}}while(i<n&&a<o);p=u>>3,i-=p,u-=p<<3,h&=(1<<u)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=a<o?o-a+257:257-(a-o),A.hold=h,A.bits=u};const r=15,o=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),s=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),l=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),d=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var f=(e,t,i,n,a,f,c,h)=>{const u=h.bits;let w,b,k,m,_,g,p=0,v=0,x=0,y=0,E=0,R=0,A=0,Z=0,S=0,T=0,O=null,U=0;const D=new Uint16Array(16),I=new Uint16Array(16);let B,N,C,z=null,F=0;for(p=0;p<=r;p++)D[p]=0;for(v=0;v<n;v++)D[t[i+v]]++;for(E=u,y=r;y>=1&&0===D[y];y--);if(E>y&&(E=y),0===y)return a[f++]=20971520,a[f++]=20971520,h.bits=1,0;for(x=1;x<y&&0===D[x];x++);for(E<x&&(E=x),Z=1,p=1;p<=r;p++)if(Z<<=1,Z-=D[p],Z<0)return-1;if(Z>0&&(0===e||1!==y))return-1;for(I[1]=0,p=1;p<r;p++)I[p+1]=I[p]+D[p];for(v=0;v<n;v++)0!==t[i+v]&&(c[I[t[i+v]]++]=v);if(0===e?(O=z=c,g=19):1===e?(O=o,U-=257,z=s,F-=257,g=256):(O=l,z=d,g=-1),T=0,v=0,p=x,_=f,R=E,A=0,k=-1,S=1<<E,m=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){B=p-A,c[v]<g?(N=0,C=c[v]):c[v]>g?(N=z[F+c[v]],C=O[U+c[v]]):(N=96,C=0),w=1<<p-A,b=1<<R,x=b;do{b-=w,a[_+(T>>A)+b]=B<<24|N<<16|C|0}while(0!==b);for(w=1<<p-1;T&w;)w>>=1;if(0!==w?(T&=w-1,T+=w):T=0,v++,0==--D[p]){if(p===y)break;p=t[i+c[v]]}if(p>E&&(T&m)!==k){for(0===A&&(A=E),_+=x,R=p-A,Z=1<<R;R+A<y&&(Z-=D[R+A],!(Z<=0));)R++,Z<<=1;if(S+=1<<R,1===e&&S>852||2===e&&S>592)return 1;k=T&m,a[k]=E<<24|R<<16|_-f|0}}return 0!==T&&(a[_+T]=p-A<<24|64<<16|0),h.bits=E,0},c={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:h,Z_BLOCK:u,Z_TREES:w,Z_OK:b,Z_STREAM_END:k,Z_NEED_DICT:m,Z_STREAM_ERROR:_,Z_DATA_ERROR:g,Z_MEM_ERROR:p,Z_BUF_ERROR:v,Z_DEFLATED:x}=c,y=12,E=30,R=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function A(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.diLine truncated
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* [js-sha1]{@link https://github.com/emn178/js-sha1}
|
||||
*
|
||||
* @version 0.6.0
|
||||
* @author Chen, Yi-Cyuan [[email protected]]
|
||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||
* @license MIT
|
||||
*/
|
||||
!function(){"use strict";function t(t){t?(f[0]=f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0,this.blocks=f):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var h="object"==typeof window?window:{},s=!h.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;s&&(h=global);var i=!h.JS_SHA1_NO_COMMON_JS&&"object"==typeof module&&module.exports,e="function"==typeof define&&define.amd,r="0123456789abcdef".split(""),o=[-2147483648,8388608,32768,128],n=[24,16,8,0],a=["hex","array","digest","arrayBuffer"],f=[],u=function(h){return function(s){return new t(!0).update(s)[h]()}},c=function(){var h=u("hex");s&&(h=p(h)),h.create=function(){return new t},h.update=function(t){return h.create().update(t)};for(var i=0;i<a.length;++i){var e=a[i];h[e]=u(e)}return h},p=function(t){var h=eval("require('crypto')"),s=eval("require('buffer').Buffer"),i=function(i){if("string"==typeof i)return h.createHash("sha1").update(i,"utf8").digest("hex");if(i.constructor===ArrayBuffer)i=new Uint8Array(i);else if(void 0===i.length)return t(i);return h.createHash("sha1").update(new s(i)).digest("hex")};return i};t.prototype.update=function(t){if(!this.finalized){var s="string"!=typeof t;s&&t.constructor===h.ArrayBuffer&&(t=new Uint8Array(t));for(var i,e,r=0,o=t.length||0,a=this.blocks;r<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),s)for(e=this.start;r<o&&e<64;++r)a[e>>2]|=t[r]<<n[3&e++];else for(e=this.start;r<o&&e<64;++r)(i=t.charCodeAt(r))<128?a[e>>2]|=i<<n[3&e++]:i<2048?(a[e>>2]|=(192|i>>6)<<n[3&e++],a[e>>2]|=(128|63&i)<<n[3&e++]):i<55296||i>=57344?(a[e>>2]|=(224|i>>12)<<n[3&e++],a[e>>2]|=(128|i>>6&63)<<n[3&e++],a[e>>2]|=(128|63&i)<<n[3&e++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++r)),a[e>>2]|=(240|i>>18)<<n[3&e++],a[e>>2]|=(128|i>>12&63)<<n[3&e++],a[e>>2]|=(128|i>>6&63)<<n[3&e++],a[e>>2]|=(128|63&i)<<n[3&e++]);this.lastByteIndex=e,this.bytes+=e-this.start,e>=64?(this.block=a[16],this.start=e-64,this.hash(),this.hashed=!0):this.start=e}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,h=this.lastByteIndex;t[16]=this.block,t[h>>2]|=o[3&h],this.block=t[16],h>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},t.prototype.hash=function(){var t,h,s=this.h0,i=this.h1,e=this.h2,r=this.h3,o=this.h4,n=this.blocks;for(t=16;t<80;++t)h=n[t-3]^n[t-8]^n[t-14]^n[t-16],n[t]=h<<1|h>>>31;for(t=0;t<20;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i&e|~i&r)+o+1518500249+n[t]<<0)<<5|o>>>27)+(s&(i=i<<30|i>>>2)|~s&e)+r+1518500249+n[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|~o&i)+e+1518500249+n[t+2]<<0)<<5|e>>>27)+(r&(o=o<<30|o>>>2)|~r&s)+i+1518500249+n[t+3]<<0)<<5|i>>>27)+(e&(r=r<<30|r>>>2)|~e&o)+s+1518500249+n[t+4]<<0,e=e<<30|e>>>2;for(;t<40;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i^e^r)+o+1859775393+n[t]<<0)<<5|o>>>27)+(s^(i=i<<30|i>>>2)^e)+r+1859775393+n[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^i)+e+1859775393+n[t+2]<<0)<<5|e>>>27)+(r^(o=o<<30|o>>>2)^s)+i+1859775393+n[t+3]<<0)<<5|i>>>27)+(e^(r=r<<30|r>>>2)^o)+s+1859775393+n[t+4]<<0,e=e<<30|e>>>2;for(;t<60;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i&e|i&r|e&r)+o-1894007588+n[t]<<0)<<5|o>>>27)+(s&(i=i<<30|i>>>2)|s&e|i&e)+r-1894007588+n[t+1]<<0)<<5|r>>>27)+(o&(s=s<<30|s>>>2)|o&i|s&i)+e-1894007588+n[t+2]<<0)<<5|e>>>27)+(r&(o=o<<30|o>>>2)|r&s|o&s)+i-1894007588+n[t+3]<<0)<<5|i>>>27)+(e&(r=r<<30|r>>>2)|e&o|r&o)+s-1894007588+n[t+4]<<0,e=e<<30|e>>>2;for(;t<80;t+=5)s=(h=(i=(h=(e=(h=(r=(h=(o=(h=s<<5|s>>>27)+(i^e^r)+o-899497514+n[t]<<0)<<5|o>>>27)+(s^(i=i<<30|i>>>2)^e)+r-899497514+n[t+1]<<0)<<5|r>>>27)+(o^(s=s<<30|s>>>2)^i)+e-899497514+n[t+2]<<0)<<5|e>>>27)+(r^(o=o<<30|o>>>2)^s)+i-899497514+n[t+3]<<0)<<5|i>>>27)+(e^(r=r<<30|r>>>2)^o)+s-899497514+n[t+4]<<0,e=e<<30|e>>>2;this.h0=this.h0+s<<0,this.h1=this.h1+i<<0,this.h2=this.h2+e<<0,this.h3=this.h3+r<<0,this.h4=this.h4+o<<0},t.prototype.hex=function(){this.finalize();var t=this.h0,h=this.h1,s=this.h2,i=this.h3,e=this.h4;return r[t>>28&15]+r[t>>24&15]+r[t>>20&15]+r[t>>16&15]+r[t>>12&15]+r[t>>8&15]+r[t>>4&15]+r[15&t]+r[h>>28&15]+r[h>>24&15]+r[h>>20&15]+r[h>>16&15]+r[h>>12&15]+r[h>>8&15]+r[h>>4&15]+r[15&h]+r[s>>28&15]+r[s>>24&15]+r[s>>20&15]+r[s>>16&15]+r[s>>12&15]+r[s>>8&15]+r[s>>4&15]+r[15&s]+r[i>>28&15]+r[i>>24&15]+r[i>>20&15]+r[i>>16&15]+r[i>>12&15]+r[i>>8&15]+r[i>>4&15]+r[15&i]+r[e>>28&15]+r[e>>24&15]+r[e>>20&15]+r[e>>16&15]+r[e>>12&15]+r[e>>8&15]+r[e>>4&15]+r[15&e]},t.prototype.toString=t.prototype.hex,t.protLine truncated
|
||||