├── script.js ├── docs ├── readme.md ├── settings.md └── imagesettings.md ├── index.html ├── importfile.js ├── README.md ├── style.css ├── imageconvert.js ├── options.js ├── convert.js └── 3th └── jszip.min.js /script.js: -------------------------------------------------------------------------------- 1 | function _CN(e,t,r,n=null){var o=document.createElement(e);if("object"==typeof t)for(var a in t)o.setAttribute(a,t[a]);return Array.isArray(r)&&r.forEach(e=>{o.appendChild("string"==typeof e||"number"==typeof e?document.createTextNode(e):e)}),null!==n&&n.appendChild(o),o}; -------------------------------------------------------------------------------- /docs/readme.md: -------------------------------------------------------------------------------- 1 | # Binary 2 Array 2 | A simple HTML5 page to convert any binary file to an array. 3 | _Personal project made for Arduino (and ESP32) projects._ 4 | 5 | Just drop or open a file in the page: 6 | https://adrianotiger.github.io/binary2array/ 7 | and press `convert` to have a binary array of your file. 8 | 9 | ## Settings 10 | Before converting, you can apply some settings to the converter. 11 | Open Converter Settings to see all converting options. 12 | 13 | If you open an image, you will get some other settings to apply: 14 | Open Image Settings to see all converting options. 15 | 16 | ## Arduino 17 | This project was made for Arduino and TFT displays. So there is also a section with some info about the conversion. 18 | 19 | ## Screenshot 20 | ![preview](https://user-images.githubusercontent.com/7373079/211860291-09249916-506d-432b-aaa2-6ef4a7221a91.png) 21 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Binary file to C Array 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

Binary 2 C array

