Ignore:
Timestamp:
10/21/21 23:45:59 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
4b7e2d3
Parents:
6b95845
Message:

added fileTypes controller, notifications, excel export, edited views

File:
1 edited

Legend:

Unmodified
Added
Removed
  • public/vendors/dataTable/pdfmake-0.1.36/pdfmake.js

    r6b95845 rc6b84df  
    69326932    var res = encoder.write(str);
    69336933    var trail = encoder.end();
    6934    
     6934
    69356935    return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res;
    69366936}
     
    69726972    if (!iconv.encodings)
    69736973        iconv.encodings = __webpack_require__(171); // Lazy load all encoding definitions.
    6974    
     6974
    69756975    // Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
    69766976    var enc = (''+encoding).toLowerCase().replace(/[^0-9a-z]|:\d{4}$/g, "");
     
    69966996                if (!codecOptions.encodingName)
    69976997                    codecOptions.encodingName = enc;
    6998                
     6998
    69996999                enc = codecDef.type;
    70007000                break;
     
    74867486  UnicodeTrie = __webpack_require__(43);
    74877487
    7488  
     7488
    74897489
    74907490  base64 = __webpack_require__(131);
     
    76607660  this.tag = 0;
    76617661  this.bitcount = 0;
    7662  
     7662
    76637663  this.dest = dest;
    76647664  this.destLen = 0;
    7665  
     7665
    76667666  this.ltree = new Tree();  /* dynamic length/symbol tree */
    76677667  this.dtree = new Tree();  /* dynamic distance tree */
     
    78057805    d.bitcount += 8;
    78067806  }
    7807  
     7807
    78087808  var sum = 0, cur = 0, len = 0;
    78097809  var tag = d.tag;
     
    78187818    cur -= t.table[len];
    78197819  } while (cur >= 0);
    7820  
     7820
    78217821  d.tag = tag;
    78227822  d.bitcount -= len;
     
    79297929  var length, invlength;
    79307930  var i;
    7931  
     7931
    79327932  /* unread from bitbuffer */
    79337933  while (d.bitcount > 8) {
     
    80028002      return d.dest.subarray(0, d.destLen);
    80038003  }
    8004  
     8004
    80058005  return d.dest;
    80068006}
     
    1150911509    return 16;
    1151011510  }
    11511  
     11511
    1151211512  n = br.readBits(3);
    1151311513  if (n > 0) {
    1151411514    return 17 + n;
    1151511515  }
    11516  
     11516
    1151711517  n = br.readBits(3);
    1151811518  if (n > 0) {
    1151911519    return 8 + n;
    1152011520  }
    11521  
     11521
    1152211522  return 17;
    1152311523}
     
    1154411544
    1154511545function DecodeMetaBlockLength(br) {
    11546   var out = new MetaBlockLength; 
     11546  var out = new MetaBlockLength;
    1154711547  var size_nibbles;
    1154811548  var size_bytes;
    1154911549  var i;
    11550  
     11550
    1155111551  out.input_end = br.readBits(1);
    1155211552  if (out.input_end && br.readBits(1)) {
    1155311553    return out;
    1155411554  }
    11555  
     11555
    1155611556  size_nibbles = br.readBits(2) + 4;
    1155711557  if (size_nibbles === 7) {
    1155811558    out.is_metadata = true;
    11559    
     11559
    1156011560    if (br.readBits(1) !== 0)
    1156111561      throw new Error('Invalid reserved bit');
    11562    
     11562
    1156311563    size_bytes = br.readBits(2);
    1156411564    if (size_bytes === 0)
    1156511565      return out;
    11566    
     11566
    1156711567    for (i = 0; i < size_bytes; i++) {
    1156811568      var next_byte = br.readBits(8);
    1156911569      if (i + 1 === size_bytes && size_bytes > 1 && next_byte === 0)
    1157011570        throw new Error('Invalid size byte');
    11571      
     11571
    1157211572      out.meta_block_length |= next_byte << (i * 8);
    1157311573    }
     
    1157711577      if (i + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0)
    1157811578        throw new Error('Invalid size nibble');
    11579      
     11579
    1158011580      out.meta_block_length |= next_nibble << (i * 4);
    1158111581    }
    1158211582  }
    11583  
     11583
    1158411584  ++out.meta_block_length;
    11585  
     11585
    1158611586  if (!out.input_end && !out.is_metadata) {
    1158711587    out.is_uncompressed = br.readBits(1);
    1158811588  }
    11589  
     11589
    1159011590  return out;
    1159111591}
     
    1159411594function ReadSymbol(table, index, br) {
    1159511595  var start_index = index;
    11596  
     11596
    1159711597  var nbits;
    1159811598  br.fillBitWindow();
     
    1161411614  var repeat_code_len = 0;
    1161511615  var space = 32768;
    11616  
     11616
    1161711617  var table = [];
    1161811618  for (var i = 0; i < 32; i++)
    1161911619    table.push(new HuffmanCode(0, 0));
    11620  
     11620
    1162111621  BrotliBuildHuffmanTable(table, 0, 5, code_length_code_lengths, CODE_LENGTH_CODES);
    1162211622
     
    1162411624    var p = 0;
    1162511625    var code_len;
    11626    
     11626
    1162711627    br.readMoreInput();
    1162811628    br.fillBitWindow();
     
    1165911659        throw new Error('[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols');
    1166011660      }
    11661      
     11661
    1166211662      for (var x = 0; x < repeat_delta; x++)
    1166311663        code_lengths[symbol + x] = repeat_code_len;
    11664      
     11664
    1166511665      symbol += repeat_delta;
    11666      
     11666
    1166711667      if (repeat_code_len !== 0) {
    1166811668        space -= repeat_delta << (15 - repeat_code_len);
     
    1167311673    throw new Error("[ReadHuffmanCodeLengths] space = " + space);
    1167411674  }
    11675  
     11675
    1167611676  for (; symbol < num_symbols; symbol++)
    1167711677    code_lengths[symbol] = 0;
     
    1168211682  var simple_code_or_skip;
    1168311683  var code_lengths = new Uint8Array(alphabet_size);
    11684  
     11684
    1168511685  br.readMoreInput();
    11686  
     11686
    1168711687  /* simple_code_or_skip is used as follows:
    1168811688     1 for simple code;
     
    1172011720          throw new Error('[ReadHuffmanCode] invalid symbols');
    1172111721        }
    11722        
     11722
    1172311723        code_lengths[symbols[1]] = 1;
    1172411724        break;
     
    1173211732          throw new Error('[ReadHuffmanCode] invalid symbols');
    1173311733        }
    11734        
     11734
    1173511735        if (br.readBits(1)) {
    1173611736          code_lengths[symbols[2]] = 3;
     
    1174811748    /* Static Huffman code for the code length code lengths */
    1174911749    var huff = [
    11750       new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 
     11750      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
    1175111751      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 1),
    11752       new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2), 
     11752      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(3, 2),
    1175311753      new HuffmanCode(2, 0), new HuffmanCode(2, 4), new HuffmanCode(2, 3), new HuffmanCode(4, 5)
    1175411754    ];
     
    1176711767      }
    1176811768    }
    11769    
     11769
    1177011770    if (!(num_codes === 1 || space === 0))
    1177111771      throw new Error('[ReadHuffmanCode] invalid num_codes or space');
    11772    
     11772
    1177311773    ReadHuffmanCodeLengths(code_length_code_lengths, alphabet_size, code_lengths, br);
    1177411774  }
    11775  
     11775
    1177611776  table_size = BrotliBuildHuffmanTable(tables, table, HUFFMAN_TABLE_BITS, code_lengths, alphabet_size);
    11777  
     11777
    1177811778  if (table_size === 0) {
    1177911779    throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");
    1178011780  }
    11781  
     11781
    1178211782  return table_size;
    1178311783}
     
    1182711827  this.alphabet_size = alphabet_size;
    1182811828  this.num_htrees = num_htrees;
    11829   this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]); 
     11829  this.codes = new Array(num_htrees + num_htrees * kMaxHuffmanTableSize[(alphabet_size + 31) >>> 5]);
    1183011830  this.htrees = new Uint32Array(num_htrees);
    1183111831}
     
    1184811848  var table;
    1184911849  var i;
    11850  
     11850
    1185111851  br.readMoreInput();
    1185211852  var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1;
     
    1186111861    max_run_length_prefix = br.readBits(4) + 1;
    1186211862  }
    11863  
     11863
    1186411864  table = [];
    1186511865  for (i = 0; i < HUFFMAN_MAX_TABLE_SIZE; i++) {
    1186611866    table[i] = new HuffmanCode(0, 0);
    1186711867  }
    11868  
     11868
    1186911869  ReadHuffmanCode(num_htrees + max_run_length_prefix, table, 0, br);
    11870  
     11870
    1187111871  for (i = 0; i < context_map_size;) {
    1187211872    var code;
     
    1189411894    InverseMoveToFrontTransform(context_map, context_map_size);
    1189511895  }
    11896  
     11896
    1189711897  return out;
    1189811898}
     
    1195511955    for (var x = 0; x < tail; x++)
    1195611956      ringbuffer[rb_pos + x] = br.buf_[br_pos + x];
    11957    
     11957
    1195811958    nbytes -= tail;
    1195911959    rb_pos += tail;
     
    1196411964  for (var x = 0; x < nbytes; x++)
    1196511965    ringbuffer[rb_pos + x] = br.buf_[br_pos + x];
    11966  
     11966
    1196711967  rb_pos += nbytes;
    1196811968  len -= nbytes;
     
    1197211972  if (rb_pos >= rb_size) {
    1197311973    output.write(ringbuffer, rb_size);
    11974     rb_pos -= rb_size;   
     11974    rb_pos -= rb_size;
    1197511975    for (var x = 0; x < rb_pos; x++)
    1197611976      ringbuffer[x] = ringbuffer[rb_size + x];
     
    1202012020function BrotliDecompressBuffer(buffer, output_size) {
    1202112021  var input = new BrotliInput(buffer);
    12022  
     12022
    1202312023  if (output_size == null) {
    1202412024    output_size = BrotliDecompressedSize(buffer);
    1202512025  }
    12026  
     12026
    1202712027  var output_buffer = new Uint8Array(output_size);
    1202812028  var output = new BrotliOutput(output_buffer);
    12029  
     12029
    1203012030  BrotliDecompress(input, output);
    12031  
     12031
    1203212032  if (output.pos < output.buffer.length) {
    1203312033    output.buffer = output.buffer.subarray(0, output.pos);
    1203412034  }
    12035  
     12035
    1203612036  return output.buffer;
    1203712037}
     
    1212012120
    1212112121    br.readMoreInput();
    12122    
     12122
    1212312123    var _out = DecodeMetaBlockLength(br);
    1212412124    meta_block_remaining_len = _out.meta_block_length;
     
    1212812128      tmp.set( output.buffer );
    1212912129      output.buffer = tmp;
    12130     }   
     12130    }
    1213112131    input_end = _out.input_end;
    1213212132    is_uncompressed = _out.is_uncompressed;
    12133    
     12133
    1213412134    if (_out.is_metadata) {
    1213512135      JumpToByteBoundary(br);
    12136      
     12136
    1213712137      for (; meta_block_remaining_len > 0; --meta_block_remaining_len) {
    1213812138        br.readMoreInput();
     
    1214012140        br.readBits(8);
    1214112141      }
    12142      
     12142
    1214312143      continue;
    1214412144    }
    12145    
     12145
    1214612146    if (meta_block_remaining_len === 0) {
    1214712147      continue;
    1214812148    }
    12149    
     12149
    1215012150    if (is_uncompressed) {
    1215112151      br.bit_pos_ = (br.bit_pos_ + 7) & ~7;
     
    1215512155      continue;
    1215612156    }
    12157    
     12157
    1215812158    for (i = 0; i < 3; ++i) {
    1215912159      num_block_types[i] = DecodeVarLenUint8(br) + 1;
     
    1216512165      }
    1216612166    }
    12167    
     12167
    1216812168    br.readMoreInput();
    12169    
     12169
    1217012170    distance_postfix_bits = br.readBits(2);
    1217112171    num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits);
     
    1217812178       context_modes[i] = (br.readBits(2) << 1);
    1217912179    }
    12180    
     12180
    1218112181    var _o1 = DecodeContextMap(num_block_types[0] << kLiteralContextBits, br);
    1218212182    num_literal_htrees = _o1.num_htrees;
    1218312183    context_map = _o1.context_map;
    12184    
     12184
    1218512185    var _o2 = DecodeContextMap(num_block_types[2] << kDistanceContextBits, br);
    1218612186    num_dist_htrees = _o2.num_htrees;
    1218712187    dist_context_map = _o2.context_map;
    12188    
     12188
    1218912189    hgroup[0] = new HuffmanTreeGroup(kNumLiteralCodes, num_literal_htrees);
    1219012190    hgroup[1] = new HuffmanTreeGroup(kNumInsertAndCopyCodes, num_block_types[1]);
     
    1221612216
    1221712217      br.readMoreInput();
    12218      
     12218
    1221912219      if (block_length[1] === 0) {
    1222012220        DecodeBlockType(num_block_types[1],
     
    1227212272      if (distance_code < 0) {
    1227312273        var context;
    12274        
     12274
    1227512275        br.readMoreInput();
    1227612276        if (block_length[2] === 0) {
     
    1233412334            if (copy_dst >= ringbuffer_end) {
    1233512335              output.write(ringbuffer, ringbuffer_size);
    12336              
     12336
    1233712337              for (var _x = 0; _x < (copy_dst - ringbuffer_end); _x++)
    1233812338                ringbuffer[_x] = ringbuffer[ringbuffer_end + _x];
     
    1239912399    count = this.buffer.length - this.pos;
    1240012400  }
    12401  
     12401
    1240212402  for (var p = 0; p < count; p++)
    1240312403    buf[i + p] = this.buffer[this.pos + p];
    12404  
     12404
    1240512405  this.pos += count;
    1240612406  return count;
     
    1241712417  if (this.pos + count > this.buffer.length)
    1241812418    throw new Error('Output buffer is not large enough');
    12419  
     12419
    1242012420  this.buffer.set(buf.subarray(0, count), this.pos);
    1242112421  this.pos += count;
     
    1254912549    }
    1255012550  }
    12551  
     12551
    1255212552  table_bits = root_bits;
    1255312553  table_size = 1 << table_bits;
     
    1255912559      root_table[table + key] = new HuffmanCode(0, sorted[0] & 0xffff);
    1256012560    }
    12561    
     12561
    1256212562    return total_size;
    1256312563  }
     
    1259212592    }
    1259312593  }
    12594  
     12594
    1259512595  return total_size;
    1259612596}
     
    1260412604
    1260512605/*
    12606 PDFImage - embeds images in PDF documents
     12606PDFImage - embeds images in PDF folders
    1260712607By Devon Govett
    1260812608 */
     
    1313913139 * var docDefinition = {
    1314013140 *      info: {
    13141  *              title: 'awesome Document',
     13141 *              title: 'awesome Folder',
    1314213142 *              author: 'john doe',
    1314313143 *              subject: 'subject of document',
     
    2551825518      this._font = null;
    2551925519      this._registeredFonts = {};
    25520      
     25520
    2552125521    },
    2552225522    font: function(src, family, size) {
     
    2601726017
    2601826018// ISO (deprecated)
    26019 [], { // windows                                       
     26019[], { // windows
    2602026020  0x0436: 'af', 0x4009: 'en-IN', 0x0487: 'rw', 0x0432: 'tn',
    2602126021  0x041C: 'sq', 0x1809: 'en-IE', 0x0441: 'sw', 0x045B: 'si',
     
    3341933419 *   - apply ljmo, vjmo, and tjmo OpenType features to decomposed Jamo sequences.
    3342033420 *
    33421  * This logic is based on the following documents:
     33421 * This logic is based on the following folders:
    3342233422 *   - http://www.microsoft.com/typography/OpenTypeDev/hangul/intro.htm
    3342333423 *   - http://ktug.org/~nomos/harfbuzz-hangul/hangulshaper.pdf
     
    4079040790];
    4079140791
    40792 // Put all encoding/alias/codec definitions to single object and export it. 
     40792// Put all encoding/alias/codec definitions to single object and export it.
    4079340793for (var i = 0; i < modules.length; i++) {
    4079440794    var module = modules[i];
     
    4094240942
    4094340943InternalDecoderCesu8.prototype.write = function(buf) {
    40944     var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, 
     40944    var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes,
    4094540945        res = '';
    4094640946    for (var i = 0; i < buf.length; i++) {
     
    4111641116        this.initialBytes.push(buf);
    4111741117        this.initialBytesLen += buf.length;
    41118        
     41118
    4111941119        if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below)
    4112041120            return '';
     
    4121241212    // Non-direct chars are encoded as "+<base64>-"; single "+" char is encoded as "+-".
    4121341213    return new Buffer(str.replace(nonDirectChars, function(chunk) {
    41214         return "+" + (chunk === '+' ? '' : 
    41215             this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) 
     41214        return "+" + (chunk === '+' ? '' :
     41215            this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, ''))
    4121641216            + "-";
    4121741217    }.bind(this)));
     
    4123541235    base64Chars[i] = base64Regex.test(String.fromCharCode(i));
    4123641236
    41237 var plusChar = '+'.charCodeAt(0), 
     41237var plusChar = '+'.charCodeAt(0),
    4123841238    minusChar = '-'.charCodeAt(0),
    4123941239    andChar = '&'.charCodeAt(0);
     
    4148441484
    4148541485// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that
    41486 // correspond to encoded bytes (if 128 - then lower half is ASCII). 
     41486// correspond to encoded bytes (if 128 - then lower half is ASCII).
    4148741487
    4148841488exports._sbcs = SBCSCodec;
     
    4149041490    if (!codecOptions)
    4149141491        throw new Error("SBCS codec is called without the data.")
    41492    
     41492
    4149341493    // Prepare char buffer for decoding.
    4149441494    if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256))
    4149541495        throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)");
    41496    
     41496
    4149741497    if (codecOptions.chars.length === 128) {
    4149841498        var asciiString = "";
     
    4150341503
    4150441504    this.decodeBuf = new Buffer(codecOptions.chars, 'ucs2');
    41505    
     41505
    4150641506    // Encoding buffer.
    4150741507    var encodeBuf = new Buffer(65536);
     
    4152641526    for (var i = 0; i < str.length; i++)
    4152741527        buf[i] = this.encodeBuf[str.charCodeAt(i)];
    41528    
     41528
    4152941529    return buf;
    4153041530}
     
    4225942259    this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node.
    4226042260
    42261     // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. 
     42261    // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here.
    4226242262    this.decodeTableSeq = [];
    4226342263
     
    4226842268    this.defaultCharUnicode = iconv.defaultCharUnicode;
    4226942269
    42270    
     42270
    4227142271    // Encode tables: Unicode -> DBCS.
    4227242272
     
    4227742277    //         <= SEQ_START  -> it's an index in encodeTableSeq, see below. The character starts a sequence.
    4227842278    this.encodeTable = [];
    42279    
     42279
    4228042280    // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of
    4228142281    // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key
     
    4229542295                    skipEncodeChars[j] = true;
    4229642296        }
    42297        
     42297
    4229842298    // Use decode trie to recursively fill out encode tables.
    4229942299    this._fillEncodeTable(0, 0, skipEncodeChars);
     
    4233242332        for (var i = 0x30; i <= 0x39; i++)
    4233342333            fourthByteNode[i] = GB18030_CODE
    42334     }       
     42334    }
    4233542335}
    4233642336
     
    4239742397                    writeTable[curAddr++] = code; // Basic char
    4239842398            }
    42399         } 
     42399        }
    4240042400        else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character.
    4240142401            var charCode = writeTable[curAddr - 1] + 1;
     
    4242842428
    4242942429DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
    42430    
     42430
    4243142431    // Get the root of character tree according to first character of the sequence.
    4243242432    var uCode = seq[0];
     
    4248942489    this.leadSurrogate = -1;
    4249042490    this.seqObj = undefined;
    42491    
     42491
    4249242492    // Static data
    4249342493    this.encodeTable = codec.encodeTable;
     
    4249842498
    4249942499DBCSEncoder.prototype.write = function(str) {
    42500     var newBuf = new Buffer(str.length * (this.gb18030 ? 4 : 3)), 
     42500    var newBuf = new Buffer(str.length * (this.gb18030 ? 4 : 3)),
    4250142501        leadSurrogate = this.leadSurrogate,
    4250242502        seqObj = this.seqObj, nextChar = -1,
     
    4251142511        else {
    4251242512            var uCode = nextChar;
    42513             nextChar = -1;   
     42513            nextChar = -1;
    4251442514        }
    4251542515
     
    4253342533                    uCode = UNASSIGNED;
    4253442534                }
    42535                
     42535
    4253642536            }
    4253742537        }
     
    4257442574            if (subtable !== undefined)
    4257542575                dbcsCode = subtable[uCode & 0xFF];
    42576            
     42576
    4257742577            if (dbcsCode <= SEQ_START) { // Sequence start
    4257842578                seqObj = this.encodeTableSeq[SEQ_START-dbcsCode];
     
    4259742597        if (dbcsCode === UNASSIGNED)
    4259842598            dbcsCode = this.defaultCharSingleByte;
    42599        
     42599
    4260042600        if (dbcsCode < 0x100) {
    4260142601            newBuf[j++] = dbcsCode;
     
    4264442644        this.leadSurrogate = -1;
    4264542645    }
    42646    
     42646
    4264742647    return newBuf.slice(0, j);
    4264842648}
     
    4266842668DBCSDecoder.prototype.write = function(buf) {
    4266942669    var newBuf = new Buffer(buf.length*2),
    42670         nodeIdx = this.nodeIdx, 
     42670        nodeIdx = this.nodeIdx,
    4267142671        prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length,
    4267242672        seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence.
     
    4267542675    if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later.
    4267642676        prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]);
    42677    
     42677
    4267842678    for (var i = 0, j = 0; i < buf.length; i++) {
    4267942679        var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset];
     
    4268242682        var uCode = this.decodeTables[nodeIdx][curByte];
    4268342683
    42684         if (uCode >= 0) { 
     42684        if (uCode >= 0) {
    4268542685            // Normal character, just use it.
    4268642686        }
     
    4271442714
    4271542715        // Write the character to buffer, handling higher planes using surrogate pair.
    42716         if (uCode > 0xFFFF) { 
     42716        if (uCode > 0xFFFF) {
    4271742717            uCode -= 0x10000;
    4271842718            var uCodeLead = 0xD800 + Math.floor(uCode / 0x400);
     
    4278442784
    4278542785module.exports = {
    42786    
     42786
    4278742787    // == Japanese/ShiftJIS ====================================================
    4278842788    // All japanese encodings are based on JIS X set of standards:
    4278942789    // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
    42790     // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. 
     42790    // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
    4279142791    //              Has several variations in 1978, 1983, 1990 and 1997.
    4279242792    // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
     
    4280642806    //  * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
    4280742807    //               Used as-is in ISO2022 family.
    42808     //  * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, 
     42808    //  * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
    4280942809    //                0201-1976 Roman, 0208-1978, 0208-1983.
    4281042810    //  * ISO2022-JP-1: Adds esc seq for 0212-1990.
     
    4291842918    //  * Big5-2003 (Taiwan standard) almost superset of cp950.
    4291942919    //  * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
    42920     //  * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. 
     42920    //  * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
    4292142921    //    many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
    4292242922    //    Plus, it has 4 combining sequences.
     
    4292942929    //    Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
    4293042930    //                   http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
    42931     // 
     42931    //
    4293242932    // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
    4293342933    // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
     
    4299842998// == Exports ==================================================================
    4299942999module.exports = function(iconv) {
    43000    
     43000
    4300143001    // Additional Public API.
    4300243002    iconv.encodeStream = function encodeStream(encoding, options) {
     
    4309343093    try {
    4309443094        var res = this.conv.end();
    43095         if (res && res.length) this.push(res, this.encoding);               
     43095        if (res && res.length) this.push(res, this.encoding);
    4309643096        done();
    4309743097    }
     
    4314143141
    4314243142        var nodeNativeEncodings = {
    43143             'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, 
     43143            'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true,
    4314443144            'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true,
    4314543145        };
     
    4699646996  this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE);
    4699746997  this.input_ = input;    /* input callback */
    46998  
     46998
    4699946999  this.reset();
    4700047000}
     
    4701047010  this.bit_end_pos_ = 0;  /* bit-reading end position from LSB of val_ */
    4701147011  this.eos_ = 0;          /* input stream is finished */
    47012  
     47012
    4701347013  this.readMoreInput();
    4701447014  for (var i = 0; i < 4; i++) {
     
    4701647016    ++this.pos_;
    4701747017  }
    47018  
     47018
    4701947019  return this.bit_end_pos_ > 0;
    4702047020};
     
    4704447044      throw new Error('Unexpected end of input');
    4704547045    }
    47046    
     47046
    4704747047    if (bytes_read < BROTLI_READ_SIZE) {
    4704847048      this.eos_ = 1;
     
    4705147051        this.buf_[dst + bytes_read + p] = 0;
    4705247052    }
    47053    
     47053
    4705447054    if (dst === 0) {
    4705547055      /* Copy the head of the ringbuffer to the slack region. */
     
    4706147061      this.buf_ptr_ = 0;
    4706247062    }
    47063    
     47063
    4706447064    this.bit_end_pos_ += bytes_read << 3;
    4706547065  }
     
    4706747067
    4706847068/* Guarantees that there are at least 24 bits in the buffer. */
    47069 BrotliBitReader.prototype.fillBitWindow = function() {   
     47069BrotliBitReader.prototype.fillBitWindow = function() {
    4707047070  while (this.bit_pos_ >= 8) {
    4707147071    this.val_ >>>= 8;
     
    4708247082    this.fillBitWindow();
    4708347083  }
    47084  
     47084
    4708547085  var val = ((this.val_ >>> this.bit_pos_) & kBitMask[n_bits]);
    4708647086  this.bit_pos_ += n_bits;
     
    4709947099
    4710047100/**
    47101  * The normal dictionary-data.js is quite large, which makes it 
    47102  * unsuitable for browser usage. In order to make it smaller, 
     47101 * The normal dictionary-data.js is quite large, which makes it
     47102 * unsuitable for browser usage. In order to make it smaller,
    4710347103 * we read dictionary.bin, which is a compressed version of
    47104  * the dictionary, and on initial load, Brotli decompresses 
     47104 * the dictionary, and on initial load, Brotli decompresses
    4710547105 * it's own dictionary. 😜
    4710647106 */
     
    4761347613  this.transform = transform;
    4761447614  this.suffix = new Uint8Array(suffix.length);
    47615  
     47615
    4761647616  for (var i = 0; i < prefix.length; i++)
    4761747617    this.prefix[i] = prefix.charCodeAt(i);
    47618  
     47618
    4761947619  for (var i = 0; i < suffix.length; i++)
    4762047620    this.suffix[i] = suffix.charCodeAt(i);
     
    4775547755    return 1;
    4775647756  }
    47757  
     47757
    4775847758  /* An overly simplified uppercasing model for utf-8. */
    4775947759  if (p[i] < 0xe0) {
     
    4776147761    return 2;
    4776247762  }
    47763  
     47763
    4776447764  /* An arbitrary transform for three byte characters. */
    4776547765  p[i + 2] ^= 5;
     
    4777547775  var start_idx = idx;
    4777647776  var uppercase;
    47777  
     47777
    4777847778  if (skip > len) {
    4777947779    skip = len;
    4778047780  }
    47781  
     47781
    4778247782  var prefix_pos = 0;
    4778347783  while (prefix_pos < prefix.length) {
    4778447784    dst[idx++] = prefix[prefix_pos++];
    4778547785  }
    47786  
     47786
    4778747787  word += skip;
    4778847788  len -= skip;
    47789  
     47789
    4779047790  if (t <= kOmitLast9) {
    4779147791    len -= t;
    4779247792  }
    47793  
     47793
    4779447794  for (i = 0; i < len; i++) {
    4779547795    dst[idx++] = BrotliDictionary.dictionary[word + i];
    4779647796  }
    47797  
     47797
    4779847798  uppercase = idx - len;
    47799  
     47799
    4780047800  if (t === kUppercaseFirst) {
    4780147801    ToUpperCase(dst, uppercase);
     
    4780747807    }
    4780847808  }
    47809  
     47809
    4781047810  var suffix_pos = 0;
    4781147811  while (suffix_pos < suffix.length) {
    4781247812    dst[idx++] = suffix[suffix_pos++];
    4781347813  }
    47814  
     47814
    4781547815  return idx - start_idx;
    4781647816}
     
    4954549545# MIT LICENSE
    4954649546# Copyright (c) 2011 Devon Govett
    49547 # 
    49548 # Permission is hereby granted, free of charge, to any person obtaining a copy of this 
    49549 # software and associated documentation files (the "Software"), to deal in the Software 
    49550 # without restriction, including without limitation the rights to use, copy, modify, merge, 
    49551 # publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons 
     49547#
     49548# Permission is hereby granted, free of charge, to any person obtaining a copy of this
     49549# software and associated documentation files (the "Software"), to deal in the Software
     49550# without restriction, including without limitation the rights to use, copy, modify, merge,
     49551# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
    4955249552# to whom the Software is furnished to do so, subject to the following conditions:
    49553 # 
    49554 # The above copyright notice and this permission notice shall be included in all copies or 
     49553#
     49554# The above copyright notice and this permission notice shall be included in all copies or
    4955549555# substantial portions of the Software.
    49556 # 
    49557 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
    49558 # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
    49559 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
    49560 # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     49556#
     49557# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
     49558# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     49559# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
     49560# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    4956149561# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    4956249562*/
Note: See TracChangeset for help on using the changeset viewer.