UNPKG

pdfmake

Version:

Client/server side PDF printing in pure JavaScript

1,477 lines (1,375 loc) 2.81 MB
/*! pdfmake v0.2.10, @license MIT, @link http://pdfmake.org */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else { var a = factory(); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(typeof self !== 'undefined' ? self : this, function() { return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 41783: /***/ (function(__unused_webpack_module, exports) { "use strict"; // The following break classes are handled by the pair table exports.OP = 0; // Opening punctuation exports.CL = 1; // Closing punctuation exports.CP = 2; // Closing parenthesis exports.QU = 3; // Ambiguous quotation exports.GL = 4; // Glue exports.NS = 5; // Non-starters exports.EX = 6; // Exclamation/Interrogation exports.SY = 7; // Symbols allowing break after exports.IS = 8; // Infix separator exports.PR = 9; // Prefix exports.PO = 10; // Postfix exports.NU = 11; // Numeric exports.AL = 12; // Alphabetic exports.HL = 13; // Hebrew Letter exports.ID = 14; // Ideographic exports.IN = 15; // Inseparable characters exports.HY = 16; // Hyphen exports.BA = 17; // Break after exports.BB = 18; // Break before exports.B2 = 19; // Break on either side (but not pair) exports.ZW = 20; // Zero-width space exports.CM = 21; // Combining marks exports.WJ = 22; // Word joiner exports.H2 = 23; // Hangul LV exports.H3 = 24; // Hangul LVT exports.JL = 25; // Hangul L Jamo exports.JV = 26; // Hangul V Jamo exports.JT = 27; // Hangul T Jamo exports.RI = 28; // Regional Indicator exports.EB = 29; // Emoji Base exports.EM = 30; // Emoji Modifier exports.ZWJ = 31; // Zero Width Joiner exports.CB = 32; // Contingent break // The following break classes are not handled by the pair table exports.AI = 33; // Ambiguous (Alphabetic or Ideograph) exports.BK = 34; // Break (mandatory) exports.CJ = 35; // Conditional Japanese Starter exports.CR = 36; // Carriage return exports.LF = 37; // Line feed exports.NL = 38; // Next line exports.SA = 39; // South-East Asian exports.SG = 40; // Surrogates exports.SP = 41; // Space exports.XX = 42; // Unknown /***/ }), /***/ 98282: /***/ (function(__unused_webpack_module, exports) { "use strict"; var CI_BRK, CP_BRK, DI_BRK, IN_BRK, PR_BRK; exports.DI_BRK = DI_BRK = 0; // Direct break opportunity exports.IN_BRK = IN_BRK = 1; // Indirect break opportunity exports.CI_BRK = CI_BRK = 2; // Indirect break opportunity for combining marks exports.CP_BRK = CP_BRK = 3; // Prohibited break for combining marks exports.PR_BRK = PR_BRK = 4; // Prohibited break // Based on example pair table from https://www.unicode.org/reports/tr14/tr14-37.html#Table2 // - ZWJ special processing for LB8a of Revision 41 // - CB manually added as per Rule LB20 // - CL, CP, NS, SY, IS, PR, PO, HY, BA, B2 and RI manually adjusted as per LB22 of Revision 45 exports.pairTable = [ //OP , CL , CP , QU , GL , NS , EX , SY , IS , PR , PO , NU , AL , HL , ID , IN , HY , BA , BB , B2 , ZW , CM , WJ , H2 , H3 , JL , JV , JT , RI , EB , EM , ZWJ , CB [PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, CP_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK], // OP [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // CL [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // CP [PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], // QU [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], // GL [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // NS [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // EX [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // SY [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // IS [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK], // PR [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // PO [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // NU [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // AL [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // HL [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // ID [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // IN [DI_BRK, PR_BRK, PR_BRK, IN_BRK, DI_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // HY [DI_BRK, PR_BRK, PR_BRK, IN_BRK, DI_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // BA [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK], // BB [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, PR_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // B2 [DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK], // ZW [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // CM [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK], // WJ [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // H2 [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // H3 [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // JL [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // JV [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // JT [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // RI [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, DI_BRK], // EB [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, IN_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // EM [IN_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, PR_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, IN_BRK, IN_BRK, IN_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK], // ZWJ [DI_BRK, PR_BRK, PR_BRK, IN_BRK, IN_BRK, DI_BRK, PR_BRK, PR_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, PR_BRK, CI_BRK, PR_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, DI_BRK, IN_BRK, DI_BRK] // CB ]; /***/ }), /***/ 57013: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; __webpack_require__(18756); exports.EncodeStream = __webpack_require__(16176); exports.DecodeStream = __webpack_require__(78984); exports.Array = __webpack_require__(38637); exports.LazyArray = __webpack_require__(88687); exports.Bitfield = __webpack_require__(72959); exports.Boolean = __webpack_require__(64888); exports.Buffer = __webpack_require__(77324); exports.Enum = __webpack_require__(71499); exports.Optional = __webpack_require__(72526); exports.Reserved = __webpack_require__(10298); exports.String = __webpack_require__(36291); exports.Struct = __webpack_require__(2731); exports.VersionedStruct = __webpack_require__(48084); var utils = __webpack_require__(76949); var NumberT = __webpack_require__(63787); var Pointer = __webpack_require__(41545); Object.assign(exports, utils, NumberT, Pointer); /***/ }), /***/ 38637: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; __webpack_require__(65292); __webpack_require__(73844); __webpack_require__(69330); __webpack_require__(11765); __webpack_require__(81755); __webpack_require__(20731); __webpack_require__(24863); __webpack_require__(14032); __webpack_require__(61726); __webpack_require__(57114); __webpack_require__(58281); __webpack_require__(94712); function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } var _require = __webpack_require__(63787), NumberT = _require.Number; var utils = __webpack_require__(76949); var ArrayT = /*#__PURE__*/function () { function ArrayT(type, length, lengthType) { if (lengthType === void 0) { lengthType = 'count'; } this.type = type; this.length = length; this.lengthType = lengthType; } var _proto = ArrayT.prototype; _proto.decode = function decode(stream, parent) { var length; var pos = stream.pos; var res = []; var ctx = parent; if (this.length != null) { length = utils.resolveLength(this.length, stream, parent); } if (this.length instanceof NumberT) { // define hidden properties Object.defineProperties(res, { parent: { value: parent }, _startOffset: { value: pos }, _currentOffset: { value: 0, writable: true }, _length: { value: length } }); ctx = res; } if (length == null || this.lengthType === 'bytes') { var target = length != null ? stream.pos + length : (parent != null ? parent._length : undefined) ? parent._startOffset + parent._length : stream.length; while (stream.pos < target) { res.push(this.type.decode(stream, ctx)); } } else { for (var i = 0, end = length; i < end; i++) { res.push(this.type.decode(stream, ctx)); } } return res; }; _proto.size = function size(array, ctx) { if (!array) { return this.type.size(null, ctx) * utils.resolveLength(this.length, null, ctx); } var size = 0; if (this.length instanceof NumberT) { size += this.length.size(); ctx = { parent: ctx }; } for (var _iterator = _createForOfIteratorHelperLoose(array), _step; !(_step = _iterator()).done;) { var item = _step.value; size += this.type.size(item, ctx); } return size; }; _proto.encode = function encode(stream, array, parent) { var ctx = parent; if (this.length instanceof NumberT) { ctx = { pointers: [], startOffset: stream.pos, parent: parent }; ctx.pointerOffset = stream.pos + this.size(array, ctx); this.length.encode(stream, array.length); } for (var _iterator2 = _createForOfIteratorHelperLoose(array), _step2; !(_step2 = _iterator2()).done;) { var item = _step2.value; this.type.encode(stream, item, ctx); } if (this.length instanceof NumberT) { var i = 0; while (i < ctx.pointers.length) { var ptr = ctx.pointers[i++]; ptr.type.encode(stream, ptr.val); } } }; return ArrayT; }(); module.exports = ArrayT; /***/ }), /***/ 72959: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; __webpack_require__(74516); var Bitfield = /*#__PURE__*/function () { function Bitfield(type, flags) { if (flags === void 0) { flags = []; } this.type = type; this.flags = flags; } var _proto = Bitfield.prototype; _proto.decode = function decode(stream) { var val = this.type.decode(stream); var res = {}; for (var i = 0; i < this.flags.length; i++) { var flag = this.flags[i]; if (flag != null) { res[flag] = !!(val & 1 << i); } } return res; }; _proto.size = function size() { return this.type.size(); }; _proto.encode = function encode(stream, keys) { var val = 0; for (var i = 0; i < this.flags.length; i++) { var flag = this.flags[i]; if (flag != null) { if (keys[flag]) { val |= 1 << i; } } } return this.type.encode(stream, val); }; return Bitfield; }(); module.exports = Bitfield; /***/ }), /***/ 64888: /***/ (function(module) { "use strict"; var BooleanT = /*#__PURE__*/function () { function BooleanT(type) { this.type = type; } var _proto = BooleanT.prototype; _proto.decode = function decode(stream, parent) { return !!this.type.decode(stream, parent); }; _proto.size = function size(val, parent) { return this.type.size(val, parent); }; _proto.encode = function encode(stream, val, parent) { return this.type.encode(stream, +val, parent); }; return BooleanT; }(); module.exports = BooleanT; /***/ }), /***/ 77324: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(76949); var _require = __webpack_require__(63787), NumberT = _require.Number; var BufferT = /*#__PURE__*/function () { function BufferT(length) { this.length = length; } var _proto = BufferT.prototype; _proto.decode = function decode(stream, parent) { var length = utils.resolveLength(this.length, stream, parent); return stream.readBuffer(length); }; _proto.size = function size(val, parent) { if (!val) { return utils.resolveLength(this.length, null, parent); } return val.length; }; _proto.encode = function encode(stream, buf, parent) { if (this.length instanceof NumberT) { this.length.encode(stream, buf.length); } return stream.writeBuffer(buf); }; return BufferT; }(); module.exports = BufferT; /***/ }), /***/ 78984: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* provided dependency */ var Buffer = __webpack_require__(50621)["Buffer"]; __webpack_require__(20731); __webpack_require__(14032); __webpack_require__(61726); __webpack_require__(57114); __webpack_require__(46467); var iconv; try { iconv = __webpack_require__(54171); } catch (error) {} var DecodeStream = /*#__PURE__*/function () { function DecodeStream(buffer) { this.buffer = buffer; this.pos = 0; this.length = this.buffer.length; } var _proto = DecodeStream.prototype; _proto.readString = function readString(length, encoding) { if (encoding === void 0) { encoding = 'ascii'; } switch (encoding) { case 'utf16le': case 'ucs2': case 'utf8': case 'ascii': return this.buffer.toString(encoding, this.pos, this.pos += length); case 'utf16be': var buf = Buffer.from(this.readBuffer(length)); // swap the bytes for (var i = 0, end = buf.length - 1; i < end; i += 2) { var byte = buf[i]; buf[i] = buf[i + 1]; buf[i + 1] = byte; } return buf.toString('utf16le'); default: buf = this.readBuffer(length); if (iconv) { try { return iconv.decode(buf, encoding); } catch (error1) {} } return buf; } }; _proto.readBuffer = function readBuffer(length) { return this.buffer.slice(this.pos, this.pos += length); }; _proto.readUInt24BE = function readUInt24BE() { return (this.readUInt16BE() << 8) + this.readUInt8(); }; _proto.readUInt24LE = function readUInt24LE() { return this.readUInt16LE() + (this.readUInt8() << 16); }; _proto.readInt24BE = function readInt24BE() { return (this.readInt16BE() << 8) + this.readUInt8(); }; _proto.readInt24LE = function readInt24LE() { return this.readUInt16LE() + (this.readInt8() << 16); }; return DecodeStream; }(); DecodeStream.TYPES = { UInt8: 1, UInt16: 2, UInt24: 3, UInt32: 4, Int8: 1, Int16: 2, Int24: 3, Int32: 4, Float: 4, Double: 8 }; var _loop = function _loop(key) { if (key.slice(0, 4) === 'read') { var bytes = DecodeStream.TYPES[key.replace(/read|[BL]E/g, '')]; DecodeStream.prototype[key] = function () { var ret = this.buffer[key](this.pos); this.pos += bytes; return ret; }; } }; for (var key in Buffer.prototype) { _loop(key); } module.exports = DecodeStream; /***/ }), /***/ 16176: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* provided dependency */ var Buffer = __webpack_require__(50621)["Buffer"]; __webpack_require__(41584); __webpack_require__(20731); __webpack_require__(61726); __webpack_require__(46467); function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var iconv; var stream = __webpack_require__(9760); var DecodeStream = __webpack_require__(78984); try { iconv = __webpack_require__(54171); } catch (error) {} var EncodeStream = /*#__PURE__*/function (_stream$Readable) { _inheritsLoose(EncodeStream, _stream$Readable); function EncodeStream(bufferSize) { var _this; if (bufferSize === void 0) { bufferSize = 65536; } _this = _stream$Readable.apply(this, arguments) || this; _this.buffer = Buffer.alloc(bufferSize); _this.bufferOffset = 0; _this.pos = 0; return _this; } // do nothing, required by node var _proto = EncodeStream.prototype; _proto._read = function _read() {}; _proto.ensure = function ensure(bytes) { if (this.bufferOffset + bytes > this.buffer.length) { return this.flush(); } }; _proto.flush = function flush() { if (this.bufferOffset > 0) { this.push(Buffer.from(this.buffer.slice(0, this.bufferOffset))); return this.bufferOffset = 0; } }; _proto.writeBuffer = function writeBuffer(buffer) { this.flush(); this.push(buffer); return this.pos += buffer.length; }; _proto.writeString = function writeString(string, encoding) { if (encoding === void 0) { encoding = 'ascii'; } switch (encoding) { case 'utf16le': case 'ucs2': case 'utf8': case 'ascii': return this.writeBuffer(Buffer.from(string, encoding)); case 'utf16be': var buf = Buffer.from(string, 'utf16le'); // swap the bytes for (var i = 0, end = buf.length - 1; i < end; i += 2) { var byte = buf[i]; buf[i] = buf[i + 1]; buf[i + 1] = byte; } return this.writeBuffer(buf); default: if (iconv) { return this.writeBuffer(iconv.encode(string, encoding)); } else { throw new Error('Install iconv-lite to enable additional string encodings.'); } } }; _proto.writeUInt24BE = function writeUInt24BE(val) { this.ensure(3); this.buffer[this.bufferOffset++] = val >>> 16 & 0xff; this.buffer[this.bufferOffset++] = val >>> 8 & 0xff; this.buffer[this.bufferOffset++] = val & 0xff; return this.pos += 3; }; _proto.writeUInt24LE = function writeUInt24LE(val) { this.ensure(3); this.buffer[this.bufferOffset++] = val & 0xff; this.buffer[this.bufferOffset++] = val >>> 8 & 0xff; this.buffer[this.bufferOffset++] = val >>> 16 & 0xff; return this.pos += 3; }; _proto.writeInt24BE = function writeInt24BE(val) { if (val >= 0) { return this.writeUInt24BE(val); } else { return this.writeUInt24BE(val + 0xffffff + 1); } }; _proto.writeInt24LE = function writeInt24LE(val) { if (val >= 0) { return this.writeUInt24LE(val); } else { return this.writeUInt24LE(val + 0xffffff + 1); } }; _proto.fill = function fill(val, length) { if (length < this.buffer.length) { this.ensure(length); this.buffer.fill(val, this.bufferOffset, this.bufferOffset + length); this.bufferOffset += length; return this.pos += length; } else { var buf = Buffer.alloc(length); buf.fill(val); return this.writeBuffer(buf); } }; _proto.end = function end() { this.flush(); return this.push(null); }; return EncodeStream; }(stream.Readable); var _loop = function _loop(key) { if (key.slice(0, 5) === 'write') { var bytes = +DecodeStream.TYPES[key.replace(/write|[BL]E/g, '')]; EncodeStream.prototype[key] = function (value) { this.ensure(bytes); this.buffer[key](value, this.bufferOffset); this.bufferOffset += bytes; return this.pos += bytes; }; } }; for (var key in Buffer.prototype) { _loop(key); } module.exports = EncodeStream; /***/ }), /***/ 71499: /***/ (function(module) { "use strict"; var Enum = /*#__PURE__*/function () { function Enum(type, options) { if (options === void 0) { options = []; } this.type = type; this.options = options; } var _proto = Enum.prototype; _proto.decode = function decode(stream) { var index = this.type.decode(stream); return this.options[index] || index; }; _proto.size = function size() { return this.type.size(); }; _proto.encode = function encode(stream, val) { var index = this.options.indexOf(val); if (index === -1) { throw new Error("Unknown option in enum: " + val); } return this.type.encode(stream, index); }; return Enum; }(); module.exports = Enum; /***/ }), /***/ 88687: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; __webpack_require__(14032); __webpack_require__(68067); function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var ArrayT = __webpack_require__(38637); var _require = __webpack_require__(63787), NumberT = _require.Number; var utils = __webpack_require__(76949); var _require2 = __webpack_require__(7187), _inspect = _require2.inspect; var LazyArrayT = /*#__PURE__*/function (_ArrayT) { _inheritsLoose(LazyArrayT, _ArrayT); function LazyArrayT() { return _ArrayT.apply(this, arguments) || this; } var _proto = LazyArrayT.prototype; _proto.decode = function decode(stream, parent) { var pos = stream.pos; var length = utils.resolveLength(this.length, stream, parent); if (this.length instanceof NumberT) { parent = { parent: parent, _startOffset: pos, _currentOffset: 0, _length: length }; } var res = new LazyArray(this.type, length, stream, parent); stream.pos += length * this.type.size(null, parent); return res; }; _proto.size = function size(val, ctx) { if (val instanceof LazyArray) { val = val.toArray(); } return _ArrayT.prototype.size.call(this, val, ctx); }; _proto.encode = function encode(stream, val, ctx) { if (val instanceof LazyArray) { val = val.toArray(); } return _ArrayT.prototype.encode.call(this, stream, val, ctx); }; return LazyArrayT; }(ArrayT); var LazyArray = /*#__PURE__*/function () { function LazyArray(type, length, stream, ctx) { this.type = type; this.length = length; this.stream = stream; this.ctx = ctx; this.base = this.stream.pos; this.items = []; } var _proto2 = LazyArray.prototype; _proto2.get = function get(index) { if (index < 0 || index >= this.length) { return undefined; } if (this.items[index] == null) { var pos = this.stream.pos; this.stream.pos = this.base + this.type.size(null, this.ctx) * index; this.items[index] = this.type.decode(this.stream, this.ctx); this.stream.pos = pos; } return this.items[index]; }; _proto2.toArray = function toArray() { var result = []; for (var i = 0, end = this.length; i < end; i++) { result.push(this.get(i)); } return result; }; _proto2.inspect = function inspect() { return _inspect(this.toArray()); }; return LazyArray; }(); module.exports = LazyArrayT; /***/ }), /***/ 63787: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var DecodeStream = __webpack_require__(78984); var NumberT = /*#__PURE__*/function () { function NumberT(type, endian) { if (endian === void 0) { endian = 'BE'; } this.type = type; this.endian = endian; this.fn = this.type; if (this.type[this.type.length - 1] !== '8') { this.fn += this.endian; } } var _proto = NumberT.prototype; _proto.size = function size() { return DecodeStream.TYPES[this.type]; }; _proto.decode = function decode(stream) { return stream["read" + this.fn](); }; _proto.encode = function encode(stream, val) { return stream["write" + this.fn](val); }; return NumberT; }(); exports.Number = NumberT; exports.uint8 = new NumberT('UInt8'); exports.uint16be = exports.uint16 = new NumberT('UInt16', 'BE'); exports.uint16le = new NumberT('UInt16', 'LE'); exports.uint24be = exports.uint24 = new NumberT('UInt24', 'BE'); exports.uint24le = new NumberT('UInt24', 'LE'); exports.uint32be = exports.uint32 = new NumberT('UInt32', 'BE'); exports.uint32le = new NumberT('UInt32', 'LE'); exports.int8 = new NumberT('Int8'); exports.int16be = exports.int16 = new NumberT('Int16', 'BE'); exports.int16le = new NumberT('Int16', 'LE'); exports.int24be = exports.int24 = new NumberT('Int24', 'BE'); exports.int24le = new NumberT('Int24', 'LE'); exports.int32be = exports.int32 = new NumberT('Int32', 'BE'); exports.int32le = new NumberT('Int32', 'LE'); exports.floatbe = exports.float = new NumberT('Float', 'BE'); exports.floatle = new NumberT('Float', 'LE'); exports.doublebe = exports.double = new NumberT('Double', 'BE'); exports.doublele = new NumberT('Double', 'LE'); var Fixed = /*#__PURE__*/function (_NumberT) { _inheritsLoose(Fixed, _NumberT); function Fixed(size, endian, fracBits) { var _this; if (fracBits === void 0) { fracBits = size >> 1; } _this = _NumberT.call(this, "Int" + size, endian) || this; _this._point = 1 << fracBits; return _this; } var _proto2 = Fixed.prototype; _proto2.decode = function decode(stream) { return _NumberT.prototype.decode.call(this, stream) / this._point; }; _proto2.encode = function encode(stream, val) { return _NumberT.prototype.encode.call(this, stream, val * this._point | 0); }; return Fixed; }(NumberT); exports.Fixed = Fixed; exports.fixed16be = exports.fixed16 = new Fixed(16, 'BE'); exports.fixed16le = new Fixed(16, 'LE'); exports.fixed32be = exports.fixed32 = new Fixed(32, 'BE'); exports.fixed32le = new Fixed(32, 'LE'); /***/ }), /***/ 72526: /***/ (function(module) { "use strict"; var Optional = /*#__PURE__*/function () { function Optional(type, condition) { if (condition === void 0) { condition = true; } this.type = type; this.condition = condition; } var _proto = Optional.prototype; _proto.decode = function decode(stream, parent) { var condition = this.condition; if (typeof condition === 'function') { condition = condition.call(parent, parent); } if (condition) { return this.type.decode(stream, parent); } }; _proto.size = function size(val, parent) { var condition = this.condition; if (typeof condition === 'function') { condition = condition.call(parent, parent); } if (condition) { return this.type.size(val, parent); } else { return 0; } }; _proto.encode = function encode(stream, val, parent) { var condition = this.condition; if (typeof condition === 'function') { condition = condition.call(parent, parent); } if (condition) { return this.type.encode(stream, val, parent); } }; return Optional; }(); module.exports = Optional; /***/ }), /***/ 41545: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(76949); var Pointer = /*#__PURE__*/function () { function Pointer(offsetType, type, options) { if (options === void 0) { options = {}; } this.offsetType = offsetType; this.type = type; this.options = options; if (this.type === 'void') { this.type = null; } if (this.options.type == null) { this.options.type = 'local'; } if (this.options.allowNull == null) { this.options.allowNull = true; } if (this.options.nullValue == null) { this.options.nullValue = 0; } if (this.options.lazy == null) { this.options.lazy = false; } if (this.options.relativeTo) { if (typeof this.options.relativeTo !== 'function') { throw new Error('relativeTo option must be a function'); } this.relativeToGetter = options.relativeTo; } } var _proto = Pointer.prototype; _proto.decode = function decode(stream, ctx) { var _this = this; var offset = this.offsetType.decode(stream, ctx); // handle NULL pointers if (offset === this.options.nullValue && this.options.allowNull) { return null; } var relative; switch (this.options.type) { case 'local': relative = ctx._startOffset; break; case 'immediate': relative = stream.pos - this.offsetType.size(); break; case 'parent': relative = ctx.parent._startOffset; break; default: var c = ctx; while (c.parent) { c = c.parent; } relative = c._startOffset || 0; } if (this.options.relativeTo) { relative += this.relativeToGetter(ctx); } var ptr = offset + relative; if (this.type != null) { var val = null; var decodeValue = function decodeValue() { if (val != null) { return val; } var pos = stream.pos; stream.pos = ptr; val = _this.type.decode(stream, ctx); stream.pos = pos; return val; }; // If this is a lazy pointer, define a getter to decode only when needed. // This obviously only works when the pointer is contained by a Struct. if (this.options.lazy) { return new utils.PropertyDescriptor({ get: decodeValue }); } return decodeValue(); } else { return ptr; } }; _proto.size = function size(val, ctx) { var parent = ctx; switch (this.options.type) { case 'local': case 'immediate': break; case 'parent': ctx = ctx.parent; break; default: // global while (ctx.parent) { ctx = ctx.parent; } } var type = this.type; if (type == null) { if (!(val instanceof VoidPointer)) { throw new Error("Must be a VoidPointer"); } var _val = val; type = _val.type; val = val.value; } if (val && ctx) { ctx.pointerSize += type.size(val, parent); } return this.offsetType.size(); }; _proto.encode = function encode(stream, val, ctx) { var relative; var parent = ctx; if (val == null) { this.offsetType.encode(stream, this.options.nullValue); return; } switch (this.options.type) { case 'local': relative = ctx.startOffset; break; case 'immediate': relative = stream.pos + this.offsetType.size(val, parent); break; case 'parent': ctx = ctx.parent; relative = ctx.startOffset; break; default: // global relative = 0; while (ctx.parent) { ctx = ctx.parent; } } if (this.options.relativeTo) { relative += this.relativeToGetter(parent.val); } this.offsetType.encode(stream, ctx.pointerOffset - relative); var type = this.type; if (type == null) { if (!(val instanceof VoidPointer)) { throw new Error("Must be a VoidPointer"); } var _val2 = val; type = _val2.type; val = val.value; } ctx.pointers.push({ type: type, val: val, parent: parent }); return ctx.pointerOffset += type.size(val, parent); }; return Pointer; }(); // A pointer whose type is determined at decode time var VoidPointer = function VoidPointer(type, value) { this.type = type; this.value = value; }; exports.Pointer = Pointer; exports.VoidPointer = VoidPointer; /***/ }), /***/ 10298: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; __webpack_require__(41584); var utils = __webpack_require__(76949); var Reserved = /*#__PURE__*/function () { function Reserved(type, count) { if (count === void 0) { count = 1; } this.type = type; this.count = count; } var _proto = Reserved.prototype; _proto.decode = function decode(stream, parent) { stream.pos += this.size(null, parent); return undefined; }; _proto.size = function size(data, parent) { var count = utils.resolveLength(this.count, null, parent); return this.type.size() * count; }; _proto.encode = function encode(stream, val, parent) { return stream.fill(0, this.size(val, parent)); }; return Reserved; }(); module.exports = Reserved; /***/ }), /***/ 36291: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* provided dependency */ var Buffer = __webpack_require__(50621)["Buffer"]; var _require = __webpack_require__(63787), NumberT = _require.Number; var utils = __webpack_require__(76949); var StringT = /*#__PURE__*/function () { function StringT(length, encoding) { if (encoding === void 0) { encoding = 'ascii'; } this.length = length; this.encoding = encoding; } var _proto = StringT.prototype; _proto.decode = function decode(stream, parent) { var length, pos; if (this.length != null) { length = utils.resolveLength(this.length, stream, parent); } else { var buffer; buffer = stream.buffer; length = stream.length; pos = stream.pos; while (pos < length && buffer[pos] !== 0x00) { ++pos; } length = pos - stream.pos; } var encoding = this.encoding; if (typeof encoding === 'function') { encoding = encoding.call(parent, parent) || 'ascii'; } var string = stream.readString(length, encoding); if (this.length == null && stream.pos < stream.length) { stream.pos++; } return string; }; _proto.size = function size(val, parent) { // Use the defined value if no value was given if (!val) { return utils.resolveLength(this.length, null, parent); } var encoding = this.encoding; if (typeof encoding === 'function') { encoding = encoding.call(parent != null ? parent.val : undefined, parent != null ? parent.val : undefined) || 'ascii'; } if (encoding === 'utf16be') { encoding = 'utf16le'; } var size = Buffer.byteLength(val, encoding); if (this.length instanceof NumberT) { size += this.length.size(); } if (this.length == null) { size++; } return size; }; _proto.encode = function encode(stream, val, parent) { var encoding = this.encoding; if (typeof encoding === 'function') { encoding = encoding.call(parent != null ? parent.val : undefined, parent != null ? parent.val : undefined) || 'ascii'; } if (this.length instanceof NumberT) { this.length.encode(stream, Buffer.byteLength(val, encoding)); } stream.writeString(val, encoding); if (this.length == null) { return stream.writeUInt8(0x00); } }; return StringT; }(); module.exports = StringT; /***/ }), /***/ 2731: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(76949); var Struct = /*#__PURE__*/function () { function Struct(fields) { if (fields === void 0) { fields = {}; } this.fields = fields; } var _proto = Struct.prototype; _proto.decode = function decode(stream, parent, length) { if (length === void 0) { length = 0; } var res = this._setup(stream, parent, length); this._parseFields(stream, res, this.fields); if (this.process != null) { this.process.call(res, stream); } return res; }; _proto._setup = function _setup(stream, parent, length) { var res = {}; // define hidden properties Object.defineProperties(res, { parent: { value: parent }, _startOffset: { value: stream.pos }, _currentOffset: { value: 0, writable: true }, _length: { value: length } }); return res; }; _proto._parseFields = function _parseFields(stream, res, fields) { for (var key in fields) { var val; var type = fields[key]; if (typeof type === 'function') { val = type.call(res, res); } else { val = type.decode(stream, res); } if (val !== undefined) { if (val instanceof utils.PropertyDescriptor) { Object.defineProperty(res, key, val); } else { res[key] = val; } } res._currentOffset = stream.pos - res._startOffset; } }; _proto.size = function size(val, parent, includePointers) { if (val == null) { val = {}; } if (includePointers == null) { includePointers = true; } var ctx = { parent: parent, val: val, pointerSize: 0 }; var size = 0; for (var key in this.fields) { var type = this.fields[key]; if (type.size != null) { size += type.size(val[key], ctx); } } if (includePointers) { size += ctx.pointerSize; } return size; }; _proto.encode = function encode(stream, val, parent) { var type; if (this.preEncode != null) { this.preEncode.call(val, stream); } var ctx = { pointers: [], startOffset: stream.pos, parent: parent, val: val, pointerSize: 0 }; ctx.pointerOffset = stream.pos + this.size(val, ctx, false); for (var key in this.fields) { type = this.fields[key]; if (type.encode != null) { type.encode(stream, val[key], ctx); } } var i = 0; while (i < ctx.pointers.length) { var ptr = ctx.pointers[i++]; ptr.type.encode(stream, ptr.val, ptr.parent); } }; return Struct; }(); module.exports = Struct; /***/ }), /***/ 48084: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; __webpack_require__(14032); function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Struct = __webpack_require__(2731); var getPath = function getPath(object, pathArray) { return pathArray.reduce(function (prevObj, key) { return prevObj && prevObj[key]; }, object); }; var VersionedStruct = /*#__PURE__*/function (_Struct) { _inheritsLoose(VersionedStruct, _Struct); function VersionedStruct(type, versions) { var _this; if (versions === void 0) { versions = {}; } _this = _Struct.call(this) || this; _this.type = type; _this.versions = versions; if (typeof type === 'string') { _this.versionPath = type.split('.'); } return _this; } var _proto = VersionedStruct.prototype; _proto.decode = function decode(stream, parent, length) { if (length === void 0) { length = 0; } var res = this._setup(stream, parent, length); if (typeof this.type === 'string') { res.version = getPath(parent, this.versionPath); } else { res.version = this.type.decode(stream); } if (this.versions.header) { this._parseFields(stream, res, this.versions.header); } var fields = this.versions[res.version]; if (fields == null) { throw new Error("Unknown version " + res.version); } if (fields instanceof VersionedStruct) { return fields.decode(stream, parent); } this._parseFields(stream, res, fields); if (this.process != null) { this.process.call(res, stream); } return res; }; _proto.size = function size(val, parent, includePointers) { if (includePointers === void 0) { includePointers = true; } var key, type; if (!val) { throw new Error('Not a fixed size'); } var ctx = { parent: parent, val: val, pointerSize: 0 }; var size = 0; if (typeof this.type !== 'string') { size += this.type.size(val.version, ctx); } if (this.versions.header) { for (key in this.versions.header) { type = this.versions.header[key]; if (type.size != null) { size += type.size(val[key], ctx); } } } var fields = this.versions[val.version]; if (fields == null) { throw new Error("Unknown version " + val.version); } for (key in fields) { type = fields[key]; if (type.size != null) { size += type.size(val[key], ctx); } } if (includePointers) { size += ctx.pointerSize; } return size; }; _proto.encode = function encode(stream, val, parent) { var key, type; if (this.preEncode != null) { this.preEncode.call(val, stream); } var ctx = { pointers: [], startOffset: stream.pos, parent: parent, val: val, pointerSize: 0 }; ctx.pointerOffset = stream.pos + this.size(val, ctx, false); if (typeof this.type !== 'string') { this.type.encode(stream, val.version); } if (this.versions.header) { for (key in this.versions.header) { type = this.versions.header[key]; if (type.encode != null) { type.encode(stream, val[key], ctx); } } } var fields = this.versions[val.version]; for (key in fields) { type = fields[key]; if (type.encode != null) { type.encode(stream, val[key], ctx); } } var i = 0; while (i < ctx.pointers.length) { var ptr = ctx.pointers[i++]; ptr.type.encode(stream, ptr.val, ptr.parent); } }; return VersionedStruct; }(Struct); module.exports = VersionedStruct; /***/ }), /***/ 76949: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var _require = __webpack_require__(63787), NumberT = _require.Number; exports.resolveLength = function (length, stream, parent) { var res; if (ty