20 |
Import (drag or open) any file you want to convert it to a C Array. Save it if you want.
21 | © 2023 - Adriano Petrucci 22 | Open GitHub project 23 | 24 | -------------------------------------------------------------------------------- /docs/settings.md: -------------------------------------------------------------------------------- 1 | # Conversion Settings 2 | 3 | ### Format 4 | The number format in the output. 5 | - HEX (Example: 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, ...) 6 | - DEC (Example: 60, 33, 68, 79, 67, 84, 89, ...) 7 | - BIN (Example: b00111100, b00100001, b01000100, b01001111, b01000011, b01010100, b01011001, ...) 8 | 9 | ### Prefix 10 | What text you want add to the number. 11 | In C and as HEX, it is `0x` (0x5A), but you can also set '\x' or leave it empty. 12 | 13 | ### Suffix 14 | What text you want add after the number. 15 | For example in VB and HEX, you need the `h` after the hex number (5Ah) 16 | 17 | ### Pad 18 | If you want fill the numbers with '0' (or ' ' for DEC) to have them aligned. 19 | For example a 0x5 will be converted to 0x05 with 8-bit numbers and to 0x0005 with 16-bit numbers 20 | 21 | ### Datatype 22 | - uint8_t for a 8 bit array 23 | - uint16_t for a 16 bit array 24 | - uint32_t for a 32 bit array 25 | Array size is updated automatically. You can set it only if the file is divisible by this data type length. 26 | 27 | ### Columns 28 | The quantity of numbers for each row. Set to 0 if you want all data on a single line. 29 | 30 | ### Skip Bytes 31 | Bytes to skip. Sometimes you have some headers to remove. If so, set the number of bytes you want to remove from the file, before the array is generated. 32 | 33 | ### ASCII Comments 34 | Add a column with the converted number as ASCII (helpful if you converts some text documents). 35 | -------------------------------------------------------------------------------- /docs/imagesettings.md: -------------------------------------------------------------------------------- 1 | # Image Settings 2 | If you import an image, another settings box will appear. So you can do some image manipulations before create the binary array. 3 | 4 | ## Convert To 5 | ### none 6 | Image is converted like any other file 7 | ### jpeg 8 | Image is converted to a JPEG before converting it 9 | ### png 10 | Image is converted to a PNG before converting it 11 | ### raw 12 | Image is converted to a raw file. It means that every pixel is a integer written as array. 13 | Example: On a 240x240 display with 16bit, it creates an array of 240*240*2=115'200 bytes. 14 | It is a good option if you use an Arduino with a TFT, since you can output directly the data read by this array without converting it. 15 | ### raw compressed 16 | A simple compression method to group pixels with the same color. 17 | On Arduino, you can use the same TFT buffer and decompress it directly on the same buffer. 18 | A compressed RAW can be 20% to 60% smaller if the image is simple. 19 | ### raw zip 20 | The raw image will be zipped. You need this library on Arduino: https://github.com/bitbank2/unzipLIB to unzip it. 21 | A zipped RAW can be 50% to 90% smaller if the image is simple. But you need more time to unzip it. 22 | 23 | ## RGB 24 | As RAW, you can choose if you want a 8-bit pixel (RGB332) or 16-bit pixel (RGB565). 25 | 26 | ## Quality 27 | As JPEG, you can choose the quality of the image (1-100%). Normally for a jpeg this value is from 90 to 95. 28 | 29 | ## Level 30 | As Zipped RAW, you can choose a compression level (1 to 9). A simple compression is faster to decompress but need more space. 31 | -------------------------------------------------------------------------------- /importfile.js: -------------------------------------------------------------------------------- 1 | let ImportFile = new class 2 | { 3 | constructor() 4 | { 5 | 6 | } 7 | 8 | init() 9 | { 10 | document.body.addEventListener("drop", (e)=>{this.dropHandler(e);}); 11 | document.body.addEventListener("dragover", (e)=>{this.dragHandler(e);}); 12 | } 13 | 14 | dropHandler(e) 15 | { 16 | // Prevent default behavior (Prevent file from being opened) 17 | e.preventDefault(); 18 | if (e.dataTransfer.items) 19 | { 20 | // Use DataTransferItemList interface to access the file(s) 21 | for (var i = 0; i < e.dataTransfer.items.length; i++) 22 | { 23 | // If dropped items aren't files, reject them 24 | if (e.dataTransfer.items[i].kind === 'file') 25 | { 26 | console.log(e.dataTransfer.items[i]); 27 | this.loadFile(e.dataTransfer.items[i].getAsFile()); 28 | break; 29 | } 30 | } 31 | } 32 | console.log(e); 33 | } 34 | 35 | dragHandler(e) 36 | { 37 | // Prevent default behavior (Prevent file from being opened) 38 | e.preventDefault(); 39 | } 40 | 41 | loadFile(f) 42 | { 43 | Converter.clear(); 44 | console.log("LOAD FILE: ", f); 45 | if(!f) 46 | { 47 | let input = _CN('input', {type:'file', accept:'.*'}); 48 | input.onchange = () => { 49 | if(input.files && input.files.length > 0) this.loadFile(input.files[0]); 50 | }; 51 | input.click(); 52 | } 53 | else if(f instanceof File) 54 | { 55 | console.log(f); 56 | if(f.size > 1024 *1024 * 2) 57 | { 58 | if(!confirm("The file is big (" + parseInt(f.size / 1024) + " kb). Are you sure you want to convert it?")) return; 59 | } 60 | Options.createDialog(f); 61 | Converter.showDialog(); 62 | } 63 | } 64 | }; 65 | 66 | window.addEventListener("load", ()=>{ImportFile.init();}); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Convert a binary file to a C style array 2 | 3 | Just another online converter, to convert a binary file to a C header array. 4 | 5 | Simple and easy to add more features. 6 | 7 | 1. Open https://adrianotiger.github.io/binary2array/ 8 | 2. Drop a file 9 | 3. Set up the options to convert the file 10 | 4. Press convert 11 | 5. In the textbox, you will get the output. Something like `static const uint8_t imageArray[120] = {0x50, 0x15, 0xa7, 0xdf, ...}` 12 | 13 | ![image](https://user-images.githubusercontent.com/7373079/211860291-09249916-506d-432b-aaa2-6ef4a7221a91.png) 14 | 15 | ## Converting Settings 16 | ### Format 17 | The number format in the output. 18 | - HEX (0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, ...) 19 | - DEC ( 60, 33, 68, 79, 67, 84, 89, ...) 20 | - BIN (b00111100, b00100001, b01000100, b01001111, b01000011, b01010100, b01011001, ...) 21 | ### Prefix 22 | What text you want add to the number. 23 | In C and as HEX, it is `0x` (0x5A), but you can also set '\x' or leave it empty. 24 | ### Suffix 25 | What text you want add after the number. 26 | For example in VB and HEX, you need the `h` after the hex number (5Ah) 27 | ### Pad 28 | If you want fill the numbers with '0' (or ' ' for DEC) to have them aligned. 29 | For example a 0x5 will be converted to 0x05 with 8-bit numbers and to 0x0005 with 16-bit numbers 30 | ### Datatype 31 | - uint8_t for a 8 bit array 32 | - uint16_t for a 16 bit array 33 | - uint32_t for a 32 bit array 34 | Array size is updated automatically. You can set it only if the file is divisible by this data type length. 35 | ### Columns 36 | The quantity of numbers for each row. Set to 0 if you want all data on a single line. 37 | ### Skip Bytes 38 | Bytes to skip. Sometimes you have some headers to remove. If so, set the number of bytes you want to remove from the file, before the array is generated. 39 | 40 | ## Image Settings 41 | If you import an image, another settings box will appear. So you can do some image manipulations before create the binary array. 42 | ### Convert To 43 | #### none 44 | Image is converted like any other image 45 | #### jpeg 46 | Image is converted to a JPEG before converting it 47 | #### png 48 | Image is converted to a PNG before converting it 49 | #### raw 50 | Image is converted to a raw file. It means that every pixel is a integer written as array. 51 | Example: On a 240x240 display with 16bit, it creates an array of 240*240*2=115'200 bytes. 52 | It is a good option if you use an Arduino with a TFT, since you can output directly the data read by this array without converting it. 53 | #### raw compressed 54 | A simple compression method to group pixels with the same color. 55 | On Arduino, you can use the same TFT buffer and decompress it directly on the same buffer. 56 | A compressed RAW can be 20% to 60% smaller if the image is simple. 57 | #### raw zip 58 | The raw image will be zipped. You need this library on Arduino: https://github.com/bitbank2/unzipLIB to unzip it. 59 | A zipped RAW can be 50% to 90% smaller if the image is simple. But you need more time to unzip it. 60 | ### RGB 61 | As RAW, you can choose if you want a 8-bit pixel (RGB332) or 16-bit pixel (RGB565). 62 | ### Quality 63 | As JPEG, you can choose the quality of the image (1-100%). Normally for a jpeg this value is from 90 to 95. 64 | ### Level 65 | As Zipped RAW, you can choose a compression level (1 to 9). A simple compression is faster to decompress but need more space. 66 | 67 | ## Credits 68 | Zip on Javascript: https://github.com/Stuk/jszip 69 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | html { 2 | width:100%; 3 | height:100%; 4 | } 5 | 6 | body { 7 | width:100%; 8 | height:100%; 9 | overflow: hidden; 10 | background: linear-gradient(to bottom, #abd, #79a); 11 | font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; 12 | text-align: center; 13 | margin:0 auto; 14 | } 15 | 16 | a { 17 | color: #000; 18 | } 19 | 20 | .dialog 21 | { 22 | width:20vw; 23 | height: 80vh; 24 | display: inline-block; 25 | border-radius: 10px; 26 | border-color: #005; 27 | border-width: 1px; 28 | border-style: solid; 29 | box-shadow: 5px 5px 4px 2px #55f; 30 | position:absolute; 31 | left: -2px; 32 | overflow-y: auto; 33 | } 34 | 35 | .dialog div 36 | { 37 | display:inline-grid; 38 | text-align: left; 39 | min-height: 18vh; 40 | min-width: 16vw; 41 | margin: 1vh; 42 | box-shadow: 0px 0px 2px 2px #55f; 43 | border-radius: 5px; 44 | padding: 0px 10px; 45 | } 46 | 47 | .dialog button, .dialog input, .dialog select 48 | { 49 | background: linear-gradient(to bottom, #abd, #79a); 50 | margin: 3px 10px; 51 | border-radius: 4px; 52 | width: 100px; 53 | max-width: 15vw; 54 | } 55 | 56 | .dialog button:hover, .dialog input:hover, .dialog select:hover 57 | { 58 | background: linear-gradient(to bottom, #dda, #aa6); 59 | box-shadow: 0px 0px 2px 2px #55f; 60 | } 61 | 62 | .dialog button:focus, .dialog input:focus, .dialog select:focus 63 | { 64 | background: linear-gradient(to bottom, #fff, #bbb); 65 | box-shadow: 0px 0px 2px 2px #ff5; 66 | } 67 | 68 | .dialog h2 69 | { 70 | margin: 10px 0px; 71 | } 72 | 73 | .dialog button 74 | { 75 | font-size: 130%; 76 | width: 80%; 77 | cursor: pointer; 78 | } 79 | 80 | .dialog div b 81 | { 82 | display:inline-block; 83 | min-width: 80px; 84 | } 85 | 86 | .dialog canvas 87 | { 88 | max-width:64px; 89 | max-height:64px; 90 | width:auto; 91 | } 92 | .dialog canvas:hover 93 | { 94 | max-width: none; 95 | max-height: none; 96 | } 97 | 98 | .dialog2 99 | { 100 | width:70vw; 101 | height: 80vh; 102 | display: inline-block; 103 | background-color: rgba(255,255,255,0.5); 104 | border-radius: 10px; 105 | border-color: #111; 106 | border-width: 1px; 107 | border-style: solid; 108 | box-shadow: 5px 5px 4px 2px #555; 109 | position:absolute; 110 | right: 5vw; 111 | overflow: hidden; 112 | } 113 | 114 | .dialog2 textarea 115 | { 116 | width:99%; 117 | height:99%; 118 | margin: 2px; 119 | border-style:none; 120 | background-color: transparent; 121 | } 122 | 123 | .dialog2 textarea:focus 124 | { 125 | outline: none; 126 | } 127 | 128 | .dialog2 .help 129 | { 130 | width: 98%; 131 | height: 80vh; 132 | background-color: #abd; 133 | position:absolute; 134 | overflow-y: auto; 135 | left: 0px; 136 | top: 0px; 137 | text-align: left; 138 | padding-left: 20px; 139 | } 140 | 141 | .copyright 142 | { 143 | display: inline-block; 144 | position: absolute; 145 | bottom: 5px; 146 | right: 5px; 147 | } 148 | 149 | .github 150 | { 151 | display: inline-block; 152 | position: absolute; 153 | top: 2px; 154 | right: 5px; 155 | font-size: 80%; 156 | } 157 | 158 | .icon 159 | { 160 | display: block; 161 | position: sticky; 162 | float: right; 163 | width: 32px; 164 | height: 32px; 165 | background: linear-gradient(to bottom, #abd, #79a); 166 | border-radius: 8px; 167 | line-height: 32px; 168 | text-align: center; 169 | overflow: hidden; 170 | cursor: pointer; 171 | } 172 | 173 | .icon:hover 174 | { 175 | box-shadow: 0px 0px 4px 2px #ff5; 176 | } -------------------------------------------------------------------------------- /imageconvert.js: -------------------------------------------------------------------------------- 1 | let ImageConverter = new class 2 | { 3 | constructor() 4 | { 5 | this.zip = null; 6 | } 7 | 8 | convertJpeg(image, options) 9 | { 10 | let buffer = null; 11 | 12 | var quality = Number.parseFloat(options["quality"].value); 13 | if(quality < 0 || quality > 100) quality = 1; 14 | else if(quality <= 1) quality = quality; 15 | else quality /= 100.0; 16 | 17 | var dataUrl = image.toDataURL("image/jpeg", quality); 18 | var startPos = dataUrl.indexOf(",") + 1; 19 | const byteCharacters = atob(dataUrl.substring(startPos)); 20 | 21 | buffer = new ArrayBuffer(byteCharacters.length); 22 | var bytes = new Uint8Array(buffer); 23 | for (var i = 0; i < byteCharacters.length; i++) { bytes[i] = byteCharacters.charCodeAt(i); } 24 | 25 | return buffer; 26 | } 27 | 28 | convertPng(image, options) 29 | { 30 | let buffer = null; 31 | 32 | // todo: add 24bit support, instead of 32-bit images 33 | // todo: add alpha support 34 | // todo: add compression support 35 | // todo: add some PNG library to the project to create better PNGs... 36 | 37 | var dataUrl = image.toDataURL("image/png"); 38 | var startPos = dataUrl.indexOf(",") + 1; 39 | const byteCharacters = atob(dataUrl.substring(startPos)); 40 | 41 | buffer = new ArrayBuffer(byteCharacters.length); 42 | var bytes = new Uint8Array(buffer); 43 | for (var i = 0; i < byteCharacters.length; i++) { bytes[i] = byteCharacters.charCodeAt(i); } 44 | 45 | return buffer; 46 | } 47 | 48 | async convertRaw(image, options, rawType) 49 | { 50 | let buffer = null; 51 | let bytes = null; 52 | 53 | const RGBbits = options["rgb"].value; 54 | var ctx = image.getContext("2d"); 55 | var data = ctx.getImageData(0,0,image.width,image.height); /* Uint8ClampedArray (4 bytes for each pixel) */ 56 | 57 | if(RGBbits == "16bit") 58 | { 59 | buffer = new ArrayBuffer(data.data.length / 2); 60 | bytes = new Uint16Array(buffer); 61 | for(var j=0;j= 2) 116 | { 117 | if(data[x] == valo && x < data.length - 1) 118 | { 119 | same++; 120 | } 121 | else 122 | { 123 | same -= 2; 124 | if (data[x] == valo && x == totalSize - 1) 125 | same++; 126 | else 127 | inc = true; 128 | if(data.BYTES_PER_ELEMENT == 1) 129 | { 130 | while (same >= 0xff) 131 | { 132 | buffer[ret++] = 0xff; 133 | same -= 0xff; 134 | } 135 | } 136 | else if(data.BYTES_PER_ELEMENT == 2) 137 | { 138 | while (same >= 0xffff) 139 | { 140 | buffer[ret++] = 0xffff; 141 | same -= 0xffff; 142 | } 143 | } 144 | buffer[ret++] = same; 145 | same = 1; 146 | valo = data[x]; 147 | } 148 | } 149 | else 150 | { 151 | inc = true; 152 | if(data[x] == valo) 153 | same++; 154 | else 155 | same = 1; 156 | valo = data[x]; 157 | } 158 | 159 | if(inc) 160 | buffer[ret++] = data[x]; 161 | } 162 | return buffer; 163 | } 164 | }; 165 | -------------------------------------------------------------------------------- /options.js: -------------------------------------------------------------------------------- 1 | let Options = new class 2 | { 3 | constructor() 4 | { 5 | this.file = null; 6 | this.div = null; 7 | this.image = null; 8 | this.divs = []; 9 | this.settings = {format:["hex", "dec", "bin"], prefix:"0x", suffix:"", pad:true, datatype:["uint8_t", "uint16_t", "uint32_t"], columns:16, skipbytes:0, asciicomments:false}; 10 | this.imageSettings = {convertto:["none", "raw", "raw_compact", "raw_zip", "jpeg", "png"], rgb:["16bit", "8bit"], quality:95, level:2}; 11 | this.typeSettings = {none:[], raw:["rgb"], raw_compact:["rgb"], raw_zip:["rgb", "level"], jpeg:["quality"], png:[]}; 12 | this.inputs = []; 13 | } 14 | 15 | createDialog(f) 16 | { 17 | this.file = f; 18 | 19 | if(this.div != null) 20 | { 21 | this.fillFileInfo(); 22 | return; 23 | } 24 | 25 | this.div = _CN("div", {class:'dialog'}, null, document.body); 26 | this.divs['fileinfo'] = _CN("div", null, null, this.div); 27 | let butt = _CN("button", {}, ["convert"], this.div); 28 | this.divs['conversion'] = _CN("div", null, null, this.div); 29 | this.divs['image'] = _CN("div", {style:"display:none;"}, null, this.div); 30 | 31 | this.fillFileInfo(); 32 | this.fillConversionSettings(); 33 | this.fillImageConversionSettings(); 34 | 35 | butt.addEventListener("click", ()=>{ 36 | if(this.image != null && this.inputs["convertto"].value != "none") 37 | { 38 | Converter.convertImage(this.image, this.inputs); 39 | } 40 | else 41 | { 42 | Converter.convert(this.file, this.inputs); 43 | } 44 | }); 45 | } 46 | 47 | fillFileInfo() 48 | { 49 | this.divs['fileinfo'].innerHTML = ""; 50 | _CN("h2", null, ["File Info:"], this.divs['fileinfo']); 51 | _CN("span", null, [_CN("b",null, ["name: "]), this.file.name], this.divs['fileinfo']); 52 | _CN("span", null, [_CN("b",null, ["type: "]), this.file.type], this.divs['fileinfo']); 53 | _CN("span", null, [_CN("b",null, ["size: "]), this.file.size.toLocaleString() + " bytes"], this.divs['fileinfo']); 54 | createImageBitmap(this.file).then(im=> { 55 | console.log(im); 56 | this.image = _CN("canvas", {width:im.width, height:im.height}); 57 | _CN("span", null, [ 58 | this.image, 59 | " : " + this.image.width + "x" + this.image.height 60 | ], this.divs['fileinfo']); 61 | this.divs['image'].style.display = "inline-grid"; 62 | let ctx = this.image.getContext("2d"); 63 | ctx.drawImage(im,0,0,this.image.width,this.image.height,0,0,this.image.width,this.image.width); 64 | }).catch(ex=>{ 65 | this.image = null; 66 | this.divs['image'].style.display = "none"; 67 | console.log("not an image"); 68 | }); 69 | } 70 | 71 | fillConversionSettings() 72 | { 73 | this.divs['conversion'].innerHTML = ""; 74 | let convTitle = _CN("h2", null, ["Conversion:", _CN("span", {class:"icon", style:"border-style:solid;border-width:1px;border-color:#00f;right:0px;"}, [" ❔"])], this.divs['conversion']); 75 | Object.keys(this.settings).forEach(k=>{ 76 | let span = _CN("span", null, null, this.divs['conversion']); 77 | _CN("b", null, [k], span); 78 | this.inputs[k] = this.createInput(this.settings[k], span); 79 | }); 80 | 81 | this.inputs["format"].addEventListener("change", ()=>{ 82 | switch(this.inputs["format"].value) 83 | { 84 | case "hex": this.inputs["prefix"].value = "0x"; break; 85 | case "dec": this.inputs["prefix"].value = ""; break; 86 | case "bin": this.inputs["prefix"].value = "b"; break; 87 | } 88 | }); 89 | 90 | convTitle.addEventListener("click", ()=>{ 91 | Converter.showHelp("settings.md"); 92 | }); 93 | } 94 | 95 | fillImageConversionSettings() 96 | { 97 | this.divs['image'].innerHTML = ""; 98 | let convTitle = _CN("h2", null, ["Image Settings:", _CN("span", {class:"icon", style:"border-style:solid;border-width:1px;border-color:#00f;right:0px;"}, [" ❔"])], this.divs['image']); 99 | Object.keys(this.imageSettings).forEach(k=>{ 100 | let span = _CN("span", null, null, this.divs['image']); 101 | _CN("b", null, [k], span); 102 | this.inputs[k] = this.createInput(this.imageSettings[k], span); 103 | if(k != "convertto") 104 | this.inputs[k].style.visibility = "hidden"; 105 | }); 106 | 107 | this.inputs["convertto"].addEventListener("change", ()=>{ 108 | var sels = this.divs['image'].getElementsByTagName("select"); 109 | var inps = this.divs['image'].getElementsByTagName("input"); 110 | var list = [] 111 | .concat(Array.from(sels)) 112 | .concat(Array.from(inps)); 113 | for(var j=1;j{this.inputs[k].style.visibility = "visible";}); 115 | }); 116 | 117 | convTitle.addEventListener("click", ()=>{ 118 | Converter.showHelp("imagesettings.md"); 119 | }); 120 | } 121 | 122 | createInput(setting, parent) 123 | { 124 | let inp = null; 125 | if(Array.isArray(setting)) 126 | { 127 | inp = _CN("select", null, null, parent); 128 | setting.forEach(o=>{_CN("option", {value:o}, [o], inp)}); 129 | } 130 | else if(typeof setting == "boolean") 131 | { 132 | inp = _CN("input", {type:"checkbox"}, null, parent); 133 | if(setting) inp.setAttribute("checked", true); 134 | } 135 | else if(typeof setting == "number") 136 | { 137 | inp = _CN("input", {type:"number", value:setting}, null, parent); 138 | } 139 | else 140 | { 141 | inp = _CN("input", {type:"text", value:setting}, null, parent); 142 | } 143 | return inp; 144 | } 145 | }; -------------------------------------------------------------------------------- /convert.js: -------------------------------------------------------------------------------- 1 | let Converter = new class 2 | { 3 | constructor() 4 | { 5 | this.div = null; 6 | this.text = null; 7 | this.help = null; 8 | this.array = null; 9 | this.download = null; 10 | } 11 | 12 | showDialog() 13 | { 14 | if(this.div != null) return; 15 | 16 | this.text = _CN("textarea"); 17 | this.help = _CN("div", {class:"help", style:"display:none;"}); 18 | let saveButt = _CN("span", {class:"icon", style:"top:5px;right:25px;position:absolute;", title:"Save C file"}, ["💾"]); 19 | this.download = _CN("span", {class:"icon", style:"top:5px;right:60px;position:absolute;", title:"Download binary"}, ["⬇"]); 20 | this.div = _CN("div", {class:"dialog2"}, [this.text, saveButt, this.download, this.help], document.body); 21 | 22 | saveButt.addEventListener("click", ()=>{this.saveFile(false);}); 23 | this.download.addEventListener("click", ()=>{this.saveFile(true);}); 24 | this.help.addEventListener("click", ()=>{this.help.style.display = "none";}); 25 | } 26 | 27 | showHelp(link) 28 | { 29 | fetch("https://raw.githubusercontent.com/Adrianotiger/binary2array/main/docs/" + link).then(r=>{ 30 | return r.text(); 31 | }).then(t=>{ 32 | console.log(t); 33 | t = t.replace(/#### (.*$)/gm, "

$1

"); 34 | t = t.replace(/### (.*$)/gm, "

$1

"); 35 | t = t.replace(/## (.*$)/gm, "

$1

"); 36 | t = t.replace(/# (.*$)/gm, "

$1

"); 37 | t = t.replace(/!\[(.*)\]\((.*)\)/gm, ""); 38 | t = t.replace(/[ |^]+(https:\/\/[.]*[^ ]+)/gm, "$2"); 39 | t = t.replace(/^[ ]*-/gm, "
  • "); 40 | t = t.replace(/\s$/gm, "
    "); 41 | this.help.style.display = "block"; 42 | this.help.innerHTML = t; 43 | }); 44 | } 45 | 46 | convert(file, options) 47 | { 48 | this.text.textContent = ""; 49 | this.download.style.display = "none"; 50 | 51 | const reader = new FileReader(); 52 | reader.addEventListener('load', (event) => { 53 | this.showContents(file.name, event.target.result, options); 54 | }); 55 | reader.readAsArrayBuffer(file); 56 | } 57 | 58 | async convertImage(image, options) 59 | { 60 | this.text.textContent = ""; 61 | this.download.style.display = "inline-block"; 62 | 63 | const convertTo = options["convertto"].value; 64 | let buffer = null; 65 | 66 | if(convertTo == "raw" || convertTo == "raw_compact" || convertTo == "raw_zip") 67 | { 68 | buffer = await ImageConverter.convertRaw(image, options, convertTo); 69 | } 70 | else if(convertTo == "png") 71 | { 72 | buffer = ImageConverter.convertPng(image, options); 73 | } 74 | else if(convertTo == "jpeg") 75 | { 76 | buffer = ImageConverter.convertJpeg(image, options); 77 | } 78 | 79 | this.showContents(convertTo, buffer, options); 80 | } 81 | 82 | clear() 83 | { 84 | if(this.text != null) 85 | { 86 | this.text.textContent = "press 'CONVERT'"; 87 | } 88 | } 89 | 90 | saveFile(saveAsBinary) 91 | { 92 | if(this.array == null || Options.file == null) return; 93 | 94 | if(window.showSaveFilePicker) 95 | { 96 | let options = { 97 | suggestedName: Options.file.name.substring(0, Options.file.name.indexOf(".")), 98 | excludeAcceptAllOption: true, 99 | types:[] 100 | }; 101 | var mime = "octet/stream"; 102 | if(saveAsBinary) 103 | { 104 | var accept = {}; 105 | var description = "Image file"; 106 | switch(Options.inputs["convertto"].value) 107 | { 108 | case "jpeg": mime = "image/jpeg"; accept[mime] = ['.jpg', '.jpeg']; break; 109 | case "png": mime = "image/png"; accept[mime] = ['.png']; break; 110 | default: accept[mime] = ['.raw']; description = "Binary file"; break; 111 | } 112 | options.types.push({description:description, accept:accept}); 113 | } 114 | else 115 | { 116 | options.types.push({description:"C File", accept:{'text/plain':['.cpp', '.h', '.c']}}); 117 | } 118 | window.showSaveFilePicker(options).then((fh)=>{ 119 | console.log(fh); 120 | fh.getFile().then(fp=>{ 121 | console.log(fp); 122 | fh.createWritable().then(async fw=>{ 123 | var contents = null; 124 | if(saveAsBinary) 125 | await fw.write(this.array); 126 | else 127 | await fw.write(this.text.textContent); 128 | fw.close(); 129 | }).catch(ex=>{ 130 | alert("Unable to open file " + fh.name); 131 | }); 132 | }).catch(ex=>{ 133 | alert("Unable to open file " + fh.name); 134 | }); 135 | }).catch(ex=>{ 136 | console.log("File picker abort"); 137 | }); 138 | } 139 | else 140 | { 141 | let a = _CN("a", {style:"display:none"}, [" "], document.body); 142 | var blob = new Blob([this.array], {type: "image/jpeg"}); 143 | var url = window.URL.createObjectURL(blob); 144 | a.href = url; 145 | a.download = "test.jpg"; 146 | a.click(); 147 | window.URL.revokeObjectURL(url); 148 | document.body.removeChild(a); 149 | } 150 | } 151 | 152 | showContents(filename, buffer, options) 153 | { 154 | this.array = null; 155 | let bits = 8; 156 | let radix = 16; 157 | let txt = ""; 158 | let padStart = 0; 159 | let padChar = '0'; 160 | let newLine = parseInt(options["columns"].value); 161 | const pad = options["pad"].checked; 162 | const prefix = options["prefix"].value.trim(); 163 | const suffix = options["suffix"].value.trim(); 164 | const writeComment = options["asciicomments"].checked; 165 | let comment = ""; 166 | 167 | if(filename.length <= 0) filename = "bin_data.bin"; 168 | 169 | switch(options["datatype"].value) 170 | { 171 | case "uint8_t": bits = 8; break; 172 | case "uint16_t": bits = 16; break; 173 | case "uint32_t": bits = 32; break; 174 | } 175 | 176 | if((buffer.byteLength % (bits / 8) ) != 0) 177 | { 178 | this.text.textContent = "ERROR: you can set '" + options["datatype"].value + "' only if the buffer size is divisible by " + (bits / 8) + "."; 179 | return; 180 | } 181 | 182 | // Create array from ArrayBuffer with the right data type 183 | switch(bits) 184 | { 185 | case 8: this.array = new Uint8Array(buffer); break; 186 | case 16: this.array = new Uint16Array(buffer); break; 187 | case 32: this.array = new Uint32Array(buffer); break; 188 | } 189 | // Check the right output format and set the padding 190 | switch(options["format"].value) 191 | { 192 | case "hex": radix = 16; if(pad) padStart = 2 * (bits / 8); break; 193 | case "dec": radix = 10; if(pad) {const sp = [3,5,8,10]; padStart = sp[bits / 8 - 1];} padChar = ' '; break; 194 | case "bin": radix = 2; padStart = bits; break; 195 | default: this.array = new UInt8Array(buffer); break; 196 | } 197 | 198 | // Remove some bytes if it is set in the options 199 | const skipBytes = parseInt(options["skipbytes"].value) / (bits/8); 200 | if(skipBytes > 0) this.array = this.array.slice(skipBytes); 201 | const arrLen = this.array.length; 202 | if(newLine == 0) newLine = arrLen; 203 | let numIndex = 0; 204 | 205 | // Begin to write the output 206 | this.text.textContent = "static const " + options["datatype"].value + " " + filename.replace(" ", "_").substring(0, filename.indexOf(".")) + "[" + arrLen + "] = {\n"; 207 | this.array.forEach(a=>{ 208 | txt += prefix + this.array[numIndex].toString(radix).padStart(padStart, padChar) + suffix; 209 | if(writeComment) comment += this.array[numIndex] < 32 || this.array[numIndex] == 127 ? "." : String.fromCharCode(this.array[numIndex]); 210 | if(++numIndex < arrLen) txt += ", "; 211 | if((numIndex % newLine) == 0) 212 | { 213 | if(writeComment) { txt += " /* " + comment.replace("\n", ".") + " */"; comment = ""; } 214 | txt += '\n'; 215 | } 216 | 217 | if((numIndex % 1000) == 0) {this.text.textContent += txt; txt = "";} 218 | }); 219 | 220 | this.text.textContent += txt.trim() + "\n};\n"; 221 | 222 | // Output some info in the console 223 | console.log(buffer); 224 | console.log(options); 225 | } 226 | }; -------------------------------------------------------------------------------- /3th/jszip.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZip v3.10.1 - A JavaScript class for generating and reading zip files 4 | 5 | 6 | (c) 2009-2016 Stuart Knightley 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. 8 | 9 | JSZip uses the library pako released under the MIT license : 10 | https://github.com/nodeca/pako/blob/main/LICENSE 11 | */ 12 | 13 | !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>2,s=(3&t)<<4|r>>4,a=1>6:64,o=2>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(){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>>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>>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=function(e){t.push({data:e,meta:t.meta})}},r.compressWorker=function(e){return new h("Deflate",e)},r.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function A(e,t){var r,n="";for(r=0;r>>=8;return n}function n(e,t,r,n,i,s){var a,o,h=e.file,u=e.compression,l=s!==O.utf8encode,f=I.transformTo("string",s(h.name)),c=I.transformTo("string",O.utf8encode(h.name)),d=h.comment,p=I.transformTo("string",s(d)),m=I.transformTo("string",O.utf8encode(d)),_=c.length!==h.name.length,g=m.length!==d.length,b="",v="",y="",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),"UNIX"===i?(C=798,z|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(e){return 63&(e||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+c,b+="up"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+="uc"+A(y.length,2)+y);var E="";return E+="\n\0",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+"\0\0\0\0"+A(z,4)+A(n,4)+f+b+p}}var I=e("../utils"),i=e("../stream/GenericWorker"),O=e("../utf8"),B=e("../crc32"),R=e("../signature");function s(e,t,r,n){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}I.inherits(s,i),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},s.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return R.DATA_DESCRIPTOR+A(e.crc32,4)+A(e.compressedSize,4)+A(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),s=e("./ArrayReader"),a=e("./StringReader"),o=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new o(e):i.uint8array?new h(n.transformTo("uint8array",e)):new s(n.transformTo("array",e)):new a(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function s(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r "+e:e}},t.exports=n},{}],29:[function(e,t,r){"use strict";var h=e("../utils"),i=e("./ConvertWorker"),s=e("./GenericWorker"),u=e("../base64"),n=e("../support"),a=e("../external"),o=null;if(n.nodestream)try{o=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function l(e,o){return new a.Promise(function(t,r){var n=[],i=e._internalType,s=e._outputType,a=e._mimeType;e.on("data",function(e,t){n.push(e),o&&o(t)}).on("error",function(e){n=[],r(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return h.newBlob(h.transformTo("arraybuffer",t),r);case"base64":return u.encode(t);default:return h.transformTo(e,t)}}(s,function(e,t){var r,n=0,i=null,s=0;for(r=0;r>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return h.nodebuffer?o.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,i,s=e.length,a=new Array(2*s);for(t=r=0;t>10&1023,a[r++]=56320|1023&n)}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(e=o.transformTo(h.uint8array?"uint8array":"array",e))},o.inherits(a,n),a.prototype.processChunk=function(e){var t=o.transformTo(h.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}(t),i=t;n!==t.length&&(h.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:s.utf8decode(i),meta:e.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=a,o.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,a){"use strict";var o=e("./support"),h=e("./base64"),r=e("./nodejsUtils"),u=e("./external");function n(e){return e}function l(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new h.Buf8(e.length),r=0,n=t.length;r>10&1023,o[n++]=56320|1023&i)}return l(o,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){for(var i=65535&e|0,s=e>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var h,c=e("../utils/common"),u=e("./trees"),d=e("./adler32"),p=e("./crc32"),n=e("./messages"),l=0,f=4,m=0,_=-2,g=-1,b=4,i=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(e,t){return e.msg=n[t],t}function T(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(c.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function N(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function U(e,t){e.pending_buf[e.pending++]=t}function P(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function L(e,t){var r,n,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,h=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,u=e.window,l=e.w_mask,f=e.prev,c=e.strstart+S,d=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===d&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sh&&0!=--i);return a<=e.lookahead?a:e.lookahead}function j(e){var t,r,n,i,s,a,o,h,u,l,f=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-z)){for(c.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;n=e.head[--t],e.head[t]=f<=n?n-f:0,--r;);for(t=r=f;n=e.prev[--t],e.prev[t]=f<=n?n-f:0,--r;);i+=f}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,h=e.strstart+e.lookahead,u=i,l=void 0,l=a.avail_in,u=x)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x)if(n=u._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-x,n=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(j(e),0===e.lookahead&&t===l)return A;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,N(e,!1),0===e.strm.avail_out))return A;if(e.strstart-e.block_start>=e.w_size-z&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(e,t){return Y(e,t,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},r.deflate=function(e,t){var r,n,i,s;if(!e||!e.state||5>8&255),U(n,n.gzhead.time>>16&255),U(n,n.gzhead.time>>24&255),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(U(n,255&n.gzhead.extra.length),U(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(U(n,0),U(n,0),U(n,0),U(n,0),U(n,0),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,3),n.status=E);else{var a=v+(n.w_bits-8<<4)<<8;a|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=E,P(n,a),0!==n.strstart&&(P(n,e.adler>>>16),P(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending!==n.pending_buf_size));)U(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&F(e),n.pending+2<=n.pending_buf_size&&(U(n,255&e.adler),U(n,e.adler>>8&255),e.adler=0,n.status=E)):n.status=E),0!==n.pending){if(F(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&T(t)<=T(r)&&t!==f)return R(e,-5);if(666===n.status&&0!==e.avail_in)return R(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===l)return A;break}if(e.match_length=0,r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):3===n.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=S){if(j(e),e.lookahead<=S&&t===l)return A;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(r=u._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):h[n.level].func(n,t);if(o!==O&&o!==B||(n.status=666),o===A||o===O)return 0===e.avail_out&&(n.last_flush=-1),m;if(o===I&&(1===t?u._tr_align(n):5!==t&&(u._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),F(e),0===e.avail_out))return n.last_flush=-1,m}return t!==f?m:n.wrap<=0?1:(2===n.wrap?(U(n,255&e.adler),U(n,e.adler>>8&255),U(n,e.adler>>16&255),U(n,e.adler>>24&255),U(n,255&e.total_in),U(n,e.total_in>>8&255),U(n,e.total_in>>16&255),U(n,e.total_in>>24&255)):(P(n,e.adler>>>16),P(n,65535&e.adler)),F(e),0=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new c.Buf8(r.w_size),c.arraySet(u,t,l-r.w_size,r.w_size,0),t=u,l=r.w_size),a=e.avail_in,o=e.next_in,h=e.input,e.avail_in=l,e.next_in=0,e.input=t,j(r);r.lookahead>=x;){for(n=r.strstart,i=r.lookahead-(x-1);r.ins_h=(r.ins_h<>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(d&(1<>>=y,p-=y),p<15&&(d+=z[n++]<>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(d&(1<>>=y,p-=y,(y=s-a)>3,d&=(1<<(p-=w<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){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.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(i),t.sane=1,t.back=-1,N):U}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):U}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(I.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),I.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(I.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>>8&255,r.check=B(r.check,E,2,0)),l=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,n,s,d,k)),512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&d>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break e;o--,u+=n[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=n[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286>>=3,l-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=_,l-=_,r.lens[r.have++]=b;else{if(16===b){for(z=_+2;l>>=_,l-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===b){for(z=_+3;l>>=_)),u>>>=3,l-=3}else{for(z=_+7;l>>=_)),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=h){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,R(e,c),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,64&g){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===h)break e;if(d=c-h,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=a-r.offset,d=r.length;for(hd?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=t[r+a[v]]}if(k>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>d-r?(e.bi_buf|=t<>d-e.bi_valid,e.bi_valid+=r-d):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){var n,i,s=new Array(g+1),a=0;for(n=1;n<=g;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=j(s[o]++,o))}}function W(e){var t;for(t=0;t>1;1<=r;r--)G(e,s,r);for(i=h;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,o,h=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=g;s++)e.bl_count[s]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<_;r++)p<(s=h[2*h[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),h[2*n+1]=s,u>=7;n>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?J(e,t,r,n):4===e.strategy||s===i?(P(e,2+(n?1:0),3),K(e,z,C)):(P(e,4+(n?1:0),3),function(e,t,r,n){var i;for(P(e,t-257,5),P(e,r-1,5),P(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+u+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){P(e,2,3),L(e,m,z),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(r,n){"use strict";if(!r.setImmediate){var i,s,t,a,o=1,h={},u=!1,l=r.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(r);e=e&&e.setTimeout?e:r,i="[object process]"==={}.toString.call(r.process)?function(e){process.nextTick(function(){c(e)})}:function(){if(r.postMessage&&!r.importScripts){var e=!0,t=r.onmessage;return r.onmessage=function(){e=!1},r.postMessage("","*"),r.onmessage=t,e}}()?(a="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",d,!1):r.attachEvent("onmessage",d),function(e){r.postMessage(a+e,"*")}):r.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){t.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(c,0,e)},e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r