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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,119,119,7,112,119,119,7,112,119,119,7,112,119,119,7,0,0,0,0,112,119,119,7,112,119,119,7,112,119,119,7,112,119,119,7,112,119,119,7,112,119,119,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,7,112,7,112,7,112,7,112,7,112,7,112,119,119,7,0,0,0,0,112,7,112,7,112,7,0,0,112,7,0,0,112,7,0,0,112,119,0,0,112,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,7,112,7,112,7,112,7,112,7,112,7,0,112,7,0,0,0,0,0,112,7,112,7,112,7,0,0,112,7,0,0,112,119,119,7,112,119,0,0,112,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,112,119,7,0,112,7,112,7,112,7,112,7,0,112,7,0,0,0,0,0,112,119,119,7,112,7,0,0,112,7,0,0,112,119,119,7,0,0,119,7,0,0,119,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,7,112,7,112,7,112,7,112,7,112,7,0,112,7,0,0,0,0,0,112,7,112,7,112,7,0,0,112,7,0,0,112,7,0,0,0,0,119,7,0,0,119,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,7,112,7,112,119,119,7,112,119,119,7,0,112,7,0,0,0,0,0,112,7,112,7,112,119,119,7,112,119,119,7,112,119,119,7,112,119,119,7,112,119,119,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,7,0,0,112,0,0,0,0,0,0,112,0,0,0,7,0,0,0,0,0,0,7,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,112,0,0,0,0,7,0,0,0,0,0,7,0,0,0,112,0,0,0,0,0,112,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,0,0,7,0,0,0,0,0,7,0,0,0,112,0,0,0,0,0,112,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,0,0,119,119,119,119,119,119,7,0,0,0,112,119,119,119,119,119,119,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,0,0,119,119,119,119,119,119,7,0,0,0,112,119,119,119,119,119,119,7,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,7,0,0,112,0,0,0,0,0,0,112,0,0,0,7,0,0,0,0,0,0,7,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,0,0,119,0,0,0,0,0,0,112,7,0,112,7,0,0,0,0,0,0,119,0,0,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,119,0,0,0,0,0,0,0,0,112,119,7,0,0,0,0,0,0,0,0,119,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,4,66,8,0,4,65,8,0,1,3,4,0,1,3,4,128,1,2,3,0,1,2,3,0,1,3,5,0,1,3,6,0,1,3,5,0,1,3,6,0,1,2,69,0,129,2,67,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,65,66,67,68,
0,47,0,45,204,8,204,56,24,15,0,23,24,85,0,83,192,14,204,80,192,94,216,94,204,0,204,94,31,63,204,94,197,46,197,44,81,9,17,55,204,94,100,91,228,35,204,62,10,15,214,42,29,94,226,94,22,35,138,18,34,84,238,82,1,16,0,0,216,62,36,81,24,55,57,49,188,91,57,49,88,57,107,57,24,63,57,49,24,55,57,49,188,91,176,81,57,49,57,49,24,63,57,49,24,53,57,49,188,91,57,49,24,59,33,55,24,63,57,49,24,63,57,49,188,91,57,49,57,49,57,49,1,16,0,0,228,91,231,123,233,91,231,91,228,91,231,91,233,27,231,91,228,91,231,91,235,91,231,91,228,91,231,123,233,91,231,123,224,91,228,123,231,91,228,123,224,91,228,43,231,91,228,43,226,91,230,123,233,91,230,123,226,43,230,43,233,91,230,27,1,16,0,0,64,94,12,90,192,90,12,90,64,94,12,90,192,90,12,90,64,94,24,92,12,92,24,92,64,94,12,92,192,92,12,92,69,94,17,92,197,92,17,92,76,94,24,94,192,92,12,92,74,88,22,94,
202,88,22,94,81,88,29,94,209,88,29,94,1,16,0,0,91,127,95,123,98,119,102,115,91,103,95,101,98,83,102,35,219,127,223,125,226,123,230,121,219,105,223,103,226,83,226,35,88,127,91,123,93,119,98,115,216,103,219,101,221,87,226,35,100,89,103,119,105,85,110,115,221,87,212,89,226,89,238,89,1,16,0,0,103,41,103,41,103,41,103,41,110,25,110,89,235,25,107,41,107,89,107,41,100,73,100,41,103,41,105,25,105,41,105,41,228,41,231,41,238,41,235,41,107,41,107,121,105,41,103,41,105,41,235,41,240,41,110,41,238,121,107,121,112,105,238,41,1,16,0,0,112,91,240,93,110,95,235,91,105,45,238,47,235,43,231,45,39,46,103,29,233,43,43,46,105,121,231,41,36,40,103,41,27,41,91,89,91,41,27,41,93,41,105,121,29,41,105,41,36,105,100,105,100,121,36,121,103,105,103,105,41,121,105,121,1,16,0,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,17,114,93,114,
17,114,157,116,83,20,159,116,19,118,159,118,15,24,91,120,143,120,219,122,22,26,98,122,150,124,226,124,1,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,238,95,0,0,110,94,46,94,0,0,110,94,238,95,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,
0,112,120,97,1,249,1,104,235,193,226,225,103,31,31,220,31,189,67,242,6,209,233,27,118,184,252,37,194,167,72,31,225,144,232,13,94,224,254,129,251,195,188,123,146,106,32,124,135,114,98,33,136,95,162,202,178,99,78,58,39,12,222,32,124,135,238,37,202,56,26,120,132,169,129,149,173,129,190,159,205,103,54,108,18,69,122,2,19,125,155,239,212,233,76,148,100,109,209,89,170,46,147,102,166,91,26,25,121,136,104,238,202,100,165,239,134,38,212,130,164,66,84,2,170,43,139,211,174,219,59,176,136,163,106,108,98,106,202,24,58,226,27,138,235,160,152,241,133,99,250,190,173,11,157,112,8,142,100,67,99,121,55,150,84,27,109,19,141,77,69,81,227,133,46,138,116,73,250,32,108,187,90,33,228,178,243,22,163,219,138,182,90,106,134,132,73,154,243,118,106,1,225,189,165,141,84,207,196,50,111,33,70,112,98,221,164,77,108,144,104,51,12,151,70,70,14,188,113,68,64,192,62,211,246,152,169,227,82,219,96,101,113,205,190,39,218,35,176,207,202,218,98,151,13,154,
163,115,203,68,183,152,77,220,88,47,149,67,83,73,178,97,153,193,221,209,189,202,36,82,9,121,158,102,91,253,117,213,90,16,205,204,5,245,72,112,99,214,61,68,57,49,48,185,48,183,87,53,91,30,152,26,29,139,116,130,135,23,230,54,22,212,13,86,10,165,179,165,153,40,83,11,94,244,64,188,170,22,50,25,168,142,76,4,11,185,45,22,54,23,26,133,135,119,153,209,29,49,56,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
var Module = typeof Module !== "undefined" ? Module : {};
if (!Module.expectedDataFileDownloads) {
Module.expectedDataFileDownloads = 0;
Module.finishedDataFileDownloads = 0;
}
Module.expectedDataFileDownloads++;
(function() {
var loadPackage = function(metadata) {
function runWithFS() {
var fileData0 = [];
fileData0.push.apply(fileData0, [ 67, 80, 79, 68, 68, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 70, 73, 76, 0, 0, 0, 0, 123, 144, 0, 0, 112, 111, 100, 47, 112, 105, 99, 111, 56, 95, 98, 111, 111, 116, 46, 112, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 1, 0, 0, 242, 16, 112, 105, 99, 111, 45, 56, 32, 99, 97, 114, 116, 114, 105, 100, 103, 101, 32, 47, 47, 32, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 31, 0, 255, 13, 46, 99, 111, 109, 10, 118, 101, 114, 115, 105, 111, 110, 32, 56, 10, 95, 95, 108, 117, 97, 95, 95, 10, 10, 45, 45, 62, 56, 6, 0, 25, 159, 95, 95, 103, 102, 120, 95, 95, 10, 48, 1, 0, 108, 15, 129, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 45, 1, 137, 64, 31, 102, 137, 64, 112, 15, 139, 1, 109, 15, 1, 1, 239, 95, 95, 95, 109, 97, 112, 10, 2, 240, 15, 1, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 44, 50, 95, 95, 115, 187, 98, 48, 49, 48, 99, 17, 0, 161, 51, 48, 53, 53, 53, 50, 98, 53, 54, 53, 10, 0, 64, 51, 53, 53, 52, 5, 0, 128, 49, 53, 51, 53, 55, 48, 53, 48, 3, 0, 15, 5, 0, 106, 0, 169, 0, 16, 56, 12, 0, 115, 50, 52, 48, 51, 53, 50, 52, 26, 0, 15, 91, 2, 130, 30, 49, 154, 0, 15, 169, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 238, 113, 95, 95, 109, 117, 115, 105, 99, 114, 74, 50, 32, 52, 49, 2, 0, 15, 12, 0, 255, 255, 224, 80, 49, 52, 49, 10, 10, 99, 70, 73, 76, 0, 0, 0, 0, 91, 157, 12, 0, 112, 111, 100, 47, 103, 102, 120, 49, 46, 112, 111, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 193, 72, 0, 0, 243, 22, 67, 80, 79, 68, 68, 0, 0, 0, 1, 0, 0, 0, 103, 102, 120, 49, 46, 112, 111, 100, 0, 47, 112, 97, 98, 97, 47, 112, 105, 99, 111, 56, 47, 112, 111, 100, 47, 25, 0, 63, 8, 1, 0, 1, 0, 10, 177, 67, 66, 77, 80, 20, 0, 1, 0, 128, 0, 0, 4, 0, 47, 32, 0, 1, 0, 255, 255, 255, 255, 255, 255, 255, 255, 207, 79, 77, 0, 255, 255, 4, 0, 73, 47, 0, 0, 0, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 91, 63, 163, 255, 255, 4, 0, 73, 47, 232, 241, 4, 0, 75, 47, 170, 204, 4, 0, 75, 15, 0, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 155, 79, 39, 236, 255, 255, 4, 0, 73, 47, 232, 241, 4, 0, 255, 12, 47, 168, 119, 4, 0, 75, 15, 0, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 59, 15, 1, 0, 77, 79, 54, 228, 0, 255, 4, 0, 73, 15, 160, 1, 77, 63, 156, 118, 131, 4, 0, 74, 15, 160, 1, 77, 15, 0, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 155, 15, 1, 0, 77, 79, 255, 173, 41, 255, 4, 0, 73, 15, 99, 1, 77, 15, 0, 2, 255, 255, 255, 255, 255, 255,
fileData0.push.apply(fileData0, [ 15, 88, 0, 39, 0, 56, 43, 38, 0, 155, 16, 0, 4, 76, 43, 4, 116, 0, 0, 48, 2, 4, 184, 19, 15, 192, 0, 49, 47, 177, 217, 0, 5, 255, 252, 4, 148, 208, 8, 84, 11, 4, 144, 2, 12, 56, 22, 15, 116, 0, 51, 15, 128, 92, 255, 160, 31, 168, 40, 45, 88, 15, 56, 22, 9, 15, 108, 0, 48, 15, 0, 10, 255, 255, 8, 8, 128, 2, 47, 177, 217, 80, 116, 11, 15, 88, 7, 0, 15, 0, 5, 21, 15, 128, 7, 255, 255, 24, 15, 80, 116, 20, 15, 128, 2, 255, 255, 48, 15, 128, 12, 3, 15, 208, 113, 6, 15, 128, 2, 255, 151, 14, 152, 1, 15, 48, 2, 75, 31, 177, 52, 17, 7, 15, 56, 22, 54, 15, 212, 0, 8, 15, 128, 2, 255, 123, 12, 148, 62, 15, 176, 14, 85, 31, 177, 52, 17, 60, 4, 4, 0, 14, 248, 19, 15, 128, 2, 255, 144, 8, 200, 6, 31, 177, 48, 12, 72, 14, 192, 4, 14, 52, 17, 15, 200, 5, 80, 15, 128, 7, 255, 215, 15, 128, 2, 1, 4, 52, 7, 12, 12, 0, 0, 180, 14, 15, 200, 0, 85, 14, 236, 7, 15, 128, 12, 255, 196, 15, 128, 7, 4, 15, 52, 17, 78, 15, 124, 2, 8, 14, 112, 10, 15, 128, 2, 255, 201, 4, 128, 12, 4, 8, 0, 42, 0, 155, 20, 0, 15, 52, 17, 69, 15, 120, 2, 8, 15, 248, 12, 5, 15, 128, 17, 255, 203, 42, 0, 155, 128, 7, 4, 8, 5, 15, 52, 17, 24, 15, 120, 2, 70, 14, 136, 2, 15, 0, 20, 255, 200, 8, 8, 10, 15, 52, 17, 41, 14, 184, 4, 15, 120, 2, 47, 14, 136, 2, 15, 128, 2, 255, 28, 14, 116, 36, 15, 128, 2, 139, 12, 188, 0, 15, 108, 37, 44, 15, 116, 2, 1, 15, 132, 2, 45, 15, 128, 2, 255, 15, 15, 248, 38, 4, 15, 136, 12, 158, 15, 244, 4, 20, 15, 4, 0, 97, 15, 128, 2, 254, 15, 200, 8, 20, 15, 56, 27, 146, 14, 128, 2, 15, 124, 2, 6, 15, 128, 2, 230, 15, 100, 57, 12, 15, 4, 0, 255, 207, 15, 0, 5, 125, 15, 176, 26, 44, 15, 104, 6, 65, 15, 20, 5, 45, 15, 228, 5, 145, 15, 128, 7, 246, 14, 176, 26, 15, 104, 1, 78, 15, 148, 2, 218, 15, 188, 0, 25, 4, 180, 59, 4, 192, 27, 15, 128, 7, 255, 255, 35, 15, 76, 1, 41, 12, 64, 30, 15, 128, 7, 196, 15, 4, 0, 255, 71, 15, 204, 8, 27, 15, 64, 30, 79, 15, 4, 0, 0, 15, 0, 70, 109, 15, 220, 11, 255, 75, 12, 204, 8, 15, 244, 4, 21, 47, 232, 241, 64, 30, 11, 15, 172, 6, 55, 15, 128, 2, 255, 204, 15, 32, 2, 31, 15, 196, 163, 30, 15, 128, 2, 255, 243, 15, 48, 11, 57, 15, 196, 163, 36, 15, 0, 10, 255, 231, 15, 176, 18, 16, 15, 116, 47, 61, 15, 0, 10, 255, 251, 14, 228, 9, 15, 100, 0, 63, 0, 120, 7, 15, 192, 0, 12, 15, 128, 7, 209, 15, 172, 17, 9, 15, 128, 7, 255, 55, 15, 96, 1, 4, 15, 128, 2, 255, 3, 12, 124, 6, 14, 176, 27, 15, 92, 10, 255, 124, 15, 128, 2, 193, 14, 124, 6, 15, 0, 30, 255, 255, 29, 15, 160, 3, 56, 15, 128, 2, 255, 255, 100, 14, 4, 0, 15, 128, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 169, 63, 255, 155, 63, 4, 0, 255, 235, 15, 128, 2, 255, 94, 4, 176, 20, 15, 128, 2, 255, 255, 99, 12, 48, 28, 15, 128, 2, 255, 255, 99, 8, 48, 28, 15, 128, 2, 255, 255, 31, 14, 60, 7, 15, 128, 7, 255, 204, 8, 40, 13, 15, 248, 0, 61, 14, 92, 0, 15, 60, 7, 255, 0, 14, 128, 1, 15, 0, 5, 255, 12, 12, 44, 1, 14, 56, 1, 15, 56, 0, 22, 15, 60, 7, 13, 15, 8, 2, 101, 15, 0, 5, 255, 91, 15, 160, 1, 25, 14, 72, 2, 15, 56, 0, 30, 15, 60, 7, 21, 15, 32, 3, 61, 15, 0, 10, 255, 199, 14, 52, 4, 15, 56, 0, 30, 15, 32, 3, 77, 15, 128, 2, 255, 187, 12, 220, 1, 14, 72, 2, 15, 56, 0, 30, 15, 32, 3, 81, 15, 0, 5, 255, 191, 15, 8, 10, 56, 15, 32, 3, 61, 15, 128, 2, 255, 227, 15, 144, 4, 89, 14, 44, 12, 15, 232, 2, 79, 8, 32, 62, 15, 32, 0, 8, 15, 80, 0, 34, 15, 4, 0, 20, 15, 128, 2, 186, 14, 212, 0, 15, 80, 19, 14, 15, 0, 20, 154, 14, 8, 10, 15, 0, 30, 255, 255, 89, 14, 4, 0, 15, 128, 2, 255, 255, 255, 250, 15, 32, 38, 0, 15, 0, 5, 255, 255, 255, 133, 15, 168, 3, 0, 15, 128, 2, 255, 135, 15, 84, 5, 20, 15, 8, 3, 255, 54, 15, 128, 12, 255, 255, 111, 15, 128, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 48, 15, 4, 0, 255, 242, 15, 128, 2, 56, 15, 4, 0, 255, 255, 35, 15, 128, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 252, 63, 54, 54, 54, 4, 0, 255, 243, 15, 128, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
fileData0.push.apply(fileData0, [ 14, 10, 69, 2, 6, 186, 3, 31, 0, 181, 2, 18, 27, 255, 197, 0, 6, 232, 10, 31, 0, 252, 0, 15, 25, 255, 237, 6, 6, 152, 25, 31, 255, 244, 2, 15, 8, 69, 23, 6, 114, 22, 11, 217, 25, 15, 106, 5, 19, 5, 14, 0, 3, 113, 2, 15, 232, 5, 16, 5, 70, 29, 25, 0, 56, 0, 6, 9, 0, 15, 189, 0, 16, 6, 136, 25, 7, 186, 0, 3, 128, 14, 15, 55, 2, 18, 8, 3, 14, 8, 189, 0, 15, 47, 4, 20, 8, 162, 5, 9, 62, 0, 15, 189, 0, 15, 15, 7, 0, 2, 14, 35, 7, 15, 55, 2, 12, 7, 61, 1, 4, 59, 1, 47, 255, 0, 126, 0, 15, 8, 217, 6, 47, 0, 0, 185, 1, 28, 9, 175, 2, 5, 240, 3, 7, 255, 0, 15, 220, 8, 17, 6, 68, 0, 40, 255, 255, 3, 1, 15, 63, 0, 19, 28, 255, 176, 5, 5, 57, 6, 15, 189, 0, 18, 14, 101, 7, 15, 177, 3, 20, 7, 208, 7, 15, 194, 1, 0, 31, 0, 185, 1, 20, 10, 50, 2, 15, 118, 2, 24, 8, 250, 0, 6, 167, 3, 5, 33, 8, 15, 43, 5, 13, 6, 44, 3, 5, 108, 6, 4, 9, 0, 15, 122, 1, 15, 5, 32, 5, 6, 46, 6, 7, 187, 13, 5, 187, 12, 15, 118, 2, 10, 5, 56, 0, 25, 0, 216, 10, 7, 2, 17, 15, 118, 2, 13, 7, 216, 5, 1, 133, 33, 31, 255, 236, 4, 23, 5, 239, 4, 14, 14, 0, 15, 59, 1, 13, 40, 255, 255, 55, 3, 11, 110, 4, 15, 51, 3, 19, 15, 196, 2, 0, 6, 252, 6, 47, 0, 255, 90, 9, 18, 43, 255, 255, 77, 29, 5, 59, 2, 15, 98, 7, 12, 9, 35, 5, 40, 255, 255, 30, 7, 1, 148, 1, 15, 232, 5, 25, 10, 179, 6, 47, 255, 255, 90, 9, 15, 27, 0, 126, 26, 4, 48, 2, 15, 204, 12, 20, 4, 56, 0, 9, 235, 6, 3, 144, 1, 15, 51, 3, 16, 15, 25, 8, 0, 7, 146, 13, 15, 232, 5, 16, 7, 238, 3, 7, 14, 0, 4, 170, 5, 15, 189, 0, 20, 25, 255, 57, 36, 15, 169, 5, 22, 6, 162, 19, 4, 193, 12, 9, 8, 2, 15, 110, 4, 26, 9, 185, 1, 14, 27, 9, 15, 102, 6, 6, 31, 0, 220, 8, 1, 15, 228, 6, 26, 8, 44, 3, 14, 248, 1, 15, 102, 6, 17, 7, 9, 26, 5, 237, 4, 15, 102, 6, 19, 5, 101, 8, 5, 16, 10, 2, 35, 8, 31, 255, 126, 0, 34, 14, 55, 2, 15, 236, 4, 23, 15, 157, 8, 31, 6, 160, 23, 9, 171, 5, 15, 35, 7, 1, 15, 246, 1, 10, 7, 239, 4, 14, 59, 1, 15, 110, 4, 6, 10, 140, 0, 47, 0, 0, 7, 14, 27, 41, 255, 0, 29, 10, 8, 115, 7, 15, 236, 4, 19, 8, 173, 2, 5, 0, 25, 15, 126, 0, 23, 13, 249, 2, 4, 78, 3, 15, 224, 7, 20, 7, 6, 11, 9, 236, 7, 31, 67, 212, 10, 16, 10, 6, 12, 9, 7, 0, 15, 216, 9, 26, 13, 156, 8, 15, 141, 12, 20, 14, 126, 0, 15, 196, 14, 17, 13, 209, 9, 7, 238, 6, 14, 204, 12, 15, 216, 9, 8, 10, 234, 2, 4, 145, 11, 31, 255, 63, 0, 22, 15, 10, 1, 0, 47, 255, 0, 126, 0, 19, 6, 94, 32, 9, 93, 9, 15, 63, 0, 26, 5, 11, 13, 14, 244, 2, 15, 55, 2, 20, 9, 7, 0, 47, 255, 255, 39, 6, 33, 11, 127, 0, 15, 169, 5, 20, 9, 21, 8, 7, 140, 2, 15, 189, 0, 27, 8, 100, 7, 14, 39, 6, 15, 248, 1, 9, 15, 79, 12, 0, 15, 200, 13, 20, 14, 116, 1, 15, 109, 20, 23, 6, 242, 1, 6, 35, 7, 2, 191, 0, 47, 0, 255, 51, 3, 26, 12, 81, 13, 31, 0, 161, 7, 16, 8, 49, 16, 15, 177, 3, 38, 31, 0, 126, 0, 34, 47, 0, 255, 240, 5, 5, 14, 106, 5, 15, 70, 14, 19, 15, 126, 0, 26, 15, 196, 0, 1, 9, 203, 0, 15, 118, 2, 26, 9, 184, 1, 47, 255, 255, 189, 0, 29, 8, 202, 16, 15, 165, 6, 20, 15, 111, 2, 4, 47, 0, 255, 252, 0, 18, 47, 255, 0, 115, 16, 0, 6, 50, 6, 15, 244, 2, 14, 13, 223, 7, 15, 125, 16, 32, 47, 0, 0, 39, 6, 36, 31, 0, 71, 12, 4, 3, 8, 0, 15, 55, 2, 22, 15, 204, 12, 32, 15, 98, 7, 3, 14, 66, 15, 15, 23, 10, 14, 11, 77, 0, 3, 14, 0, 15, 58, 17, 19, 8, 130, 1, 39, 0, 0, 168, 21, 47, 0, 255, 244, 2, 15, 14, 183, 0, 6, 223, 24, 15, 39, 6, 20, 47, 255, 0, 58, 17, 36, 6, 157, 24, 13, 190, 1, 15, 94, 8, 17, 14, 233, 5, 9, 246, 7, 15, 11, 13, 18, 7, 48, 0, 5, 9, 17, 14, 122, 1, 15, 236, 4, 21, 14, 121, 17, 15, 35, 7, 10, 11, 7, 0, 15, 63, 0, 25, 31, 255, 7, 0, 3, 4, 25, 12, 15, 177, 3, 20, 30, 0, 191, 3, 15, 152, 25, 20, 15, 130, 0, 5, 15, 122, 1, 19, 10, 87, 7, 31, 255, 157, 8, 39, 15, 122, 1, 29, 12, 28, 4, 8, 66, 3, 47, 255, 255, 39, 6, 21, 7, 13, 26, 15, 106, 5, 30, 31, 0, 92, 10, 4, 15, 165, 6, 25, 11, 131, 2, 31, 255, 47, 4, 22, 8, 56, 0, 13, 156, 10, 31, 0, 110, 4, 25, 13, 237, 22, 15, 192, 15, 23, 41, 0, 255, 143, 9, 160, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0 ]);
Module["FS_createDataFile"]("/", "data.pod", fileData0, true, true, false);
}
if (Module["calledRun"]) {
runWithFS();
} else {
if (!Module["preRun"]) Module["preRun"] = [];
Module["preRun"].push(runWithFS);
}
};
loadPackage({
"files": []
});
})();
var moduleOverrides = {};
var key;
for (key in Module) {
if (Module.hasOwnProperty(key)) {
moduleOverrides[key] = Module[key];
}
}
Module["arguments"] = [];
Module["thisProgram"] = "./this.program";
Module["quit"] = function(status, toThrow) {
throw toThrow;
};
Module["preRun"] = [];
Module["postRun"] = [];
var ENVIRONMENT_IS_WEB = false;
var ENVIRONMENT_IS_WORKER = false;
var ENVIRONMENT_IS_NODE = false;
var ENVIRONMENT_IS_SHELL = false;
ENVIRONMENT_IS_WEB = typeof window === "object";
ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
ENVIRONMENT_IS_NODE = typeof process === "object" && typeof require === "function" && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER;
ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
var scriptDirectory = "";
function locateFile(path) {
if (Module["locateFile"]) {
return Module["locateFile"](path, scriptDirectory);
} else {
return scriptDirectory + path;
}
}
if (ENVIRONMENT_IS_NODE) {
scriptDirectory = __dirname + "/";
var nodeFS;
var nodePath;
Module["read"] = function shell_read(filename, binary) {
var ret;
ret = tryParseAsDataURI(filename);
if (!ret) {
if (!nodeFS) nodeFS = require("fs");
if (!nodePath) nodePath = require("path");
filename = nodePath["normalize"](filename);
ret = nodeFS["readFileSync"](filename);
}
return binary ? ret : ret.toString();
};
Module["readBinary"] = function readBinary(filename) {
var ret = Module["read"](filename, true);
if (!ret.buffer) {
ret = new Uint8Array(ret);
}
assert(ret.buffer);
return ret;
};
if (process["argv"].length > 1) {
Module["thisProgram"] = process["argv"][1].replace(/\\/g, "/");
}
Module["arguments"] = process["argv"].slice(2);
if (typeof module !== "undefined") {
module["exports"] = Module;
}
process["on"]("uncaughtException", function(ex) {
if (!(ex instanceof ExitStatus)) {
throw ex;
}
});
process["on"]("unhandledRejection", abort);
Module["quit"] = function(status) {
process["exit"](status);
};
Module["inspect"] = function() {
return "[Emscripten Module object]";
};
} else if (ENVIRONMENT_IS_SHELL) {
if (typeof read != "undefined") {
Module["read"] = function shell_read(f) {
var data = tryParseAsDataURI(f);
if (data) {
return intArrayToString(data);
}
return read(f);
};
}
Module["readBinary"] = function readBinary(f) {
var data;
data = tryParseAsDataURI(f);
if (data) {
return data;
}
if (typeof readbuffer === "function") {
return new Uint8Array(readbuffer(f));
}
data = read(f, "binary");
assert(typeof data === "object");
return data;
};
if (typeof scriptArgs != "undefined") {
Module["arguments"] = scriptArgs;
} else if (typeof arguments != "undefined") {
Module["arguments"] = arguments;
}
if (typeof quit === "function") {
Module["quit"] = function(status) {
quit(status);
};
}
} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
if (ENVIRONMENT_IS_WORKER) {
scriptDirectory = self.location.href;
} else if (document.currentScript) {
scriptDirectory = document.currentScript.src;
}
if (scriptDirectory.indexOf("blob:") !== 0) {
scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1);
} else {
scriptDirectory = "";
}
Module["read"] = function shell_read(url) {
try {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
xhr.send(null);
return xhr.responseText;
} catch (err) {
var data = tryParseAsDataURI(url);
if (data) {
return intArrayToString(data);
}
throw err;
}
};
if (ENVIRONMENT_IS_WORKER) {
Module["readBinary"] = function readBinary(url) {
try {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
xhr.responseType = "arraybuffer";
xhr.send(null);
return new Uint8Array(xhr.response);
} catch (err) {
var data = tryParseAsDataURI(url);
if (data) {
return data;
}
throw err;
}
};
}
Module["readAsync"] = function readAsync(url, onload, onerror) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "arraybuffer";
xhr.onload = function xhr_onload() {
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
onload(xhr.response);
return;
}
var data = tryParseAsDataURI(url);
if (data) {
onload(data.buffer);
return;
}
onerror();
};
xhr.onerror = onerror;
xhr.send(null);
};
Module["setWindowTitle"] = function(title) {
document.title = title;
};
} else {}
var out = Module["print"] || (typeof console !== "undefined" ? console.log.bind(console) : typeof print !== "undefined" ? print : null);
var err = Module["printErr"] || (typeof printErr !== "undefined" ? printErr : typeof console !== "undefined" && console.warn.bind(console) || out);
for (key in moduleOverrides) {
if (moduleOverrides.hasOwnProperty(key)) {
Module[key] = moduleOverrides[key];
}
}
moduleOverrides = undefined;
var STACK_ALIGN = 16;
function dynamicAlloc(size) {
var ret = HEAP32[DYNAMICTOP_PTR >> 2];
var end = ret + size + 15 & -16;
if (end <= _emscripten_get_heap_size()) {
HEAP32[DYNAMICTOP_PTR >> 2] = end;
} else {
return 0;
}
return ret;
}
function getNativeTypeSize(type) {
switch (type) {
case "i1":
case "i8":
return 1;
case "i16":
return 2;
case "i32":
return 4;
case "i64":
return 8;
case "float":
return 4;
case "double":
return 8;
default:
{
if (type[type.length - 1] === "*") {
return 4;
} else if (type[0] === "i") {
var bits = parseInt(type.substr(1));
assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type);
return bits / 8;
} else {
return 0;
}
}
}
}
function warnOnce(text) {
if (!warnOnce.shown) warnOnce.shown = {};
if (!warnOnce.shown[text]) {
warnOnce.shown[text] = 1;
err(text);
}
}
var jsCallStartIndex = 1;
var functionPointers = new Array(0);
var funcWrappers = {};
function dynCall(sig, ptr, args) {
if (args && args.length) {
return Module["dynCall_" + sig].apply(null, [ ptr ].concat(args));
} else {
return Module["dynCall_" + sig].call(null, ptr);
}
}
var tempRet0 = 0;
var setTempRet0 = function(value) {
tempRet0 = value;
};
var getTempRet0 = function() {
return tempRet0;
};
var GLOBAL_BASE = 8;
function getValue(ptr, type, noSafe) {
type = type || "i8";
if (type.charAt(type.length - 1) === "*") type = "i32";
switch (type) {
case "i1":
return HEAP8[ptr >> 0];
case "i8":
return HEAP8[ptr >> 0];
case "i16":
return HEAP16[ptr >> 1];
case "i32":
return HEAP32[ptr >> 2];
case "i64":
return HEAP32[ptr >> 2];
case "float":
return HEAPF32[ptr >> 2];
case "double":
return HEAPF64[ptr >> 3];
default:
abort("invalid type for getValue: " + type);
}
return null;
}
var ABORT = false;
var EXITSTATUS = 0;
function assert(condition, text) {
if (!condition) {
abort("Assertion failed: " + text);
}
}
function getCFunc(ident) {
var func = Module["_" + ident];
assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");
return func;
}
function ccall(ident, returnType, argTypes, args, opts) {
var toC = {
"string": function(str) {
var ret = 0;
if (str !== null && str !== undefined && str !== 0) {
var len = (str.length << 2) + 1;
ret = stackAlloc(len);
stringToUTF8(str, ret, len);
}
return ret;
},
"array": function(arr) {
var ret = stackAlloc(arr.length);
writeArrayToMemory(arr, ret);
return ret;
}
};
function convertReturnValue(ret) {
if (returnType === "string") return UTF8ToString(ret);
if (returnType === "boolean") return Boolean(ret);
return ret;
}
var func = getCFunc(ident);
var cArgs = [];
var stack = 0;
if (args) {
for (var i = 0; i < args.length; i++) {
var converter = toC[argTypes[i]];
if (converter) {
if (stack === 0) stack = stackSave();
cArgs[i] = converter(args[i]);
} else {
cArgs[i] = args[i];
}
}
}
var ret = func.apply(null, cArgs);
ret = convertReturnValue(ret);
if (stack !== 0) stackRestore(stack);
return ret;
}
function setValue(ptr, value, type, noSafe) {
type = type || "i8";
if (type.charAt(type.length - 1) === "*") type = "i32";
switch (type) {
case "i1":
HEAP8[ptr >> 0] = value;
break;
case "i8":
HEAP8[ptr >> 0] = value;
break;
case "i16":
HEAP16[ptr >> 1] = value;
break;
case "i32":
HEAP32[ptr >> 2] = value;
break;
case "i64":
tempI64 = [ value >>> 0, (tempDouble = value, +Math_abs(tempDouble) >= +1 ? tempDouble > +0 ? (Math_min(+Math_floor(tempDouble / +4294967296), +4294967295) | 0) >>> 0 : ~~+Math_ceil((tempDouble - +(~~tempDouble >>> 0)) / +4294967296) >>> 0 : 0) ],
HEAP32[ptr >> 2] = tempI64[0], HEAP32[ptr + 4 >> 2] = tempI64[1];
break;
case "float":
HEAPF32[ptr >> 2] = value;
break;
case "double":
HEAPF64[ptr >> 3] = value;
break;
default:
abort("invalid type for setValue: " + type);
}
}
var ALLOC_NORMAL = 0;
var ALLOC_NONE = 3;
function allocate(slab, types, allocator, ptr) {
var zeroinit, size;
if (typeof slab === "number") {
zeroinit = true;
size = slab;
} else {
zeroinit = false;
size = slab.length;
}
var singleType = typeof types === "string" ? types : null;
var ret;
if (allocator == ALLOC_NONE) {
ret = ptr;
} else {
ret = [ _malloc, stackAlloc, dynamicAlloc ][allocator](Math.max(size, singleType ? 1 : types.length));
}
if (zeroinit) {
var stop;
ptr = ret;
assert((ret & 3) == 0);
stop = ret + (size & ~3);
for (;ptr < stop; ptr += 4) {
HEAP32[ptr >> 2] = 0;
}
stop = ret + size;
while (ptr < stop) {
HEAP8[ptr++ >> 0] = 0;
}
return ret;
}
if (singleType === "i8") {
if (slab.subarray || slab.slice) {
HEAPU8.set(slab, ret);
} else {
HEAPU8.set(new Uint8Array(slab), ret);
}
return ret;
}
var i = 0, type, typeSize, previousType;
while (i < size) {
var curr = slab[i];
type = singleType || types[i];
if (type === 0) {
i++;
continue;
}
if (type == "i64") type = "i32";
setValue(ret + i, curr, type);
if (previousType !== type) {
typeSize = getNativeTypeSize(type);
previousType = type;
}
i += typeSize;
}
return ret;
}
function getMemory(size) {
if (!runtimeInitialized) return dynamicAlloc(size);
return _malloc(size);
}
var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;
function UTF8ArrayToString(u8Array, idx, maxBytesToRead) {
var endIdx = idx + maxBytesToRead;
var endPtr = idx;
while (u8Array[endPtr] && !(endPtr >= endIdx)) ++endPtr;
if (endPtr - idx > 16 && u8Array.subarray && UTF8Decoder) {
return UTF8Decoder.decode(u8Array.subarray(idx, endPtr));
} else {
var str = "";
while (idx < endPtr) {
var u0 = u8Array[idx++];
if (!(u0 & 128)) {
str += String.fromCharCode(u0);
continue;
}
var u1 = u8Array[idx++] & 63;
if ((u0 & 224) == 192) {
str += String.fromCharCode((u0 & 31) << 6 | u1);
continue;
}
var u2 = u8Array[idx++] & 63;
if ((u0 & 240) == 224) {
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
} else {
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | u8Array[idx++] & 63;
}
if (u0 < 65536) {
str += String.fromCharCode(u0);
} else {
var ch = u0 - 65536;
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
}
}
}
return str;
}
function UTF8ToString(ptr, maxBytesToRead) {
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
}
function stringToUTF8Array(str, outU8Array, outIdx, maxBytesToWrite) {
if (!(maxBytesToWrite > 0)) return 0;
var startIdx = outIdx;
var endIdx = outIdx + maxBytesToWrite - 1;
for (var i = 0; i < str.length; ++i) {
var u = str.charCodeAt(i);
if (u >= 55296 && u <= 57343) {
var u1 = str.charCodeAt(++i);
u = 65536 + ((u & 1023) << 10) | u1 & 1023;
}
if (u <= 127) {
if (outIdx >= endIdx) break;
outU8Array[outIdx++] = u;
} else if (u <= 2047) {
if (outIdx + 1 >= endIdx) break;
outU8Array[outIdx++] = 192 | u >> 6;
outU8Array[outIdx++] = 128 | u & 63;
} else if (u <= 65535) {
if (outIdx + 2 >= endIdx) break;
outU8Array[outIdx++] = 224 | u >> 12;
outU8Array[outIdx++] = 128 | u >> 6 & 63;
outU8Array[outIdx++] = 128 | u & 63;
} else {
if (outIdx + 3 >= endIdx) break;
outU8Array[outIdx++] = 240 | u >> 18;
outU8Array[outIdx++] = 128 | u >> 12 & 63;
outU8Array[outIdx++] = 128 | u >> 6 & 63;
outU8Array[outIdx++] = 128 | u & 63;
}
}
outU8Array[outIdx] = 0;
return outIdx - startIdx;
}
function stringToUTF8(str, outPtr, maxBytesToWrite) {
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
}
function lengthBytesUTF8(str) {
var len = 0;
for (var i = 0; i < str.length; ++i) {
var u = str.charCodeAt(i);
if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4;
}
return len;
}
var UTF16Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le") : undefined;
function allocateUTF8OnStack(str) {
var size = lengthBytesUTF8(str) + 1;
var ret = stackAlloc(size);
stringToUTF8Array(str, HEAP8, ret, size);
return ret;
}
function writeArrayToMemory(array, buffer) {
HEAP8.set(array, buffer);
}
function writeAsciiToMemory(str, buffer, dontAddNull) {
for (var i = 0; i < str.length; ++i) {
HEAP8[buffer++ >> 0] = str.charCodeAt(i);
}
if (!dontAddNull) HEAP8[buffer >> 0] = 0;
}
function demangle(func) {
return func;
}
function demangleAll(text) {
var regex = /__Z[\w\d_]+/g;
return text.replace(regex, function(x) {
var y = demangle(x);
return x === y ? x : y + " [" + x + "]";
});
}
function jsStackTrace() {
var err = new Error();
if (!err.stack) {
try {
throw new Error(0);
} catch (e) {
err = e;
}
if (!err.stack) {
return "(no stack trace available)";
}
}
return err.stack.toString();
}
function stackTrace() {
var js = jsStackTrace();
if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"]();
return demangleAll(js);
}
var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
function updateGlobalBufferViews() {
Module["HEAP8"] = HEAP8 = new Int8Array(buffer);
Module["HEAP16"] = HEAP16 = new Int16Array(buffer);
Module["HEAP32"] = HEAP32 = new Int32Array(buffer);
Module["HEAPU8"] = HEAPU8 = new Uint8Array(buffer);
Module["HEAPU16"] = HEAPU16 = new Uint16Array(buffer);
Module["HEAPU32"] = HEAPU32 = new Uint32Array(buffer);
Module["HEAPF32"] = HEAPF32 = new Float32Array(buffer);
Module["HEAPF64"] = HEAPF64 = new Float64Array(buffer);
}
var STACK_BASE = 3002288, DYNAMIC_BASE = 8245168, DYNAMICTOP_PTR = 3002032;
var TOTAL_STACK = 5242880;
var TOTAL_MEMORY = Module["TOTAL_MEMORY"] || 134217728;
if (TOTAL_MEMORY < TOTAL_STACK) err("TOTAL_MEMORY should be larger than TOTAL_STACK, was " + TOTAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")");
if (Module["buffer"]) {
buffer = Module["buffer"];
} else {
{
buffer = new ArrayBuffer(TOTAL_MEMORY);
}
Module["buffer"] = buffer;
}
updateGlobalBufferViews();
HEAP32[DYNAMICTOP_PTR >> 2] = DYNAMIC_BASE;
function callRuntimeCallbacks(callbacks) {
while (callbacks.length > 0) {
var callback = callbacks.shift();
if (typeof callback == "function") {
callback();
continue;
}
var func = callback.func;
if (typeof func === "number") {
if (callback.arg === undefined) {
Module["dynCall_v"](func);
} else {
Module["dynCall_vi"](func, callback.arg);
}
} else {
func(callback.arg === undefined ? null : callback.arg);
}
}
}
var __ATPRERUN__ = [];
var __ATINIT__ = [];
var __ATMAIN__ = [];
var __ATEXIT__ = [];
var __ATPOSTRUN__ = [];
var runtimeInitialized = false;
var runtimeExited = false;
function preRun() {
if (Module["preRun"]) {
if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ];
while (Module["preRun"].length) {
addOnPreRun(Module["preRun"].shift());
}
}
callRuntimeCallbacks(__ATPRERUN__);
}
function ensureInitRuntime() {
if (runtimeInitialized) return;
runtimeInitialized = true;
callRuntimeCallbacks(__ATINIT__);
}
function preMain() {
callRuntimeCallbacks(__ATMAIN__);
}
function exitRuntime() {
callRuntimeCallbacks(__ATEXIT__);
runtimeExited = true;
}
function postRun() {
if (Module["postRun"]) {
if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ];
while (Module["postRun"].length) {
addOnPostRun(Module["postRun"].shift());
}
}
callRuntimeCallbacks(__ATPOSTRUN__);
}
function addOnPreRun(cb) {
__ATPRERUN__.unshift(cb);
}
function addOnPostRun(cb) {
__ATPOSTRUN__.unshift(cb);
}
var Math_abs = Math.abs;
var Math_ceil = Math.ceil;
var Math_floor = Math.floor;
var Math_min = Math.min;
var runDependencies = 0;
var runDependencyWatcher = null;
var dependenciesFulfilled = null;
function getUniqueRunDependency(id) {
return id;
}
function addRunDependency(id) {
runDependencies++;
if (Module["monitorRunDependencies"]) {
Module["monitorRunDependencies"](runDependencies);
}
}
function removeRunDependency(id) {
runDependencies--;
if (Module["monitorRunDependencies"]) {
Module["monitorRunDependencies"](runDependencies);
}
if (runDependencies == 0) {
if (runDependencyWatcher !== null) {
clearInterval(runDependencyWatcher);
runDependencyWatcher = null;
}
if (dependenciesFulfilled) {
var callback = dependenciesFulfilled;
dependenciesFulfilled = null;
callback();
}
}
}
Module["preloadedImages"] = {};
Module["preloadedAudios"] = {};
var memoryInitializer = null;
var dataURIPrefix = "data:application/octet-stream;base64,";
function isDataURI(filename) {
return String.prototype.startsWith ? filename.startsWith(dataURIPrefix) : filename.indexOf(dataURIPrefix) === 0;
}
var ASM_CONSTS = [ function() {
if (typeof _cartdat !== "undefined") return 1;
return 0;
}, function() {
return _cartdat.length / 32768;
}, function() {
_cdpos = _cdpos + 1;
return _cartdat[_cdpos - 1];
}, function($0) {
ciii = $0;
iii = 0;
}, function() {
iii = iii + 1;
return _cartname[ciii].charCodeAt(iii - 1);
}, function() {
Module.pico8Reset = function() {
codo_command = 1;
};
Module.pico8ToggleSound = function() {
codo_command = 3;
};
Module.pico8TogglePaused = function() {
codo_command = 4;
};
Module.pico8SetPaused = function(p) {
codo_command = 5;
codo_command_p = 0;
if (p) codo_command_p = 1;
};
Module.pico8ToggleControlMenu = function() {
codo_command = 7;
};
}, function() {
function mkdir_0(d) {
try {
stat = FS.stat(d);
console.log("found directory: " + d);
} catch (e) {
FS.mkdir(d);
console.log("created directory: " + d);
}
}
console.log("mounting /user_data");
mkdir_0("/user_data");
FS.mount(IDBFS, {}, "/user_data");
FS.syncfs(true, function(err) {
if (!err) {
console.log("codo: mounted filesystem.\n");
codo_mounted_filesystem = 1;
mkdir_0("/user_data/cdata");
mkdir_0("/user_data/cstore");
mkdir_0("/user_data/carts");
mkdir_0("/user_data/backup");
mkdir_0("/user_data/plates");
mkdir_0("/user_data/bbs");
mkdir_0("/user_data/bbs/carts");
mkdir_0("/user_data/bbs/labels");
} else {
console.log("** could not mount filesystem\n");
console.log(err);
}
});
}, function() {
var val = 0;
if (window.location.pathname.indexOf("widget.php") >= 0) val = 1;
return val;
}, function() {
var val = 0;
if (window.location.pathname.indexOf("pico-8.php") >= 0) val = 1;
return val;
}, function($0, $1, $2, $3, $4) {
if (typeof pico8_state !== "undefined") {
pico8_state.is_paused = $0;
pico8_state.sound_volume = $1;
pico8_state.frame_number = $2;
pico8_state.has_focus = $3;
pico8_state.show_dpad = $4;
}
}, function() {
var val = 0;
if (typeof codo_command !== "undefined") {
val = codo_command;
codo_command = 0;
}
return val;
}, function() {
var val = 0;
if (typeof codo_command_p !== "undefined") {
val = codo_command_p;
codo_command_p = 0;
}
return val;
}, function() {
button_i = 0;
}, function() {
var val = -1;
if (typeof pico8_buttons !== "undefined") {
val = pico8_buttons[button_i];
button_i++;
}
return val;
}, function() {
var val = 0;
if (typeof pico8_gamepads !== "undefined") {
val = pico8_gamepads.count;
}
return val;
}, function() {
if (typeof on_module_load !== "undefined") {
if (on_module_load) on_module_load();
}
}, function($0, $1, $2, $3) {
var img = document.createElement("img");
img.src = UTF8ToString($0, $1);
img.style.cssText = "margin:4px; display:block; width:" + $2 + "px; height:" + $3 + "px";
holder = document.getElementById("p8_desktop");
if (holder) {
while (holder.childElementCount > 16 - 1) holder.removeChild(holder.firstChild);
holder.appendChild(img);
}
}, function($0, $1) {
if (typeof pico8_state !== "undefined") {
if (typeof pico8_state.system_messages === "undefined") pico8_state.system_messages = new Array();
pico8_state.system_messages.push(UTF8ToString($0, $1));
}
}, function($0) {
var str = window.location.hostname;
return allocate(intArrayFromString(str), "i8", ALLOC_NORMAL);
}, function($0, $1) {
if (typeof pico8_gpio !== "undefined") pico8_gpio[$0] = $1;
}, function($0) {
var val = 0;
if (typeof pico8_gpio !== "undefined") val = pico8_gpio[$0];
return val;
}, function() {
FS.syncfs(false, function(err) {});
}, function() {
var val = 0;
if (typeof codo_mounted_filesystem !== "undefined") val = 1;
return val;
}, function() {
return typeof p8_touch_detected === "undefined" || !p8_touch_detected ? 0 : 1;
}, function() {
return document.hidden ? 1 : 0;
}, function() {
if (typeof codo_key_buffer === "undefined") codo_key_buffer = [];
document.addEventListener("keydown", function(e) {
var val = -1;
if (e.key.length == 1) {
val = e.key.charCodeAt(0);
} else {
if (e.key == "Tab") val = 9;
if (e.key == "Enter") val = 13;
if (e.key == "Backspace") val = 8;
if (e.key == "Escape") val = 27;
if (val == -1) {}
}
var el = document.getElementById("codo_textarea");
codo_key_buffer.push(val);
});
}, function() {
}, function() {
document.addEventListener("wheel", function(e) {
dx = e.deltaX;
if (dx < 0) dx = -1;
if (dx > 0) dx = 1;
if (e.deltaMode == 2) dx *= 4;
if (typeof codo_wheel_dx !== "undefined") codo_wheel_dx -= dx;
dy = e.deltaY;
if (dy < 0) dy = -1;
if (dy > 0) dy = 1;
if (e.deltaMode == 2) dy *= 4;
if (typeof codo_wheel_dy !== "undefined") codo_wheel_dy -= dy;
});
}, function($0) {
function audio_log(msg) {
if (window.console && window.console.log) {
window.console.log("[codo] audio_init_webaudio " + msg);
}
}
audio_log("audio_init");
var codo_audio_context;
if (typeof Module === "undefined") audio_log(" *** Module undefined"); else if (typeof Module.ccall === "undefined") audio_log(" **** Module.ccall undefined"); else {
var webAudioAPI = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.oAudioContext || window.msAudioContext;
if (webAudioAPI) {
if (typeof pico8_audio_context !== "undefined") {
codo_audio_context = pico8_audio_context;
audio_log("found pico8_audio_context");
} else if (typeof voxatron_audio_context !== "undefined") {
codo_audio_context = voxatron_audio_context;
audio_log("found voxatron_audio_context");
} else {
codo_audio_context = new webAudioAPI();
audio_log("creating own audio context");
}
if (codo_audio_context) {
audio_log("Sample Rate: " + codo_audio_context.sampleRate);
audio_log("Buffer Size: " + $0);
node = codo_audio_context.createScriptProcessor($0, 1, 1);
node.onaudioprocess = function(e) {
var data = e.outputBuffer.getChannelData(0);
var r = 22050 / codo_audio_context.sampleRate;
var len0 = Math.floor(data.length * r);
var len1 = data.length;
var ptr = Module.ccall("mix_0", "number", [ "number", "number" ], [ len0, len1 ]);
for (var j = 0; j < data.length; j++) data[j] = Module.getValue(ptr + j * 2, "i16") / 32768;
};
node.connect(codo_audio_context.destination);
} else {
audio_log("** failed to create codo_audio_context");
}
} else {
audio_log("** webAudioAPI not found");
}
}
}, function() {
if (typeof codo_key_buffer === "undefined") codo_key_buffer = [];
return codo_key_buffer.length > 0 ? 1 : 0;
}, function() {
if (typeof codo_key_buffer === "undefined") codo_key_buffer = [];
let val = codo_key_buffer.shift() | 0;
return val;
}, function() {
temp = typeof codo_wheel_dx !== "undefined" ? codo_wheel_dx : 0;
codo_wheel_dx = 0;
return temp;
}, function() {
temp = typeof codo_wheel_dy !== "undefined" ? codo_wheel_dy : 0;
codo_wheel_dy = 0;
return temp;
}, function() {
if (document.hidden) return 0;
el = typeof codo_textarea === "undefined" ? document.getElementById("codo_textarea") : codo_textarea;
if (el) {
if (el == document.activeElement) return 1;
}
el = document.activeElement;
return !el || el.tagName.toLowerCase() != "input" && el.tagName.toLowerCase() != "textarea";
}, function() {
el = typeof codo_textarea === "undefined" ? document.getElementById("codo_textarea") : codo_textarea;
if (el && el.style.display != "none") {
el.focus();
el.select();
}
}, function() {
el = typeof codo_textarea === "undefined" ? document.getElementById("codo_textarea") : codo_textarea;
if (el && el.style.display != "none") {
el.select();
}
}, function() {
var ret = 0;
if (typeof pico8_mouse !== "undefined" && pico8_mouse.length > 0) ret = 1;
return ret;
}, function() {
return pico8_mouse[0];
}, function() {
return pico8_mouse[1];
}, function() {
return pico8_mouse[2];
}, function() {
_dir_name = "";
}, function($0) {
_dir_name = _dir_name + String.fromCharCode($0);
}, function() {
console.log("@@ mkdir directory (nocheck): " + _dir_name);
FS.createPath("", _dir_name, true, true);
}, function() {
el = typeof codo_textarea === "undefined" ? document.getElementById("codo_textarea") : codo_textarea;
if (el) {}
}, function() {
_codo_str_out = "";
}, function($0) {
_codo_str_out = _codo_str_out + String.fromCharCode($0);
}, function() {
el = typeof codo_textarea === "undefined" ? document.getElementById("codo_textarea") : codo_textarea;
if (el) {
el.value = _codo_str_out;
return 0;
} else return 1;
}, function() {
el = typeof codo_textarea === "undefined" ? document.getElementById("codo_textarea") : codo_textarea;
if (el && el.style.display == "none" && (typeof p8_touch_detected === "undefined" || !p8_touch_detected)) {
console.log("@@ enabling codo_textfield");
el.style.display = "";
el.focus();
el.select();
}
}, function() {
el = typeof codo_textarea === "undefined" ? document.getElementById("codo_textarea") : codo_textarea;
if (el && el.style.display != "none" && el.value != "") {
_codo_text_value = el.value;
return 1;
}
return 0;
}, function() {
return typeof _codo_text_value === "undefined" ? 1 : 0;
}, function() {
iii = 0;
}, function() {
iii = iii + 1;
return _codo_text_value.charCodeAt(iii - 1);
} ];
function _emscripten_asm_const_i(code) {
return ASM_CONSTS[code]();
}
function _emscripten_asm_const_ii(code, a0) {
return ASM_CONSTS[code](a0);
}
function _emscripten_asm_const_iii(code, a0, a1) {
return ASM_CONSTS[code](a0, a1);
}
function _emscripten_asm_const_iiiiii(code, a0, a1, a2, a3, a4) {
return ASM_CONSTS[code](a0, a1, a2, a3, a4);
}
function _emscripten_asm_const_iiiii(code, a0, a1, a2, a3) {
return ASM_CONSTS[code](a0, a1, a2, a3);
}
__ATINIT__.push({
func: function() {
___emscripten_environ_constructor();
}
});
memoryInitializer = "data:application/octet-stream;base64,AAAAAAAAAACoqAAAY88AALGoAAC5qAAAwqgAAMmoAADQqAAABc8AALmoAADWqAAA3agAAOOoAAAAAAAAAAAAAAAACAgICAgAAAAAAAAAAAAAAAAAAAAAAAAMBAQEBAQEBAQEBAQEBAQEFhYWFhYWFhYWFgQEBAQEBAQVFRUVFRUFBQUFBQUFBQUFBQUFBQUFBQUFBQQEBAQFBBUVFRUVFQUFBQUFBQUFBQUFBQUFBQUFBQUFBAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGBxQVRQUFxsPBA8VGx8fHx8fHx8fHx8fHx8fGB8YGBgYGBgaCK8vLyE5FRUEGJiBGIUUVAXAAAAAAAAAAAAAAAAAQICAwMDAwQEBAQEBAQEBQUFBQUFBQUFBQUFBQUFBQYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgINM8AAF3PAAA7zwAAHs8AACPPAAAOzwAAENAAABLPAAAFzwAAWM8AABbPAABnzwAAPs8AAGPPAAAwzwAAOM8AAEvPAABEzwAAGc8AAAvQAABSzwAAKs8AAHXqAABGqwAADq0AABGtAAAUrQAAF60AABqtAADQtQAAHa0AACatAAAtrQAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQABAoKAAAACh8KHwofFB8FHxECBAgRCBQdEg0EBAAAAAQICAgEBAICAgQVDh8OFQQEHwQEAAAACBAAAB8AAAAAAAAEAQIECBAfERERHwQMBAQfHwEfEB8fAQcBHxERHwEBHxAfAR8QEB8RHx8BAQEBHxEfER8fER8BAQAEAAQAAAQABAgDDBAMAwAOAA4AGAYBBhgfAQcABB8RHRUdHxEfEREeER4RHw8QEBAPHhERER8fEBwQHx8QHhAQDhAQEQ8RER8REQ4EBAQOAgICEgwSFBgUEhAQEBAfERsVERERGRUTEQ4REREOHhEeEBAfERETHx4RHhERDxAOAR4fBAQEBBEREREOERERCgQRERUbEREKBAoREREOBAQfAgQIHwwICAgMEAgEAgEGAgICBgQKAAAAAAAAAB8EAgAAAB8RHxERHhEeER8PEBAQDx4REREfHxAcEB8fEB4QEA4QEBEPEREfEREOBAQEDgICAhIMEhQYFBIQEBAQHxEbFRERERkVExEOERERDh4RHhAQHxEREx8eER4REQ8QDgEeHwQEBAQRERERDhEREQoEEREVGxERCgQKERERDgQEHwIECB8EBAgEBAQEBAQEBAQCBAQFCgAAAAAAAAAfAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA/v8AA
var tempDoublePtr = 3002272;
function ___setErrNo(value) {
if (Module["___errno_location"]) HEAP32[Module["___errno_location"]() >> 2] = value;
return value;
}
var PATH = {
splitPath: function(filename) {
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
return splitPathRe.exec(filename).slice(1);
},
normalizeArray: function(parts, allowAboveRoot) {
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === ".") {
parts.splice(i, 1);
} else if (last === "..") {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
if (allowAboveRoot) {
for (;up; up--) {
parts.unshift("..");
}
}
return parts;
},
normalize: function(path) {
var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/";
path = PATH.normalizeArray(path.split("/").filter(function(p) {
return !!p;
}), !isAbsolute).join("/");
if (!path && !isAbsolute) {
path = ".";
}
if (path && trailingSlash) {
path += "/";
}
return (isAbsolute ? "/" : "") + path;
},
dirname: function(path) {
var result = PATH.splitPath(path), root = result[0], dir = result[1];
if (!root && !dir) {
return ".";
}
if (dir) {
dir = dir.substr(0, dir.length - 1);
}
return root + dir;
},
basename: function(path) {
if (path === "/") return "/";
var lastSlash = path.lastIndexOf("/");
if (lastSlash === -1) return path;
return path.substr(lastSlash + 1);
},
extname: function(path) {
return PATH.splitPath(path)[3];
},
join: function() {
var paths = Array.prototype.slice.call(arguments, 0);
return PATH.normalize(paths.join("/"));
},
join2: function(l, r) {
return PATH.normalize(l + "/" + r);
},
resolve: function() {
var resolvedPath = "", resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = i >= 0 ? arguments[i] : FS.cwd();
if (typeof path !== "string") {
throw new TypeError("Arguments to path.resolve must be strings");
} else if (!path) {
return "";
}
resolvedPath = path + "/" + resolvedPath;
resolvedAbsolute = path.charAt(0) === "/";
}
resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter(function(p) {
return !!p;
}), !resolvedAbsolute).join("/");
return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
},
relative: function(from, to) {
from = PATH.resolve(from).substr(1);
to = PATH.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (;start < arr.length; start++) {
if (arr[start] !== "") break;
}
var end = arr.length - 1;
for (;end >= 0; end--) {
if (arr[end] !== "") break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split("/"));
var toParts = trim(to.split("/"));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push("..");
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join("/");
}
};
var TTY = {
ttys: [],
init: function() {},
shutdown: function() {},
register: function(dev, ops) {
TTY.ttys[dev] = {
input: [],
output: [],
ops: ops
};
FS.registerDevice(dev, TTY.stream_ops);
},
stream_ops: {
open: function(stream) {
var tty = TTY.ttys[stream.node.rdev];
if (!tty) {
throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
stream.tty = tty;
stream.seekable = false;
},
close: function(stream) {
stream.tty.ops.flush(stream.tty);
},
flush: function(stream) {
stream.tty.ops.flush(stream.tty);
},
read: function(stream, buffer, offset, length, pos) {
if (!stream.tty || !stream.tty.ops.get_char) {
throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
}
var bytesRead = 0;
for (var i = 0; i < length; i++) {
var result;
try {
result = stream.tty.ops.get_char(stream.tty);
} catch (e) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
if (result === undefined && bytesRead === 0) {
throw new FS.ErrnoError(ERRNO_CODES.EAGAIN);
}
if (result === null || result === undefined) break;
bytesRead++;
buffer[offset + i] = result;
}
if (bytesRead) {
stream.node.timestamp = Date.now();
}
return bytesRead;
},
write: function(stream, buffer, offset, length, pos) {
if (!stream.tty || !stream.tty.ops.put_char) {
throw new FS.ErrnoError(ERRNO_CODES.ENXIO);
}
try {
for (var i = 0; i < length; i++) {
stream.tty.ops.put_char(stream.tty, buffer[offset + i]);
}
} catch (e) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
if (length) {
stream.node.timestamp = Date.now();
}
return i;
}
},
default_tty_ops: {
get_char: function(tty) {
if (!tty.input.length) {
var result = null;
if (ENVIRONMENT_IS_NODE) {
var BUFSIZE = 256;
var buf = new Buffer(BUFSIZE);
var bytesRead = 0;
var isPosixPlatform = process.platform != "win32";
var fd = process.stdin.fd;
if (isPosixPlatform) {
var usingDevice = false;
try {
fd = fs.openSync("/dev/stdin", "r");
usingDevice = true;
} catch (e) {}
}
try {
bytesRead = fs.readSync(fd, buf, 0, BUFSIZE, null);
} catch (e) {
if (e.toString().indexOf("EOF") != -1) bytesRead = 0; else throw e;
}
if (usingDevice) {
fs.closeSync(fd);
}
if (bytesRead > 0) {
result = buf.slice(0, bytesRead).toString("utf-8");
} else {
result = null;
}
} else if (typeof window != "undefined" && typeof window.prompt == "function") {
result = window.prompt("Input: ");
if (result !== null) {
result += "\n";
}
} else if (typeof readline == "function") {
result = readline();
if (result !== null) {
result += "\n";
}
}
if (!result) {
return null;
}
tty.input = intArrayFromString(result, true);
}
return tty.input.shift();
},
put_char: function(tty, val) {
if (val === null || val === 10) {
out(UTF8ArrayToString(tty.output, 0));
tty.output = [];
} else {
if (val != 0) tty.output.push(val);
}
},
flush: function(tty) {
if (tty.output && tty.output.length > 0) {
out(UTF8ArrayToString(tty.output, 0));
tty.output = [];
}
}
},
default_tty1_ops: {
put_char: function(tty, val) {
if (val === null || val === 10) {
err(UTF8ArrayToString(tty.output, 0));
tty.output = [];
} else {
if (val != 0) tty.output.push(val);
}
},
flush: function(tty) {
if (tty.output && tty.output.length > 0) {
err(UTF8ArrayToString(tty.output, 0));
tty.output = [];
}
}
}
};
var MEMFS = {
ops_table: null,
mount: function(mount) {
return MEMFS.createNode(null, "/", 16384 | 511, 0);
},
createNode: function(parent, name, mode, dev) {
if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
if (!MEMFS.ops_table) {
MEMFS.ops_table = {
dir: {
node: {
getattr: MEMFS.node_ops.getattr,
setattr: MEMFS.node_ops.setattr,
lookup: MEMFS.node_ops.lookup,
mknod: MEMFS.node_ops.mknod,
rename: MEMFS.node_ops.rename,
unlink: MEMFS.node_ops.unlink,
rmdir: MEMFS.node_ops.rmdir,
readdir: MEMFS.node_ops.readdir,
symlink: MEMFS.node_ops.symlink
},
stream: {
llseek: MEMFS.stream_ops.llseek
}
},
file: {
node: {
getattr: MEMFS.node_ops.getattr,
setattr: MEMFS.node_ops.setattr
},
stream: {
llseek: MEMFS.stream_ops.llseek,
read: MEMFS.stream_ops.read,
write: MEMFS.stream_ops.write,
allocate: MEMFS.stream_ops.allocate,
mmap: MEMFS.stream_ops.mmap,
msync: MEMFS.stream_ops.msync
}
},
link: {
node: {
getattr: MEMFS.node_ops.getattr,
setattr: MEMFS.node_ops.setattr,
readlink: MEMFS.node_ops.readlink
},
stream: {}
},
chrdev: {
node: {
getattr: MEMFS.node_ops.getattr,
setattr: MEMFS.node_ops.setattr
},
stream: FS.chrdev_stream_ops
}
};
}
var node = FS.createNode(parent, name, mode, dev);
if (FS.isDir(node.mode)) {
node.node_ops = MEMFS.ops_table.dir.node;
node.stream_ops = MEMFS.ops_table.dir.stream;
node.contents = {};
} else if (FS.isFile(node.mode)) {
node.node_ops = MEMFS.ops_table.file.node;
node.stream_ops = MEMFS.ops_table.file.stream;
node.usedBytes = 0;
node.contents = null;
} else if (FS.isLink(node.mode)) {
node.node_ops = MEMFS.ops_table.link.node;
node.stream_ops = MEMFS.ops_table.link.stream;
} else if (FS.isChrdev(node.mode)) {
node.node_ops = MEMFS.ops_table.chrdev.node;
node.stream_ops = MEMFS.ops_table.chrdev.stream;
}
node.timestamp = Date.now();
if (parent) {
parent.contents[name] = node;
}
return node;
},
getFileDataAsRegularArray: function(node) {
if (node.contents && node.contents.subarray) {
var arr = [];
for (var i = 0; i < node.usedBytes; ++i) arr.push(node.contents[i]);
return arr;
}
return node.contents;
},
getFileDataAsTypedArray: function(node) {
if (!node.contents) return new Uint8Array();
if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes);
return new Uint8Array(node.contents);
},
expandFileStorage: function(node, newCapacity) {
var prevCapacity = node.contents ? node.contents.length : 0;
if (prevCapacity >= newCapacity) return;
var CAPACITY_DOUBLING_MAX = 1024 * 1024;
newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) | 0);
if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256);
var oldContents = node.contents;
node.contents = new Uint8Array(newCapacity);
if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
return;
},
resizeFileStorage: function(node, newSize) {
if (node.usedBytes == newSize) return;
if (newSize == 0) {
node.contents = null;
node.usedBytes = 0;
return;
}
if (!node.contents || node.contents.subarray) {
var oldContents = node.contents;
node.contents = new Uint8Array(new ArrayBuffer(newSize));
if (oldContents) {
node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes)));
}
node.usedBytes = newSize;
return;
}
if (!node.contents) node.contents = [];
if (node.contents.length > newSize) node.contents.length = newSize; else while (node.contents.length < newSize) node.contents.push(0);
node.usedBytes = newSize;
},
node_ops: {
getattr: function(node) {
var attr = {};
attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
attr.ino = node.id;
attr.mode = node.mode;
attr.nlink = 1;
attr.uid = 0;
attr.gid = 0;
attr.rdev = node.rdev;
if (FS.isDir(node.mode)) {
attr.size = 4096;
} else if (FS.isFile(node.mode)) {
attr.size = node.usedBytes;
} else if (FS.isLink(node.mode)) {
attr.size = node.link.length;
} else {
attr.size = 0;
}
attr.atime = new Date(node.timestamp);
attr.mtime = new Date(node.timestamp);
attr.ctime = new Date(node.timestamp);
attr.blksize = 4096;
attr.blocks = Math.ceil(attr.size / attr.blksize);
return attr;
},
setattr: function(node, attr) {
if (attr.mode !== undefined) {
node.mode = attr.mode;
}
if (attr.timestamp !== undefined) {
node.timestamp = attr.timestamp;
}
if (attr.size !== undefined) {
MEMFS.resizeFileStorage(node, attr.size);
}
},
lookup: function(parent, name) {
throw FS.genericErrors[ERRNO_CODES.ENOENT];
},
mknod: function(parent, name, mode, dev) {
return MEMFS.createNode(parent, name, mode, dev);
},
rename: function(old_node, new_dir, new_name) {
if (FS.isDir(old_node.mode)) {
var new_node;
try {
new_node = FS.lookupNode(new_dir, new_name);
} catch (e) {}
if (new_node) {
for (var i in new_node.contents) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
}
}
}
delete old_node.parent.contents[old_node.name];
old_node.name = new_name;
new_dir.contents[new_name] = old_node;
old_node.parent = new_dir;
},
unlink: function(parent, name) {
delete parent.contents[name];
},
rmdir: function(parent, name) {
var node = FS.lookupNode(parent, name);
for (var i in node.contents) {
throw new FS.ErrnoError(ERRNO_CODES.ENOTEMPTY);
}
delete parent.contents[name];
},
readdir: function(node) {
var entries = [ ".", ".." ];
for (var key in node.contents) {
if (!node.contents.hasOwnProperty(key)) {
continue;
}
entries.push(key);
}
return entries;
},
symlink: function(parent, newname, oldpath) {
var node = MEMFS.createNode(parent, newname, 511 | 40960, 0);
node.link = oldpath;
return node;
},
readlink: function(node) {
if (!FS.isLink(node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return node.link;
}
},
stream_ops: {
read: function(stream, buffer, offset, length, position) {
var contents = stream.node.contents;
if (position >= stream.node.usedBytes) return 0;
var size = Math.min(stream.node.usedBytes - position, length);
assert(size >= 0);
if (size > 8 && contents.subarray) {
buffer.set(contents.subarray(position, position + size), offset);
} else {
for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
}
return size;
},
write: function(stream, buffer, offset, length, position, canOwn) {
if (!length) return 0;
var node = stream.node;
node.timestamp = Date.now();
if (buffer.subarray && (!node.contents || node.contents.subarray)) {
if (canOwn) {
node.contents = buffer.subarray(offset, offset + length);
node.usedBytes = length;
return length;
} else if (node.usedBytes === 0 && position === 0) {
node.contents = new Uint8Array(buffer.subarray(offset, offset + length));
node.usedBytes = length;
return length;
} else if (position + length <= node.usedBytes) {
node.contents.set(buffer.subarray(offset, offset + length), position);
return length;
}
}
MEMFS.expandFileStorage(node, position + length);
if (node.contents.subarray && buffer.subarray) node.contents.set(buffer.subarray(offset, offset + length), position); else {
for (var i = 0; i < length; i++) {
node.contents[position + i] = buffer[offset + i];
}
}
node.usedBytes = Math.max(node.usedBytes, position + length);
return length;
},
llseek: function(stream, offset, whence) {
var position = offset;
if (whence === 1) {
position += stream.position;
} else if (whence === 2) {
if (FS.isFile(stream.node.mode)) {
position += stream.node.usedBytes;
}
}
if (position < 0) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return position;
},
allocate: function(stream, offset, length) {
MEMFS.expandFileStorage(stream.node, offset + length);
stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length);
},
mmap: function(stream, buffer, offset, length, position, prot, flags) {
if (!FS.isFile(stream.node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
var ptr;
var allocated;
var contents = stream.node.contents;
if (!(flags & 2) && (contents.buffer === buffer || contents.buffer === buffer.buffer)) {
allocated = false;
ptr = contents.byteOffset;
} else {
if (position > 0 || position + length < stream.node.usedBytes) {
if (contents.subarray) {
contents = contents.subarray(position, position + length);
} else {
contents = Array.prototype.slice.call(contents, position, position + length);
}
}
allocated = true;
ptr = _malloc(length);
if (!ptr) {
throw new FS.ErrnoError(ERRNO_CODES.ENOMEM);
}
buffer.set(contents, ptr);
}
return {
ptr: ptr,
allocated: allocated
};
},
msync: function(stream, buffer, offset, length, mmapFlags) {
if (!FS.isFile(stream.node.mode)) {
throw new FS.ErrnoError(ERRNO_CODES.ENODEV);
}
if (mmapFlags & 2) {
return 0;
}
var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false);
return 0;
}
}
};
var IDBFS = {
dbs: {},
indexedDB: function() {
if (typeof indexedDB !== "undefined") return indexedDB;
var ret = null;
if (typeof window === "object") ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
assert(ret, "IDBFS used, but indexedDB not supported");
return ret;
},
DB_VERSION: 21,
DB_STORE_NAME: "FILE_DATA",
mount: function(mount) {
return MEMFS.mount.apply(null, arguments);
},
syncfs: function(mount, populate, callback) {
IDBFS.getLocalSet(mount, function(err, local) {
if (err) return callback(err);
IDBFS.getRemoteSet(mount, function(err, remote) {
if (err) return callback(err);
var src = populate ? remote : local;
var dst = populate ? local : remote;
IDBFS.reconcile(src, dst, callback);
});
});
},
getDB: function(name, callback) {
var db = IDBFS.dbs[name];
if (db) {
return callback(null, db);
}
var req;
try {
req = IDBFS.indexedDB().open(name, IDBFS.DB_VERSION);
} catch (e) {
return callback(e);
}
if (!req) {
return callback("Unable to connect to IndexedDB");
}
req.onupgradeneeded = function(e) {
var db = e.target.result;
var transaction = e.target.transaction;
var fileStore;
if (db.objectStoreNames.contains(IDBFS.DB_STORE_NAME)) {
fileStore = transaction.objectStore(IDBFS.DB_STORE_NAME);
} else {
fileStore = db.createObjectStore(IDBFS.DB_STORE_NAME);
}
if (!fileStore.indexNames.contains("timestamp")) {
fileStore.createIndex("timestamp", "timestamp", {
unique: false
});
}
};
req.onsuccess = function() {
db = req.result;
IDBFS.dbs[name] = db;
callback(null, db);
};
req.onerror = function(e) {
callback(this.error);
e.preventDefault();
};
},
getLocalSet: function(mount, callback) {
var entries = {};
function isRealDir(p) {
return p !== "." && p !== "..";
}
function toAbsolute(root) {
return function(p) {
return PATH.join2(root, p);
};
}
var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
while (check.length) {
var path = check.pop();
var stat;
try {
stat = FS.stat(path);
} catch (e) {
return callback(e);
}
if (FS.isDir(stat.mode)) {
check.push.apply(check, FS.readdir(path).filter(isRealDir).map(toAbsolute(path)));
}
entries[path] = {
timestamp: stat.mtime
};
}
return callback(null, {
type: "local",
entries: entries
});
},
getRemoteSet: function(mount, callback) {
var entries = {};
IDBFS.getDB(mount.mountpoint, function(err, db) {
if (err) return callback(err);
try {
var transaction = db.transaction([ IDBFS.DB_STORE_NAME ], "readonly");
transaction.onerror = function(e) {
callback(this.error);
e.preventDefault();
};
var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
var index = store.index("timestamp");
index.openKeyCursor().onsuccess = function(event) {
var cursor = event.target.result;
if (!cursor) {
return callback(null, {
type: "remote",
db: db,
entries: entries
});
}
entries[cursor.primaryKey] = {
timestamp: cursor.key
};
cursor.continue();
};
} catch (e) {
return callback(e);
}
});
},
loadLocalEntry: function(path, callback) {
var stat, node;
try {
var lookup = FS.lookupPath(path);
node = lookup.node;
stat = FS.stat(path);
} catch (e) {
return callback(e);
}
if (FS.isDir(stat.mode)) {
return callback(null, {
timestamp: stat.mtime,
mode: stat.mode
});
} else if (FS.isFile(stat.mode)) {
node.contents = MEMFS.getFileDataAsTypedArray(node);
return callback(null, {
timestamp: stat.mtime,
mode: stat.mode,
contents: node.contents
});
} else {
return callback(new Error("node type not supported"));
}
},
storeLocalEntry: function(path, entry, callback) {
try {
if (FS.isDir(entry.mode)) {
FS.mkdir(path, entry.mode);
} else if (FS.isFile(entry.mode)) {
FS.writeFile(path, entry.contents, {
canOwn: true
});
} else {
return callback(new Error("node type not supported"));
}
FS.chmod(path, entry.mode);
FS.utime(path, entry.timestamp, entry.timestamp);
} catch (e) {
return callback(e);
}
callback(null);
},
removeLocalEntry: function(path, callback) {
try {
var lookup = FS.lookupPath(path);
var stat = FS.stat(path);
if (FS.isDir(stat.mode)) {
FS.rmdir(path);
} else if (FS.isFile(stat.mode)) {
FS.unlink(path);
}
} catch (e) {
return callback(e);
}
callback(null);
},
loadRemoteEntry: function(store, path, callback) {
var req = store.get(path);
req.onsuccess = function(event) {
callback(null, event.target.result);
};
req.onerror = function(e) {
callback(this.error);
e.preventDefault();
};
},
storeRemoteEntry: function(store, path, entry, callback) {
var req = store.put(entry, path);
req.onsuccess = function() {
callback(null);
};
req.onerror = function(e) {
callback(this.error);
e.preventDefault();
};
},
removeRemoteEntry: function(store, path, callback) {
var req = store.delete(path);
req.onsuccess = function() {
callback(null);
};
req.onerror = function(e) {
callback(this.error);
e.preventDefault();
};
},
reconcile: function(src, dst, callback) {
var total = 0;
var create = [];
Object.keys(src.entries).forEach(function(key) {
var e = src.entries[key];
var e2 = dst.entries[key];
if (!e2 || e.timestamp > e2.timestamp) {
create.push(key);
total++;
}
});
var remove = [];
Object.keys(dst.entries).forEach(function(key) {
var e = dst.entries[key];
var e2 = src.entries[key];
if (!e2) {
remove.push(key);
total++;
}
});
if (!total) {
return callback(null);
}
var errored = false;
var completed = 0;
var db = src.type === "remote" ? src.db : dst.db;
var transaction = db.transaction([ IDBFS.DB_STORE_NAME ], "readwrite");
var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
function done(err) {
if (err) {
if (!done.errored) {
done.errored = true;
return callback(err);
}
return;
}
if (++completed >= total) {
return callback(null);
}
}
transaction.onerror = function(e) {
done(this.error);
e.preventDefault();
};
create.sort().forEach(function(path) {
if (dst.type === "local") {
IDBFS.loadRemoteEntry(store, path, function(err, entry) {
if (err) return done(err);
IDBFS.storeLocalEntry(path, entry, done);
});
} else {
IDBFS.loadLocalEntry(path, function(err, entry) {
if (err) return done(err);
IDBFS.storeRemoteEntry(store, path, entry, done);
});
}
});
remove.sort().reverse().forEach(function(path) {
if (dst.type === "local") {
IDBFS.removeLocalEntry(path, done);
} else {
IDBFS.removeRemoteEntry(store, path, done);
}
});
}
};
var NODEFS = {
isWindows: false,
staticInit: function() {
NODEFS.isWindows = !!process.platform.match(/^win/);
var flags = process["binding"]("constants");
if (flags["fs"]) {
flags = flags["fs"];
}
NODEFS.flagsForNodeMap = {
1024: flags["O_APPEND"],
64: flags["O_CREAT"],
128: flags["O_EXCL"],
0: flags["O_RDONLY"],
2: flags["O_RDWR"],
4096: flags["O_SYNC"],
512: flags["O_TRUNC"],
1: flags["O_WRONLY"]
};
},
bufferFrom: function(arrayBuffer) {
return Buffer.alloc ? Buffer.from(arrayBuffer) : new Buffer(arrayBuffer);
},
mount: function(mount) {
assert(ENVIRONMENT_IS_NODE);
return NODEFS.createNode(null, "/", NODEFS.getMode(mount.opts.root), 0);
},
createNode: function(parent, name, mode, dev) {
if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
var node = FS.createNode(parent, name, mode);
node.node_ops = NODEFS.node_ops;
node.stream_ops = NODEFS.stream_ops;
return node;
},
getMode: function(path) {
var stat;
try {
stat = fs.lstatSync(path);
if (NODEFS.isWindows) {
stat.mode = stat.mode | (stat.mode & 292) >> 2;
}
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
return stat.mode;
},
realPath: function(node) {
var parts = [];
while (node.parent !== node) {
parts.push(node.name);
node = node.parent;
}
parts.push(node.mount.opts.root);
parts.reverse();
return PATH.join.apply(null, parts);
},
flagsForNode: function(flags) {
flags &= ~2097152;
flags &= ~2048;
flags &= ~32768;
flags &= ~524288;
var newFlags = 0;
for (var k in NODEFS.flagsForNodeMap) {
if (flags & k) {
newFlags |= NODEFS.flagsForNodeMap[k];
flags ^= k;
}
}
if (!flags) {
return newFlags;
} else {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
},
node_ops: {
getattr: function(node) {
var path = NODEFS.realPath(node);
var stat;
try {
stat = fs.lstatSync(path);
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
if (NODEFS.isWindows && !stat.blksize) {
stat.blksize = 4096;
}
if (NODEFS.isWindows && !stat.blocks) {
stat.blocks = (stat.size + stat.blksize - 1) / stat.blksize | 0;
}
return {
dev: stat.dev,
ino: stat.ino,
mode: stat.mode,
nlink: stat.nlink,
uid: stat.uid,
gid: stat.gid,
rdev: stat.rdev,
size: stat.size,
atime: stat.atime,
mtime: stat.mtime,
ctime: stat.ctime,
blksize: stat.blksize,
blocks: stat.blocks
};
},
setattr: function(node, attr) {
var path = NODEFS.realPath(node);
try {
if (attr.mode !== undefined) {
fs.chmodSync(path, attr.mode);
node.mode = attr.mode;
}
if (attr.timestamp !== undefined) {
var date = new Date(attr.timestamp);
fs.utimesSync(path, date, date);
}
if (attr.size !== undefined) {
fs.truncateSync(path, attr.size);
}
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
lookup: function(parent, name) {
var path = PATH.join2(NODEFS.realPath(parent), name);
var mode = NODEFS.getMode(path);
return NODEFS.createNode(parent, name, mode);
},
mknod: function(parent, name, mode, dev) {
var node = NODEFS.createNode(parent, name, mode, dev);
var path = NODEFS.realPath(node);
try {
if (FS.isDir(node.mode)) {
fs.mkdirSync(path, node.mode);
} else {
fs.writeFileSync(path, "", {
mode: node.mode
});
}
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
return node;
},
rename: function(oldNode, newDir, newName) {
var oldPath = NODEFS.realPath(oldNode);
var newPath = PATH.join2(NODEFS.realPath(newDir), newName);
try {
fs.renameSync(oldPath, newPath);
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
unlink: function(parent, name) {
var path = PATH.join2(NODEFS.realPath(parent), name);
try {
fs.unlinkSync(path);
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
rmdir: function(parent, name) {
var path = PATH.join2(NODEFS.realPath(parent), name);
try {
fs.rmdirSync(path);
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
readdir: function(node) {
var path = NODEFS.realPath(node);
try {
return fs.readdirSync(path);
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
symlink: function(parent, newName, oldPath) {
var newPath = PATH.join2(NODEFS.realPath(parent), newName);
try {
fs.symlinkSync(oldPath, newPath);
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
readlink: function(node) {
var path = NODEFS.realPath(node);
try {
path = fs.readlinkSync(path);
path = NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root), path);
return path;
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
}
},
stream_ops: {
open: function(stream) {
var path = NODEFS.realPath(stream.node);
try {
if (FS.isFile(stream.node.mode)) {
stream.nfd = fs.openSync(path, NODEFS.flagsForNode(stream.flags));
}
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
close: function(stream) {
try {
if (FS.isFile(stream.node.mode) && stream.nfd) {
fs.closeSync(stream.nfd);
}
} catch (e) {
if (!e.code) throw e;
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
read: function(stream, buffer, offset, length, position) {
if (length === 0) return 0;
try {
return fs.readSync(stream.nfd, NODEFS.bufferFrom(buffer.buffer), offset, length, position);
} catch (e) {
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
write: function(stream, buffer, offset, length, position) {
try {
return fs.writeSync(stream.nfd, NODEFS.bufferFrom(buffer.buffer), offset, length, position);
} catch (e) {
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
},
llseek: function(stream, offset, whence) {
var position = offset;
if (whence === 1) {
position += stream.position;
} else if (whence === 2) {
if (FS.isFile(stream.node.mode)) {
try {
var stat = fs.fstatSync(stream.nfd);
position += stat.size;
} catch (e) {
throw new FS.ErrnoError(ERRNO_CODES[e.code]);
}
}
}
if (position < 0) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return position;
}
}
};
var WORKERFS = {
DIR_MODE: 16895,
FILE_MODE: 33279,
reader: null,
mount: function(mount) {
assert(ENVIRONMENT_IS_WORKER);
if (!WORKERFS.reader) WORKERFS.reader = new FileReaderSync();
var root = WORKERFS.createNode(null, "/", WORKERFS.DIR_MODE, 0);
var createdParents = {};
function ensureParent(path) {
var parts = path.split("/");
var parent = root;
for (var i = 0; i < parts.length - 1; i++) {
var curr = parts.slice(0, i + 1).join("/");
if (!createdParents[curr]) {
createdParents[curr] = WORKERFS.createNode(parent, parts[i], WORKERFS.DIR_MODE, 0);
}
parent = createdParents[curr];
}
return parent;
}
function base(path) {
var parts = path.split("/");
return parts[parts.length - 1];
}
Array.prototype.forEach.call(mount.opts["files"] || [], function(file) {
WORKERFS.createNode(ensureParent(file.name), base(file.name), WORKERFS.FILE_MODE, 0, file, file.lastModifiedDate);
});
(mount.opts["blobs"] || []).forEach(function(obj) {
WORKERFS.createNode(ensureParent(obj["name"]), base(obj["name"]), WORKERFS.FILE_MODE, 0, obj["data"]);
});
(mount.opts["packages"] || []).forEach(function(pack) {
pack["metadata"].files.forEach(function(file) {
var name = file.filename.substr(1);
WORKERFS.createNode(ensureParent(name), base(name), WORKERFS.FILE_MODE, 0, pack["blob"].slice(file.start, file.end));
});
});
return root;
},
createNode: function(parent, name, mode, dev, contents, mtime) {
var node = FS.createNode(parent, name, mode);
node.mode = mode;
node.node_ops = WORKERFS.node_ops;
node.stream_ops = WORKERFS.stream_ops;
node.timestamp = (mtime || new Date()).getTime();
assert(WORKERFS.FILE_MODE !== WORKERFS.DIR_MODE);
if (mode === WORKERFS.FILE_MODE) {
node.size = contents.size;
node.contents = contents;
} else {
node.size = 4096;
node.contents = {};
}
if (parent) {
parent.contents[name] = node;
}
return node;
},
node_ops: {
getattr: function(node) {
return {
dev: 1,
ino: undefined,
mode: node.mode,
nlink: 1,
uid: 0,
gid: 0,
rdev: undefined,
size: node.size,
atime: new Date(node.timestamp),
mtime: new Date(node.timestamp),
ctime: new Date(node.timestamp),
blksize: 4096,
blocks: Math.ceil(node.size / 4096)
};
},
setattr: function(node, attr) {
if (attr.mode !== undefined) {
node.mode = attr.mode;
}
if (attr.timestamp !== undefined) {
node.timestamp = attr.timestamp;
}
},
lookup: function(parent, name) {
throw new FS.ErrnoError(ERRNO_CODES.ENOENT);
},
mknod: function(parent, name, mode, dev) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
},
rename: function(oldNode, newDir, newName) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
},
unlink: function(parent, name) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
},
rmdir: function(parent, name) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
},
readdir: function(node) {
var entries = [ ".", ".." ];
for (var key in node.contents) {
if (!node.contents.hasOwnProperty(key)) {
continue;
}
entries.push(key);
}
return entries;
},
symlink: function(parent, newName, oldPath) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
},
readlink: function(node) {
throw new FS.ErrnoError(ERRNO_CODES.EPERM);
}
},
stream_ops: {
read: function(stream, buffer, offset, length, position) {
if (position >= stream.node.size) return 0;
var chunk = stream.node.contents.slice(position, position + length);
var ab = WORKERFS.reader.readAsArrayBuffer(chunk);
buffer.set(new Uint8Array(ab), offset);
return chunk.size;
},
write: function(stream, buffer, offset, length, position) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
},
llseek: function(stream, offset, whence) {
var position = offset;
if (whence === 1) {
position += stream.position;
} else if (whence === 2) {
if (FS.isFile(stream.node.mode)) {
position += stream.node.size;
}
}
if (position < 0) {
throw new FS.ErrnoError(ERRNO_CODES.EINVAL);
}
return position;
}
}
};
var FS = {
root: null,
mounts: [],
devices: {},
streams: [],
nextInode: 1,
nameTable: null,
currentPath: "/",
initialized: false,
ignorePermissions: true,
trackingDelegate: {},
tracking: {
openFlags: {
READ: 1,
WRITE: 2
}
},
ErrnoError: null,
genericErrors: {},
filesystems: null,
syncFSRequests: 0,
handleFSError: function(e) {
if (!(e instanceof FS.ErrnoError)) throw e + " : " + stackTrace();
return ___setErrNo(e.errno);
},
lookupPath: function(path, opts) {
path = PATH.resolve(FS.cwd(), path);
opts = opts || {};
if (!path) return {
path: "",
node: null
};
var defaults = {
follow_mount: true,
recurse_count: 0
};
for (var key in defaults) {
if (opts[key] === undefined) {
opts[key] = defaults[key];
}
}
if (opts.recurse_count > 8) {
throw new FS.ErrnoError(40);
}
var parts = PATH.normalizeArray(path.split("/").filter(function(p) {
return !!p;
}), false);
var current = FS.root;
var current_path = "/";
for (var i = 0; i < parts.length; i++) {
var islast = i === parts.length - 1;
if (islast && opts.parent) {
break;
}
current = FS.lookupNode(current, parts[i]);
current_path = PATH.join2(current_path, parts[i]);
if (FS.isMountpoint(current)) {
if (!islast || islast && opts.follow_mount) {
current = current.mounted.root;
}
}
if (!islast || opts.follow) {
var count = 0;
while (FS.isLink(current.mode)) {
var link = FS.readlink(current_path);
current_path = PATH.resolve(PATH.dirname(current_path), link);
var lookup = FS.lookupPath(current_path, {
recurse_count: opts.recurse_count
});
current = lookup.node;
if (count++ > 40) {
throw new FS.ErrnoError(40);
}
}
}
}
return {
path: current_path,
node: current
};
},
getPath: function(node) {
var path;
while (true) {
if (FS.isRoot(node)) {
var mount = node.mount.mountpoint;
if (!path) return mount;
return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path;
}
path = path ? node.name + "/" + path : node.name;
node = node.parent;
}
},
hashName: function(parentid, name) {
var hash = 0;
for (var i = 0; i < name.length; i++) {
hash = (hash << 5) - hash + name.charCodeAt(i) | 0;
}
return (parentid + hash >>> 0) % FS.nameTable.length;
},
hashAddNode: function(node) {
var hash = FS.hashName(node.parent.id, node.name);
node.name_next = FS.nameTable[hash];
FS.nameTable[hash] = node;
},
hashRemoveNode: function(node) {
var hash = FS.hashName(node.parent.id, node.name);
if (FS.nameTable[hash] === node) {
FS.nameTable[hash] = node.name_next;
} else {
var current = FS.nameTable[hash];
while (current) {
if (current.name_next === node) {
current.name_next = node.name_next;
break;
}
current = current.name_next;
}
}
},
lookupNode: function(parent, name) {
var err = FS.mayLookup(parent);
if (err) {
throw new FS.ErrnoError(err, parent);
}
var hash = FS.hashName(parent.id, name);
for (var node = FS.nameTable[hash]; node; node = node.name_next) {
var nodeName = node.name;
if (node.parent.id === parent.id && nodeName === name) {
return node;
}
}
return FS.lookup(parent, name);
},
createNode: function(parent, name, mode, rdev) {
if (!FS.FSNode) {
FS.FSNode = function(parent, name, mode, rdev) {
if (!parent) {
parent = this;
}
this.parent = parent;
this.mount = parent.mount;
this.mounted = null;
this.id = FS.nextInode++;
this.name = name;
this.mode = mode;
this.node_ops = {};
this.stream_ops = {};
this.rdev = rdev;
};
FS.FSNode.prototype = {};
var readMode = 292 | 73;
var writeMode = 146;
Object.defineProperties(FS.FSNode.prototype, {
read: {
get: function() {
return (this.mode & readMode) === readMode;
},
set: function(val) {
val ? this.mode |= readMode : this.mode &= ~readMode;
}
},
write: {
get: function() {
return (this.mode & writeMode) === writeMode;
},
set: function(val) {
val ? this.mode |= writeMode : this.mode &= ~writeMode;
}
},
isFolder: {
get: function() {
return FS.isDir(this.mode);
}
},
isDevice: {
get: function() {
return FS.isChrdev(this.mode);
}
}
});
}
var node = new FS.FSNode(parent, name, mode, rdev);
FS.hashAddNode(node);
return node;
},
destroyNode: function(node) {
FS.hashRemoveNode(node);
},
isRoot: function(node) {
return node === node.parent;
},
isMountpoint: function(node) {
return !!node.mounted;
},
isFile: function(mode) {
return (mode & 61440) === 32768;
},
isDir: function(mode) {
return (mode & 61440) === 16384;
},
isLink: function(mode) {
return (mode & 61440) === 40960;
},
isChrdev: function(mode) {
return (mode & 61440) === 8192;
},
isBlkdev: function(mode) {
return (mode & 61440) === 24576;
},
isFIFO: function(mode) {
return (mode & 61440) === 4096;
},
isSocket: function(mode) {
return (mode & 49152) === 49152;
},
flagModes: {
"r": 0,
"rs": 1052672,
"r+": 2,
"w": 577,
"wx": 705,
"xw": 705,
"w+": 578,
"wx+": 706,
"xw+": 706,
"a": 1089,
"ax": 1217,
"xa": 1217,
"a+": 1090,
"ax+": 1218,
"xa+": 1218
},
modeStringToFlags: function(str) {
var flags = FS.flagModes[str];
if (typeof flags === "undefined") {
throw new Error("Unknown file open mode: " + str);
}
return flags;
},
flagsToPermissionString: function(flag) {
var perms = [ "r", "w", "rw" ][flag & 3];
if (flag & 512) {
perms += "w";
}
return perms;
},
nodePermissions: function(node, perms) {
if (FS.ignorePermissions) {
return 0;
}
if (perms.indexOf("r") !== -1 && !(node.mode & 292)) {
return 13;
} else if (perms.indexOf("w") !== -1 && !(node.mode & 146)) {
return 13;
} else if (perms.indexOf("x") !== -1 && !(node.mode & 73)) {
return 13;
}
return 0;
},
mayLookup: function(dir) {
var err = FS.nodePermissions(dir, "x");
if (err) return err;
if (!dir.node_ops.lookup) return 13;
return 0;
},
mayCreate: function(dir, name) {
try {
var node = FS.lookupNode(dir, name);
return 17;
} catch (e) {}
return FS.nodePermissions(dir, "wx");
},
mayDelete: function(dir, name, isdir) {
var node;
try {
node = FS.lookupNode(dir, name);
} catch (e) {
return e.errno;
}
var err = FS.nodePermissions(dir, "wx");
if (err) {
return err;
}
if (isdir) {
if (!FS.isDir(node.mode)) {
return 20;
}
if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
return 16;
}
} else {
if (FS.isDir(node.mode)) {
return 21;
}
}
return 0;
},
mayOpen: function(node, flags) {
if (!node) {
return 2;
}
if (FS.isLink(node.mode)) {
return 40;
} else if (FS.isDir(node.mode)) {
if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) {
return 21;
}
}
return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
},
MAX_OPEN_FDS: 4096,
nextfd: function(fd_start, fd_end) {
fd_start = fd_start || 0;
fd_end = fd_end || FS.MAX_OPEN_FDS;
for (var fd = fd_start; fd <= fd_end; fd++) {
if (!FS.streams[fd]) {
return fd;
}
}
throw new FS.ErrnoError(24);
},
getStream: function(fd) {
return FS.streams[fd];
},
createStream: function(stream, fd_start, fd_end) {
if (!FS.FSStream) {
FS.FSStream = function() {};
FS.FSStream.prototype = {};
Object.defineProperties(FS.FSStream.prototype, {
object: {
get: function() {
return this.node;
},
set: function(val) {
this.node = val;
}
},
isRead: {
get: function() {
return (this.flags & 2097155) !== 1;
}
},
isWrite: {
get: function() {
return (this.flags & 2097155) !== 0;
}
},
isAppend: {
get: function() {
return this.flags & 1024;
}
}
});
}
var newStream = new FS.FSStream();
for (var p in stream) {
newStream[p] = stream[p];
}
stream = newStream;
var fd = FS.nextfd(fd_start, fd_end);
stream.fd = fd;
FS.streams[fd] = stream;
return stream;
},
closeStream: function(fd) {
FS.streams[fd] = null;
},
chrdev_stream_ops: {
open: function(stream) {
var device = FS.getDevice(stream.node.rdev);
stream.stream_ops = device.stream_ops;
if (stream.stream_ops.open) {
stream.stream_ops.open(stream);
}
},
llseek: function() {
throw new FS.ErrnoError(29);
}
},
major: function(dev) {
return dev >> 8;
},
minor: function(dev) {
return dev & 255;
},
makedev: function(ma, mi) {
return ma << 8 | mi;
},
registerDevice: function(dev, ops) {
FS.devices[dev] = {
stream_ops: ops
};
},
getDevice: function(dev) {
return FS.devices[dev];
},
getMounts: function(mount) {
var mounts = [];
var check = [ mount ];
while (check.length) {
var m = check.pop();
mounts.push(m);
check.push.apply(check, m.mounts);
}
return mounts;
},
syncfs: function(populate, callback) {
if (typeof populate === "function") {
callback = populate;
populate = false;
}
FS.syncFSRequests++;
if (FS.syncFSRequests > 1) {
console.log("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work");
}
var mounts = FS.getMounts(FS.root.mount);
var completed = 0;
function doCallback(err) {
assert(FS.syncFSRequests > 0);
FS.syncFSRequests--;
return callback(err);
}
function done(err) {
if (err) {
if (!done.errored) {
done.errored = true;
return doCallback(err);
}
return;
}
if (++completed >= mounts.length) {
doCallback(null);
}
}
mounts.forEach(function(mount) {
if (!mount.type.syncfs) {
return done(null);
}
mount.type.syncfs(mount, populate, done);
});
},
mount: function(type, opts, mountpoint) {
var root = mountpoint === "/";
var pseudo = !mountpoint;
var node;
if (root && FS.root) {
throw new FS.ErrnoError(16);
} else if (!root && !pseudo) {
var lookup = FS.lookupPath(mountpoint, {
follow_mount: false
});
mountpoint = lookup.path;
node = lookup.node;
if (FS.isMountpoint(node)) {
throw new FS.ErrnoError(16);
}
if (!FS.isDir(node.mode)) {
throw new FS.ErrnoError(20);
}
}
var mount = {
type: type,
opts: opts,
mountpoint: mountpoint,
mounts: []
};
var mountRoot = type.mount(mount);
mountRoot.mount = mount;
mount.root = mountRoot;
if (root) {
FS.root = mountRoot;
} else if (node) {
node.mounted = mount;
if (node.mount) {
node.mount.mounts.push(mount);
}
}
return mountRoot;
},
unmount: function(mountpoint) {
var lookup = FS.lookupPath(mountpoint, {
follow_mount: false
});
if (!FS.isMountpoint(lookup.node)) {
throw new FS.ErrnoError(22);
}
var node = lookup.node;
var mount = node.mounted;
var mounts = FS.getMounts(mount);
Object.keys(FS.nameTable).forEach(function(hash) {
var current = FS.nameTable[hash];
while (current) {
var next = current.name_next;
if (mounts.indexOf(current.mount) !== -1) {
FS.destroyNode(current);
}
current = next;
}
});
node.mounted = null;
var idx = node.mount.mounts.indexOf(mount);
assert(idx !== -1);
node.mount.mounts.splice(idx, 1);
},
lookup: function(parent, name) {
return parent.node_ops.lookup(parent, name);
},
mknod: function(path, mode, dev) {
var lookup = FS.lookupPath(path, {
parent: true
});
var parent = lookup.node;
var name = PATH.basename(path);
if (!name || name === "." || name === "..") {
throw new FS.ErrnoError(22);
}
var err = FS.mayCreate(parent, name);
if (err) {
throw new FS.ErrnoError(err);
}
if (!parent.node_ops.mknod) {
throw new FS.ErrnoError(1);
}
return parent.node_ops.mknod(parent, name, mode, dev);
},
create: function(path, mode) {
mode = mode !== undefined ? mode : 438;
mode &= 4095;
mode |= 32768;
return FS.mknod(path, mode, 0);
},
mkdir: function(path, mode) {
mode = mode !== undefined ? mode : 511;
mode &= 511 | 512;
mode |= 16384;
return FS.mknod(path, mode, 0);
},
mkdirTree: function(path, mode) {
var dirs = path.split("/");
var d = "";
for (var i = 0; i < dirs.length; ++i) {
if (!dirs[i]) continue;
d += "/" + dirs[i];
try {
FS.mkdir(d, mode);
} catch (e) {
if (e.errno != 17) throw e;
}
}
},
mkdev: function(path, mode, dev) {
if (typeof dev === "undefined") {
dev = mode;
mode = 438;
}
mode |= 8192;
return FS.mknod(path, mode, dev);
},
symlink: function(oldpath, newpath) {
if (!PATH.resolve(oldpath)) {
throw new FS.ErrnoError(2);
}
var lookup = FS.lookupPath(newpath, {
parent: true
});
var parent = lookup.node;
if (!parent) {
throw new FS.ErrnoError(2);
}
var newname = PATH.basename(newpath);
var err = FS.mayCreate(parent, newname);
if (err) {
throw new FS.ErrnoError(err);
}
if (!parent.node_ops.symlink) {
throw new FS.ErrnoError(1);
}
return parent.node_ops.symlink(parent, newname, oldpath);
},
rename: function(old_path, new_path) {
var old_dirname = PATH.dirname(old_path);
var new_dirname = PATH.dirname(new_path);
var old_name = PATH.basename(old_path);
var new_name = PATH.basename(new_path);
var lookup, old_dir, new_dir;
try {
lookup = FS.lookupPath(old_path, {
parent: true
});
old_dir = lookup.node;
lookup = FS.lookupPath(new_path, {
parent: true
});
new_dir = lookup.node;
} catch (e) {
throw new FS.ErrnoError(16);
}
if (!old_dir || !new_dir) throw new FS.ErrnoError(2);
if (old_dir.mount !== new_dir.mount) {
throw new FS.ErrnoError(18);
}
var old_node = FS.lookupNode(old_dir, old_name);
var relative = PATH.relative(old_path, new_dirname);
if (relative.charAt(0) !== ".") {
throw new FS.ErrnoError(22);
}
relative = PATH.relative(new_path, old_dirname);
if (relative.charAt(0) !== ".") {
throw new FS.ErrnoError(39);
}
var new_node;
try {
new_node = FS.lookupNode(new_dir, new_name);
} catch (e) {}
if (old_node === new_node) {
return;
}
var isdir = FS.isDir(old_node.mode);
var err = FS.mayDelete(old_dir, old_name, isdir);
if (err) {
throw new FS.ErrnoError(err);
}
err = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name);
if (err) {
throw new FS.ErrnoError(err);
}
if (!old_dir.node_ops.rename) {
throw new FS.ErrnoError(1);
}
if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) {
throw new FS.ErrnoError(16);
}
if (new_dir !== old_dir) {
err = FS.nodePermissions(old_dir, "w");
if (err) {
throw new FS.ErrnoError(err);
}
}
try {
if (FS.trackingDelegate["willMovePath"]) {
FS.trackingDelegate["willMovePath"](old_path, new_path);
}
} catch (e) {
console.log("FS.trackingDelegate['willMovePath']('" + old_path + "', '" + new_path + "') threw an exception: " + e.message);
}
FS.hashRemoveNode(old_node);
try {
old_dir.node_ops.rename(old_node, new_dir, new_name);
} catch (e) {
throw e;
} finally {
FS.hashAddNode(old_node);
}
try {
if (FS.trackingDelegate["onMovePath"]) FS.trackingDelegate["onMovePath"](old_path, new_path);
} catch (e) {
console.log("FS.trackingDelegate['onMovePath']('" + old_path + "', '" + new_path + "') threw an exception: " + e.message);
}
},
rmdir: function(path) {
var lookup = FS.lookupPath(path, {
parent: true
});
var parent = lookup.node;
var name = PATH.basename(path);
var node = FS.lookupNode(parent, name);
var err = FS.mayDelete(parent, name, true);
if (err) {
throw new FS.ErrnoError(err);
}
if (!parent.node_ops.rmdir) {
throw new FS.ErrnoError(1);
}
if (FS.isMountpoint(node)) {
throw new FS.ErrnoError(16);
}
try {
if (FS.trackingDelegate["willDeletePath"]) {
FS.trackingDelegate["willDeletePath"](path);
}
} catch (e) {
console.log("FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message);
}
parent.node_ops.rmdir(parent, name);
FS.destroyNode(node);
try {
if (FS.trackingDelegate["onDeletePath"]) FS.trackingDelegate["onDeletePath"](path);
} catch (e) {
console.log("FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message);
}
},
readdir: function(path) {
var lookup = FS.lookupPath(path, {
follow: true
});
var node = lookup.node;
if (!node.node_ops.readdir) {
throw new FS.ErrnoError(20);
}
return node.node_ops.readdir(node);
},
unlink: function(path) {
var lookup = FS.lookupPath(path, {
parent: true
});
var parent = lookup.node;
var name = PATH.basename(path);
var node = FS.lookupNode(parent, name);
var err = FS.mayDelete(parent, name, false);
if (err) {
throw new FS.ErrnoError(err);
}
if (!parent.node_ops.unlink) {
throw new FS.ErrnoError(1);
}
if (FS.isMountpoint(node)) {
throw new FS.ErrnoError(16);
}
try {
if (FS.trackingDelegate["willDeletePath"]) {
FS.trackingDelegate["willDeletePath"](path);
}
} catch (e) {
console.log("FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message);
}
parent.node_ops.unlink(parent, name);
FS.destroyNode(node);
try {
if (FS.trackingDelegate["onDeletePath"]) FS.trackingDelegate["onDeletePath"](path);
} catch (e) {
console.log("FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message);
}
},
readlink: function(path) {
var lookup = FS.lookupPath(path);
var link = lookup.node;
if (!link) {
throw new FS.ErrnoError(2);
}
if (!link.node_ops.readlink) {
throw new FS.ErrnoError(22);
}
return PATH.resolve(FS.getPath(link.parent), link.node_ops.readlink(link));
},
stat: function(path, dontFollow) {
var lookup = FS.lookupPath(path, {
follow: !dontFollow
});
var node = lookup.node;
if (!node) {
throw new FS.ErrnoError(2);
}
if (!node.node_ops.getattr) {
throw new FS.ErrnoError(1);
}
return node.node_ops.getattr(node);
},
lstat: function(path) {
return FS.stat(path, true);
},
chmod: function(path, mode, dontFollow) {
var node;
if (typeof path === "string") {
var lookup = FS.lookupPath(path, {
follow: !dontFollow
});
node = lookup.node;
} else {
node = path;
}
if (!node.node_ops.setattr) {
throw new FS.ErrnoError(1);
}
node.node_ops.setattr(node, {
mode: mode & 4095 | node.mode & ~4095,
timestamp: Date.now()
});
},
lchmod: function(path, mode) {
FS.chmod(path, mode, true);
},
fchmod: function(fd, mode) {
var stream = FS.getStream(fd);
if (!stream) {
throw new FS.ErrnoError(9);
}
FS.chmod(stream.node, mode);
},
chown: function(path, uid, gid, dontFollow) {
var node;
if (typeof path === "string") {
var lookup = FS.lookupPath(path, {
follow: !dontFollow
});
node = lookup.node;
} else {
node = path;
}
if (!node.node_ops.setattr) {
throw new FS.ErrnoError(1);
}
node.node_ops.setattr(node, {
timestamp: Date.now()
});
},
lchown: function(path, uid, gid) {
FS.chown(path, uid, gid, true);
},
fchown: function(fd, uid, gid) {
var stream = FS.getStream(fd);
if (!stream) {
throw new FS.ErrnoError(9);
}
FS.chown(stream.node, uid, gid);
},
truncate: function(path, len) {
if (len < 0) {
throw new FS.ErrnoError(22);
}
var node;
if (typeof path === "string") {
var lookup = FS.lookupPath(path, {
follow: true
});
node = lookup.node;
} else {
node = path;
}
if (!node.node_ops.setattr) {
throw new FS.ErrnoError(1);
}
if (FS.isDir(node.mode)) {
throw new FS.ErrnoError(21);
}
if (!FS.isFile(node.mode)) {
throw new FS.ErrnoError(22);
}
var err = FS.nodePermissions(node, "w");
if (err) {
throw new FS.ErrnoError(err);
}
node.node_ops.setattr(node, {
size: len,
timestamp: Date.now()
});
},
ftruncate: function(fd, len) {
var stream = FS.getStream(fd);
if (!stream) {
throw new FS.ErrnoError(9);
}
if ((stream.flags & 2097155) === 0) {
throw new FS.ErrnoError(22);
}
FS.truncate(stream.node, len);
},
utime: function(path, atime, mtime) {
var lookup = FS.lookupPath(path, {
follow: true
});
var node = lookup.node;
node.node_ops.setattr(node, {
timestamp: Math.max(atime, mtime)
});
},
open: function(path, flags, mode, fd_start, fd_end) {
if (path === "") {
throw new FS.ErrnoError(2);
}
flags = typeof flags === "string" ? FS.modeStringToFlags(flags) : flags;
mode = typeof mode === "undefined" ? 438 : mode;
if (flags & 64) {
mode = mode & 4095 | 32768;
} else {
mode = 0;
}
var node;
if (typeof path === "object") {
node = path;
} else {
path = PATH.normalize(path);
try {
var lookup = FS.lookupPath(path, {
follow: !(flags & 131072)
});
node = lookup.node;
} catch (e) {}
}
var created = false;
if (flags & 64) {
if (node) {
if (flags & 128) {
throw new FS.ErrnoError(17);
}
} else {
node = FS.mknod(path, mode, 0);
created = true;
}
}
if (!node) {
throw new FS.ErrnoError(2);
}
if (FS.isChrdev(node.mode)) {
flags &= ~512;
}
if (flags & 65536 && !FS.isDir(node.mode)) {
throw new FS.ErrnoError(20);
}
if (!created) {
var err = FS.mayOpen(node, flags);
if (err) {
throw new FS.ErrnoError(err);
}
}
if (flags & 512) {
FS.truncate(node, 0);
}
flags &= ~(128 | 512);
var stream = FS.createStream({
node: node,
path: FS.getPath(node),
flags: flags,
seekable: true,
position: 0,
stream_ops: node.stream_ops,
ungotten: [],
error: false
}, fd_start, fd_end);
if (stream.stream_ops.open) {
stream.stream_ops.open(stream);
}
if (Module["logReadFiles"] && !(flags & 1)) {
if (!FS.readFiles) FS.readFiles = {};
if (!(path in FS.readFiles)) {
FS.readFiles[path] = 1;
console.log("FS.trackingDelegate error on read file: " + path);
}
}
try {
if (FS.trackingDelegate["onOpenFile"]) {
var trackingFlags = 0;
if ((flags & 2097155) !== 1) {
trackingFlags |= FS.tracking.openFlags.READ;
}
if ((flags & 2097155) !== 0) {
trackingFlags |= FS.tracking.openFlags.WRITE;
}
FS.trackingDelegate["onOpenFile"](path, trackingFlags);
}
} catch (e) {
console.log("FS.trackingDelegate['onOpenFile']('" + path + "', flags) threw an exception: " + e.message);
}
return stream;
},
close: function(stream) {
if (FS.isClosed(stream)) {
throw new FS.ErrnoError(9);
}
if (stream.getdents) stream.getdents = null;
try {
if (stream.stream_ops.close) {
stream.stream_ops.close(stream);
}
} catch (e) {
throw e;
} finally {
FS.closeStream(stream.fd);
}
stream.fd = null;
},
isClosed: function(stream) {
return stream.fd === null;
},
llseek: function(stream, offset, whence) {
if (FS.isClosed(stream)) {
throw new FS.ErrnoError(9);
}
if (!stream.seekable || !stream.stream_ops.llseek) {
throw new FS.ErrnoError(29);
}
if (whence != 0 && whence != 1 && whence != 2) {
throw new FS.ErrnoError(22);
}
stream.position = stream.stream_ops.llseek(stream, offset, whence);
stream.ungotten = [];
return stream.position;
},
read: function(stream, buffer, offset, length, position) {
if (length < 0 || position < 0) {
throw new FS.ErrnoError(22);
}
if (FS.isClosed(stream)) {
throw new FS.ErrnoError(9);
}
if ((stream.flags & 2097155) === 1) {
throw new FS.ErrnoError(9);
}
if (FS.isDir(stream.node.mode)) {
throw new FS.ErrnoError(21);
}
if (!stream.stream_ops.read) {
throw new FS.ErrnoError(22);
}
var seeking = typeof position !== "undefined";
if (!seeking) {
position = stream.position;
} else if (!stream.seekable) {
throw new FS.ErrnoError(29);
}
var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
if (!seeking) stream.position += bytesRead;
return bytesRead;
},
write: function(stream, buffer, offset, length, position, canOwn) {
if (length < 0 || position < 0) {
throw new FS.ErrnoError(22);
}
if (FS.isClosed(stream)) {
throw new FS.ErrnoError(9);
}
if ((stream.flags & 2097155) === 0) {
throw new FS.ErrnoError(9);
}
if (FS.isDir(stream.node.mode)) {
throw new FS.ErrnoError(21);
}
if (!stream.stream_ops.write) {
throw new FS.ErrnoError(22);
}
if (stream.flags & 1024) {
FS.llseek(stream, 0, 2);
}
var seeking = typeof position !== "undefined";
if (!seeking) {
position = stream.position;
} else if (!stream.seekable) {
throw new FS.ErrnoError(29);
}
var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
if (!seeking) stream.position += bytesWritten;
try {
if (stream.path && FS.trackingDelegate["onWriteToFile"]) FS.trackingDelegate["onWriteToFile"](stream.path);
} catch (e) {
console.log("FS.trackingDelegate['onWriteToFile']('" + stream.path + "') threw an exception: " + e.message);
}
return bytesWritten;
},
allocate: function(stream, offset, length) {
if (FS.isClosed(stream)) {
throw new FS.ErrnoError(9);
}
if (offset < 0 || length <= 0) {
throw new FS.ErrnoError(22);
}
if ((stream.flags & 2097155) === 0) {
throw new FS.ErrnoError(9);
}
if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) {
throw new FS.ErrnoError(19);
}
if (!stream.stream_ops.allocate) {
throw new FS.ErrnoError(95);
}
stream.stream_ops.allocate(stream, offset, length);
},
mmap: function(stream, buffer, offset, length, position, prot, flags) {
if ((stream.flags & 2097155) === 1) {
throw new FS.ErrnoError(13);
}
if (!stream.stream_ops.mmap) {
throw new FS.ErrnoError(19);
}
return stream.stream_ops.mmap(stream, buffer, offset, length, position, prot, flags);
},
msync: function(stream, buffer, offset, length, mmapFlags) {
if (!stream || !stream.stream_ops.msync) {
return 0;
}
return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags);
},
munmap: function(stream) {
return 0;
},
ioctl: function(stream, cmd, arg) {
if (!stream.stream_ops.ioctl) {
throw new FS.ErrnoError(25);
}
return stream.stream_ops.ioctl(stream, cmd, arg);
},
readFile: function(path, opts) {
opts = opts || {};
opts.flags = opts.flags || "r";
opts.encoding = opts.encoding || "binary";
if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
throw new Error('Invalid encoding type "' + opts.encoding + '"');
}
var ret;
var stream = FS.open(path, opts.flags);
var stat = FS.stat(path);
var length = stat.size;
var buf = new Uint8Array(length);
FS.read(stream, buf, 0, length, 0);
if (opts.encoding === "utf8") {
ret = UTF8ArrayToString(buf, 0);
} else if (opts.encoding === "binary") {
ret = buf;
}
FS.close(stream);
return ret;
},
writeFile: function(path, data, opts) {
opts = opts || {};
opts.flags = opts.flags || "w";
var stream = FS.open(path, opts.flags, opts.mode);
if (typeof data === "string") {
var buf = new Uint8Array(lengthBytesUTF8(data) + 1);
var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn);
} else if (ArrayBuffer.isView(data)) {
FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn);
} else {
throw new Error("Unsupported data type");
}
FS.close(stream);
},
cwd: function() {
return FS.currentPath;
},
chdir: function(path) {
var lookup = FS.lookupPath(path, {
follow: true
});
if (lookup.node === null) {
throw new FS.ErrnoError(2);
}
if (!FS.isDir(lookup.node.mode)) {
throw new FS.ErrnoError(20);
}
var err = FS.nodePermissions(lookup.node, "x");
if (err) {
throw new FS.ErrnoError(err);
}
FS.currentPath = lookup.path;
},
createDefaultDirectories: function() {
FS.mkdir("/tmp");
FS.mkdir("/home");
FS.mkdir("/home/web_user");
},
createDefaultDevices: function() {
FS.mkdir("/dev");
FS.registerDevice(FS.makedev(1, 3), {
read: function() {
return 0;
},
write: function(stream, buffer, offset, length, pos) {
return length;
}
});
FS.mkdev("/dev/null", FS.makedev(1, 3));
TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
FS.mkdev("/dev/tty", FS.makedev(5, 0));
FS.mkdev("/dev/tty1", FS.makedev(6, 0));
var random_device;
if (typeof crypto === "object" && typeof crypto["getRandomValues"] === "function") {
var randomBuffer = new Uint8Array(1);
random_device = function() {
crypto.getRandomValues(randomBuffer);
return randomBuffer[0];
};
} else if (ENVIRONMENT_IS_NODE) {
try {
var crypto_module = require("crypto");
random_device = function() {
return crypto_module["randomBytes"](1)[0];
};
} catch (e) {
random_device = function() {
return Math.random() * 256 | 0;
};
}
} else {
random_device = function() {
abort("random_device");
};
}
FS.createDevice("/dev", "random", random_device);
FS.createDevice("/dev", "urandom", random_device);
FS.mkdir("/dev/shm");
FS.mkdir("/dev/shm/tmp");
},
createSpecialDirectories: function() {
FS.mkdir("/proc");
FS.mkdir("/proc/self");
FS.mkdir("/proc/self/fd");
FS.mount({
mount: function() {
var node = FS.createNode("/proc/self", "fd", 16384 | 511, 73);
node.node_ops = {
lookup: function(parent, name) {
var fd = +name;
var stream = FS.getStream(fd);
if (!stream) throw new FS.ErrnoError(9);
var ret = {
parent: null,
mount: {
mountpoint: "fake"
},
node_ops: {
readlink: function() {
return stream.path;
}
}
};
ret.parent = ret;
return ret;
}
};
return node;
}
}, {}, "/proc/self/fd");
},
createStandardStreams: function() {
if (Module["stdin"]) {
FS.createDevice("/dev", "stdin", Module["stdin"]);
} else {
FS.symlink("/dev/tty", "/dev/stdin");
}
if (Module["stdout"]) {
FS.createDevice("/dev", "stdout", null, Module["stdout"]);
} else {
FS.symlink("/dev/tty", "/dev/stdout");
}
if (Module["stderr"]) {
FS.createDevice("/dev", "stderr", null, Module["stderr"]);
} else {
FS.symlink("/dev/tty1", "/dev/stderr");
}
var stdin = FS.open("/dev/stdin", "r");
assert(stdin.fd === 0, "invalid handle for stdin (" + stdin.fd + ")");
var stdout = FS.open("/dev/stdout", "w");
assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")");
var stderr = FS.open("/dev/stderr", "w");
assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")");
},
ensureErrnoError: function() {
if (FS.ErrnoError) return;
FS.ErrnoError = function ErrnoError(errno, node) {
this.node = node;
this.setErrno = function(errno) {
this.errno = errno;
};
this.setErrno(errno);
this.message = "FS error";
if (this.stack) Object.defineProperty(this, "stack", {
value: new Error().stack,
writable: true
});
};
FS.ErrnoError.prototype = new Error();
FS.ErrnoError.prototype.constructor = FS.ErrnoError;
[ 2 ].forEach(function(code) {
FS.genericErrors[code] = new FS.ErrnoError(code);
FS.genericErrors[code].stack = "<generic error, no stack>";
});
},
staticInit: function() {
FS.ensureErrnoError();
FS.nameTable = new Array(4096);
FS.mount(MEMFS, {}, "/");
FS.createDefaultDirectories();
FS.createDefaultDevices();
FS.createSpecialDirectories();
FS.filesystems = {
"MEMFS": MEMFS,
"IDBFS": IDBFS,
"NODEFS": NODEFS,
"WORKERFS": WORKERFS
};
},
init: function(input, output, error) {
assert(!FS.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");
FS.init.initialized = true;
FS.ensureErrnoError();
Module["stdin"] = input || Module["stdin"];
Module["stdout"] = output || Module["stdout"];
Module["stderr"] = error || Module["stderr"];
FS.createStandardStreams();
},
quit: function() {
FS.init.initialized = false;
var fflush = Module["_fflush"];
if (fflush) fflush(0);
for (var i = 0; i < FS.streams.length; i++) {
var stream = FS.streams[i];
if (!stream) {
continue;
}
FS.close(stream);
}
},
getMode: function(canRead, canWrite) {
var mode = 0;
if (canRead) mode |= 292 | 73;
if (canWrite) mode |= 146;
return mode;
},
joinPath: function(parts, forceRelative) {
var path = PATH.join.apply(null, parts);
if (forceRelative && path[0] == "/") path = path.substr(1);
return path;
},
absolutePath: function(relative, base) {
return PATH.resolve(base, relative);
},
standardizePath: function(path) {
return PATH.normalize(path);
},
findObject: function(path, dontResolveLastLink) {
var ret = FS.analyzePath(path, dontResolveLastLink);
if (ret.exists) {
return ret.object;
} else {
___setErrNo(ret.error);
return null;
}
},
analyzePath: function(path, dontResolveLastLink) {
try {
var lookup = FS.lookupPath(path, {
follow: !dontResolveLastLink
});
path = lookup.path;
} catch (e) {}
var ret = {
isRoot: false,
exists: false,
error: 0,
name: null,
path: null,
object: null,
parentExists: false,
parentPath: null,
parentObject: null
};
try {
var lookup = FS.lookupPath(path, {
parent: true
});
ret.parentExists = true;
ret.parentPath = lookup.path;
ret.parentObject = lookup.node;
ret.name = PATH.basename(path);
lookup = FS.lookupPath(path, {
follow: !dontResolveLastLink
});
ret.exists = true;
ret.path = lookup.path;
ret.object = lookup.node;
ret.name = lookup.node.name;
ret.isRoot = lookup.path === "/";
} catch (e) {
ret.error = e.errno;
}
return ret;
},
createFolder: function(parent, name, canRead, canWrite) {
var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
var mode = FS.getMode(canRead, canWrite);
return FS.mkdir(path, mode);
},
createPath: function(parent, path, canRead, canWrite) {
parent = typeof parent === "string" ? parent : FS.getPath(parent);
var parts = path.split("/").reverse();
while (parts.length) {
var part = parts.pop();
if (!part) continue;
var current = PATH.join2(parent, part);
try {
FS.mkdir(current);
} catch (e) {}
parent = current;
}
return current;
},
createFile: function(parent, name, properties, canRead, canWrite) {
var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
var mode = FS.getMode(canRead, canWrite);
return FS.create(path, mode);
},
createDataFile: function(parent, name, data, canRead, canWrite, canOwn) {
var path = name ? PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name) : parent;
var mode = FS.getMode(canRead, canWrite);
var node = FS.create(path, mode);
if (data) {
if (typeof data === "string") {
var arr = new Array(data.length);
for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
data = arr;
}
FS.chmod(node, mode | 146);
var stream = FS.open(node, "w");
FS.write(stream, data, 0, data.length, 0, canOwn);
FS.close(stream);
FS.chmod(node, mode);
}
return node;
},
createDevice: function(parent, name, input, output) {
var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
var mode = FS.getMode(!!input, !!output);
if (!FS.createDevice.major) FS.createDevice.major = 64;
var dev = FS.makedev(FS.createDevice.major++, 0);
FS.registerDevice(dev, {
open: function(stream) {
stream.seekable = false;
},
close: function(stream) {
if (output && output.buffer && output.buffer.length) {
output(10);
}
},
read: function(stream, buffer, offset, length, pos) {
var bytesRead = 0;
for (var i = 0; i < length; i++) {
var result;
try {
result = input();
} catch (e) {
throw new FS.ErrnoError(5);
}
if (result === undefined && bytesRead === 0) {
throw new FS.ErrnoError(11);
}
if (result === null || result === undefined) break;
bytesRead++;
buffer[offset + i] = result;
}
if (bytesRead) {
stream.node.timestamp = Date.now();
}
return bytesRead;
},
write: function(stream, buffer, offset, length, pos) {
for (var i = 0; i < length; i++) {
try {
output(buffer[offset + i]);
} catch (e) {
throw new FS.ErrnoError(5);
}
}
if (length) {
stream.node.timestamp = Date.now();
}
return i;
}
});
return FS.mkdev(path, mode, dev);
},
createLink: function(parent, name, target, canRead, canWrite) {
var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
return FS.symlink(target, path);
},
forceLoadFile: function(obj) {
if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
var success = true;
if (typeof XMLHttpRequest !== "undefined") {
throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");
} else if (Module["read"]) {
try {
obj.contents = intArrayFromString(Module["read"](obj.url), true);
obj.usedBytes = obj.contents.length;
} catch (e) {
success = false;
}
} else {
throw new Error("Cannot load without read() or XMLHttpRequest.");
}
if (!success) ___setErrNo(5);
return success;
},
createLazyFile: function(parent, name, url, canRead, canWrite) {
function LazyUint8Array() {
this.lengthKnown = false;
this.chunks = [];
}
LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
if (idx > this.length - 1 || idx < 0) {
return undefined;
}
var chunkOffset = idx % this.chunkSize;
var chunkNum = idx / this.chunkSize | 0;
return this.getter(chunkNum)[chunkOffset];
};
LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
this.getter = getter;
};
LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
var xhr = new XMLHttpRequest();
xhr.open("HEAD", url, false);
xhr.send(null);
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
var datalength = Number(xhr.getResponseHeader("Content-length"));
var header;
var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
var chunkSize = 1024 * 1024;
if (!hasByteServing) chunkSize = datalength;
var doXHR = function(from, to) {
if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!");
var xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
if (typeof Uint8Array != "undefined") xhr.responseType = "arraybuffer";
if (xhr.overrideMimeType) {
xhr.overrideMimeType("text/plain; charset=x-user-defined");
}
xhr.send(null);
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
if (xhr.response !== undefined) {
return new Uint8Array(xhr.response || []);
} else {
return intArrayFromString(xhr.responseText || "", true);
}
};
var lazyArray = this;
lazyArray.setDataGetter(function(chunkNum) {
var start = chunkNum * chunkSize;
var end = (chunkNum + 1) * chunkSize - 1;
end = Math.min(end, datalength - 1);
if (typeof lazyArray.chunks[chunkNum] === "undefined") {
lazyArray.chunks[chunkNum] = doXHR(start, end);
}
if (typeof lazyArray.chunks[chunkNum] === "undefined") throw new Error("doXHR failed!");
return lazyArray.chunks[chunkNum];
});
if (usesGzip || !datalength) {
chunkSize = datalength = 1;
datalength = this.getter(0).length;
chunkSize = datalength;
console.log("LazyFiles on gzip forces download of the whole file when length is accessed");
}
this._length = datalength;
this._chunkSize = chunkSize;
this.lengthKnown = true;
};
if (typeof XMLHttpRequest !== "undefined") {
if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
var lazyArray = new LazyUint8Array();
Object.defineProperties(lazyArray, {
length: {
get: function() {
if (!this.lengthKnown) {
this.cacheLength();
}
return this._length;
}
},
chunkSize: {
get: function() {
if (!this.lengthKnown) {
this.cacheLength();
}
return this._chunkSize;
}
}
});
var properties = {
isDevice: false,
contents: lazyArray
};
} else {
var properties = {
isDevice: false,
url: url
};
}
var node = FS.createFile(parent, name, properties, canRead, canWrite);
if (properties.contents) {
node.contents = properties.contents;
} else if (properties.url) {
node.contents = null;
node.url = properties.url;
}
Object.defineProperties(node, {
usedBytes: {
get: function() {
return this.contents.length;
}
}
});
var stream_ops = {};
var keys = Object.keys(node.stream_ops);
keys.forEach(function(key) {
var fn = node.stream_ops[key];
stream_ops[key] = function forceLoadLazyFile() {
if (!FS.forceLoadFile(node)) {
throw new FS.ErrnoError(5);
}
return fn.apply(null, arguments);
};
});
stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) {
if (!FS.forceLoadFile(node)) {
throw new FS.ErrnoError(5);
}
var contents = stream.node.contents;
if (position >= contents.length) return 0;
var size = Math.min(contents.length - position, length);
assert(size >= 0);
if (contents.slice) {
for (var i = 0; i < size; i++) {
buffer[offset + i] = contents[position + i];
}
} else {
for (var i = 0; i < size; i++) {
buffer[offset + i] = contents.get(position + i);
}
}
return size;
};
node.stream_ops = stream_ops;
return node;
},
createPreloadedFile: function(parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) {
Browser.init();
var fullname = name ? PATH.resolve(PATH.join2(parent, name)) : parent;
var dep = getUniqueRunDependency("cp " + fullname);
function processData(byteArray) {
function finish(byteArray) {
if (preFinish) preFinish();
if (!dontCreateFile) {
FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
}
if (onload) onload();
removeRunDependency(dep);
}
var handled = false;
Module["preloadPlugins"].forEach(function(plugin) {
if (handled) return;
if (plugin["canHandle"](fullname)) {
plugin["handle"](byteArray, fullname, finish, function() {
if (onerror) onerror();
removeRunDependency(dep);
});
handled = true;
}
});
if (!handled) finish(byteArray);
}
addRunDependency(dep);
if (typeof url == "string") {
Browser.asyncLoad(url, function(byteArray) {
processData(byteArray);
}, onerror);
} else {
processData(url);
}
},
indexedDB: function() {
return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
},
DB_NAME: function() {
return "EM_FS_" + window.location.pathname;
},
DB_VERSION: 20,
DB_STORE_NAME: "FILE_DATA",
saveFilesToDB: function(paths, onload, onerror) {
onload = onload || function() {};
onerror = onerror || function() {};
var indexedDB = FS.indexedDB();
try {
var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
} catch (e) {
return onerror(e);
}
openRequest.onupgradeneeded = function openRequest_onupgradeneeded() {
console.log("creating db");
var db = openRequest.result;
db.createObjectStore(FS.DB_STORE_NAME);
};
openRequest.onsuccess = function openRequest_onsuccess() {
var db = openRequest.result;
var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite");
var files = transaction.objectStore(FS.DB_STORE_NAME);
var ok = 0, fail = 0, total = paths.length;
function finish() {
if (fail == 0) onload(); else onerror();
}
paths.forEach(function(path) {
var putRequest = files.put(FS.analyzePath(path).object.contents, path);
putRequest.onsuccess = function putRequest_onsuccess() {
ok++;
if (ok + fail == total) finish();
};
putRequest.onerror = function putRequest_onerror() {
fail++;
if (ok + fail == total) finish();
};
});
transaction.onerror = onerror;
};
openRequest.onerror = onerror;
},
loadFilesFromDB: function(paths, onload, onerror) {
onload = onload || function() {};
onerror = onerror || function() {};
var indexedDB = FS.indexedDB();
try {
var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
} catch (e) {
return onerror(e);
}
openRequest.onupgradeneeded = onerror;
openRequest.onsuccess = function openRequest_onsuccess() {
var db = openRequest.result;
try {
var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly");
} catch (e) {
onerror(e);
return;
}
var files = transaction.objectStore(FS.DB_STORE_NAME);
var ok = 0, fail = 0, total = paths.length;
function finish() {
if (fail == 0) onload(); else onerror();
}
paths.forEach(function(path) {
var getRequest = files.get(path);
getRequest.onsuccess = function getRequest_onsuccess() {
if (FS.analyzePath(path).exists) {
FS.unlink(path);
}
FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
ok++;
if (ok + fail == total) finish();
};
getRequest.onerror = function getRequest_onerror() {
fail++;
if (ok + fail == total) finish();
};
});
transaction.onerror = onerror;
};
openRequest.onerror = onerror;
}
};
function _emscripten_set_main_loop_timing(mode, value) {
Browser.mainLoop.timingMode = mode;
Browser.mainLoop.timingValue = value;
if (!Browser.mainLoop.func) {
return 1;
}
if (mode == 0) {
Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler_setTimeout() {
var timeUntilNextTick = Math.max(0, Browser.mainLoop.tickStartTime + value - _emscripten_get_now()) | 0;
setTimeout(Browser.mainLoop.runner, timeUntilNextTick);
};
Browser.mainLoop.method = "timeout";
} else if (mode == 1) {
Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler_rAF() {
Browser.requestAnimationFrame(Browser.mainLoop.runner);
};
Browser.mainLoop.method = "rAF";
} else if (mode == 2) {
if (typeof setImmediate === "undefined") {
var setImmediates = [];
var emscriptenMainLoopMessageId = "setimmediate";
var Browser_setImmediate_messageHandler = function(event) {
if (event.data === emscriptenMainLoopMessageId || event.data.target === emscriptenMainLoopMessageId) {
event.stopPropagation();
setImmediates.shift()();
}
};
addEventListener("message", Browser_setImmediate_messageHandler, true);
setImmediate = function Browser_emulated_setImmediate(func) {
setImmediates.push(func);
if (ENVIRONMENT_IS_WORKER) {
if (Module["setImmediates"] === undefined) Module["setImmediates"] = [];
Module["setImmediates"].push(func);
postMessage({
target: emscriptenMainLoopMessageId
});
} else postMessage(emscriptenMainLoopMessageId, "*");
};
}
Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler_setImmediate() {
setImmediate(Browser.mainLoop.runner);
};
Browser.mainLoop.method = "immediate";
}
return 0;
}
function _emscripten_get_now() {
abort();
}
function _emscripten_set_main_loop(func, fps, simulateInfiniteLoop, arg, noSetTiming) {
Module["noExitRuntime"] = true;
assert(!Browser.mainLoop.func, "emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");
Browser.mainLoop.func = func;
Browser.mainLoop.arg = arg;
var browserIterationFunc;
if (typeof arg !== "undefined") {
browserIterationFunc = function() {
Module["dynCall_vi"](func, arg);
};
} else {
browserIterationFunc = function() {
Module["dynCall_v"](func);
};
}
var thisMainLoopId = Browser.mainLoop.currentlyRunningMainloop;
Browser.mainLoop.runner = function Browser_mainLoop_runner() {
if (ABORT) return;
if (Browser.mainLoop.queue.length > 0) {
var start = Date.now();
var blocker = Browser.mainLoop.queue.shift();
blocker.func(blocker.arg);
if (Browser.mainLoop.remainingBlockers) {
var remaining = Browser.mainLoop.remainingBlockers;
var next = remaining % 1 == 0 ? remaining - 1 : Math.floor(remaining);
if (blocker.counted) {
Browser.mainLoop.remainingBlockers = next;
} else {
next = next + .5;
Browser.mainLoop.remainingBlockers = (8 * remaining + next) / 9;
}
}
console.log('main loop blocker "' + blocker.name + '" took ' + (Date.now() - start) + " ms");
Browser.mainLoop.updateStatus();
if (thisMainLoopId < Browser.mainLoop.currentlyRunningMainloop) return;
setTimeout(Browser.mainLoop.runner, 0);
return;
}
if (thisMainLoopId < Browser.mainLoop.currentlyRunningMainloop) return;
Browser.mainLoop.currentFrameNumber = Browser.mainLoop.currentFrameNumber + 1 | 0;
if (Browser.mainLoop.timingMode == 1 && Browser.mainLoop.timingValue > 1 && Browser.mainLoop.currentFrameNumber % Browser.mainLoop.timingValue != 0) {
Browser.mainLoop.scheduler();
return;
} else if (Browser.mainLoop.timingMode == 0) {
Browser.mainLoop.tickStartTime = _emscripten_get_now();
}
if (Browser.mainLoop.method === "timeout" && Module.ctx) {
err("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!");
Browser.mainLoop.method = "";
}
Browser.mainLoop.runIter(browserIterationFunc);
if (thisMainLoopId < Browser.mainLoop.currentlyRunningMainloop) return;
if (typeof SDL === "object" && SDL.audio && SDL.audio.queueNewAudioData) SDL.audio.queueNewAudioData();
Browser.mainLoop.scheduler();
};
if (!noSetTiming) {
if (fps && fps > 0) _emscripten_set_main_loop_timing(0, 1e3 / fps); else _emscripten_set_main_loop_timing(1, 1);
Browser.mainLoop.scheduler();
}
if (simulateInfiniteLoop) {
throw "SimulateInfiniteLoop";
}
}
var Browser = {
mainLoop: {
scheduler: null,
method: "",
currentlyRunningMainloop: 0,
func: null,
arg: 0,
timingMode: 0,
timingValue: 0,
currentFrameNumber: 0,
queue: [],
pause: function() {
Browser.mainLoop.scheduler = null;
Browser.mainLoop.currentlyRunningMainloop++;
},
resume: function() {
Browser.mainLoop.currentlyRunningMainloop++;
var timingMode = Browser.mainLoop.timingMode;
var timingValue = Browser.mainLoop.timingValue;
var func = Browser.mainLoop.func;
Browser.mainLoop.func = null;
_emscripten_set_main_loop(func, 0, false, Browser.mainLoop.arg, true);
_emscripten_set_main_loop_timing(timingMode, timingValue);
Browser.mainLoop.scheduler();
},
updateStatus: function() {
if (Module["setStatus"]) {
var message = Module["statusMessage"] || "Please wait...";
var remaining = Browser.mainLoop.remainingBlockers;
var expected = Browser.mainLoop.expectedBlockers;
if (remaining) {
if (remaining < expected) {
Module["setStatus"](message + " (" + (expected - remaining) + "/" + expected + ")");
} else {
Module["setStatus"](message);
}
} else {
Module["setStatus"]("");
}
}
},
runIter: function(func) {
if (ABORT) return;
if (Module["preMainLoop"]) {
var preRet = Module["preMainLoop"]();
if (preRet === false) {
return;
}
}
try {
func();
} catch (e) {
if (e instanceof ExitStatus) {
return;
} else {
if (e && typeof e === "object" && e.stack) err("exception thrown: " + [ e, e.stack ]);
throw e;
}
}
if (Module["postMainLoop"]) Module["postMainLoop"]();
}
},
isFullscreen: false,
pointerLock: false,
moduleContextCreatedCallbacks: [],
workers: [],
init: function() {
if (!Module["preloadPlugins"]) Module["preloadPlugins"] = [];
if (Browser.initted) return;
Browser.initted = true;
try {
new Blob();
Browser.hasBlobConstructor = true;
} catch (e) {
Browser.hasBlobConstructor = false;
console.log("warning: no blob constructor, cannot create blobs with mimetypes");
}
Browser.BlobBuilder = typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : typeof WebKitBlobBuilder != "undefined" ? WebKitBlobBuilder : !Browser.hasBlobConstructor ? console.log("warning: no BlobBuilder") : null;
Browser.URLObject = typeof window != "undefined" ? window.URL ? window.URL : window.webkitURL : undefined;
if (!Module.noImageDecoding && typeof Browser.URLObject === "undefined") {
console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available.");
Module.noImageDecoding = true;
}
var imagePlugin = {};
imagePlugin["canHandle"] = function imagePlugin_canHandle(name) {
return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name);
};
imagePlugin["handle"] = function imagePlugin_handle(byteArray, name, onload, onerror) {
var b = null;
if (Browser.hasBlobConstructor) {
try {
b = new Blob([ byteArray ], {
type: Browser.getMimetype(name)
});
if (b.size !== byteArray.length) {
b = new Blob([ new Uint8Array(byteArray).buffer ], {
type: Browser.getMimetype(name)
});
}
} catch (e) {
warnOnce("Blob constructor present but fails: " + e + "; falling back to blob builder");
}
}
if (!b) {
var bb = new Browser.BlobBuilder();
bb.append(new Uint8Array(byteArray).buffer);
b = bb.getBlob();
}
var url = Browser.URLObject.createObjectURL(b);
var img = new Image();
img.onload = function img_onload() {
assert(img.complete, "Image " + name + " could not be decoded");
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
Module["preloadedImages"][name] = canvas;
Browser.URLObject.revokeObjectURL(url);
if (onload) onload(byteArray);
};
img.onerror = function img_onerror(event) {
console.log("Image " + url + " could not be decoded");
if (onerror) onerror();
};
img.src = url;
};
Module["preloadPlugins"].push(imagePlugin);
var audioPlugin = {};
audioPlugin["canHandle"] = function audioPlugin_canHandle(name) {
return !Module.noAudioDecoding && name.substr(-4) in {
".ogg": 1,
".wav": 1,
".mp3": 1
};
};
audioPlugin["handle"] = function audioPlugin_handle(byteArray, name, onload, onerror) {
var done = false;
function finish(audio) {
if (done) return;
done = true;
Module["preloadedAudios"][name] = audio;
if (onload) onload(byteArray);
}
function fail() {
if (done) return;
done = true;
Module["preloadedAudios"][name] = new Audio();
if (onerror) onerror();
}
if (Browser.hasBlobConstructor) {
try {
var b = new Blob([ byteArray ], {
type: Browser.getMimetype(name)
});
} catch (e) {
return fail();
}
var url = Browser.URLObject.createObjectURL(b);
var audio = new Audio();
audio.addEventListener("canplaythrough", function() {
finish(audio);
}, false);
audio.onerror = function audio_onerror(event) {
if (done) return;
console.log("warning: browser could not fully decode audio " + name + ", trying slower base64 approach");
function encode64(data) {
var BASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var PAD = "=";
var ret = "";
var leftchar = 0;
var leftbits = 0;
for (var i = 0; i < data.length; i++) {
leftchar = leftchar << 8 | data[i];
leftbits += 8;
while (leftbits >= 6) {
var curr = leftchar >> leftbits - 6 & 63;
leftbits -= 6;
ret += BASE[curr];
}
}
if (leftbits == 2) {
ret += BASE[(leftchar & 3) << 4];
ret += PAD + PAD;
} else if (leftbits == 4) {
ret += BASE[(leftchar & 15) << 2];
ret += PAD;
}
return ret;
}
audio.src = "data:audio/x-" + name.substr(-3) + ";base64," + encode64(byteArray);
finish(audio);
};
audio.src = url;
Browser.safeSetTimeout(function() {
finish(audio);
}, 1e4);
} else {
return fail();
}
};
Module["preloadPlugins"].push(audioPlugin);
function pointerLockChange() {
Browser.pointerLock = document["pointerLockElement"] === Module["canvas"] || document["mozPointerLockElement"] === Module["canvas"] || document["webkitPointerLockElement"] === Module["canvas"] || document["msPointerLockElement"] === Module["canvas"];
}
var canvas = Module["canvas"];
if (canvas) {
canvas.requestPointerLock = canvas["requestPointerLock"] || canvas["mozRequestPointerLock"] || canvas["webkitRequestPointerLock"] || canvas["msRequestPointerLock"] || function() {};
canvas.exitPointerLock = document["exitPointerLock"] || document["mozExitPointerLock"] || document["webkitExitPointerLock"] || document["msExitPointerLock"] || function() {};
canvas.exitPointerLock = canvas.exitPointerLock.bind(document);
document.addEventListener("pointerlockchange", pointerLockChange, false);
document.addEventListener("mozpointerlockchange", pointerLockChange, false);
document.addEventListener("webkitpointerlockchange", pointerLockChange, false);
document.addEventListener("mspointerlockchange", pointerLockChange, false);
if (Module["elementPointerLock"]) {
canvas.addEventListener("click", function(ev) {
if (!Browser.pointerLock && Module["canvas"].requestPointerLock) {
Module["canvas"].requestPointerLock();
ev.preventDefault();
}
}, false);
}
}
},
createContext: function(canvas, useWebGL, setInModule, webGLContextAttributes) {
if (useWebGL && Module.ctx && canvas == Module.canvas) return Module.ctx;
var ctx;
var contextHandle;
if (useWebGL) {
var contextAttributes = {
antialias: false,
alpha: false,
majorVersion: 1
};
if (webGLContextAttributes) {
for (var attribute in webGLContextAttributes) {
contextAttributes[attribute] = webGLContextAttributes[attribute];
}
}
if (typeof GL !== "undefined") {
contextHandle = GL.createContext(canvas, contextAttributes);
if (contextHandle) {
ctx = GL.getContext(contextHandle).GLctx;
}
}
} else {
ctx = canvas.getContext("2d");
}
if (!ctx) return null;
if (setInModule) {
if (!useWebGL) assert(typeof GLctx === "undefined", "cannot set in module if GLctx is used, but we are a non-GL context that would replace it");
Module.ctx = ctx;
if (useWebGL) GL.makeContextCurrent(contextHandle);
Module.useWebGL = useWebGL;
Browser.moduleContextCreatedCallbacks.forEach(function(callback) {
callback();
});
Browser.init();
}
return ctx;
},
destroyContext: function(canvas, useWebGL, setInModule) {},
fullscreenHandlersInstalled: false,
lockPointer: undefined,
resizeCanvas: undefined,
requestFullscreen: function(lockPointer, resizeCanvas, vrDevice) {
lockPointer = false;
console.log("forcing lockPointer to false");
Browser.lockPointer = lockPointer;
Browser.resizeCanvas = resizeCanvas;
Browser.vrDevice = vrDevice;
if (typeof Browser.lockPointer === "undefined") Browser.lockPointer = false;
if (typeof Browser.resizeCanvas === "undefined") Browser.resizeCanvas = false;
if (typeof Browser.vrDevice === "undefined") Browser.vrDevice = null;
var canvas = Module["canvas"];
function fullscreenChange() {
Browser.isFullscreen = false;
var canvasContainer = canvas.parentNode;
if ((document["fullscreenElement"] || document["mozFullScreenElement"] || document["msFullscreenElement"] || document["webkitFullscreenElement"] || document["webkitCurrentFullScreenElement"]) === canvasContainer) {
canvas.exitFullscreen = document["exitFullscreen"] || document["cancelFullScreen"] || document["mozCancelFullScreen"] || document["msExitFullscreen"] || document["webkitCancelFullScreen"] || function() {};
canvas.exitFullscreen = canvas.exitFullscreen.bind(document);
Browser.isFullscreen = true;
if (Browser.resizeCanvas) {
Browser.setFullscreenCanvasSize();
} else {
Browser.updateCanvasDimensions(canvas);
}
} else {
canvasContainer.parentNode.insertBefore(canvas, canvasContainer);
canvasContainer.parentNode.removeChild(canvasContainer);
if (Browser.resizeCanvas) {
Browser.setWindowedCanvasSize();
} else {
Browser.updateCanvasDimensions(canvas);
}
}
if (Module["onFullScreen"]) Module["onFullScreen"](Browser.isFullscreen);
if (Module["onFullscreen"]) Module["onFullscreen"](Browser.isFullscreen);
}
if (!Browser.fullscreenHandlersInstalled) {
Browser.fullscreenHandlersInstalled = true;
document.addEventListener("fullscreenchange", fullscreenChange, false);
document.addEventListener("mozfullscreenchange", fullscreenChange, false);
document.addEventListener("webkitfullscreenchange", fullscreenChange, false);
document.addEventListener("MSFullscreenChange", fullscreenChange, false);
}
var canvasContainer = document.createElement("div");
canvas.parentNode.insertBefore(canvasContainer, canvas);
canvasContainer.appendChild(canvas);
canvasContainer.requestFullscreen = canvasContainer["requestFullscreen"] || canvasContainer["mozRequestFullScreen"] || canvasContainer["msRequestFullscreen"] || (canvasContainer["webkitRequestFullscreen"] ? function() {
canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]);
} : null) || (canvasContainer["webkitRequestFullScreen"] ? function() {
canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]);
} : null);
if (vrDevice) {
canvasContainer.requestFullscreen({
vrDisplay: vrDevice
});
} else {
canvasContainer.requestFullscreen();
}
},
requestFullScreen: function(lockPointer, resizeCanvas, vrDevice) {
err("Browser.requestFullScreen() is deprecated. Please call Browser.requestFullscreen instead.");
Browser.requestFullScreen = function(lockPointer, resizeCanvas, vrDevice) {
return Browser.requestFullscreen(lockPointer, resizeCanvas, vrDevice);
};
return Browser.requestFullscreen(lockPointer, resizeCanvas, vrDevice);
},
nextRAF: 0,
fakeRequestAnimationFrame: function(func) {
var now = Date.now();
if (Browser.nextRAF === 0) {
Browser.nextRAF = now + 1e3 / 60;
} else {
while (now + 2 >= Browser.nextRAF) {
Browser.nextRAF += 1e3 / 60;
}
}
var delay = Math.max(Browser.nextRAF - now, 0);
setTimeout(func, delay);
},
requestAnimationFrame: function requestAnimationFrame(func) {
if (typeof window === "undefined") {
Browser.fakeRequestAnimationFrame(func);
} else {
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = window["requestAnimationFrame"] || window["mozRequestAnimationFrame"] || window["webkitRequestAnimationFrame"] || window["msRequestAnimationFrame"] || window["oRequestAnimationFrame"] || Browser.fakeRequestAnimationFrame;
}
window.requestAnimationFrame(func);
}
},
safeCallback: function(func) {
return function() {
if (!ABORT) return func.apply(null, arguments);
};
},
allowAsyncCallbacks: true,
queuedAsyncCallbacks: [],
pauseAsyncCallbacks: function() {
Browser.allowAsyncCallbacks = false;
},
resumeAsyncCallbacks: function() {
Browser.allowAsyncCallbacks = true;
if (Browser.queuedAsyncCallbacks.length > 0) {
var callbacks = Browser.queuedAsyncCallbacks;
Browser.queuedAsyncCallbacks = [];
callbacks.forEach(function(func) {
func();
});
}
},
safeRequestAnimationFrame: function(func) {
return Browser.requestAnimationFrame(function() {
if (ABORT) return;
if (Browser.allowAsyncCallbacks) {
func();
} else {
Browser.queuedAsyncCallbacks.push(func);
}
});
},
safeSetTimeout: function(func, timeout) {
Module["noExitRuntime"] = true;
return setTimeout(function() {
if (ABORT) return;
if (Browser.allowAsyncCallbacks) {
func();
} else {
Browser.queuedAsyncCallbacks.push(func);
}
}, timeout);
},
safeSetInterval: function(func, timeout) {
Module["noExitRuntime"] = true;
return setInterval(function() {
if (ABORT) return;
if (Browser.allowAsyncCallbacks) {
func();
}
}, timeout);
},
getMimetype: function(name) {
return {
"jpg": "image/jpeg",
"jpeg": "image/jpeg",
"png": "image/png",
"bmp": "image/bmp",
"ogg": "audio/ogg",
"wav": "audio/wav",
"mp3": "audio/mpeg"
}[name.substr(name.lastIndexOf(".") + 1)];
},
getUserMedia: function(func) {
if (!window.getUserMedia) {
window.getUserMedia = navigator["getUserMedia"] || navigator["mozGetUserMedia"];
}
window.getUserMedia(func);
},
getMovementX: function(event) {
return event["movementX"] || event["mozMovementX"] || event["webkitMovementX"] || 0;
},
getMovementY: function(event) {
return event["movementY"] || event["mozMovementY"] || event["webkitMovementY"] || 0;
},
getMouseWheelDelta: function(event) {
var delta = 0;
switch (event.type) {
case "DOMMouseScroll":
delta = event.detail;
break;
case "mousewheel":
delta = event.wheelDelta;
break;
case "wheel":
delta = event["deltaY"];
break;
default:
throw "unrecognized mouse wheel event: " + event.type;
}
return delta;
},
mouseX: 0,
mouseY: 0,
mouseMovementX: 0,
mouseMovementY: 0,
touches: {},
lastTouches: {},
calculateMouseEvent: function(event) {
if (Browser.pointerLock) {
if (event.type != "mousemove" && "mozMovementX" in event) {
Browser.mouseMovementX = Browser.mouseMovementY = 0;
} else {
Browser.mouseMovementX = Browser.getMovementX(event);
Browser.mouseMovementY = Browser.getMovementY(event);
}
if (typeof SDL != "undefined") {
Browser.mouseX = SDL.mouseX + Browser.mouseMovementX;
Browser.mouseY = SDL.mouseY + Browser.mouseMovementY;
} else {
Browser.mouseX += Browser.mouseMovementX;
Browser.mouseY += Browser.mouseMovementY;
}
} else {
var rect = Module["canvas"].getBoundingClientRect();
var cw = Module["canvas"].width;
var ch = Module["canvas"].height;
var scrollX = typeof window.scrollX !== "undefined" ? window.scrollX : window.pageXOffset;
var scrollY = typeof window.scrollY !== "undefined" ? window.scrollY : window.pageYOffset;
if (event.type === "touchstart" || event.type === "touchend" || event.type === "touchmove") {
var touch = event.touch;
if (touch === undefined) {
return;
}
var adjustedX = touch.pageX - (scrollX + rect.left);
var adjustedY = touch.pageY - (scrollY + rect.top);
adjustedX = adjustedX * (cw / rect.width);
adjustedY = adjustedY * (ch / rect.height);
var coords = {
x: adjustedX,
y: adjustedY
};
if (event.type === "touchstart") {
Browser.lastTouches[touch.identifier] = coords;
Browser.touches[touch.identifier] = coords;
} else if (event.type === "touchend" || event.type === "touchmove") {
var last = Browser.touches[touch.identifier];
if (!last) last = coords;
Browser.lastTouches[touch.identifier] = last;
Browser.touches[touch.identifier] = coords;
}
return;
}
var x = event.pageX - (scrollX + rect.left);
var y = event.pageY - (scrollY + rect.top);
x = x * (cw / rect.width);
y = y * (ch / rect.height);
Browser.mouseMovementX = x - Browser.mouseX;
Browser.mouseMovementY = y - Browser.mouseY;
Browser.mouseX = x;
Browser.mouseY = y;
}
},
asyncLoad: function(url, onload, onerror, noRunDep) {
var dep = !noRunDep ? getUniqueRunDependency("al " + url) : "";
Module["readAsync"](url, function(arrayBuffer) {
assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
onload(new Uint8Array(arrayBuffer));
if (dep) removeRunDependency(dep);
}, function(event) {
if (onerror) {
onerror();
} else {
throw 'Loading data file "' + url + '" failed.';
}
});
if (dep) addRunDependency(dep);
},
resizeListeners: [],
updateResizeListeners: function() {
var canvas = Module["canvas"];
Browser.resizeListeners.forEach(function(listener) {
listener(canvas.width, canvas.height);
});
},
setCanvasSize: function(width, height, noUpdates) {
var canvas = Module["canvas"];
Browser.updateCanvasDimensions(canvas, width, height);
if (!noUpdates) Browser.updateResizeListeners();
},
windowedWidth: 0,
windowedHeight: 0,
setFullscreenCanvasSize: function() {
if (typeof SDL != "undefined") {
var flags = HEAPU32[SDL.screen >> 2];
flags = flags | 8388608;
HEAP32[SDL.screen >> 2] = flags;
}
Browser.updateCanvasDimensions(Module["canvas"]);
Browser.updateResizeListeners();
},
setWindowedCanvasSize: function() {
if (typeof SDL != "undefined") {
var flags = HEAPU32[SDL.screen >> 2];
flags = flags & ~8388608;
HEAP32[SDL.screen >> 2] = flags;
}
Browser.updateCanvasDimensions(Module["canvas"]);
Browser.updateResizeListeners();
},
updateCanvasDimensions: function(canvas, wNative, hNative) {
if (wNative && hNative) {
canvas.widthNative = wNative;
canvas.heightNative = hNative;
} else {
wNative = canvas.widthNative;
hNative = canvas.heightNative;
}
var w = wNative;
var h = hNative;
if (Module["forcedAspectRatio"] && Module["forcedAspectRatio"] > 0) {
if (w / h < Module["forcedAspectRatio"]) {
w = Math.round(h * Module["forcedAspectRatio"]);
} else {
h = Math.round(w / Module["forcedAspectRatio"]);
}
}
if ((document["fullscreenElement"] || document["mozFullScreenElement"] || document["msFullscreenElement"] || document["webkitFullscreenElement"] || document["webkitCurrentFullScreenElement"]) === canvas.parentNode && typeof screen != "undefined") {
var factor = Math.min(screen.width / w, screen.height / h);
w = Math.round(w * factor);
h = Math.round(h * factor);
}
if (Browser.resizeCanvas) {
if (canvas.width != w) canvas.width = w;
if (canvas.height != h) canvas.height = h;
if (typeof canvas.style != "undefined") {
canvas.style.removeProperty("width");
canvas.style.removeProperty("height");
}
} else {
if (canvas.width != wNative) canvas.width = wNative;
if (canvas.height != hNative) canvas.height = hNative;
if (typeof canvas.style != "undefined") {
if (w != wNative || h != hNative) {
canvas.style.setProperty("width", w + "px", "important");
canvas.style.setProperty("height", h + "px", "important");
} else {
canvas.style.removeProperty("width");
canvas.style.removeProperty("height");
}
}
}
},
wgetRequests: {},
nextWgetRequestHandle: 0,
getNextWgetRequestHandle: function() {
var handle = Browser.nextWgetRequestHandle;
Browser.nextWgetRequestHandle++;
return handle;
}
};
function _SDL_GetTicks() {
return Date.now() - SDL.startTime | 0;
}
function _SDL_LockSurface(surf) {
var surfData = SDL.surfaces[surf];
surfData.locked++;
if (surfData.locked > 1) return 0;
if (!surfData.buffer) {
surfData.buffer = _malloc(surfData.width * surfData.height * 4);
HEAP32[surf + 20 >> 2] = surfData.buffer;
}
HEAP32[surf + 20 >> 2] = surfData.buffer;
if (surf == SDL.screen && Module.screenIsReadOnly && surfData.image) return 0;
if (SDL.defaults.discardOnLock) {
if (!surfData.image) {
surfData.image = surfData.ctx.createImageData(surfData.width, surfData.height);
}
if (!SDL.defaults.opaqueFrontBuffer) return;
} else {
surfData.image = surfData.ctx.getImageData(0, 0, surfData.width, surfData.height);
}
if (surf == SDL.screen && SDL.defaults.opaqueFrontBuffer) {
var data = surfData.image.data;
var num = data.length;
for (var i = 0; i < num / 4; i++) {
data[i * 4 + 3] = 255;
}
}
if (SDL.defaults.copyOnLock && !SDL.defaults.discardOnLock) {
if (surfData.isFlagSet(2097152)) {
throw "CopyOnLock is not supported for SDL_LockSurface with SDL_HWPALETTE flag set" + new Error().stack;
} else {
HEAPU8.set(surfData.image.data, surfData.buffer);
}
}
return 0;
}
var SDL = {
defaults: {
width: 320,
height: 200,
copyOnLock: false,
discardOnLock: true,
opaqueFrontBuffer: false
},
version: null,
surfaces: {},
canvasPool: [],
events: [],
fonts: [ null ],
audios: [ null ],
rwops: [ null ],
music: {
audio: null,
volume: 1
},
mixerFrequency: 22050,
mixerFormat: 32784,
mixerNumChannels: 2,
mixerChunkSize: 1024,
channelMinimumNumber: 0,
GL: false,
glAttributes: {
0: 3,
1: 3,
2: 2,
3: 0,
4: 0,
5: 1,
6: 16,
7: 0,
8: 0,
9: 0,
10: 0,
11: 0,
12: 0,
13: 0,
14: 0,
15: 1,
16: 0,
17: 0,
18: 0
},
keyboardState: null,
keyboardMap: {},
canRequestFullscreen: false,
isRequestingFullscreen: false,
textInput: false,
startTime: null,
initFlags: 0,
buttonState: 0,
modState: 0,
DOMButtons: [ 0, 0, 0 ],
DOMEventToSDLEvent: {},
TOUCH_DEFAULT_ID: 0,
eventHandler: null,
eventHandlerContext: null,
eventHandlerTemp: 0,
keyCodes: {
16: 1249,
17: 1248,
18: 1250,
20: 1081,
33: 1099,
34: 1102,
35: 1101,
36: 1098,
37: 1104,
38: 1106,
39: 1103,
40: 1105,
44: 316,
45: 1097,
46: 127,
91: 1251,
93: 1125,
96: 1122,
97: 1113,
98: 1114,
99: 1115,
100: 1116,
101: 1117,
102: 1118,
103: 1119,
104: 1120,
105: 1121,
106: 1109,
107: 1111,
109: 1110,
110: 1123,
111: 1108,
112: 1082,
113: 1083,
114: 1084,
115: 1085,
116: 1086,
117: 1087,
118: 1088,
119: 1089,
120: 1090,
121: 1091,
122: 1092,
123: 1093,
124: 1128,
125: 1129,
126: 1130,
127: 1131,
128: 1132,
129: 1133,
130: 1134,
131: 1135,
132: 1136,
133: 1137,
134: 1138,
135: 1139,
144: 1107,
160: 94,
161: 33,
162: 34,
163: 35,
164: 36,
165: 37,
166: 38,
167: 95,
168: 40,
169: 41,
170: 42,
171: 43,
172: 124,
173: 45,
174: 123,
175: 125,
176: 126,
181: 127,
182: 129,
183: 128,
188: 44,
190: 46,
191: 47,
192: 96,
219: 91,
220: 92,
221: 93,
222: 39,
224: 1251
},
scanCodes: {
8: 42,
9: 43,
13: 40,
27: 41,
32: 44,
35: 204,
39: 53,
44: 54,
46: 55,
47: 56,
48: 39,
49: 30,
50: 31,
51: 32,
52: 33,
53: 34,
54: 35,
55: 36,
56: 37,
57: 38,
58: 203,
59: 51,
61: 46,
91: 47,
92: 49,
93: 48,
96: 52,
97: 4,
98: 5,
99: 6,
100: 7,
101: 8,
102: 9,
103: 10,
104: 11,
105: 12,
106: 13,
107: 14,
108: 15,
109: 16,
110: 17,
111: 18,
112: 19,
113: 20,
114: 21,
115: 22,
116: 23,
117: 24,
118: 25,
119: 26,
120: 27,
121: 28,
122: 29,
127: 76,
305: 224,
308: 226,
316: 70
},
loadRect: function(rect) {
return {
x: HEAP32[rect + 0 >> 2],
y: HEAP32[rect + 4 >> 2],
w: HEAP32[rect + 8 >> 2],
h: HEAP32[rect + 12 >> 2]
};
},
updateRect: function(rect, r) {
HEAP32[rect >> 2] = r.x;
HEAP32[rect + 4 >> 2] = r.y;
HEAP32[rect + 8 >> 2] = r.w;
HEAP32[rect + 12 >> 2] = r.h;
},
intersectionOfRects: function(first, second) {
var leftX = Math.max(first.x, second.x);
var leftY = Math.max(first.y, second.y);
var rightX = Math.min(first.x + first.w, second.x + second.w);
var rightY = Math.min(first.y + first.h, second.y + second.h);
return {
x: leftX,
y: leftY,
w: Math.max(leftX, rightX) - leftX,
h: Math.max(leftY, rightY) - leftY
};
},
checkPixelFormat: function(fmt) {},
loadColorToCSSRGB: function(color) {
var rgba = HEAP32[color >> 2];
return "rgb(" + (rgba & 255) + "," + (rgba >> 8 & 255) + "," + (rgba >> 16 & 255) + ")";
},
loadColorToCSSRGBA: function(color) {
var rgba = HEAP32[color >> 2];
return "rgba(" + (rgba & 255) + "," + (rgba >> 8 & 255) + "," + (rgba >> 16 & 255) + "," + (rgba >> 24 & 255) / 255 + ")";
},
translateColorToCSSRGBA: function(rgba) {
return "rgba(" + (rgba & 255) + "," + (rgba >> 8 & 255) + "," + (rgba >> 16 & 255) + "," + (rgba >>> 24) / 255 + ")";
},
translateRGBAToCSSRGBA: function(r, g, b, a) {
return "rgba(" + (r & 255) + "," + (g & 255) + "," + (b & 255) + "," + (a & 255) / 255 + ")";
},
translateRGBAToColor: function(r, g, b, a) {
return r | g << 8 | b << 16 | a << 24;
},
makeSurface: function(width, height, flags, usePageCanvas, source, rmask, gmask, bmask, amask) {
flags = flags || 0;
var is_SDL_HWSURFACE = flags & 1;
var is_SDL_HWPALETTE = flags & 2097152;
var is_SDL_OPENGL = flags & 67108864;
var surf = _malloc(60);
var pixelFormat = _malloc(44);
var bpp = is_SDL_HWPALETTE ? 1 : 4;
var buffer = 0;
if (!is_SDL_HWSURFACE && !is_SDL_OPENGL) {
buffer = _malloc(width * height * 4);
}
HEAP32[surf >> 2] = flags;
HEAP32[surf + 4 >> 2] = pixelFormat;
HEAP32[surf + 8 >> 2] = width;
HEAP32[surf + 12 >> 2] = height;
HEAP32[surf + 16 >> 2] = width * bpp;
HEAP32[surf + 20 >> 2] = buffer;
HEAP32[surf + 36 >> 2] = 0;
HEAP32[surf + 40 >> 2] = 0;
HEAP32[surf + 44 >> 2] = Module["canvas"].width;
HEAP32[surf + 48 >> 2] = Module["canvas"].height;
HEAP32[surf + 56 >> 2] = 1;
HEAP32[pixelFormat >> 2] = -2042224636;
HEAP32[pixelFormat + 4 >> 2] = 0;
HEAP8[pixelFormat + 8 >> 0] = bpp * 8;
HEAP8[pixelFormat + 9 >> 0] = bpp;
HEAP32[pixelFormat + 12 >> 2] = rmask || 255;
HEAP32[pixelFormat + 16 >> 2] = gmask || 65280;
HEAP32[pixelFormat + 20 >> 2] = bmask || 16711680;
HEAP32[pixelFormat + 24 >> 2] = amask || 4278190080;
SDL.GL = SDL.GL || is_SDL_OPENGL;
var canvas;
if (!usePageCanvas) {
if (SDL.canvasPool.length > 0) {
canvas = SDL.canvasPool.pop();
} else {
canvas = document.createElement("canvas");
}
canvas.width = width;
canvas.height = height;
} else {
canvas = Module["canvas"];
}
var webGLContextAttributes = {
antialias: SDL.glAttributes[13] != 0 && SDL.glAttributes[14] > 1,
depth: SDL.glAttributes[6] > 0,
stencil: SDL.glAttributes[7] > 0,
alpha: SDL.glAttributes[3] > 0
};
var ctx = Browser.createContext(canvas, is_SDL_OPENGL, usePageCanvas, webGLContextAttributes);
SDL.surfaces[surf] = {
width: width,
height: height,
canvas: canvas,
ctx: ctx,
surf: surf,
buffer: buffer,
pixelFormat: pixelFormat,
alpha: 255,
flags: flags,
locked: 0,
usePageCanvas: usePageCanvas,
source: source,
isFlagSet: function(flag) {
return flags & flag;
}
};
return surf;
},
copyIndexedColorData: function(surfData, rX, rY, rW, rH) {
if (!surfData.colors) {
return;
}
var fullWidth = Module["canvas"].width;
var fullHeight = Module["canvas"].height;
var startX = rX || 0;
var startY = rY || 0;
var endX = (rW || fullWidth - startX) + startX;
var endY = (rH || fullHeight - startY) + startY;
var buffer = surfData.buffer;
if (!surfData.image.data32) {
surfData.image.data32 = new Uint32Array(surfData.image.data.buffer);
}
var data32 = surfData.image.data32;
var colors32 = surfData.colors32;
for (var y = startY; y < endY; ++y) {
var base = y * fullWidth;
for (var x = startX; x < endX; ++x) {
data32[base + x] = colors32[HEAPU8[buffer + base + x >> 0]];
}
}
},
freeSurface: function(surf) {
var refcountPointer = surf + 56;
var refcount = HEAP32[refcountPointer >> 2];
if (refcount > 1) {
HEAP32[refcountPointer >> 2] = refcount - 1;
return;
}
var info = SDL.surfaces[surf];
if (!info.usePageCanvas && info.canvas) SDL.canvasPool.push(info.canvas);
if (info.buffer) _free(info.buffer);
_free(info.pixelFormat);
_free(surf);
SDL.surfaces[surf] = null;
if (surf === SDL.screen) {
SDL.screen = null;
}
},
blitSurface: function(src, srcrect, dst, dstrect, scale) {
var srcData = SDL.surfaces[src];
var dstData = SDL.surfaces[dst];
var sr, dr;
if (srcrect) {
sr = SDL.loadRect(srcrect);
} else {
sr = {
x: 0,
y: 0,
w: srcData.width,
h: srcData.height
};
}
if (dstrect) {
dr = SDL.loadRect(dstrect);
} else {
dr = {
x: 0,
y: 0,
w: srcData.width,
h: srcData.height
};
}
if (dstData.clipRect) {
var widthScale = !scale || sr.w === 0 ? 1 : sr.w / dr.w;
var heightScale = !scale || sr.h === 0 ? 1 : sr.h / dr.h;
dr = SDL.intersectionOfRects(dstData.clipRect, dr);
sr.w = dr.w * widthScale;
sr.h = dr.h * heightScale;
if (dstrect) {
SDL.updateRect(dstrect, dr);
}
}
var blitw, blith;
if (scale) {
blitw = dr.w;
blith = dr.h;
} else {
blitw = sr.w;
blith = sr.h;
}
if (sr.w === 0 || sr.h === 0 || blitw === 0 || blith === 0) {
return 0;
}
var oldAlpha = dstData.ctx.globalAlpha;
dstData.ctx.globalAlpha = srcData.alpha / 255;
dstData.ctx.drawImage(srcData.canvas, sr.x, sr.y, sr.w, sr.h, dr.x, dr.y, blitw, blith);
dstData.ctx.globalAlpha = oldAlpha;
if (dst != SDL.screen) {
warnOnce("WARNING: copying canvas data to memory for compatibility");
_SDL_LockSurface(dst);
dstData.locked--;
}
return 0;
},
downFingers: {},
savedKeydown: null,
receiveEvent: function(event) {
function unpressAllPressedKeys() {
for (var code in SDL.keyboardMap) {
SDL.events.push({
type: "keyup",
keyCode: SDL.keyboardMap[code]
});
}
}
switch (event.type) {
case "touchstart":
case "touchmove":
{
event.preventDefault();
var touches = [];
if (event.type === "touchstart") {
for (var i = 0; i < event.touches.length; i++) {
var touch = event.touches[i];
if (SDL.downFingers[touch.identifier] != true) {
SDL.downFingers[touch.identifier] = true;
touches.push(touch);
}
}
} else {
touches = event.touches;
}
var firstTouch = touches[0];
if (firstTouch) {
if (event.type == "touchstart") {
SDL.DOMButtons[0] = 1;
}
var mouseEventType;
switch (event.type) {
case "touchstart":
mouseEventType = "mousedown";
break;
case "touchmove":
mouseEventType = "mousemove";
break;
}
var mouseEvent = {
type: mouseEventType,
button: 0,
pageX: firstTouch.clientX,
pageY: firstTouch.clientY
};
SDL.events.push(mouseEvent);
}
for (var i = 0; i < touches.length; i++) {
var touch = touches[i];
SDL.events.push({
type: event.type,
touch: touch
});
}
break;
}
case "touchend":
{
event.preventDefault();
for (var i = 0; i < event.changedTouches.length; i++) {
var touch = event.changedTouches[i];
if (SDL.downFingers[touch.identifier] === true) {
delete SDL.downFingers[touch.identifier];
}
}
var mouseEvent = {
type: "mouseup",
button: 0,
pageX: event.changedTouches[0].clientX,
pageY: event.changedTouches[0].clientY
};
SDL.DOMButtons[0] = 0;
SDL.events.push(mouseEvent);
for (var i = 0; i < event.changedTouches.length; i++) {
var touch = event.changedTouches[i];
SDL.events.push({
type: "touchend",
touch: touch
});
}
break;
}
case "DOMMouseScroll":
case "mousewheel":
case "wheel":
var delta = -Browser.getMouseWheelDelta(event);
delta = delta == 0 ? 0 : delta > 0 ? Math.max(delta, 1) : Math.min(delta, -1);
var button = delta > 0 ? 3 : 4;
SDL.events.push({
type: "mousedown",
button: button,
pageX: event.pageX,
pageY: event.pageY
});
SDL.events.push({
type: "mouseup",
button: button,
pageX: event.pageX,
pageY: event.pageY
});
SDL.events.push({
type: "wheel",
deltaX: 0,
deltaY: delta
});
event.preventDefault();
break;
case "mousemove":
if (SDL.DOMButtons[0] === 1) {
SDL.events.push({
type: "touchmove",
touch: {
identifier: 0,
deviceID: -1,
pageX: event.pageX,
pageY: event.pageY
}
});
}
if (Browser.pointerLock) {
if ("mozMovementX" in event) {
event["movementX"] = event["mozMovementX"];
event["movementY"] = event["mozMovementY"];
}
if (event["movementX"] == 0 && event["movementY"] == 0) {
event.preventDefault();
return;
}
}
case "keydown":
case "keyup":
case "keypress":
case "mousedown":
case "mouseup":
if (event.type !== "keydown" || !SDL.unicode && !SDL.textInput || (event.keyCode === 8 || event.keyCode === 9)) {}
if (event.type == "mousedown") {
SDL.DOMButtons[event.button] = 1;
SDL.events.push({
type: "touchstart",
touch: {
identifier: 0,
deviceID: -1,
pageX: event.pageX,
pageY: event.pageY
}
});
} else if (event.type == "mouseup") {
if (!SDL.DOMButtons[event.button]) {
return;
}
SDL.events.push({
type: "touchend",
touch: {
identifier: 0,
deviceID: -1,
pageX: event.pageX,
pageY: event.pageY
}
});
SDL.DOMButtons[event.button] = 0;
}
if (event.type === "keydown" || event.type === "mousedown") {
SDL.canRequestFullscreen = true;
} else if (event.type === "keyup" || event.type === "mouseup") {
if (SDL.isRequestingFullscreen) {
Module["requestFullscreen"](false, true);
SDL.isRequestingFullscreen = false;
}
SDL.canRequestFullscreen = false;
}
if (event.type === "keypress" && SDL.savedKeydown) {
SDL.savedKeydown.keypressCharCode = event.charCode;
SDL.savedKeydown = null;
} else if (event.type === "keydown") {
SDL.savedKeydown = event;
}
if (event.type !== "keypress" || SDL.textInput) {
SDL.events.push(event);
}
break;
case "mouseout":
for (var i = 0; i < 3; i++) {
if (SDL.DOMButtons[i]) {
SDL.events.push({
type: "mouseup",
button: i,
pageX: event.pageX,
pageY: event.pageY
});
SDL.DOMButtons[i] = 0;
}
}
event.preventDefault();
break;
case "focus":
SDL.events.push(event);
event.preventDefault();
break;
case "blur":
SDL.events.push(event);
unpressAllPressedKeys();
event.preventDefault();
break;
case "visibilitychange":
SDL.events.push({
type: "visibilitychange",
visible: !document.hidden
});
unpressAllPressedKeys();
event.preventDefault();
break;
case "unload":
if (Browser.mainLoop.runner) {
SDL.events.push(event);
Browser.mainLoop.runner();
}
return;
case "resize":
SDL.events.push(event);
if (event.preventDefault) {
event.preventDefault();
}
break;
}
if (SDL.events.length >= 1e4) {
err("SDL event queue full, dropping events");
SDL.events = SDL.events.slice(0, 1e4);
}
SDL.flushEventsToHandler();
return;
},
lookupKeyCodeForEvent: function(event) {
var code = event.keyCode;
if (code >= 65 && code <= 90) {
code += 32;
} else {
code = SDL.keyCodes[event.keyCode] || event.keyCode;
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_RIGHT && code >= (224 | 1 << 10) && code <= (227 | 1 << 10)) {
code += 4;
}
}
return code;
},
handleEvent: function(event) {
if (event.handled) return;
event.handled = true;
switch (event.type) {
case "touchstart":
case "touchend":
case "touchmove":
{
Browser.calculateMouseEvent(event);
break;
}
case "keydown":
case "keyup":
{
var down = event.type === "keydown";
var code = SDL.lookupKeyCodeForEvent(event);
HEAP8[SDL.keyboardState + code >> 0] = down;
SDL.modState = (HEAP8[SDL.keyboardState + 1248 >> 0] ? 64 : 0) | (HEAP8[SDL.keyboardState + 1249 >> 0] ? 1 : 0) | (HEAP8[SDL.keyboardState + 1250 >> 0] ? 256 : 0) | (HEAP8[SDL.keyboardState + 1252 >> 0] ? 128 : 0) | (HEAP8[SDL.keyboardState + 1253 >> 0] ? 2 : 0) | (HEAP8[SDL.keyboardState + 1254 >> 0] ? 512 : 0);
if (down) {
SDL.keyboardMap[code] = event.keyCode;
} else {
delete SDL.keyboardMap[code];
}
break;
}
case "mousedown":
case "mouseup":
if (event.type == "mousedown") {
SDL.buttonState |= 1 << event.button;
} else if (event.type == "mouseup") {
SDL.buttonState &= ~(1 << event.button);
}
case "mousemove":
{
Browser.calculateMouseEvent(event);
break;
}
}
},
flushEventsToHandler: function() {
if (!SDL.eventHandler) return;
while (SDL.pollEvent(SDL.eventHandlerTemp)) {
Module["dynCall_iii"](SDL.eventHandler, SDL.eventHandlerContext, SDL.eventHandlerTemp);
}
},
pollEvent: function(ptr) {
if (SDL.initFlags & 512 && SDL.joystickEventState) {
SDL.queryJoysticks();
}
if (ptr) {
while (SDL.events.length > 0) {
if (SDL.makeCEvent(SDL.events.shift(), ptr) !== false) return 1;
}
return 0;
} else {
return SDL.events.length > 0;
}
},
makeCEvent: function(event, ptr) {
if (typeof event === "number") {
_memcpy(ptr, event, 28);
_free(event);
return;
}
SDL.handleEvent(event);
switch (event.type) {
case "keydown":
case "keyup":
{
var down = event.type === "keydown";
var key = SDL.lookupKeyCodeForEvent(event);
var scan;
if (key >= 1024) {
scan = key - 1024;
} else {
scan = SDL.scanCodes[key] || key;
}
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP8[ptr + 8 >> 0] = down ? 1 : 0;
HEAP8[ptr + 9 >> 0] = 0;
HEAP32[ptr + 12 >> 2] = scan;
HEAP32[ptr + 16 >> 2] = key;
HEAP16[ptr + 20 >> 1] = SDL.modState;
HEAP32[ptr + 24 >> 2] = event.keypressCharCode || key;
break;
}
case "keypress":
{
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
var cStr = intArrayFromString(String.fromCharCode(event.charCode));
for (var i = 0; i < cStr.length; ++i) {
HEAP8[ptr + (8 + i) >> 0] = cStr[i];
}
break;
}
case "mousedown":
case "mouseup":
case "mousemove":
{
if (event.type != "mousemove") {
var down = event.type === "mousedown";
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 4 >> 2] = 0;
HEAP32[ptr + 8 >> 2] = 0;
HEAP32[ptr + 12 >> 2] = 0;
HEAP8[ptr + 16 >> 0] = event.button + 1;
HEAP8[ptr + 17 >> 0] = down ? 1 : 0;
HEAP32[ptr + 20 >> 2] = Browser.mouseX;
HEAP32[ptr + 24 >> 2] = Browser.mouseY;
} else {
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 4 >> 2] = 0;
HEAP32[ptr + 8 >> 2] = 0;
HEAP32[ptr + 12 >> 2] = 0;
HEAP32[ptr + 16 >> 2] = SDL.buttonState;
HEAP32[ptr + 20 >> 2] = Browser.mouseX;
HEAP32[ptr + 24 >> 2] = Browser.mouseY;
HEAP32[ptr + 28 >> 2] = Browser.mouseMovementX;
HEAP32[ptr + 32 >> 2] = Browser.mouseMovementY;
}
break;
}
case "wheel":
{
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 16 >> 2] = event.deltaX;
HEAP32[ptr + 20 >> 2] = event.deltaY;
break;
}
case "touchstart":
case "touchend":
case "touchmove":
{
var touch = event.touch;
if (!Browser.touches[touch.identifier]) break;
var w = Module["canvas"].width;
var h = Module["canvas"].height;
var x = Browser.touches[touch.identifier].x / w;
var y = Browser.touches[touch.identifier].y / h;
var lx = Browser.lastTouches[touch.identifier].x / w;
var ly = Browser.lastTouches[touch.identifier].y / h;
var dx = x - lx;
var dy = y - ly;
if (touch["deviceID"] === undefined) touch.deviceID = SDL.TOUCH_DEFAULT_ID;
if (dx === 0 && dy === 0 && event.type === "touchmove") return false;
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 4 >> 2] = _SDL_GetTicks();
tempI64 = [ touch.deviceID >>> 0, (tempDouble = touch.deviceID, +Math_abs(tempDouble) >= +1 ? tempDouble > +0 ? (Math_min(+Math_floor(tempDouble / +4294967296), +4294967295) | 0) >>> 0 : ~~+Math_ceil((tempDouble - +(~~tempDouble >>> 0)) / +4294967296) >>> 0 : 0) ],
HEAP32[ptr + 8 >> 2] = tempI64[0], HEAP32[ptr + 12 >> 2] = tempI64[1];
tempI64 = [ touch.identifier >>> 0, (tempDouble = touch.identifier, +Math_abs(tempDouble) >= +1 ? tempDouble > +0 ? (Math_min(+Math_floor(tempDouble / +4294967296), +4294967295) | 0) >>> 0 : ~~+Math_ceil((tempDouble - +(~~tempDouble >>> 0)) / +4294967296) >>> 0 : 0) ],
HEAP32[ptr + 16 >> 2] = tempI64[0], HEAP32[ptr + 20 >> 2] = tempI64[1];
HEAPF32[ptr + 24 >> 2] = x;
HEAPF32[ptr + 28 >> 2] = y;
HEAPF32[ptr + 32 >> 2] = dx;
HEAPF32[ptr + 36 >> 2] = dy;
if (touch.force !== undefined) {
HEAPF32[ptr + 40 >> 2] = touch.force;
} else {
HEAPF32[ptr + 40 >> 2] = event.type == "touchend" ? 0 : 1;
}
break;
}
case "unload":
{
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
break;
}
case "resize":
{
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 4 >> 2] = event.w;
HEAP32[ptr + 8 >> 2] = event.h;
break;
}
case "joystick_button_up":
case "joystick_button_down":
{
var state = event.type === "joystick_button_up" ? 0 : 1;
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP8[ptr + 4 >> 0] = event.index;
HEAP8[ptr + 5 >> 0] = event.button;
HEAP8[ptr + 6 >> 0] = state;
break;
}
case "joystick_axis_motion":
{
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP8[ptr + 4 >> 0] = event.index;
HEAP8[ptr + 5 >> 0] = event.axis;
HEAP32[ptr + 8 >> 2] = SDL.joystickAxisValueConversion(event.value);
break;
}
case "focus":
{
var SDL_WINDOWEVENT_FOCUS_GAINED = 12;
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 4 >> 2] = 0;
HEAP8[ptr + 8 >> 0] = SDL_WINDOWEVENT_FOCUS_GAINED;
break;
}
case "blur":
{
var SDL_WINDOWEVENT_FOCUS_LOST = 13;
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 4 >> 2] = 0;
HEAP8[ptr + 8 >> 0] = SDL_WINDOWEVENT_FOCUS_LOST;
break;
}
case "visibilitychange":
{
var SDL_WINDOWEVENT_SHOWN = 1;
var SDL_WINDOWEVENT_HIDDEN = 2;
var visibilityEventID = event.visible ? SDL_WINDOWEVENT_SHOWN : SDL_WINDOWEVENT_HIDDEN;
HEAP32[ptr >> 2] = SDL.DOMEventToSDLEvent[event.type];
HEAP32[ptr + 4 >> 2] = 0;
HEAP8[ptr + 8 >> 0] = visibilityEventID;
break;
}
default:
throw "Unhandled SDL event: " + event.type;
}
},
makeFontString: function(height, fontName) {
if (fontName.charAt(0) != "'" && fontName.charAt(0) != '"') {
fontName = '"' + fontName + '"';
}
return height + "px " + fontName + ", serif";
},
estimateTextWidth: function(fontData, text) {
var h = fontData.size;
var fontString = SDL.makeFontString(h, fontData.name);
var tempCtx = SDL.ttfContext;
tempCtx.save();
tempCtx.font = fontString;
var ret = tempCtx.measureText(text).width | 0;
tempCtx.restore();
return ret;
},
allocateChannels: function(num) {
if (SDL.numChannels && SDL.numChannels >= num && num != 0) return;
SDL.numChannels = num;
SDL.channels = [];
for (var i = 0; i < num; i++) {
SDL.channels[i] = {
audio: null,
volume: 1
};
}
},
setGetVolume: function(info, volume) {
if (!info) return 0;
var ret = info.volume * 128;
if (volume != -1) {
info.volume = Math.min(Math.max(volume, 0), 128) / 128;
if (info.audio) {
try {
info.audio.volume = info.volume;
if (info.audio.webAudioGainNode) info.audio.webAudioGainNode["gain"]["value"] = info.volume;
} catch (e) {
err("setGetVolume failed to set audio volume: " + e);
}
}
}
return ret;
},
setPannerPosition: function(info, x, y, z) {
if (!info) return;
if (info.audio) {
if (info.audio.webAudioPannerNode) {
info.audio.webAudioPannerNode["setPosition"](x, y, z);
}
}
},
playWebAudio: function(audio) {
if (!audio) return;
if (audio.webAudioNode) return;
if (!SDL.webAudioAvailable()) return;
try {
var webAudio = audio.resource.webAudio;
audio.paused = false;
if (!webAudio.decodedBuffer) {
if (webAudio.onDecodeComplete === undefined) abort("Cannot play back audio object that was not loaded");
webAudio.onDecodeComplete.push(function() {
if (!audio.paused) SDL.playWebAudio(audio);
});
return;
}
audio.webAudioNode = SDL.audioContext["createBufferSource"]();
audio.webAudioNode["buffer"] = webAudio.decodedBuffer;
audio.webAudioNode["loop"] = audio.loop;
audio.webAudioNode["onended"] = function() {
audio["onended"]();
};
audio.webAudioPannerNode = SDL.audioContext["createPanner"]();
audio.webAudioPannerNode["setPosition"](0, 0, -.5);
audio.webAudioPannerNode["panningModel"] = "equalpower";
audio.webAudioGainNode = SDL.audioContext["createGain"]();
audio.webAudioGainNode["gain"]["value"] = audio.volume;
audio.webAudioNode["connect"](audio.webAudioPannerNode);
audio.webAudioPannerNode["connect"](audio.webAudioGainNode);
audio.webAudioGainNode["connect"](SDL.audioContext["destination"]);
audio.webAudioNode["start"](0, audio.currentPosition);
audio.startTime = SDL.audioContext["currentTime"] - audio.currentPosition;
} catch (e) {
err("playWebAudio failed: " + e);
}
},
pauseWebAudio: function(audio) {
if (!audio) return;
if (audio.webAudioNode) {
try {
audio.currentPosition = (SDL.audioContext["currentTime"] - audio.startTime) % audio.resource.webAudio.decodedBuffer.duration;
audio.webAudioNode["onended"] = undefined;
audio.webAudioNode.stop(0);
audio.webAudioNode = undefined;
} catch (e) {
err("pauseWebAudio failed: " + e);
}
}
audio.paused = true;
},
openAudioContext: function() {
if (!SDL.audioContext) {
if (typeof AudioContext !== "undefined") SDL.audioContext = new AudioContext(); else if (typeof webkitAudioContext !== "undefined") SDL.audioContext = new webkitAudioContext();
}
},
webAudioAvailable: function() {
return !!SDL.audioContext;
},
fillWebAudioBufferFromHeap: function(heapPtr, sizeSamplesPerChannel, dstAudioBuffer) {
var numChannels = SDL.audio.channels;
for (var c = 0; c < numChannels; ++c) {
var channelData = dstAudioBuffer["getChannelData"](c);
if (channelData.length != sizeSamplesPerChannel) {
throw "Web Audio output buffer length mismatch! Destination size: " + channelData.length + " samples vs expected " + sizeSamplesPerChannel + " samples!";
}
if (SDL.audio.format == 32784) {
for (var j = 0; j < sizeSamplesPerChannel; ++j) {
channelData[j] = HEAP16[heapPtr + (j * numChannels + c) * 2 >> 1] / 32768;
}
} else if (SDL.audio.format == 8) {
for (var j = 0; j < sizeSamplesPerChannel; ++j) {
var v = HEAP8[heapPtr + (j * numChannels + c) >> 0];
channelData[j] = (v >= 0 ? v - 128 : v + 128) / 128;
}
} else if (SDL.audio.format == 33056) {
for (var j = 0; j < sizeSamplesPerChannel; ++j) {
channelData[j] = HEAPF32[heapPtr + (j * numChannels + c) * 4 >> 2];
}
} else {
throw "Invalid SDL audio format " + SDL.audio.format + "!";
}
}
},
debugSurface: function(surfData) {
console.log("dumping surface " + [ surfData.surf, surfData.source, surfData.width, surfData.height ]);
var image = surfData.ctx.getImageData(0, 0, surfData.width, surfData.height);
var data = image.data;
var num = Math.min(surfData.width, surfData.height);
for (var i = 0; i < num; i++) {
console.log(" diagonal " + i + ":" + [ data[i * surfData.width * 4 + i * 4 + 0], data[i * surfData.width * 4 + i * 4 + 1], data[i * surfData.width * 4 + i * 4 + 2], data[i * surfData.width * 4 + i * 4 + 3] ]);
}
},
joystickEventState: 1,
lastJoystickState: {},
joystickNamePool: {},
recordJoystickState: function(joystick, state) {
var buttons = new Array(state.buttons.length);
for (var i = 0; i < state.buttons.length; i++) {
buttons[i] = SDL.getJoystickButtonState(state.buttons[i]);
}
SDL.lastJoystickState[joystick] = {
buttons: buttons,
axes: state.axes.slice(0),
timestamp: state.timestamp,
index: state.index,
id: state.id
};
},
getJoystickButtonState: function(button) {
if (typeof button === "object") {
return button["pressed"];
} else {
return button > 0;
}
},
queryJoysticks: function() {
for (var joystick in SDL.lastJoystickState) {
var state = SDL.getGamepad(joystick - 1);
var prevState = SDL.lastJoystickState[joystick];
if (typeof state === "undefined") return;
if (state === null) return;
if (typeof state.timestamp !== "number" || state.timestamp !== prevState.timestamp || !state.timestamp) {
var i;
for (i = 0; i < state.buttons.length; i++) {
var buttonState = SDL.getJoystickButtonState(state.buttons[i]);
if (buttonState !== prevState.buttons[i]) {
SDL.events.push({
type: buttonState ? "joystick_button_down" : "joystick_button_up",
joystick: joystick,
index: joystick - 1,
button: i
});
}
}
for (i = 0; i < state.axes.length; i++) {
if (state.axes[i] !== prevState.axes[i]) {
SDL.events.push({
type: "joystick_axis_motion",
joystick: joystick,
index: joystick - 1,
axis: i,
value: state.axes[i]
});
}
}
SDL.recordJoystickState(joystick, state);
}
}
},
joystickAxisValueConversion: function(value) {
value = Math.min(1, Math.max(value, -1));
return Math.ceil((value + 1) * 32767.5 - 32768);
},
getGamepads: function() {
var fcn = navigator.getGamepads || navigator.webkitGamepads || navigator.mozGamepads || navigator.gamepads || navigator.webkitGetGamepads;
if (fcn !== undefined) {
return fcn.apply(navigator);
} else {
return [];
}
},
getGamepad: function(deviceIndex) {
var gamepads = SDL.getGamepads();
if (gamepads.length > deviceIndex && deviceIndex >= 0) {
return gamepads[deviceIndex];
}
return null;
}
};
function _SDL_ClearError() {}
function _SDL_GetError() {
if (!SDL.errorMessage) {
SDL.errorMessage = allocate(intArrayFromString("unknown SDL-emscripten error"), "i8", ALLOC_NORMAL);
}
return SDL.errorMessage;
}
function _SDL_GetModState() {
return SDL.modState;
}
function _SDL_GetMouseState(x, y) {
if (x) HEAP32[x >> 2] = Browser.mouseX;
if (y) HEAP32[y >> 2] = Browser.mouseY;
return SDL.buttonState;
}
function _SDL_GetWindowSize(window, width, height) {
var w = Module["canvas"].width;
var h = Module["canvas"].height;
if (width) HEAP32[width >> 2] = w;
if (height) HEAP32[height >> 2] = h;
}
function _SDL_Init(initFlags) {
SDL.startTime = Date.now();
SDL.initFlags = initFlags;
if (!Module["doNotCaptureKeyboard"]) {
var keyboardListeningElement = Module["keyboardListeningElement"] || document;
keyboardListeningElement.addEventListener("keydown", SDL.receiveEvent);
keyboardListeningElement.addEventListener("keyup", SDL.receiveEvent);
keyboardListeningElement.addEventListener("keypress", SDL.receiveEvent);
window.addEventListener("focus", SDL.receiveEvent);
window.addEventListener("blur", SDL.receiveEvent);
document.addEventListener("visibilitychange", SDL.receiveEvent);
}
window.addEventListener("unload", SDL.receiveEvent);
SDL.keyboardState = _malloc(65536);
_memset(SDL.keyboardState, 0, 65536);
SDL.DOMEventToSDLEvent["keydown"] = 768;
SDL.DOMEventToSDLEvent["keyup"] = 769;
SDL.DOMEventToSDLEvent["keypress"] = 771;
SDL.DOMEventToSDLEvent["mousedown"] = 1025;
SDL.DOMEventToSDLEvent["mouseup"] = 1026;
SDL.DOMEventToSDLEvent["mousemove"] = 1024;
SDL.DOMEventToSDLEvent["wheel"] = 1027;
SDL.DOMEventToSDLEvent["touchstart"] = 1792;
SDL.DOMEventToSDLEvent["touchend"] = 1793;
SDL.DOMEventToSDLEvent["touchmove"] = 1794;
SDL.DOMEventToSDLEvent["unload"] = 256;
SDL.DOMEventToSDLEvent["resize"] = 28673;
SDL.DOMEventToSDLEvent["visibilitychange"] = 512;
SDL.DOMEventToSDLEvent["focus"] = 512;
SDL.DOMEventToSDLEvent["blur"] = 512;
SDL.DOMEventToSDLEvent["joystick_axis_motion"] = 1536;
SDL.DOMEventToSDLEvent["joystick_button_down"] = 1539;
SDL.DOMEventToSDLEvent["joystick_button_up"] = 1540;
return 0;
}
function _SDL_LockAudio() {}
function _SDL_PollEvent(ptr) {
return SDL.pollEvent(ptr);
}
var GL = {
counter: 1,
lastError: 0,
buffers: [],
mappedBuffers: {},
programs: [],
framebuffers: [],
renderbuffers: [],
textures: [],
uniforms: [],
shaders: [],
vaos: [],
contexts: {},
currentContext: null,
offscreenCanvases: {},
timerQueriesEXT: [],
programInfos: {},
stringCache: {},
unpackAlignment: 4,
init: function() {
GL.miniTempBuffer = new Float32Array(GL.MINI_TEMP_BUFFER_SIZE);
for (var i = 0; i < GL.MINI_TEMP_BUFFER_SIZE; i++) {
GL.miniTempBufferViews[i] = GL.miniTempBuffer.subarray(0, i + 1);
}
},
recordError: function recordError(errorCode) {
if (!GL.lastError) {
GL.lastError = errorCode;
}
},
getNewId: function(table) {
var ret = GL.counter++;
for (var i = table.length; i < ret; i++) {
table[i] = null;
}
return ret;
},
MINI_TEMP_BUFFER_SIZE: 256,
miniTempBuffer: null,
miniTempBufferViews: [ 0 ],
getSource: function(shader, count, string, length) {
var source = "";
for (var i = 0; i < count; ++i) {
var len = length ? HEAP32[length + i * 4 >> 2] : -1;
source += UTF8ToString(HEAP32[string + i * 4 >> 2], len < 0 ? undefined : len);
}
return source;
},
createContext: function(canvas, webGLContextAttributes) {
var ctx = canvas.getContext("webgl", webGLContextAttributes) || canvas.getContext("experimental-webgl", webGLContextAttributes);
return ctx && GL.registerContext(ctx, webGLContextAttributes);
},
registerContext: function(ctx, webGLContextAttributes) {
var handle = _malloc(8);
var context = {
handle: handle,
attributes: webGLContextAttributes,
version: webGLContextAttributes.majorVersion,
GLctx: ctx
};
if (ctx.canvas) ctx.canvas.GLctxObject = context;
GL.contexts[handle] = context;
if (typeof webGLContextAttributes.enableExtensionsByDefault === "undefined" || webGLContextAttributes.enableExtensionsByDefault) {
GL.initExtensions(context);
}
return handle;
},
makeContextCurrent: function(contextHandle) {
GL.currentContext = GL.contexts[contextHandle];
Module.ctx = GLctx = GL.currentContext && GL.currentContext.GLctx;
return !(contextHandle && !GLctx);
},
getContext: function(contextHandle) {
return GL.contexts[contextHandle];
},
deleteContext: function(contextHandle) {
if (GL.currentContext === GL.contexts[contextHandle]) GL.currentContext = null;
if (typeof JSEvents === "object") JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);
if (GL.contexts[contextHandle] && GL.contexts[contextHandle].GLctx.canvas) GL.contexts[contextHandle].GLctx.canvas.GLctxObject = undefined;
_free(GL.contexts[contextHandle]);
GL.contexts[contextHandle] = null;
},
initExtensions: function(context) {
if (!context) context = GL.currentContext;
if (context.initExtensionsDone) return;
context.initExtensionsDone = true;
var GLctx = context.GLctx;
if (context.version < 2) {
var instancedArraysExt = GLctx.getExtension("ANGLE_instanced_arrays");
if (instancedArraysExt) {
GLctx["vertexAttribDivisor"] = function(index, divisor) {
instancedArraysExt["vertexAttribDivisorANGLE"](index, divisor);
};
GLctx["drawArraysInstanced"] = function(mode, first, count, primcount) {
instancedArraysExt["drawArraysInstancedANGLE"](mode, first, count, primcount);
};
GLctx["drawElementsInstanced"] = function(mode, count, type, indices, primcount) {
instancedArraysExt["drawElementsInstancedANGLE"](mode, count, type, indices, primcount);
};
}
var vaoExt = GLctx.getExtension("OES_vertex_array_object");
if (vaoExt) {
GLctx["createVertexArray"] = function() {
return vaoExt["createVertexArrayOES"]();
};
GLctx["deleteVertexArray"] = function(vao) {
vaoExt["deleteVertexArrayOES"](vao);
};
GLctx["bindVertexArray"] = function(vao) {
vaoExt["bindVertexArrayOES"](vao);
};
GLctx["isVertexArray"] = function(vao) {
return vaoExt["isVertexArrayOES"](vao);
};
}
var drawBuffersExt = GLctx.getExtension("WEBGL_draw_buffers");
if (drawBuffersExt) {
GLctx["drawBuffers"] = function(n, bufs) {
drawBuffersExt["drawBuffersWEBGL"](n, bufs);
};
}
}
GLctx.disjointTimerQueryExt = GLctx.getExtension("EXT_disjoint_timer_query");
var automaticallyEnabledExtensions = [ "OES_texture_float", "OES_texture_half_float", "OES_standard_derivatives", "OES_vertex_array_object", "WEBGL_compressed_texture_s3tc", "WEBGL_depth_texture", "OES_element_index_uint", "EXT_texture_filter_anisotropic", "EXT_frag_depth", "WEBGL_draw_buffers", "ANGLE_instanced_arrays", "OES_texture_float_linear", "OES_texture_half_float_linear", "EXT_blend_minmax", "EXT_shader_texture_lod", "WEBGL_compressed_texture_pvrtc", "EXT_color_buffer_half_float", "WEBGL_color_buffer_float", "EXT_sRGB", "WEBGL_compressed_texture_etc1", "EXT_disjoint_timer_query", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_astc", "EXT_color_buffer_float", "WEBGL_compressed_texture_s3tc_srgb", "EXT_disjoint_timer_query_webgl2" ];
var exts = GLctx.getSupportedExtensions();
if (exts && exts.length > 0) {
GLctx.getSupportedExtensions().forEach(function(ext) {
if (automaticallyEnabledExtensions.indexOf(ext) != -1) {
GLctx.getExtension(ext);
}
});
}
},
populateUniformTable: function(program) {
var p = GL.programs[program];
var ptable = GL.programInfos[program] = {
uniforms: {},
maxUniformLength: 0,
maxAttributeLength: -1,
maxUniformBlockNameLength: -1
};
var utable = ptable.uniforms;
var numUniforms = GLctx.getProgramParameter(p, 35718);
for (var i = 0; i < numUniforms; ++i) {
var u = GLctx.getActiveUniform(p, i);
var name = u.name;
ptable.maxUniformLength = Math.max(ptable.maxUniformLength, name.length + 1);
var ls = name.lastIndexOf("[");
if (ls > 0) {
name = name.slice(0, ls);
}
var loc = GLctx.getUniformLocation(p, name);
if (loc) {
var id = GL.getNewId(GL.uniforms);
utable[name] = [ u.size, id ];
GL.uniforms[id] = loc;
for (var j = 1; j < u.size; ++j) {
var n = name + "[" + j + "]";
loc = GLctx.getUniformLocation(p, n);
id = GL.getNewId(GL.uniforms);
GL.uniforms[id] = loc;
}
}
}
}
};
function _SDL_SetVideoMode(width, height, depth, flags) {
[ "touchstart", "touchend", "touchmove", "mousedown", "mouseup", "mousemove", "DOMMouseScroll", "mousewheel", "wheel", "mouseout" ].forEach(function(event) {
Module["canvas"].addEventListener(event, SDL.receiveEvent, true);
});
var canvas = Module["canvas"];
if (width == 0 && height == 0) {
width = canvas.width;
height = canvas.height;
}
if (!SDL.addedResizeListener) {
SDL.addedResizeListener = true;
Browser.resizeListeners.push(function(w, h) {
if (!SDL.settingVideoMode) {
SDL.receiveEvent({
type: "resize",
w: w,
h: h
});
}
});
}
SDL.settingVideoMode = true;
Browser.setCanvasSize(width, height);
SDL.settingVideoMode = false;
if (SDL.screen) {
SDL.freeSurface(SDL.screen);
assert(!SDL.screen);
}
if (SDL.GL) flags = flags | 67108864;
SDL.screen = SDL.makeSurface(width, height, flags, true, "screen");
return SDL.screen;
}
function _SDL_UnlockAudio() {}
function _SDL_UnlockSurface(surf) {
assert(!SDL.GL);
var surfData = SDL.surfaces[surf];
if (!surfData.locked || --surfData.locked > 0) {
return;
}
if (surfData.isFlagSet(2097152)) {
SDL.copyIndexedColorData(surfData);
} else if (!surfData.colors) {
var data = surfData.image.data;
var buffer = surfData.buffer;
assert(buffer % 4 == 0, "Invalid buffer offset: " + buffer);
var src = buffer >> 2;
var dst = 0;
var isScreen = surf == SDL.screen;
var num;
if (typeof CanvasPixelArray !== "undefined" && data instanceof CanvasPixelArray) {
num = data.length;
while (dst < num) {
var val = HEAP32[src];
data[dst] = val & 255;
data[dst + 1] = val >> 8 & 255;
data[dst + 2] = val >> 16 & 255;
data[dst + 3] = isScreen ? 255 : val >> 24 & 255;
src++;
dst += 4;
}
} else {
var data32 = new Uint32Array(data.buffer);
if (isScreen && SDL.defaults.opaqueFrontBuffer) {
num = data32.length;
data32.set(HEAP32.subarray(src, src + num));
var data8 = new Uint8Array(data.buffer);
var i = 3;
var j = i + 4 * num;
if (num % 8 == 0) {
while (i < j) {
data8[i] = 255;
i = i + 4 | 0;
data8[i] = 255;
i = i + 4 | 0;
data8[i] = 255;
i = i + 4 | 0;
data8[i] = 255;
i = i + 4 | 0;
data8[i] = 255;
i = i + 4 | 0;
data8[i] = 255;
i = i + 4 | 0;
data8[i] = 255;
i = i + 4 | 0;
data8[i] = 255;
i = i + 4 | 0;
}
} else {
while (i < j) {
data8[i] = 255;
i = i + 4 | 0;
}
}
} else {
data32.set(HEAP32.subarray(src, src + data32.length));
}
}
} else {
var width = Module["canvas"].width;
var height = Module["canvas"].height;
var s = surfData.buffer;
var data = surfData.image.data;
var colors = surfData.colors;
for (var y = 0; y < height; y++) {
var base = y * width * 4;
for (var x = 0; x < width; x++) {
var val = HEAPU8[s++ >> 0] * 4;
var start = base + x * 4;
data[start] = colors[val];
data[start + 1] = colors[val + 1];
data[start + 2] = colors[val + 2];
}
s += width * 3;
}
}
surfData.ctx.putImageData(surfData.image, 0, 0);
}
var ENV = {};
function ___buildEnvironment(environ) {
var MAX_ENV_VALUES = 64;
var TOTAL_ENV_SIZE = 1024;
var poolPtr;
var envPtr;
if (!___buildEnvironment.called) {
___buildEnvironment.called = true;
ENV["USER"] = ENV["LOGNAME"] = "web_user";
ENV["PATH"] = "/";
ENV["PWD"] = "/";
ENV["HOME"] = "/home/web_user";
ENV["LANG"] = "C.UTF-8";
ENV["_"] = Module["thisProgram"];
poolPtr = getMemory(TOTAL_ENV_SIZE);
envPtr = getMemory(MAX_ENV_VALUES * 4);
HEAP32[envPtr >> 2] = poolPtr;
HEAP32[environ >> 2] = envPtr;
} else {
envPtr = HEAP32[environ >> 2];
poolPtr = HEAP32[envPtr >> 2];
}
var strings = [];
var totalSize = 0;
for (var key in ENV) {
if (typeof ENV[key] === "string") {
var line = key + "=" + ENV[key];
strings.push(line);
totalSize += line.length;
}
}
if (totalSize > TOTAL_ENV_SIZE) {
throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");
}
var ptrSize = 4;
for (var i = 0; i < strings.length; i++) {
var line = strings[i];
writeAsciiToMemory(line, poolPtr);
HEAP32[envPtr + i * ptrSize >> 2] = poolPtr;
poolPtr += line.length + 1;
}
HEAP32[envPtr + strings.length * ptrSize >> 2] = 0;
}
function ___lock() {}
var ERRNO_CODES = {
EPERM: 1,
ENOENT: 2,
ESRCH: 3,
EINTR: 4,
EIO: 5,
ENXIO: 6,
E2BIG: 7,
ENOEXEC: 8,
EBADF: 9,
ECHILD: 10,
EAGAIN: 11,
EWOULDBLOCK: 11,
ENOMEM: 12,
EACCES: 13,
EFAULT: 14,
ENOTBLK: 15,
EBUSY: 16,
EEXIST: 17,
EXDEV: 18,
ENODEV: 19,
ENOTDIR: 20,
EISDIR: 21,
EINVAL: 22,
ENFILE: 23,
EMFILE: 24,
ENOTTY: 25,
ETXTBSY: 26,
EFBIG: 27,
ENOSPC: 28,
ESPIPE: 29,
EROFS: 30,
EMLINK: 31,
EPIPE: 32,
EDOM: 33,
ERANGE: 34,
ENOMSG: 42,
EIDRM: 43,
ECHRNG: 44,
EL2NSYNC: 45,
EL3HLT: 46,
EL3RST: 47,
ELNRNG: 48,
EUNATCH: 49,
ENOCSI: 50,
EL2HLT: 51,
EDEADLK: 35,
ENOLCK: 37,
EBADE: 52,
EBADR: 53,
EXFULL: 54,
ENOANO: 55,
EBADRQC: 56,
EBADSLT: 57,
EDEADLOCK: 35,
EBFONT: 59,
ENOSTR: 60,
ENODATA: 61,
ETIME: 62,
ENOSR: 63,
ENONET: 64,
ENOPKG: 65,
EREMOTE: 66,
ENOLINK: 67,
EADV: 68,
ESRMNT: 69,
ECOMM: 70,
EPROTO: 71,
EMULTIHOP: 72,
EDOTDOT: 73,
EBADMSG: 74,
ENOTUNIQ: 76,
EBADFD: 77,
EREMCHG: 78,
ELIBACC: 79,
ELIBBAD: 80,
ELIBSCN: 81,
ELIBMAX: 82,
ELIBEXEC: 83,
ENOSYS: 38,
ENOTEMPTY: 39,
ENAMETOOLONG: 36,
ELOOP: 40,
EOPNOTSUPP: 95,
EPFNOSUPPORT: 96,
ECONNRESET: 104,
ENOBUFS: 105,
EAFNOSUPPORT: 97,
EPROTOTYPE: 91,
ENOTSOCK: 88,
ENOPROTOOPT: 92,
ESHUTDOWN: 108,
ECONNREFUSED: 111,
EADDRINUSE: 98,
ECONNABORTED: 103,
ENETUNREACH: 101,
ENETDOWN: 100,
ETIMEDOUT: 110,
EHOSTDOWN: 112,
EHOSTUNREACH: 113,
EINPROGRESS: 115,
EALREADY: 114,
EDESTADDRREQ: 89,
EMSGSIZE: 90,
EPROTONOSUPPORT: 93,
ESOCKTNOSUPPORT: 94,
EADDRNOTAVAIL: 99,
ENETRESET: 102,
EISCONN: 106,
ENOTCONN: 107,
ETOOMANYREFS: 109,
EUSERS: 87,
EDQUOT: 122,
ESTALE: 116,
ENOTSUP: 95,
ENOMEDIUM: 123,
EILSEQ: 84,
EOVERFLOW: 75,
ECANCELED: 125,
ENOTRECOVERABLE: 131,
EOWNERDEAD: 130,
ESTRPIPE: 86
};
var SYSCALLS = {
DEFAULT_POLLMASK: 5,
mappings: {},
umask: 511,
calculateAt: function(dirfd, path) {
if (path[0] !== "/") {
var dir;
if (dirfd === -100) {
dir = FS.cwd();
} else {
var dirstream = FS.getStream(dirfd);
if (!dirstream) throw new FS.ErrnoError(ERRNO_CODES.EBADF);
dir = dirstream.path;
}
path = PATH.join2(dir, path);
}
return path;
},
doStat: function(func, path, buf) {
try {
var stat = func(path);
} catch (e) {
if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) {
return -ERRNO_CODES.ENOTDIR;
}
throw e;
}
HEAP32[buf >> 2] = stat.dev;
HEAP32[buf + 4 >> 2] = 0;
HEAP32[buf + 8 >> 2] = stat.ino;
HEAP32[buf + 12 >> 2] = stat.mode;
HEAP32[buf + 16 >> 2] = stat.nlink;
HEAP32[buf + 20 >> 2] = stat.uid;
HEAP32[buf + 24 >> 2] = stat.gid;
HEAP32[buf + 28 >> 2] = stat.rdev;
HEAP32[buf + 32 >> 2] = 0;
HEAP32[buf + 36 >> 2] = stat.size;
HEAP32[buf + 40 >> 2] = 4096;
HEAP32[buf + 44 >> 2] = stat.blocks;
HEAP32[buf + 48 >> 2] = stat.atime.getTime() / 1e3 | 0;
HEAP32[buf + 52 >> 2] = 0;
HEAP32[buf + 56 >> 2] = stat.mtime.getTime() / 1e3 | 0;
HEAP32[buf + 60 >> 2] = 0;
HEAP32[buf + 64 >> 2] = stat.ctime.getTime() / 1e3 | 0;
HEAP32[buf + 68 >> 2] = 0;
HEAP32[buf + 72 >> 2] = stat.ino;
return 0;
},
doMsync: function(addr, stream, len, flags) {
var buffer = new Uint8Array(HEAPU8.subarray(addr, addr + len));
FS.msync(stream, buffer, 0, len, flags);
},
doMkdir: function(path, mode) {
path = PATH.normalize(path);
if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1);
FS.mkdir(path, mode, 0);
return 0;
},
doMknod: function(path, mode, dev) {
switch (mode & 61440) {
case 32768:
case 8192:
case 24576:
case 4096:
case 49152:
break;
default:
return -ERRNO_CODES.EINVAL;
}
FS.mknod(path, mode, dev);
return 0;
},
doReadlink: function(path, buf, bufsize) {
if (bufsize <= 0) return -ERRNO_CODES.EINVAL;
var ret = FS.readlink(path);
var len = Math.min(bufsize, lengthBytesUTF8(ret));
var endChar = HEAP8[buf + len];
stringToUTF8(ret, buf, bufsize + 1);
HEAP8[buf + len] = endChar;
return len;
},
doAccess: function(path, amode) {
if (amode & ~7) {
return -ERRNO_CODES.EINVAL;
}
var node;
var lookup = FS.lookupPath(path, {
follow: true
});
node = lookup.node;
var perms = "";
if (amode & 4) perms += "r";
if (amode & 2) perms += "w";
if (amode & 1) perms += "x";
if (perms && FS.nodePermissions(node, perms)) {
return -ERRNO_CODES.EACCES;
}
return 0;
},
doDup: function(path, flags, suggestFD) {
var suggest = FS.getStream(suggestFD);
if (suggest) FS.close(suggest);
return FS.open(path, flags, 0, suggestFD, suggestFD).fd;
},
doReadv: function(stream, iov, iovcnt, offset) {
var ret = 0;
for (var i = 0; i < iovcnt; i++) {
var ptr = HEAP32[iov + i * 8 >> 2];
var len = HEAP32[iov + (i * 8 + 4) >> 2];
var curr = FS.read(stream, HEAP8, ptr, len, offset);
if (curr < 0) return -1;
ret += curr;
if (curr < len) break;
}
return ret;
},
doWritev: function(stream, iov, iovcnt, offset) {
var ret = 0;
for (var i = 0; i < iovcnt; i++) {
var ptr = HEAP32[iov + i * 8 >> 2];
var len = HEAP32[iov + (i * 8 + 4) >> 2];
var curr = FS.write(stream, HEAP8, ptr, len, offset);
if (curr < 0) return -1;
ret += curr;
}
return ret;
},
varargs: 0,
get: function(varargs) {
SYSCALLS.varargs += 4;
var ret = HEAP32[SYSCALLS.varargs - 4 >> 2];
return ret;
},
getStr: function() {
var ret = UTF8ToString(SYSCALLS.get());
return ret;
},
getStreamFromFD: function() {
var stream = FS.getStream(SYSCALLS.get());
if (!stream) throw new FS.ErrnoError(ERRNO_CODES.EBADF);
return stream;
},
getSocketFromFD: function() {
var socket = SOCKFS.getSocket(SYSCALLS.get());
if (!socket) throw new FS.ErrnoError(ERRNO_CODES.EBADF);
return socket;
},
getSocketAddress: function(allowNull) {
var addrp = SYSCALLS.get(), addrlen = SYSCALLS.get();
if (allowNull && addrp === 0) return null;
var info = __read_sockaddr(addrp, addrlen);
if (info.errno) throw new FS.ErrnoError(info.errno);
info.addr = DNS.lookup_addr(info.addr) || info.addr;
return info;
},
get64: function() {
var low = SYSCALLS.get(), high = SYSCALLS.get();
return low;
},
getZero: function() {
SYSCALLS.get();
}
};
function ___syscall140(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var stream = SYSCALLS.getStreamFromFD(), offset_high = SYSCALLS.get(), offset_low = SYSCALLS.get(), result = SYSCALLS.get(), whence = SYSCALLS.get();
var offset = offset_low;
FS.llseek(stream, offset, whence);
HEAP32[result >> 2] = stream.position;
if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
return 0;
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall145(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var stream = SYSCALLS.getStreamFromFD(), iov = SYSCALLS.get(), iovcnt = SYSCALLS.get();
return SYSCALLS.doReadv(stream, iov, iovcnt);
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall146(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var stream = SYSCALLS.getStreamFromFD(), iov = SYSCALLS.get(), iovcnt = SYSCALLS.get();
return SYSCALLS.doWritev(stream, iov, iovcnt);
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall195(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var path = SYSCALLS.getStr(), buf = SYSCALLS.get();
return SYSCALLS.doStat(FS.stat, path, buf);
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall220(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var stream = SYSCALLS.getStreamFromFD(), dirp = SYSCALLS.get(), count = SYSCALLS.get();
if (!stream.getdents) {
stream.getdents = FS.readdir(stream.path);
}
var pos = 0;
while (stream.getdents.length > 0 && pos + 268 <= count) {
var id;
var type;
var name = stream.getdents.pop();
if (name[0] === ".") {
id = 1;
type = 4;
} else {
var child = FS.lookupNode(stream.node, name);
id = child.id;
type = FS.isChrdev(child.mode) ? 2 : FS.isDir(child.mode) ? 4 : FS.isLink(child.mode) ? 10 : 8;
}
HEAP32[dirp + pos >> 2] = id;
HEAP32[dirp + pos + 4 >> 2] = stream.position;
HEAP16[dirp + pos + 8 >> 1] = 268;
HEAP8[dirp + pos + 10 >> 0] = type;
stringToUTF8(name, dirp + pos + 11, 256);
pos += 268;
}
return pos;
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall221(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var stream = SYSCALLS.getStreamFromFD(), cmd = SYSCALLS.get();
switch (cmd) {
case 0:
{
var arg = SYSCALLS.get();
if (arg < 0) {
return -ERRNO_CODES.EINVAL;
}
var newStream;
newStream = FS.open(stream.path, stream.flags, 0, arg);
return newStream.fd;
}
case 1:
case 2:
return 0;
case 3:
return stream.flags;
case 4:
{
var arg = SYSCALLS.get();
stream.flags |= arg;
return 0;
}
case 12:
{
var arg = SYSCALLS.get();
var offset = 0;
HEAP16[arg + offset >> 1] = 2;
return 0;
}
case 13:
case 14:
return 0;
case 16:
case 8:
return -ERRNO_CODES.EINVAL;
case 9:
___setErrNo(ERRNO_CODES.EINVAL);
return -1;
default:
{
return -ERRNO_CODES.EINVAL;
}
}
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall5(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var pathname = SYSCALLS.getStr(), flags = SYSCALLS.get(), mode = SYSCALLS.get();
var stream = FS.open(pathname, flags, mode);
return stream.fd;
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall54(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var stream = SYSCALLS.getStreamFromFD(), op = SYSCALLS.get();
switch (op) {
case 21509:
case 21505:
{
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
return 0;
}
case 21510:
case 21511:
case 21512:
case 21506:
case 21507:
case 21508:
{
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
return 0;
}
case 21519:
{
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
var argp = SYSCALLS.get();
HEAP32[argp >> 2] = 0;
return 0;
}
case 21520:
{
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
return -ERRNO_CODES.EINVAL;
}
case 21531:
{
var argp = SYSCALLS.get();
return FS.ioctl(stream, op, argp);
}
case 21523:
{
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
return 0;
}
case 21524:
{
if (!stream.tty) return -ERRNO_CODES.ENOTTY;
return 0;
}
default:
abort("bad ioctl syscall " + op);
}
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___syscall6(which, varargs) {
SYSCALLS.varargs = varargs;
try {
var stream = SYSCALLS.getStreamFromFD();
FS.close(stream);
return 0;
} catch (e) {
if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
return -e.errno;
}
}
function ___unlock() {}
function _abort() {
Module["abort"]();
}
function _emscripten_async_wget_data(url, arg, onload, onerror) {
Browser.asyncLoad(UTF8ToString(url), function(byteArray) {
var buffer = _malloc(byteArray.length);
HEAPU8.set(byteArray, buffer);
dynCall_viii(onload, arg, buffer, byteArray.length);
_free(buffer);
}, function() {
if (onerror) dynCall_vi(onerror, arg);
}, true);
}
function _emscripten_get_heap_size() {
return TOTAL_MEMORY;
}
function abortOnCannotGrowMemory(requestedSize) {
abort("Cannot enlarge memory arrays to size " + requestedSize + " bytes. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value " + TOTAL_MEMORY + ", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ");
}
function _emscripten_resize_heap(requestedSize) {
abortOnCannotGrowMemory(requestedSize);
}
function _exit(status) {
exit(status);
}
var ___tm_current = 3002128;
var ___tm_timezone = (stringToUTF8("GMT", 3002176, 4), 3002176);
function _gmtime_r(time, tmPtr) {
var date = new Date(HEAP32[time >> 2] * 1e3);
HEAP32[tmPtr >> 2] = date.getUTCSeconds();
HEAP32[tmPtr + 4 >> 2] = date.getUTCMinutes();
HEAP32[tmPtr + 8 >> 2] = date.getUTCHours();
HEAP32[tmPtr + 12 >> 2] = date.getUTCDate();
HEAP32[tmPtr + 16 >> 2] = date.getUTCMonth();
HEAP32[tmPtr + 20 >> 2] = date.getUTCFullYear() - 1900;
HEAP32[tmPtr + 24 >> 2] = date.getUTCDay();
HEAP32[tmPtr + 36 >> 2] = 0;
HEAP32[tmPtr + 32 >> 2] = 0;
var start = Date.UTC(date.getUTCFullYear(), 0, 1, 0, 0, 0, 0);
var yday = (date.getTime() - start) / (1e3 * 60 * 60 * 24) | 0;
HEAP32[tmPtr + 28 >> 2] = yday;
HEAP32[tmPtr + 40 >> 2] = ___tm_timezone;
return tmPtr;
}
function _gmtime(time) {
return _gmtime_r(time, ___tm_current);
}
function _tzset() {
if (_tzset.called) return;
_tzset.called = true;
HEAP32[__get_timezone() >> 2] = new Date().getTimezoneOffset() * 60;
var winter = new Date(2e3, 0, 1);
var summer = new Date(2e3, 6, 1);
HEAP32[__get_daylight() >> 2] = Number(winter.getTimezoneOffset() != summer.getTimezoneOffset());
function extractZone(date) {
var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/);
return match ? match[1] : "GMT";
}
var winterName = extractZone(winter);
var summerName = extractZone(summer);
var winterNamePtr = allocate(intArrayFromString(winterName), "i8", ALLOC_NORMAL);
var summerNamePtr = allocate(intArrayFromString(summerName), "i8", ALLOC_NORMAL);
if (summer.getTimezoneOffset() < winter.getTimezoneOffset()) {
HEAP32[__get_tzname() >> 2] = winterNamePtr;
HEAP32[__get_tzname() + 4 >> 2] = summerNamePtr;
} else {
HEAP32[__get_tzname() >> 2] = summerNamePtr;
HEAP32[__get_tzname() + 4 >> 2] = winterNamePtr;
}
}
function _localtime_r(time, tmPtr) {
_tzset();
var date = new Date(HEAP32[time >> 2] * 1e3);
HEAP32[tmPtr >> 2] = date.getSeconds();
HEAP32[tmPtr + 4 >> 2] = date.getMinutes();
HEAP32[tmPtr + 8 >> 2] = date.getHours();
HEAP32[tmPtr + 12 >> 2] = date.getDate();
HEAP32[tmPtr + 16 >> 2] = date.getMonth();
HEAP32[tmPtr + 20 >> 2] = date.getFullYear() - 1900;
HEAP32[tmPtr + 24 >> 2] = date.getDay();
var start = new Date(date.getFullYear(), 0, 1);
var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0;
HEAP32[tmPtr + 28 >> 2] = yday;
HEAP32[tmPtr + 36 >> 2] = -(date.getTimezoneOffset() * 60);
var summerOffset = new Date(2e3, 6, 1).getTimezoneOffset();
var winterOffset = start.getTimezoneOffset();
var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0;
HEAP32[tmPtr + 32 >> 2] = dst;
var zonePtr = HEAP32[__get_tzname() + (dst ? 4 : 0) >> 2];
HEAP32[tmPtr + 40 >> 2] = zonePtr;
return tmPtr;
}
function _localtime(time) {
return _localtime_r(time, ___tm_current);
}
function _longjmp(env, value) {
_setThrew(env, value || 1);
throw "longjmp";
}
function _emscripten_memcpy_big(dest, src, num) {
HEAPU8.set(HEAPU8.subarray(src, src + num), dest);
}
function __isLeapYear(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function __arraySum(array, index) {
var sum = 0;
for (var i = 0; i <= index; sum += array[i++]) ;
return sum;
}
var __MONTH_DAYS_LEAP = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
var __MONTH_DAYS_REGULAR = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
function __addDays(date, days) {
var newDate = new Date(date.getTime());
while (days > 0) {
var leap = __isLeapYear(newDate.getFullYear());
var currentMonth = newDate.getMonth();
var daysInCurrentMonth = (leap ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR)[currentMonth];
if (days > daysInCurrentMonth - newDate.getDate()) {
days -= daysInCurrentMonth - newDate.getDate() + 1;
newDate.setDate(1);
if (currentMonth < 11) {
newDate.setMonth(currentMonth + 1);
} else {
newDate.setMonth(0);
newDate.setFullYear(newDate.getFullYear() + 1);
}
} else {
newDate.setDate(newDate.getDate() + days);
return newDate;
}
}
return newDate;
}
function _strftime(s, maxsize, format, tm) {
var tm_zone = HEAP32[tm + 40 >> 2];
var date = {
tm_sec: HEAP32[tm >> 2],
tm_min: HEAP32[tm + 4 >> 2],
tm_hour: HEAP32[tm + 8 >> 2],
tm_mday: HEAP32[tm + 12 >> 2],
tm_mon: HEAP32[tm + 16 >> 2],
tm_year: HEAP32[tm + 20 >> 2],
tm_wday: HEAP32[tm + 24 >> 2],
tm_yday: HEAP32[tm + 28 >> 2],
tm_isdst: HEAP32[tm + 32 >> 2],
tm_gmtoff: HEAP32[tm + 36 >> 2],
tm_zone: tm_zone ? UTF8ToString(tm_zone) : ""
};
var pattern = UTF8ToString(format);
var EXPANSION_RULES_1 = {
"%c": "%a %b %d %H:%M:%S %Y",
"%D": "%m/%d/%y",
"%F": "%Y-%m-%d",
"%h": "%b",
"%r": "%I:%M:%S %p",
"%R": "%H:%M",
"%T": "%H:%M:%S",
"%x": "%m/%d/%y",
"%X": "%H:%M:%S"
};
for (var rule in EXPANSION_RULES_1) {
pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_1[rule]);
}
var WEEKDAYS = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
var MONTHS = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
function leadingSomething(value, digits, character) {
var str = typeof value === "number" ? value.toString() : value || "";
while (str.length < digits) {
str = character[0] + str;
}
return str;
}
function leadingNulls(value, digits) {
return leadingSomething(value, digits, "0");
}
function compareByDay(date1, date2) {
function sgn(value) {
return value < 0 ? -1 : value > 0 ? 1 : 0;
}
var compare;
if ((compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0) {
if ((compare = sgn(date1.getMonth() - date2.getMonth())) === 0) {
compare = sgn(date1.getDate() - date2.getDate());
}
}
return compare;
}
function getFirstWeekStartDate(janFourth) {
switch (janFourth.getDay()) {
case 0:
return new Date(janFourth.getFullYear() - 1, 11, 29);
case 1:
return janFourth;
case 2:
return new Date(janFourth.getFullYear(), 0, 3);
case 3:
return new Date(janFourth.getFullYear(), 0, 2);
case 4:
return new Date(janFourth.getFullYear(), 0, 1);
case 5:
return new Date(janFourth.getFullYear() - 1, 11, 31);
case 6:
return new Date(janFourth.getFullYear() - 1, 11, 30);
}
}
function getWeekBasedYear(date) {
var thisDate = __addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday);
var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4);
var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4);
var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) {
if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) {
return thisDate.getFullYear() + 1;
} else {
return thisDate.getFullYear();
}
} else {
return thisDate.getFullYear() - 1;
}
}
var EXPANSION_RULES_2 = {
"%a": function(date) {
return WEEKDAYS[date.tm_wday].substring(0, 3);
},
"%A": function(date) {
return WEEKDAYS[date.tm_wday];
},
"%b": function(date) {
return MONTHS[date.tm_mon].substring(0, 3);
},
"%B": function(date) {
return MONTHS[date.tm_mon];
},
"%C": function(date) {
var year = date.tm_year + 1900;
return leadingNulls(year / 100 | 0, 2);
},
"%d": function(date) {
return leadingNulls(date.tm_mday, 2);
},
"%e": function(date) {
return leadingSomething(date.tm_mday, 2, " ");
},
"%g": function(date) {
return getWeekBasedYear(date).toString().substring(2);
},
"%G": function(date) {
return getWeekBasedYear(date);
},
"%H": function(date) {
return leadingNulls(date.tm_hour, 2);
},
"%I": function(date) {
var twelveHour = date.tm_hour;
if (twelveHour == 0) twelveHour = 12; else if (twelveHour > 12) twelveHour -= 12;
return leadingNulls(twelveHour, 2);
},
"%j": function(date) {
return leadingNulls(date.tm_mday + __arraySum(__isLeapYear(date.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date.tm_mon - 1), 3);
},
"%m": function(date) {
return leadingNulls(date.tm_mon + 1, 2);
},
"%M": function(date) {
return leadingNulls(date.tm_min, 2);
},
"%n": function() {
return "\n";
},
"%p": function(date) {
if (date.tm_hour >= 0 && date.tm_hour < 12) {
return "AM";
} else {
return "PM";
}
},
"%S": function(date) {
return leadingNulls(date.tm_sec, 2);
},
"%t": function() {
return "\t";
},
"%u": function(date) {
var day = new Date(date.tm_year + 1900, date.tm_mon + 1, date.tm_mday, 0, 0, 0, 0);
return day.getDay() || 7;
},
"%U": function(date) {
var janFirst = new Date(date.tm_year + 1900, 0, 1);
var firstSunday = janFirst.getDay() === 0 ? janFirst : __addDays(janFirst, 7 - janFirst.getDay());
var endDate = new Date(date.tm_year + 1900, date.tm_mon, date.tm_mday);
if (compareByDay(firstSunday, endDate) < 0) {
var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth() - 1) - 31;
var firstSundayUntilEndJanuary = 31 - firstSunday.getDate();
var days = firstSundayUntilEndJanuary + februaryFirstUntilEndMonth + endDate.getDate();
return leadingNulls(Math.ceil(days / 7), 2);
}
return compareByDay(firstSunday, janFirst) === 0 ? "01" : "00";
},
"%V": function(date) {
var janFourthThisYear = new Date(date.tm_year + 1900, 0, 4);
var janFourthNextYear = new Date(date.tm_year + 1901, 0, 4);
var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
var endDate = __addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday);
if (compareByDay(endDate, firstWeekStartThisYear) < 0) {
return "53";
}
if (compareByDay(firstWeekStartNextYear, endDate) <= 0) {
return "01";
}
var daysDifference;
if (firstWeekStartThisYear.getFullYear() < date.tm_year + 1900) {
daysDifference = date.tm_yday + 32 - firstWeekStartThisYear.getDate();
} else {
daysDifference = date.tm_yday + 1 - firstWeekStartThisYear.getDate();
}
return leadingNulls(Math.ceil(daysDifference / 7), 2);
},
"%w": function(date) {
var day = new Date(date.tm_year + 1900, date.tm_mon + 1, date.tm_mday, 0, 0, 0, 0);
return day.getDay();
},
"%W": function(date) {
var janFirst = new Date(date.tm_year, 0, 1);
var firstMonday = janFirst.getDay() === 1 ? janFirst : __addDays(janFirst, janFirst.getDay() === 0 ? 1 : 7 - janFirst.getDay() + 1);
var endDate = new Date(date.tm_year + 1900, date.tm_mon, date.tm_mday);
if (compareByDay(firstMonday, endDate) < 0) {
var februaryFirstUntilEndMonth = __arraySum(__isLeapYear(endDate.getFullYear()) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, endDate.getMonth() - 1) - 31;
var firstMondayUntilEndJanuary = 31 - firstMonday.getDate();
var days = firstMondayUntilEndJanuary + februaryFirstUntilEndMonth + endDate.getDate();
return leadingNulls(Math.ceil(days / 7), 2);
}
return compareByDay(firstMonday, janFirst) === 0 ? "01" : "00";
},
"%y": function(date) {
return (date.tm_year + 1900).toString().substring(2);
},
"%Y": function(date) {
return date.tm_year + 1900;
},
"%z": function(date) {
var off = date.tm_gmtoff;
var ahead = off >= 0;
off = Math.abs(off) / 60;
off = off / 60 * 100 + off % 60;
return (ahead ? "+" : "-") + String("0000" + off).slice(-4);
},
"%Z": function(date) {
return date.tm_zone;
},
"%%": function() {
return "%";
}
};
for (var rule in EXPANSION_RULES_2) {
if (pattern.indexOf(rule) >= 0) {
pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_2[rule](date));
}
}
var bytes = intArrayFromString(pattern, false);
if (bytes.length > maxsize) {
return 0;
}
writeArrayToMemory(bytes, s);
return bytes.length - 1;
}
function _time(ptr) {
var ret = Date.now() / 1e3 | 0;
if (ptr) {
HEAP32[ptr >> 2] = ret;
}
return ret;
}
FS.staticInit();
__ATINIT__.unshift(function() {
if (!Module["noFSInit"] && !FS.init.initialized) FS.init();
});
__ATMAIN__.push(function() {
FS.ignorePermissions = false;
});
__ATEXIT__.push(function() {
FS.quit();
});
Module["FS_createFolder"] = FS.createFolder;
Module["FS_createPath"] = FS.createPath;
Module["FS_createDataFile"] = FS.createDataFile;
Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
Module["FS_createLazyFile"] = FS.createLazyFile;
Module["FS_createLink"] = FS.createLink;
Module["FS_createDevice"] = FS.createDevice;
Module["FS_unlink"] = FS.unlink;
__ATINIT__.unshift(function() {
TTY.init();
});
__ATEXIT__.push(function() {
TTY.shutdown();
});
if (ENVIRONMENT_IS_NODE) {
var fs = require("fs");
var NODEJS_PATH = require("path");
NODEFS.staticInit();
}
Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas, vrDevice) {
err("Module.requestFullScreen is deprecated. Please call Module.requestFullscreen instead.");
Module["requestFullScreen"] = Module["requestFullscreen"];
Browser.requestFullScreen(lockPointer, resizeCanvas, vrDevice);
};
Module["requestFullscreen"] = function Module_requestFullscreen(lockPointer, resizeCanvas, vrDevice) {
Browser.requestFullscreen(lockPointer, resizeCanvas, vrDevice);
};
Module["requestAnimationFrame"] = function Module_requestAnimationFrame(func) {
Browser.requestAnimationFrame(func);
};
Module["setCanvasSize"] = function Module_setCanvasSize(width, height, noUpdates) {
Browser.setCanvasSize(width, height, noUpdates);
};
Module["pauseMainLoop"] = function Module_pauseMainLoop() {
Browser.mainLoop.pause();
};
Module["resumeMainLoop"] = function Module_resumeMainLoop() {
Browser.mainLoop.resume();
};
Module["getUserMedia"] = function Module_getUserMedia() {
Browser.getUserMedia();
};
Module["createContext"] = function Module_createContext(canvas, useWebGL, setInModule, webGLContextAttributes) {
return Browser.createContext(canvas, useWebGL, setInModule, webGLContextAttributes);
};
if (ENVIRONMENT_IS_NODE) {
_emscripten_get_now = function _emscripten_get_now_actual() {
var t = process["hrtime"]();
return t[0] * 1e3 + t[1] / 1e6;
};
} else if (typeof dateNow !== "undefined") {
_emscripten_get_now = dateNow;
} else if (typeof self === "object" && self["performance"] && typeof self["performance"]["now"] === "function") {
_emscripten_get_now = function() {
return self["performance"]["now"]();
};
} else if (typeof performance === "object" && typeof performance["now"] === "function") {
_emscripten_get_now = function() {
return performance["now"]();
};
} else {
_emscripten_get_now = Date.now;
}
var GLctx;
GL.init();
var ASSERTIONS = false;
function intArrayFromString(stringy, dontAddNull, length) {
var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
var u8array = new Array(len);
var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
if (dontAddNull) u8array.length = numBytesWritten;
return u8array;
}
function intArrayToString(array) {
var ret = [];
for (var i = 0; i < array.length; i++) {
var chr = array[i];
if (chr > 255) {
if (ASSERTIONS) {
assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF.");
}
chr &= 255;
}
ret.push(String.fromCharCode(chr));
}
return ret.join("");
}
var decodeBase64 = typeof atob === "function" ? atob : function(input) {
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
do {
enc1 = keyStr.indexOf(input.charAt(i++));
enc2 = keyStr.indexOf(input.charAt(i++));
enc3 = keyStr.indexOf(input.charAt(i++));
enc4 = keyStr.indexOf(input.charAt(i++));
chr1 = enc1 << 2 | enc2 >> 4;
chr2 = (enc2 & 15) << 4 | enc3 >> 2;
chr3 = (enc3 & 3) << 6 | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 !== 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 !== 64) {
output = output + String.fromCharCode(chr3);
}
} while (i < input.length);
return output;
};
function intArrayFromBase64(s) {
if (typeof ENVIRONMENT_IS_NODE === "boolean" && ENVIRONMENT_IS_NODE) {
var buf;
try {
buf = Buffer.from(s, "base64");
} catch (_) {
buf = new Buffer(s, "base64");
}
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
}
try {
var decoded = decodeBase64(s);
var bytes = new Uint8Array(decoded.length);
for (var i = 0; i < decoded.length; ++i) {
bytes[i] = decoded.charCodeAt(i);
}
return bytes;
} catch (_) {
throw new Error("Converting base64 string to bytes failed.");
}
}
function tryParseAsDataURI(filename) {
if (!isDataURI(filename)) {
return;
}
return intArrayFromBase64(filename.slice(dataURIPrefix.length));
}
function invoke_vii(index, a1, a2) {
var sp = stackSave();
try {
dynCall_vii(index, a1, a2);
} catch (e) {
stackRestore(sp);
if (e !== e + 0 && e !== "longjmp") throw e;
_setThrew(1, 0);
}
}
var asmGlobalArg = {
"Math": Math,
"Int8Array": Int8Array,
"Int16Array": Int16Array,
"Int32Array": Int32Array,
"Uint8Array": Uint8Array,
"Uint16Array": Uint16Array,
"Float32Array": Float32Array,
"Float64Array": Float64Array,
"NaN": NaN,
Infinity: Infinity
};
var asmLibraryArg = {
"a": abort,
"b": setTempRet0,
"c": getTempRet0,
"d": invoke_vii,
"e": _SDL_ClearError,
"f": _SDL_GetError,
"g": _SDL_GetModState,
"h": _SDL_GetMouseState,
"i": _SDL_GetTicks,
"j": _SDL_GetWindowSize,
"k": _SDL_Init,
"l": _SDL_LockAudio,
"m": _SDL_LockSurface,
"n": _SDL_PollEvent,
"o": _SDL_SetVideoMode,
"p": _SDL_UnlockAudio,
"q": _SDL_UnlockSurface,
"r": ___buildEnvironment,
"s": ___lock,
"t": ___setErrNo,
"u": ___syscall140,
"v": ___syscall145,
"w": ___syscall146,
"x": ___syscall195,
"y": ___syscall220,
"z": ___syscall221,
"A": ___syscall5,
"B": ___syscall54,
"C": ___syscall6,
"D": ___unlock,
"E": __addDays,
"F": __arraySum,
"G": __isLeapYear,
"H": _abort,
"I": _emscripten_asm_const_i,
"J": _emscripten_asm_const_ii,
"K": _emscripten_asm_const_iii,
"L": _emscripten_asm_const_iiiii,
"M": _emscripten_asm_const_iiiiii,
"N": _emscripten_async_wget_data,
"O": _emscripten_get_heap_size,
"P": _emscripten_get_now,
"Q": _emscripten_memcpy_big,
"R": _emscripten_resize_heap,
"S": _emscripten_set_main_loop,
"T": _emscripten_set_main_loop_timing,
"U": _exit,
"V": _gmtime,
"W": _gmtime_r,
"X": _localtime,
"Y": _localtime_r,
"Z": _longjmp,
"_": _strftime,
"$": _time,
"aa": _tzset,
"ab": abortOnCannotGrowMemory,
"ac": tempDoublePtr,
"ad": DYNAMICTOP_PTR
};
// EMSCRIPTEN_START_ASM
var asm = (/** @suppress {uselessCode} */ function(global,env,buffer) {
"use asm";var a=new global.Int8Array(buffer),b=new global.Int16Array(buffer),c=new global.Int32Array(buffer),d=new global.Uint8Array(buffer),e=new global.Uint16Array(buffer),f=new global.Float32Array(buffer),g=new global.Float64Array(buffer),h=env.ac|0,i=env.ad|0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=global.NaN,s=global.Infinity,t=global.Math.floor,u=global.Math.abs,v=global.Math.sqrt,w=global.Math.cos,x=global.Math.sin,y=global.Math.atan,z=global.Math.atan2,A=global.Math.ceil,B=global.Math.imul,C=global.Math.min,D=global.Math.clz32,E=env.a,F=env.b,G=env.c,H=env.d,I=env.e,J=env.f,K=env.g,L=env.h,M=env.i,N=env.j,O=env.k,P=env.l,Q=env.m,R=env.n,S=env.o,T=env.p,U=env.q,V=env.r,W=env.s,X=env.t,Y=env.u,Z=env.v,_=env.w,$=env.x,aa=env.y,ba=env.z,ca=env.A,da=env.B,ea=env.C,fa=env.D,ga=env.E,ha=env.F,ia=env.G,ja=env.H,ka=env.I,la=env.J,ma=env.K,na=env.L,oa=env.M,pa=env.N,qa=env.O,ra=env.P,sa=env.Q,ta=env.R,ua=env.S,va=env.T,wa=env.U,xa=env.V,ya=env.W,za=env.X,Aa=env.Y,Ba=env.Z,Ca=env._,Da=env.$,Ea=env.aa,Fa=env.ab,Ga=3002288,Ha=8245168,Ia=0.0;
// EMSCRIPTEN_START_FUNCS
function xf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=Ga;Ga=Ga+16|0;d=b+8|0;e=b;f=a+16|0;g=c[c[f>>2]>>2]|0;h=g+16|0;i=a+8|0;j=c[i>>2]|0;if(h>>>0>=j>>>0|(h|0)==2060540)k=-1;else k=c[g+20>>2]&15;h=g+8|0;if(!(h>>>0>=j>>>0|(h|0)==2060540)){h=c[g+12>>2]&15;if((h|0)!=5){l=h+1|0;m=6}}else{l=0;m=6}if((m|0)==6){m=c[16+(l<<2)>>2]|0;c[e>>2]=43216;c[e+4>>2]=m;gf(a,1,Bd(a,45446,e)|0)|0}switch(k|0){case 0:case 5:break;default:gf(a,2,45737)|0}if(pf(a,1,45725)|0)hf(a,45759,d)|0;d=c[c[f>>2]>>2]|0;f=c[i>>2]|0;k=d+24|0;if(f>>>0>=k>>>0){c[i>>2]=k;Jd(a,1)|0;Ga=b;return 1}e=(d+20+(3-f)|0)>>>3;d=f;do{c[d+4>>2]=0;d=d+8|0}while(d>>>0<k>>>0);c[i>>2]=f+(e+1<<3);c[i>>2]=k;Jd(a,1)|0;Ga=b;return 1}function yf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;b=a+16|0;d=c[c[b>>2]>>2]|0;e=d+8|0;f=a+8|0;g=c[f>>2]|0;if(e>>>0>=g>>>0|(e|0)==2060540){gf(a,1,45466)|0;h=c[c[b>>2]>>2]|0;i=c[f>>2]|0}else{h=d;i=g}g=h+16|0;if(g>>>0>=i>>>0|(g|0)==2060540){gf(a,2,45466)|0;a=c[c[b>>2]>>2]|0;j=a+16|0;k=a;l=c[f>>2]|0}else{j=g;k=h;l=i}i=k+8|0;k=i>>>0<l>>>0?i:2060540;i=j>>>0<l>>>0?j:2060540;if((k|0)!=2060540&(i|0)!=2060540?(c[k+4>>2]|0)==(c[i+4>>2]|0):0){j=(Bc(0,k,i)|0)!=0&1;m=j;n=c[f>>2]|0}else{m=0;n=l}c[n>>2]=m;c[n+4>>2]=1;c[f>>2]=(c[f>>2]|0)+8;return 1}function zf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=a+16|0;d=c[c[b>>2]>>2]|0;e=d+8|0;f=a+8|0;g=c[f>>2]|0;if(!(e>>>0>=g>>>0|(e|0)==2060540)?(c[d+12>>2]&14|1|0)==5:0){h=e;i=g}else{gf(a,1,45795)|0;h=(c[c[b>>2]>>2]|0)+8|0;i=c[f>>2]|0}b=h>>>0<i>>>0?h:2060540;switch(c[b+4>>2]&15){case 4:{j=c[(c[b>>2]|0)+12>>2]|0;break}case 7:{j=c[(c[b>>2]|0)+16>>2]|0;break}case 5:{j=ad(c[b>>2]|0)|0;break}default:j=0}c[i>>2]=j<<16;c[i+4>>2]=3;c[f>>2]=(c[f>>2]|0)+8;return 1}function Af(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;b=Ga;Ga=Ga+16|0;d=b;e=a+16|0;f=c[c[e>>2]>>2]|0;g=f+8|0;h=a+8|0;i=c[h>>2]|0;if(!(g>>>0>=i>>>0|(g|0)==2060540)){g=c[f+12>>2]&15;if((g|0)==5){j=f;k=i}else{l=g+1|0;m=4}}else{l=0;m=4}if((m|0)==4){m=c[16+(l<<2)>>2]|0;c[d>>2]=43216;c[d+4>>2]=m;gf(a,1,Bd(a,45446,d)|0)|0;j=c[c[e>>2]>>2]|0;k=c[h>>2]|0}d=j+16|0;if(d>>>0>=k>>>0|(d|0)==2060540){gf(a,2,45466)|0;n=c[c[e>>2]>>2]|0;o=c[h>>2]|0}else{n=j;o=k}k=n+8|0;j=n+24|0;if(o>>>0>=j>>>0){c[h>>2]=j;p=c[k>>2]|0;q=n+16|0;r=uc(p,q)|0;s=c[h>>2]|0;t=s+-8|0;u=c[r>>2]|0;c[t>>2]=u;v=r+4|0;w=c[v>>2]|0;x=s+-4|0;c[x>>2]=w;Ga=b;return 1}e=(n+20+(3-o)|0)>>>3;a=o;do{c[a+4>>2]=0;a=a+8|0}while(a>>>0<j>>>0);c[h>>2]=o+(e+1<<3);c[h>>2]=j;p=c[k>>2]|0;q=n+16|0;r=uc(p,q)|0;s=c[h>>2]|0;t=s+-8|0;u=c[r>>2]|0;c[t>>2]=u;v=r+4|0;w=c[v>>2]|0;x=s+-4|0;c[x>>2]=w;Ga=b;return 1}function Bf(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=Ga;Ga=Ga+16|0;e=d;f=b+16|0;g=c[c[f>>2]>>2]|0;h=g+8|0;i=b+8|0;j=c[i>>2]|0;if(!(h>>>0>=j>>>0|(h|0)==2060540)){h=c[g+12>>2]&15;if((h|0)==5){k=g;l=j}else{m=h+1|0;n=4}}else{m=0;n=4}if((n|0)==4){n=c[16+(m<<2)>>2]|0;c[e>>2]=43216;c[e+4>>2]=n;gf(b,1,Bd(b,45446,e)|0)|0;k=c[c[f>>2]>>2]|0;l=c[i>>2]|0}e=k+16|0;if(e>>>0>=l>>>0|(e|0)==2060540){gf(b,2,45466)|0;o=c[c[f>>2]>>2]|0;p=c[i>>2]|0}else{o=k;p=l}l=o+24|0;if(l>>>0>=p>>>0|(l|0)==2060540){gf(b,3,45466)|0;q=c[c[f>>2]>>2]|0;r=c[i>>2]|0}else{q=o;r=p}p=q+8|0;o=q+32|0;if(r>>>0<o>>>0){f=(q+28+(3-r)|0)>>>3;l=r;do{c[l+4>>2]=0;l=l+8|0}while(l>>>0<o>>>0);c[i>>2]=r+(f+1<<3)}c[i>>2]=o;o=c[p>>2]|0;f=q+16|0;r=uc(o,f)|0;if((r|0)==2060540)s=vc(b,o,f)|0;else s=r;c[s>>2]=c[q+24>>2];c[s+4>>2]=c[q+28>>2];a[(c[p>>2]|0)+6>>0]=0;q=c[i>>2]|0;if(!(c[q+-4>>2]&64)){t=q;u=t+-16|0;c[i>>2]=u;Ga=d;return 1}if(!(a[(c[q+-8>>2]|0)+5>>0]&3)){t=q;u=t+-16|0;c[i>>2]=u;Ga=d;return 1}s=c[p>>2]|0;p=s+5|0;r=a[p>>0]|0;if(!(r&4)){t=q;u=t+-16|0;c[i>>2]=u;Ga=d;return 1}q=c[b+12>>2]|0;a[p>>0]=r&-5;r=q+76|0;c[s+24>>2]=c[r>>2];c[r>>2]=s;t=c[i>>2]|0;u=t+-16|0;c[i>>2]=u;Ga=d;return 1}function Cf(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;b=a+16|0;d=c[c[b>>2]>>2]|0;e=d+8|0;f=a+8|0;g=c[f>>2]|0;if(e>>>0>=g>>>0|(e|0)==2060540){gf(a,1,45466)|0;h=c[c[b>>2]>>2]|0;i=h+8|0;j=c[f>>2]|0;k=h}else{i=e;j=g;k=d}if(i>>>0>=j>>>0|(i|0)==2060540){l=0;m=16+(l<<2)|0;n=
function Dl(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=Ga;Ga=Ga+1024|0;f=e;Eu(f|0,0,1024)|0;g=c[b+648>>2]|0;if(!g){Ga=e;return}h=b+652|0;if(a[h>>0]|0){Ga=e;return}i=b+653|0;if(a[i>>0]|0){Ga=e;return}j=c[g+12>>2]|0;g=16384;while(1){k=f+(d[j>>0]<<2)|0;c[k>>2]=(c[k>>2]|0)+1;g=g+-1|0;if(!g)break;else j=j+1|0}a[h>>0]=0;a[i>>0]=1;a[b+654>>0]=2;a[b+655>>0]=3;a[b+656>>0]=4;a[b+657>>0]=5;a[b+658>>0]=6;a[b+659>>0]=7;a[b+660>>0]=8;a[b+661>>0]=9;a[b+662>>0]=10;a[b+663>>0]=11;a[b+664>>0]=12;a[b+665>>0]=13;a[b+666>>0]=14;a[b+667>>0]=15;i=f+4|0;h=f+8|0;j=f+12|0;g=f+16|0;k=f+20|0;l=f+24|0;m=f+28|0;n=f+32|0;o=f+36|0;p=f+40|0;q=f+44|0;r=f+48|0;s=f+52|0;t=f+56|0;u=f+60|0;v=0;do{w=v+128|0;if(c[f+(w<<2)>>2]|0){x=(c[i>>2]|0)<(c[f>>2]|0)&1;y=(c[h>>2]|0)<(c[f+(x<<2)>>2]|0)?2:x;x=(c[j>>2]|0)<(c[f+(y<<2)>>2]|0)?3:y;y=(c[g>>2]|0)<(c[f+(x<<2)>>2]|0)?4:x;x=(c[k>>2]|0)<(c[f+(y<<2)>>2]|0)?5:y;y=(c[l>>2]|0)<(c[f+(x<<2)>>2]|0)?6:x;x=(c[m>>2]|0)<(c[f+(y<<2)>>2]|0)?7:y;y=(c[n>>2]|0)<(c[f+(x<<2)>>2]|0)?8:x;x=(c[o>>2]|0)<(c[f+(y<<2)>>2]|0)?9:y;y=(c[p>>2]|0)<(c[f+(x<<2)>>2]|0)?10:x;x=(c[q>>2]|0)<(c[f+(y<<2)>>2]|0)?11:y;y=(c[r>>2]|0)<(c[f+(x<<2)>>2]|0)?12:x;x=(c[s>>2]|0)<(c[f+(y<<2)>>2]|0)?13:y;y=(c[t>>2]|0)<(c[f+(x<<2)>>2]|0)?14:x;x=(c[f+(v<<2)>>2]|0)==0?v:(c[u>>2]|0)<(c[f+(y<<2)>>2]|0)?15:y;c[f+(x<<2)>>2]=16384;a[b+668+v>>0]=x;a[b+652+x>>0]=w}v=v+1|0}while((v|0)!=16);Ga=e;return}function El(b,d){b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=Ga;Ga=Ga+1856|0;f=e+1032|0;g=e+1024|0;h=e+1040|0;i=e;c[b+1080>>2]=0;if(Ms(2921044)|0){j=b+1072|0;qp(c[b>>2]|0,((c[j>>2]|0)*692|0)+692|0)|0;k=c[(c[b>>2]|0)+12>>2]|0;c[b+4>>2]=k;l=c[j>>2]|0;c[j>>2]=l+1;j=k+(l*692|0)|0;Eu(j+4|0,0,688)|0;c[j>>2]=185;a[j+388>>0]=0;rm(j+4|0,60021)|0;c[j+648>>2]=0;c[j+684>>2]=2}c[g>>2]=2920020;c[g+4>>2]=d;as(i,67368,g)|0;if(!(pq(i,57889,h,-1)|0)){g=h+256|0;d=h+512|0;j=b+1072|0;l=b+4|0;do do if((a[g>>0]|0)!=46){if((Lt(g,57891)|0)==0?(c[d>>2]&16384|0)==0:0)break;qp(c[b>>2]|0,((c[j>>2]|0)*692|0)+692|0)|0;k=c[(c[b>>2]|0)+12>>2]|0;c[l>>2]=k;m=c[j>>2]|0;c[j>>2]=m+1;n=k+(m*692|0)|0;Eu(n|0,0,692)|0;c[f>>2]=2921044;c[f+4>>2]=g;as(i,67368,f)|0;m=n+260|0;Ut(m,i,128)|0;c[n+648>>2]=0;k=n+684|0;c[k>>2]=1;a[n+388>>0]=0;if(!(c[d>>2]&16384))o=n+4|0;else{c[n>>2]=181;p=n+4|0;rm(p,g)|0;c[k>>2]=2;o=p}if(((a[o>>0]|0)==0?(Mn(m,0,o,0),m=Ms(o)|0,m>>>0>3):0)?(p=m+-3+(n+4)|0,(a[p>>0]|0)==46):0)a[p>>0]=0}while(0);while(!(qq(h)|0));q=j;r=l}else{q=b+1072|0;r=b+4|0}Ns(c[r>>2]|0,c[q>>2]|0,692,2);if((b|0)==1428384){Ga=e;return}if((c[q>>2]|0)<=0){Ga=e;return}b=0;do{l=c[r>>2]|0;j=l+(b*692|0)+688|0;c[j>>2]=0;c[j>>2]=(pl(1428384,l+(b*692|0)+388|0,l+(b*692|0)+260|0)|0)!=-1&1;b=b+1|0}while((b|0)<(c[q>>2]|0));Ga=e;return}function Fl(b){b=b|0;var d=0,e=0,f=0;d=Ga;Ga=Ga+16|0;e=d;if(b|0?(Ms(b)|0)>>>0>=2:0){if((Ms(b)|0)>>>0<2)a[1447472]=0;else{f=c[405843]|0;c[e>>2]=3002004;c[e+4>>2]=f;c[e+8>>2]=b;as(1447472,57449,e)|0}rl(b,0)|0;if(c[405846]|0){Ga=d;return}rm(1623660,1447472)|0;rm(1624684,1446448)|0;c[405846]=1;c[405847]=Iq()|0;c[405848]=0;Wq(1623660,1624684,2,3)|0;Ga=d;return}c[405846]=0;bb(57873,1500);c[732416]=0;Ga=d;return}function Gl(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=Cs(a+4|0,b+4|0)|0;e=(c[a+684>>2]|0)==2;f=c[b+684>>2]|0;if(e){if((f|0)!=2){g=-1;return g|0}}else if(!(e|(f|0)!=2)){g=1;return g|0}return ((d|0)==0?(a>>>0<b>>>0?1:-1):d)|0}function Hl(){return}function Il(a,b,d){a=a|0;b=b|0;d=d|0;if(c[405846]|0)return;rm(1623660,a)|0;rm(1624684,b)|0;c[405846]=1;c[405847]=Iq()|0;c[405848]=d;Wq(1623660,1624684,2,3)|0;return}function Jl(a){a=a|0;c[405846]=0;if(a|0)bb(a,1500);c[732416]=0;return}function Kl(){return 101}function Ll(){var b=0,d=0,e=0;if(!((a[2926560]|0)!=0&(c[732414]|0)!=0|(c[405785]|0)!=0)){b=0;return b|0}d=Bo(1624684)|0;if(!d){b=0;return b|0}rl(Ao(d,57895,0)|0,0)|0;e=(Ms(Ao(d,57895,0)|0)|0)>>>0<2;zo(d);if(e|(c[750218]|0)==0){b=0;return b|0}if(ng()|0){b=0;return b|0}if(!(Cs(1446448,2923100)|0)){b=0;return b|0}c[406687]=1;b=1;return b|0}function Ml(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0;d=Ga;Ga=Ga+16|0;e=d;if(!((a|0)!=0&(b|0)!=0)){Ga=d;return
function Yd(a,b){a=a|0;b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;d=c[a>>2]|0;e=a+28|0;f=c[e>>2]|0;g=a+20|0;h=c[g>>2]|0;do if((f|0)!=-1){i=c[d+12>>2]|0;j=f;while(1){k=i+(j<<2)|0;l=c[k>>2]|0;m=(l>>>14)+-131071|0;n=j;j=(m|0)==-1?-1:j+1+m|0;if((n|0)>0?(m=k+-4|0,o=c[m>>2]|0,((o&63)+-37|0)>>>0<5):0){p=m;q=o}else{p=k;q=l}if((q&63|0)==41){c[p>>2]=q&8372224|q>>>23<<6|40;o=h+~n|0;if((((o|0)>-1?o:0-o|0)|0)>131071){r=8;break}s=c[k>>2]&16383;t=(o<<14)+2147467264|0}else{o=h+~n|0;if((((o|0)>-1?o:0-o|0)|0)>131071){r=11;break}s=(o<<14)+2147467264|0;t=l&16383}c[k>>2]=s|t;if((j|0)==-1){r=14;break}}if((r|0)==8)$d(c[a+12>>2]|0,43994);else if((r|0)==11)$d(c[a+12>>2]|0,43994);else if((r|0)==14){u=c[g>>2]|0;break}}else u=h;while(0);c[e>>2]=-1;e=d+48|0;if((u|0)<(c[e>>2]|0)){v=c[d+12>>2]|0;w=u}else{u=d+12|0;h=ae(c[(c[a+12>>2]|0)+32>>2]|0,c[u>>2]|0,e,4,2147483645,44342)|0;c[u>>2]=h;v=h;w=c[g>>2]|0}c[v+(w<<2)>>2]=b;b=c[g>>2]|0;w=d+52|0;v=a+12|0;if((b|0)<(c[w>>2]|0)){x=d+20|0;y=b;z=c[v>>2]|0;A=z+8|0;B=c[A>>2]|0;C=c[x>>2]|0;D=C+(y<<2)|0;c[D>>2]=B;E=c[g>>2]|0;F=E+1|0;c[g>>2]=F;return E|0}else{b=d+20|0;c[b>>2]=ae(c[(c[v>>2]|0)+32>>2]|0,c[b>>2]|0,w,4,2147483645,44342)|0;x=b;y=c[g>>2]|0;z=c[v>>2]|0;A=z+8|0;B=c[A>>2]|0;C=c[x>>2]|0;D=C+(y<<2)|0;c[D>>2]=B;E=c[g>>2]|0;F=E+1|0;c[g>>2]=F;return E|0}return 0}function Zd(e){e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;f=e+16|0;g=c[f>>2]|0;h=e+12|0;i=c[h>>2]|0;do if(c[g>>2]|0?a[g+9>>0]|0:0){j=e+28|0;k=c[j>>2]|0;c[j>>2]=-1;l=Yd(e,2147450916)|0;do if((k|0)!=-1){if((l|0)==-1){m=k;n=d[g+8>>0]|0;break}o=c[(c[e>>2]|0)+12>>2]|0;p=l;while(1){q=o+(p<<2)|0;r=c[q>>2]|0;s=(r>>>14)+-131071|0;t=(s|0)==-1?-1:p+1+s|0;if((t|0)==-1)break;else p=t}o=k+~p|0;if((((o|0)>-1?o:0-o|0)|0)>131071)$d(c[h>>2]|0,43994);else{c[q>>2]=(o<<14)+2147467264|r&16383;u=11;break}}else u=11;while(0);if((u|0)==11){k=d[g+8>>0]|0;if((l|0)==-1){c[e+24>>2]=c[e+20>>2];break}else{m=l;n=k}}k=c[(c[e>>2]|0)+12>>2]|0;o=(n<<6)+64&16320;t=m;do{s=k+(t<<2)|0;v=c[s>>2]|0;w=(v>>>14)+-131071|0;c[s>>2]=v&-16321|o;t=(w|0)==-1?-1:t+1+w|0}while((t|0)!=-1);c[e+24>>2]=c[e+20>>2];t=c[j>>2]|0;if((t|0)==-1){c[j>>2]=m;break}o=t;while(1){x=k+(o<<2)|0;y=c[x>>2]|0;t=(y>>>14)+-131071|0;l=(t|0)==-1?-1:o+1+t|0;if((l|0)==-1)break;else o=l}k=m+~o|0;if((((k|0)>-1?k:0-k|0)|0)>131071)$d(c[h>>2]|0,43994);else{c[x>>2]=(k<<14)+2147467264|y&16383;break}}while(0);if(a[g+10>>0]|0){y=i+32|0;x=Mc(c[y>>2]|0,53085,5)|0;m=i+44|0;n=c[m>>2]|0;r=n+24|0;q=i+28|0;k=c[q>>2]|0;j=c[k+20>>2]|0;l=n+28|0;t=c[l>>2]|0;w=n+32|0;if((t|0)<(c[w>>2]|0)){z=k;A=t;B=n;C=c[r>>2]|0}else{n=ae(c[y>>2]|0,c[r>>2]|0,w,16,32767,44021)|0;c[r>>2]=n;z=c[q>>2]|0;A=c[l>>2]|0;B=c[m>>2]|0;C=n}c[C+(t<<4)>>2]=x;c[C+(t<<4)+8>>2]=0;a[C+(t<<4)+12>>0]=a[z+46>>0]|0;c[C+(t<<4)+4>>2]=j;c[l>>2]=A+1;A=(c[B+24>>2]|0)+(t<<4)|0;t=b[(c[z+16>>2]|0)+6>>1]|0;z=B+16|0;l=c[z>>2]|0;if((l|0)>(t|0)){j=B+12|0;B=t;t=l;while(1){l=c[(c[j>>2]|0)+(B<<4)>>2]|0;C=c[A>>2]|0;x=a[l+4>>0]|0;do if(x<<24>>24==(a[C+4>>0]|0)){if(x<<24>>24==4){if((l|0)!=(C|0)){u=35;break}}else{n=c[l+12>>2]|0;if((l|0)!=(C|0)){if((n|0)!=(c[C+12>>2]|0)){u=35;break}if(Zr(l+16|0,C+16|0,n)|0){u=35;break}}}be(i,B,A);D=B;E=c[z>>2]|0}else u=35;while(0);if((u|0)==35){u=0;D=B+1|0;E=t}if((D|0)<(E|0)){B=D;t=E}else break}}}E=c[g>>2]|0;c[f>>2]=E;f=g+8|0;t=a[f>>0]|0;D=e+46|0;B=a[D>>0]|0;u=B&255;z=c[(c[h>>2]|0)+44>>2]|0;A=z+4|0;c[A>>2]=(t&255)-u+(c[A>>2]|0);if((t&255)<(B&255)){A=c[e+20>>2]|0;j=c[e+40>>2]|0;C=c[(c[e>>2]|0)+24>>2]|0;l=c[z>>2]|0;x=u;while(1){u=(x&255)+-1<<24>>24;c[C+((b[l+(j+(u&255)<<1)>>1]|0)*12|0)+8>>2]=A;if((u&255)>(t&255))x=x+-1|0;else break}a[D>>0]=t;F=t}else F=B;a[e+48>>0]=F;F=c[i+44>>2]|0;c[F+28>>2]=b[g+4>>1];B=b[g+6>>1]|0;if(!E)if((c[F+16>>2]|0)>(B|0))de(i,(c[F+12>>2]|0)+(B<<4)|0);else return;F=z+16|0;if((c[F>>2]|0)<=(B|0))return;i=z+12|0;z=g+9|0;g=B;B=t;while(1){t=c[i>>2]|0;E=t+(g<<4)+12|0;D=B&255;if((d[E>>0]|0)>(B&255)){if(a[z>>0]|0?(x=c[t+(g<<4)+4>>2]|0,(x|0)!=-1):0){t=c[(c[e>>2]|0)+12>>2]|0;A=(D<<6)+64&16320;D=x;do{x=t+(D<<2)|0;j
function Sa(a){a=a|0;var b=0;b=Ga;Ga=Ga+a|0;Ga=Ga+15&-16;return b|0}function Ta(){return Ga|0}function Ua(a){a=a|0;Ga=a}function Va(a,b){a=a|0;b=b|0;Ga=a;Ha=b}function Wa(){return c[(c[(c[c[694856]>>2]|0)+16>>2]|0)+12>>2]|0}function Xa(){var a=0,b=0;a=c[732521]|0;c[732521]=a+6;if((a|0)<=116)return;c[732521]=a;a=0;b=c[694838]|0;do{vo(b,b,0,a+6|0,0,a,128,1);a=a+1|0;b=c[694838]|0}while((a|0)!=122);Hm(b,0,122,127,127,0);Rg(65536);return}function Ya(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;b=Ga;Ga=Ga+208|0;d=b+200|0;e=b+192|0;f=b+184|0;g=b+176|0;h=b+168|0;i=b+160|0;j=b+152|0;k=b+144|0;l=b+136|0;m=b+128|0;n=b+120|0;o=b+112|0;p=b+104|0;q=b+96|0;r=b+88|0;s=b+80|0;t=b+72|0;u=b+64|0;v=b+8|0;w=b;x=b+204|0;if(!(_r(a,35336,9)|0))Kn(a+10|0,2920020)|0;if(!(_r(a,35346,10)|0))Kn(a+11|0,2922068)|0;if(!(_r(a,35357,14)|0)){c[w>>2]=1623148;At(a+14|0,35372,w)|0}if(!(_r(a,35376,11)|0)){c[v>>2]=1623180;c[v+4>>2]=1623184;c[v+8>>2]=1623188;c[v+12>>2]=1623192;c[v+16>>2]=1623196;c[v+20>>2]=1623200;c[v+24>>2]=1623204;c[v+28>>2]=1623208;c[v+32>>2]=1623212;c[v+36>>2]=1623216;c[v+40>>2]=1623220;c[v+44>>2]=1623224;c[v+48>>2]=1623228;At(a+11|0,35388,v)|0}if(!(_r(a,35428,10)|0)){c[u>>2]=1623308;At(a+10|0,35372,u)|0}if(!(_r(a,35439,11)|0)){c[t>>2]=1623332;At(a+11|0,35372,t)|0}if(!(_r(a,46981,7)|0)){c[s>>2]=1623336;At(a+7|0,35372,s)|0}if((_r(a,57683,6)|0)==0?(c[r>>2]=2023172,At(a+6|0,35372,r)|0,c[515970]|0):0)c[515970]=c[505793];if(!(_r(a,35451,9)|0)){c[q>>2]=1623344;At(a+9|0,35372,q)|0}if(!(_r(a,47335,16)|0)){c[p>>2]=1623320;At(a+16|0,35372,p)|0}if(!(_r(a,47236,9)|0)){c[o>>2]=1623324;At(a+9|0,35372,o)|0}if(!(_r(a,35461,12)|0)){c[n>>2]=1623360;At(a+12|0,35372,n)|0}if(!(_r(a,35474,20)|0)){c[m>>2]=2022612;At(a+20|0,35372,m)|0}if(!(_r(a,35495,22)|0)){c[l>>2]=2022616;At(a+22|0,35372,l)|0}if(!(_r(a,35518,14)|0)){c[k>>2]=x;At(a+14|0,35372,k)|0;c[405842]=(c[x>>2]|0)==2&1}if(!(_r(a,46692,13)|0)){c[j>>2]=1623368;At(a+13|0,35372,j)|0}if(!(_r(a,47441,9)|0)){c[i>>2]=1623312;At(a+9|0,35372,i)|0}if(!(_r(a,35533,9)|0)){c[h>>2]=1623316;At(a+9|0,35372,h)|0}if(!(_r(a,35543,19)|0)){c[g>>2]=1623172;At(a+19|0,35372,g)|0}if(!(_r(a,35563,19)|0)){c[f>>2]=1623168;At(a+19|0,35372,f)|0}if(!(_r(a,35583,22)|0)){c[e>>2]=1623176;At(a+22|0,35372,e)|0}if(_r(a,35606,11)|0){Ga=b;return 0}c[d>>2]=1623352;At(a+11|0,35372,d)|0;Ga=b;return 0}function Za(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;b=Ga;Ga=Ga+256|0;d=b+248|0;e=b+240|0;f=b+232|0;g=b+224|0;h=b+216|0;i=b+208|0;j=b+200|0;k=b+192|0;l=b+184|0;m=b+176|0;n=b+168|0;o=b+160|0;p=b+152|0;q=b+144|0;r=b+136|0;s=b+128|0;t=b+120|0;u=b+112|0;v=b+104|0;w=b+96|0;x=b+88|0;y=b+80|0;z=b+72|0;A=b+64|0;B=b+56|0;C=b+48|0;D=b+40|0;E=b+32|0;F=b+24|0;G=b+16|0;H=b+8|0;I=b;J=a+8|0;a=c[J>>2]|0;c[I>>2]=35631;It(a,35618,I)|0;Rt(35638,25,1,c[J>>2]|0)|0;I=c[J>>2]|0;c[H>>2]=c[505793];It(I,35664,H)|0;Rt(35676,37,1,c[J>>2]|0)|0;H=c[J>>2]|0;c[G>>2]=2920020;It(H,35714,G)|0;Rt(35729,36,1,c[J>>2]|0)|0;G=c[J>>2]|0;c[F>>2]=2922068;It(G,35766,F)|0;Rt(35782,65,1,c[J>>2]|0)|0;F=c[J>>2]|0;c[E>>2]=c[405787];It(F,35848,E)|0;Rt(35868,70,1,c[J>>2]|0)|0;Rt(35939,12,1,c[J>>2]|0)|0;E=c[J>>2]|0;c[D>>2]=c[405795];It(E,35952,D)|0;D=c[J>>2]|0;c[C>>2]=c[405796];It(D,35952,C)|0;C=c[J>>2]|0;c[B>>2]=c[405797];It(C,35952,B)|0;B=c[J>>2]|0;c[A>>2]=c[405798];It(B,35952,A)|0;A=c[J>>2]|0;c[z>>2]=c[405799];It(A,35952,z)|0;z=c[J>>2]|0;c[y>>2]=c[405800];It(z,35952,y)|0;y=c[J>>2]|0;c[x>>2]=c[405801];It(y,35952,x)|0;x=c[J>>2]|0;c[w>>2]=c[405802];It(x,35952,w)|0;w=c[J>>2]|0;c[v>>2]=c[405803];It(w,35952,v)|0;v=c[J>>2]|0;c[u>>2]=c[405804];It(v,35952,u)|0;u=c[J>>2]|0;c[t>>2]=c[405805];It(u,35952,t)|0;t=c[J>>2]|0;c[s>>2]=c[405806];It(t,35952,s)|0;s=c[J>>2]|0;c[r>>2]=c[405807];It(s,35952,r)|0;Rt(35956,2,1,c[J>>2]|0)|0;Rt(35959,52,1,c[J>>2]|0)|0;r=c[J>>2]|0;c[q>>2]=c[405827];It(r,36012,q)|0;Rt(36028,70,1,c[J>>2]|0)|0;q=c[J>>2]|0;c[p>>2]=c[405833];It(q,36099,p)|0;Rt(36116,125,1,c[J>>2]|0)|0;p=c[J>>2]|0;c[o>>2]=c[405836];It(p,36242,o)|0;Rt(36257,52,
function Uj(a,b,d,e,f,g,h,i){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0;j=B(e,e)|0;k=B(f,f)|0;l=0-(k+(((e|0)%2|0)+(j>>>2)))|0;m=(k>>>2)+((f|0)%2|0)|0;n=0-(j+m)|0;o=0-m|0;m=k<<1;p=j<<1;if((f|e|0)<0)q=0;else{r=g+b|0;s=h+d|0;t=0;u=f;v=B(B(j,-2)|0,f)|0;w=0;x=B(0-j|0,f)|0;y=0;while(1){z=y+8|0;do if(((B(t,k)|0)+x|0)>(l|0)?(A=B(u,j)|0,(A+x|0)>(o|0)):0){C=b-t|0;D=r+t|0;E=(Rj(a,C,D,d-u|0,i,c[732532]|0)|0)+z|0;if((x-A|0)<=(n|0)){A=w+m|0;F=v+p|0;G=t+1|0;H=u+-1|0;I=F;J=A;K=A+x+F|0;L=(Rj(a,C,D,s+u|0,i,c[732532]|0)|0)+E|0;break}if(!u)M=E;else M=(Rj(a,C,D,s+u|0,i,c[732532]|0)|0)+E|0;E=v+p|0;G=t;H=u+-1|0;I=E;J=w;K=E+x|0;L=M}else N=5;while(0);if((N|0)==5){N=0;E=w+m|0;G=t+1|0;H=u;I=v;J=E;K=E+x|0;L=z}if((H|0)<0|(G|0)>(e|0)){q=L;break}else{t=G;u=H;v=I;w=J;x=K;y=L}}}if(!h)O=q;else O=(Rj(a,b-e|0,e+b+g|0,d+1|0,i,c[732532]|0)|0)+q|0;if(f|0){P=O;return P|0}P=(Rj(a,b-e|0,e+b|0,d,i,c[732532]|0)|0)+O|0;return P|0}function Vj(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0;h=(e|0)<(b|0);i=h?e:b;j=h?b:e;e=(f|0)<(d|0);b=e?f:d;h=e?d:f;f=h-b|0;if((f|0)>=2?(d=j-i|0,(d|0)>=2):0){k=Uj(a,(j+i|0)/2|0,(h+b|0)/2|0,d>>>1,f>>>1,d&1,f&1,g)|0;return k|0}f=0;d=b;while(1){b=(Rj(a,i,j,d,g,c[732532]|0)|0)+f|0;if((d|0)<(h|0)){f=b;d=d+1|0}else{k=b;break}}return k|0}function Wj(b,d,e,f,g,h){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;i=Ga;Ga=Ga+128|0;j=i+64|0;k=i;l=k;m=1792;n=l+64|0;do{c[l>>2]=c[m>>2];l=l+4|0;m=m+4|0}while((l|0)<(n|0));if((h|0)==1){l=j;n=l+64|0;do{c[l>>2]=0;l=l+4|0}while((l|0)<(n|0));if(!((e|0)>(g|0)|(d|0)>(f|0))){l=c[b+16>>2]|0;n=e;while(1){h=c[l+(n<<2)>>2]|0;m=d;while(1){o=j+(c[1856+((a[h+m>>0]&15)<<2)>>2]<<2)|0;c[o>>2]=(c[o>>2]|0)+1;if((m|0)<(f|0))m=m+1|0;else break}if((n|0)<(g|0))n=n+1|0;else break}}n=(B(1-d+f<<1,1-e+g|0)|0)/3|0;l=(c[j+4>>2]|0)+(c[j>>2]|0)-n|0;m=(l|0)<0?0-l|0:l;l=(c[j+8>>2]|0)+((c[j+4>>2]|0)+(c[j>>2]|0))-n|0;h=(l|0)<0?0-l|0:l;l=(h|0)<(m|0);o=l?h:m;m=(c[j+12>>2]|0)+((c[j+8>>2]|0)+((c[j+4>>2]|0)+(c[j>>2]|0)))-n|0;h=(m|0)<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+16>>2]|0)+((c[j+12>>2]|0)+((c[j+8>>2]|0)+((c[j+4>>2]|0)+(c[j>>2]|0))))))))))-n|0;h=(u|0)<0?0-u|0:u;u=(h|0)<(v|0);w=u?h:v;v=(c[j+44>>2]|0)+((c[j+40>>2]|0)+((c[j+36>>2]|0)+((c[j+32>>2]|0)+((c[j+28>>2]|0)+((c[j+24>>2]|0)+((c[j+20>>2]|0)+((c[j+16>>2]|0)+((c[j+12>>2]|0)+((c[j+8>>2]|0)+((c[j+4>>2]|0)+(c[j>>2]|0)))))))))))-n|0;h=(v|0)<0?0-v|0:v;v=(h|0)<(w|0);x=v?12:u?11:t?10:s?9:r?8:q?7:p?6:o?5:m?4:l?3:2;l=v?h:w;w=(c[j+48>>2]|0)+((c[j+44>>2]|0)+((c[j+40>>2]|0)+((c[j+36>>2]|0)+((c[j+32>>2]|0)+((c[j+28>>2]|0)+((c[j+24>>2]|0)+((c[j+20>>2]|0)+((c[j+16>>2]|0)+((c[j+12>>2]|0)+((c[j+8>>2]|0)+((c[j+4>>2]|0)+(c[j>>2]|0))))))))))))-n|0;h=(w|0)<0?0-w|0:w;w=(x|0)==-1|(h|0)<(l|0);v=w?13:x;x=w?h:l;l=(c[j+52>>2]|0)+((c[j+48>>2]|0)+((c[j+44>>2]|0)+((c[j+40>>2]|0)+((c[j+36>>2]|0)+((c[j+32>>2]|0)+((c[j+28>>2]|0)+((c[j+24>>2]|0)+
function Bc(e,f,g){e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;h=Ga;Ga=Ga+16|0;i=h;j=f+4|0;a:do switch(c[j>>2]&63){case 0:{k=1;break}case 3:{k=(c[f>>2]|0)==(c[g>>2]|0);break}case 1:{k=(c[f>>2]|0)==(c[g>>2]|0);break}case 2:{k=(c[f>>2]|0)==(c[g>>2]|0);break}case 22:{k=(c[f>>2]|0)==(c[g>>2]|0);break}case 4:{k=(c[f>>2]|0)==(c[g>>2]|0);break}case 20:{l=c[f>>2]|0;m=c[g>>2]|0;n=c[l+12>>2]|0;if((l|0)!=(m|0))if((n|0)==(c[m+12>>2]|0))k=(Zr(l+16|0,m+16|0,n)|0)==0;else k=0;else k=1;break}case 7:{n=c[f>>2]|0;m=c[g>>2]|0;if((n|0)!=(m|0))if(((e|0)!=0?(l=c[n+8>>2]|0,n=c[m+8>>2]|0,(l|0)!=0):0)?(m=l+6|0,o=a[m>>0]|0,(o&32)==0):0){p=c[(c[e+12>>2]|0)+176>>2]|0;q=c[p+8>>2]|0;r=(c[l+16>>2]|0)+(((1<<(d[l+7>>0]|0))+-1&q)*20|0)|0;while(1){if((c[r+12>>2]|0)==68?(c[r+8>>2]|0)==(p|0):0){s=17;break}t=c[r+16>>2]|0;if(!t){u=2060540;break}else r=t}if((s|0)==17)u=r;t=u+4|0;v=c[t>>2]|0;if(!v){a[m>>0]=o|32;k=0;break a}if(u)if((l|0)!=(n|0))if((n|0)!=0?(w=n+6|0,x=a[w>>0]|0,(x&32)==0):0){y=(c[n+16>>2]|0)+(((1<<(d[n+7>>0]|0))+-1&q)*20|0)|0;while(1){if((c[y+12>>2]|0)==68?(c[y+8>>2]|0)==(p|0):0){s=28;break}z=c[y+16>>2]|0;if(!z){A=2060540;break}else y=z}if((s|0)==28)A=y;p=c[A+4>>2]|0;if(!p){a[w>>0]=x|32;k=0;break a}if((A|0)!=0&(v|0)==(p|0)?(Bc(0,u,A)|0)!=0:0){B=u;C=t;s=59}else k=0}else k=0;else{B=u;C=t;s=59}else k=0}else k=0;else k=1;break}case 5:{p=c[f>>2]|0;q=c[g>>2]|0;if((p|0)!=(q|0))if(((e|0)!=0?(n=c[p+8>>2]|0,p=c[q+8>>2]|0,(n|0)!=0):0)?(q=n+6|0,l=a[q>>0]|0,(l&32)==0):0){o=c[(c[e+12>>2]|0)+176>>2]|0;m=c[o+8>>2]|0;r=(c[n+16>>2]|0)+(((1<<(d[n+7>>0]|0))+-1&m)*20|0)|0;while(1){if((c[r+12>>2]|0)==68?(c[r+8>>2]|0)==(o|0):0){s=41;break}z=c[r+16>>2]|0;if(!z){D=2060540;break}else r=z}if((s|0)==41)D=r;t=D+4|0;v=c[t>>2]|0;if(!v){a[q>>0]=l|32;k=0;break a}if(D)if((n|0)!=(p|0))if((p|0)!=0?(x=p+6|0,w=a[x>>0]|0,(w&32)==0):0){y=(c[p+16>>2]|0)+(((1<<(d[p+7>>0]|0))+-1&m)*20|0)|0;while(1){if((c[y+12>>2]|0)==68?(c[y+8>>2]|0)==(o|0):0){s=52;break}z=c[y+16>>2]|0;if(!z){E=2060540;break}else y=z}if((s|0)==52)E=y;o=c[E+4>>2]|0;if(!o){a[x>>0]=w|32;k=0;break a}if((E|0)!=0&(v|0)==(o|0)?(Bc(0,D,E)|0)!=0:0){B=D;C=t;s=59}else k=0}else k=0;else{B=D;C=t;s=59}else k=0}else k=0;else k=1;break}default:k=(c[f>>2]|0)==(c[g>>2]|0)}while(0);b:do if((s|0)==59){D=e+8|0;E=c[D>>2]|0;u=e+28|0;A=E-(c[u>>2]|0)|0;c[D>>2]=E+8;c[E>>2]=c[B>>2];c[E+4>>2]=c[C>>2];E=c[D>>2]|0;c[D>>2]=E+8;c[E>>2]=c[f>>2];c[E+4>>2]=c[j>>2];E=c[D>>2]|0;c[D>>2]=E+8;c[E>>2]=c[g>>2];c[E+4>>2]=c[g+4>>2];E=(c[D>>2]|0)+-24|0;o=a[(c[e+16>>2]|0)+18>>0]&1;m=e+38|0;p=(b[m>>1]|0)+1<<16>>16;b[m>>1]=p;if((p&65535)>199){if(p<<16>>16==200)ic(e,43256,i);if((p&65535)>224)gc(e,6)}p=o<<24>>24!=0;if(!p){o=e+36|0;b[o>>1]=(b[o>>1]|0)+1<<16>>16}if(!(mc(e,E,1)|0))nc(e);if(!p){p=e+36|0;b[p>>1]=(b[p>>1]|0)+-1<<16>>16}b[m>>1]=(b[m>>1]|0)+-1<<16>>16;m=(c[u>>2]|0)+A|0;A=c[D>>2]|0;u=A+-8|0;c[D>>2]=u;c[m>>2]=c[u>>2];c[m+4>>2]=c[A+-4>>2];A=c[D>>2]|0;switch(c[A+4>>2]|0){case 0:{k=0;break b;break}case 1:{k=(c[A>>2]|0)!=0;break b;break}default:{k=1;break b}}}while(0);Ga=h;return k&1|0}function Cc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;e=c[b+4>>2]|0;if((e|0)==3){if((c[d+4>>2]|0)==3){f=(c[b>>2]|0)<(c[d>>2]|0)&1;return f|0}}else if((e&15|0)==4?(c[d+4>>2]&15|0)==4:0){e=c[b>>2]|0;g=c[d>>2]|0;h=e+16|0;i=g+16|0;j=eu(h,i)|0;a:do if(!j){k=c[g+12>>2]|0;l=i;m=c[e+12>>2]|0;n=h;while(1){o=Ms(n)|0;if((o|0)==(k|0)){p=0;break a}q=o+1|0;if((o|0)==(m|0)){p=-1;break a}l=l+q|0;n=n+q|0;o=eu(n,l)|0;if(o|0){p=o;break}else{k=k-q|0;m=m-q|0}}}else p=j;while(0);f=p>>>31;return f|0}p=a+8|0;if(!(Jc(a,b,d,c[p>>2]|0,26)|0))Kc(a,b,d);d=c[p>>2]|0;p=c[d+4>>2]|0;switch(p|0){case 1:{f=(c[d>>2]|0)!=0&1;return f|0}case 0:{f=p;return f|0}default:{f=1;return f|0}}return 0}function Dc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;e=c[b+4>>2]|0;if((e|0)==3){if((c[d+4>>2]|0)==3){f=(c[b>>2]|0)<=(c[d>>2]|0);g=f&1;return g|0}}else if((e&15|0)==4?(c[d+4>>2]&15|0)==4:0){e=c[b>>2]|0;h=c[d>>2]|0;i=e+16|0;j=h+16|0;k=eu(i,j)|0;a:do if(!k){l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c=0,Mc=0,Nc=0,Oc=0,Pc=0,Qc=0,Rc=0,Sc=0,Tc=0,Uc=0,Vc=0,Wc=0,Xc=0,Yc=0,Zc=0,_c=0,$c=0,ad=0,bd=0,cd=0,dd=0,ed=0,fd=0,gd=0,hd=0,id=0,jd=0,kd=0,ld=0,md=0,nd=0,od=0,pd=0,qd=0,rd=0,sd=0,td=0,ud=0,vd=0,wd=0,xd=0,yd=0,zd=0,Ad=0,Bd=0,Cd=0,Dd=0,Ed=0,Fd=0,Gd=0,Hd=0,Id=0,Jd=0,Kd=0,Ld=0,Md=0,Nd=0,Od=0,Pd=0,Qd=0,Rd=0,Sd=0,Td=0,Ud=0,Vd=0,Wd=0,Xd=0,Yd=0,Zd=0,_d=0,$d=0,ae=0;j=Ga;Ga=Ga+192|0;k=j+176|0;l=j+20|0;m=j+8|0;n=j+4|0;o=j;c[n>>2]=0;c[o>>2]=0;c[e>>2]=0;c[f>>2]=0;p=b+216|0;c[p>>2]=0;Du(l|0,b+28|0,156)|0;c[l>>2]=h;c[l+4>>2]=i;a:do if(c[b+12>>2]|0){q=B(i,h)|0;b:do switch(c[b+184>>2]|0){case 6:{r=(q|0)!=0;if((c[b+188>>2]|0)==8){if(!r)break b;s=0;while(1){if((a[g+(s<<2|3)>>0]|0)!=-1)break a;s=s+1|0;if(s>>>0>=q>>>0)break b}}if(r){s=0;do{t=s<<3;if((a[g+(t|6)>>0]|0)!=-1)break a;s=s+1|0;if((a[g+(t|7)>>0]|0)!=-1)break a}while(s>>>0<q>>>0)}break}case 4:{s=(q|0)!=0;if((c[b+188>>2]|0)==8){if(!s)break b;r=0;while(1){if((a[g+(r<<1|1)>>0]|0)!=-1)break a;r=r+1|0;if(r>>>0>=q>>>0)break b}}if(s){r=0;do{t=r<<2;if((a[g+(t|2)>>0]|0)!=-1)break a;r=r+1|0;if((a[g+(t|3)>>0]|0)!=-1)break a}while(r>>>0<q>>>0)}break}case 3:{r=c[b+192>>2]|0;s=c[b+196>>2]|0;if(s|0){t=0;do{if((a[r+(t<<2|3)>>0]|0)!=-1)break a;t=t+1|0}while(t>>>0<s>>>0)}break}default:break a}while(0);q=l+20|0;switch(c[q>>2]|0){case 6:{c[q>>2]=2;break a;break}case 4:{c[q>>2]=0;break a;break}default:break a}}while(0);if((c[b+8>>2]|0)>>>0>32768){c[p>>2]=60;Ga=j;return}if((c[b>>2]|0)>>>0>2){c[p>>2]=61;Ga=j;return}if((c[b+44>>2]|0)>>>0>1){c[p>>2]=71;Ga=j;return}q=l+20|0;s=c[q>>2]|0;t=l+24|0;r=c[t>>2]|0;switch(s|0){case 0:{switch(r|0){case 1:case 2:case 4:case 8:case 16:break;default:{u=37;v=42}}break}case 2:{switch(r|0){case 8:case 16:break;default:{u=37;v=42}}break}case 3:{switch(r|0){case 1:case 2:case 4:case 8:break;default:{u=37;v=42}}break}case 4:{switch(r|0){case 8:case 16:break;default:{u=37;v=42}}break}case 6:{switch(r|0){case 8:case 16:break;default:{u=37;v=42}}break}default:{u=31;v=42}}if((v|0)==42){c[p>>2]=u;Ga=j;return}c[p>>2]=0;u=b+184|0;w=c[u>>2]|0;x=c[b+188>>2]|0;switch(w|0){case 0:{switch(x|0){case 1:case 2:case 4:case 8:case 16:break;default:{y=37;v=49}}break}case 2:{switch(x|0){case 8:case 16:break;default:{y=37;v=49}}break}case 3:{switch(x|0){case 1:case 2:case 4:case 8:break;default:{y=37;v=49}}break}case 4:{switch(x|0){case 8:case 16:break;default:{y=37;v=49}}break}case 6:{switch(x|0){case 8:case 16:break;default:{y=37;v=49}}break}default:{y=31;v=49}}if((v|0)==49){c[p>>2]=y;Ga=j;return}c[p>>2]=0;do if((w|0)==(s|0)&(x|0)==(r|0))ep(n,o,g,l);else{y=B(i,h)|0;switch(s|0){case 3:case 0:{z=-1;v=55;break}case 2:{A=3;v=54;break}case 4:break;case 6:{A=4;v=54;break}default:{z=0;v=55}}if((v|0)==54){C=((B(B(r,y)|0,A)|0)+7|0)>>>3;v=56}else if((v|0)==55)switch(s|0){case 2:case 6:{C=((B(z&r,y)|0)+7|0)>>>3;v=56;break}default:{}}if((v|0)==56?(r|0)==8:0){y=mp(C)|0;if(!((C|0)!=0&(y|0)==0)){if((c[p>>2]|0)==0?(D=Yo(y,g,q,u,h,i)|0,c[p>>2]=D,(D|0)==0):0)ep(n,o,y,l)}else c[p>>2]=9955;op(y);break}c[p>>2]=59;Ga=j;return}while(0);c[m>>2]=0;u=m+8|0;c[u>>2]=0;g=m+4|0;c[g>>2]=0;c:do if(!(c[p>>2]|0)){C=np(0,2)|0;if(!C){E=0;F=0}else{c[u>>2]=2;c[m>>2]=C;c[g>>2]=1;a[C>>0]=-1
function Ar(a,e,f){a=a|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;g=c[a>>2]|0;Iq()|0;if((f|0)<=0)return;h=a+525596|0;i=a+525588|0;j=a+525572|0;k=g+32|0;l=g+40|0;g=a+525592|0;m=a+525580|0;n=a+525576|0;o=a+525600|0;p=a+525584|0;q=e;e=f;f=c[h>>2]|0;a:while(1){r=c[i>>2]|0;if((r|0)>(f|0)){s=r-f|0;r=(s|0)<(e|0)?s:e;do if((r|0)!=0?(s=r+f|0,(r|0)>0):0){t=c[(c[a>>2]|0)+40>>2]|0;if((t|0)<=0){u=f+1|0;Eu(q|0,0,((s|0)>(u|0)?s:u)-f<<1|0)|0;v=c[h>>2]|0;break}u=f;w=q;while(1){x=0;y=0;do{y=y+(b[a+4+(x*32848|0)+80+(u<<1)>>1]|0)|0;x=x+1|0}while((x|0)!=(t|0));x=(y|0)/3|0;z=(x|0)<32767?x:32767;b[w>>1]=(z|0)>-32767?z:-32767;u=u+1|0;if((u|0)>=(s|0)){v=f;break}else w=w+2|0}}else v=f;while(0);c[h>>2]=v+r;w=e-r|0;if((w|0)>0){A=q+(r<<1)|0;C=w}else{D=44;break}}else{A=q;C=e}w=c[l>>2]|0;b:do if((c[j>>2]|0)<(c[k>>2]|0))E=w;else{c:do if((w|0)>0){s=0;while(1){F=a+4+(s*32848|0)+28|0;if((c[F>>2]|0)==11)break;u=s+1|0;if((u|0)<(w|0))s=u;else break c}y=c[a+4+(s*32848|0)+32>>2]|0;c[j>>2]=y;c[j>>2]=((y|0)<0?1:(y|0)>=(c[k>>2]|0))?0:y;c[F>>2]=0;c[a+4+(s*32848|0)+40>>2]=0;c[a+4+(s*32848|0)+36>>2]=0;c[m>>2]=0;c[n>>2]=0;E=c[l>>2]|0;break b}while(0);if(!(c[o>>2]|0)){D=21;break a}c[j>>2]=0;E=w}while(0);if((E|0)>0){w=0;do{r=a+262788+(w*32848|0)|0;y=a+4+(w*32848|0)|0;u=r+80|0;do{c[r>>2]=c[y>>2];r=r+4|0;y=y+4|0}while((r|0)<(u|0));w=w+1|0;y=c[l>>2]|0}while((w|0)<(y|0));G=y}else G=E;c[g>>2]=-1;if(!(c[m>>2]|0)){if((G|0)>0){w=0;do{yr(a,a+4+(w*32848|0)|0);w=w+1|0;H=c[l>>2]|0}while((w|0)<(H|0));w=c[g>>2]|0;if((w|0)!=-1){c[j>>2]=w;c[m>>2]=0;c[n>>2]=0;if((H|0)>0){w=0;do{yr(a,a+4+(w*32848|0)|0);w=w+1|0;y=c[l>>2]|0}while((w|0)<(y|0));I=y;D=33}}else{I=H;D=33}}}else{I=G;D=33}if((D|0)==33?(D=0,(I|0)>0):0){w=0;do{y=a+4+(w*32848|0)|0;xr(a,y);zr(a,y,0,c[i>>2]|0);zr(a,a+262788+(w*32848|0)|0,0,128);y=0;do{r=B(128-y|0,b[a+262788+(w*32848|0)+80+(y<<1)>>1]|0)|0;u=a+4+(w*32848|0)+80+(y<<1)|0;b[u>>1]=((B(y,b[u>>1]|0)|0)+r|0)>>>7;y=y+1|0}while((y|0)!=128);w=w+1|0}while((w|0)<(c[l>>2]|0))}c[h>>2]=0;w=(c[m>>2]|0)+1|0;c[m>>2]=w;if((w|0)<(c[p>>2]|0))J=c[n>>2]|0;else{c[m>>2]=0;w=(c[n>>2]|0)+1|0;c[n>>2]=w;J=w}w=c[a>>2]|0;y=c[j>>2]|0;if((J|0)>=(c[(c[w+60>>2]|0)+((d[w+72+y>>0]|0)*2596|0)+32>>2]|0)){c[n>>2]=0;c[j>>2]=y+1}if((C|0)>0){q=A;e=C;f=0}else{D=44;break}}if((D|0)==21){c[a+525604>>2]=0;return}else if((D|0)==44)return}function Br(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ha=0,Ia=0,Ja=0;b=Ga;Ga=Ga+16|0;d=b;do if(a>>>0<245){e=a>>>0<11?16:a+11&-8;f=e>>>3;g=c[750351]|0;h=g>>>f;if(h&3|0){i=(h&1^1)+f|0;j=3001444+(i<<1<<2)|0;k=j+8|0;l=c[k>>2]|0;m=l+8|0;n=c[m>>2]|0;if((n|0)==(j|0))c[750351]=g&~(1<<i);else{c[n+12>>2]=j;c[k>>2]=n}n=i<<3;c[l+4>>2]=n|3;i=l+n+4|0;c[i>>2]=c[i>>2]|1;o=m;Ga=b;return o|0}m=c[750353]|0;if(e>>>0>m>>>0){if(h|0){i=2<<f;n=h<<f&(i|0-i);i=(n&0-n)+-1|0;n=i>>>12&16;f=i>>>n;i=f>>>5&8;h=f>>>i;f=h>>>2&4;l=h>>>f;h=l>>>1&2;k=l>>>h;l=k>>>1&1;j=(i|n|f|h|l)+(k>>>l)|0;l=3001444+(j<<1<<2)|0;k=l+8|0;h=c[k>>2]|0;f=h+8|0;n=c[f>>2]|0;if((n|0)==(l|0)){i=g&~(1<<j);c[750351]=i;p=i}else{c[n+12>>2]=l;c[k>>2]=n;p=g}n=j<<3;j=n-e|0;c[h+4>>2]=e|3;k=h+e|0;c[k+4>>2]=j|1;c[h+n>>2]=j;if(m|0){n=c[750356]|0;h=m>>>3;l=3001444+(h<<1<<2)|0;i=1<<h;if(!(p&i)){c[750351]=p|i;q=l;r=l+8|0}else{i=l+8|0;q=c[i>>2]|0;r=i}c[r>>2]=n;c[q+12>>2]=n;c[n+8>>2]=q;c[n+12>>2]=l}c[750353]=j;c[750356]=k;o=f;Ga=b;return o|0}f=c[750352]|0;if(f){k=(f&0-f)+-1|0;j=k>>>12&16;l=k>>>j;k=l>>>5&8;n=l>>>k;l=n>>>2&4;i=n>>>l;n=i>>>1&2;h=i>>>n;i=h>>>1&1;s=c[3001708+((k|j|l|n|i)+(h>>>i)<<2)>>2]|0;i=s;h=s;n=(c[s+4>>2]&-8)-e|0;while(1){s=c[i+16>>2]|0;if(!s){l=c[i+20>>2]|0;if(!l)break;else t=l}else t=s;s=(c[t+4>>2]&-8)-e|0;l=s>>>0<n>>>0;i=t;h=l?t:h;n=l?s:n}i=h+e|0;if(i>>>0>h>>>0){s=c[h+24>>2]|0;l=c[h+12>>2]|0;do if((l|0)==(h|0)){j=h+20|0
function Bo(b){b=b|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;d=Ga;Ga=Ga+2048|0;e=d+1024|0;f=d;g=Fn(b,67514)|0;if(!g){h=0;Ga=d;return h|0}b=mp(24)|0;lp(b,0,24);a:do if(!(Dn(g)|0)){i=b+12|0;j=b+4|0;while(1){a[e>>0]=0;Hn(e,1023,g)|0;k=a[e>>0]|0;b:do switch(k<<24>>24){case 0:case 47:break;default:{l=e;m=k;while(1){n=m<<24>>24;switch(m<<24>>24){case 47:case 0:{break b;break}default:{}}if(m<<24>>24==95|((n+-48|0)>>>0<10|((n&-33)+-65|0)>>>0<26))break;n=l+1|0;l=n;m=a[n>>0]|0}if(m<<24>>24){a[f>>0]=0;n=0;o=l;p=m;while(1){a[f+n>>0]=p;n=n+1|0;a[f+n>>0]=0;q=o+1|0;p=a[q>>0]|0;r=p<<24>>24;if(!(p<<24>>24==95|((r+-48|0)>>>0<10|((r&-33)+-65|0)>>>0<26)))break;else o=q}if(a[f>>0]|0){yo(b,f);p=a[q>>0]|0;if(p<<24>>24==58)s=(a[o+2>>0]|0)==58;else s=0;n=q;m=p;c:while(1){switch(m<<24>>24){case 58:case 32:break;default:break c}p=n+1|0;n=p;m=a[p>>0]|0}o=m<<24>>24==0;if(!s){if(o)break b;c[i>>2]=np(c[i>>2]|0,(c[j>>2]<<2)+4|0)|0;p=mp((Ms(n)|0)+1|0)|0;l=c[j>>2]|0;c[(c[i>>2]|0)+(l<<2)>>2]=p;rm(c[(c[i>>2]|0)+(l<<2)>>2]|0,n)|0;c[j>>2]=(c[j>>2]|0)+1;break b}if(!o){o=n;while(1){a[f>>0]=0;l=o;while(1){t=a[l>>0]|0;if(t<<24>>24==32)l=l+1|0;else break}p=0;r=l;u=t;d:while(1){switch(u<<24>>24){case 32:case 0:{break d;break}default:{}}a[f+p>>0]=u;v=p+1|0;a[f+v>>0]=0;w=r+1|0;p=v;r=w;u=a[w>>0]|0}if(!(a[f>>0]|0))x=u;else{c[i>>2]=np(c[i>>2]|0,(c[j>>2]<<2)+4|0)|0;p=mp((Ms(f)|0)+1|0)|0;l=c[j>>2]|0;c[(c[i>>2]|0)+(l<<2)>>2]=p;rm(c[(c[i>>2]|0)+(l<<2)>>2]|0,f)|0;c[j>>2]=(c[j>>2]|0)+1;x=a[r>>0]|0}if(!(x<<24>>24))break;else o=r}}}}}}while(0);if(Dn(g)|0)break a}}while(0);Gn(g);c[515541]=(c[515541]|0)+1;h=b;Ga=d;return h|0}function Co(a){a=a|0;var b=0;b=kp(11032)|0;c[b>>2]=a<<2;c[515541]=(c[515541]|0)+1;return b|0}function Do(a){a=a|0;if(!a)return;Eo(a);op(a);c[515541]=(c[515541]|0)+-1;return}function Eo(a){a=a|0;var b=0;b=a+11016|0;Np(c[b>>2]|0);Mp(c[b>>2]|0);c[b>>2]=0;b=a+344|0;op(c[b>>2]|0);c[b>>2]=0;b=a+688|0;op(c[b>>2]|0);c[b>>2]=0;b=a+1032|0;op(c[b>>2]|0);c[b>>2]=0;b=a+1376|0;op(c[b>>2]|0);c[b>>2]=0;b=a+1720|0;op(c[b>>2]|0);c[b>>2]=0;b=a+2064|0;op(c[b>>2]|0);c[b>>2]=0;b=a+2408|0;op(c[b>>2]|0);c[b>>2]=0;b=a+2752|0;op(c[b>>2]|0);c[b>>2]=0;b=a+3096|0;op(c[b>>2]|0);c[b>>2]=0;b=a+3440|0;op(c[b>>2]|0);c[b>>2]=0;b=a+3784|0;op(c[b>>2]|0);c[b>>2]=0;b=a+4128|0;op(c[b>>2]|0);c[b>>2]=0;b=a+4472|0;op(c[b>>2]|0);c[b>>2]=0;b=a+4816|0;op(c[b>>2]|0);c[b>>2]=0;b=a+5160|0;op(c[b>>2]|0);c[b>>2]=0;b=a+5504|0;op(c[b>>2]|0);c[b>>2]=0;b=a+5848|0;op(c[b>>2]|0);c[b>>2]=0;b=a+6192|0;op(c[b>>2]|0);c[b>>2]=0;b=a+6536|0;op(c[b>>2]|0);c[b>>2]=0;b=a+6880|0;op(c[b>>2]|0);c[b>>2]=0;b=a+7224|0;op(c[b>>2]|0);c[b>>2]=0;b=a+7568|0;op(c[b>>2]|0);c[b>>2]=0;b=a+7912|0;op(c[b>>2]|0);c[b>>2]=0;b=a+8256|0;op(c[b>>2]|0);c[b>>2]=0;b=a+8600|0;op(c[b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Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu,Pu];var Ka=[Qu,sf,Gl,Qu];var La=[Ru,Nr,Jr,Fs,nf,Or,Ir,Ct];var Ma=[Su,ck];var Na=[Tu,zm];var Oa=[Uu,ab,Al,Bl,Vq,Uu,Uu,Uu];var Pa=[Vu,fm,Md,Qd,tf,ec,Of,Pf];var Qa=[Wu,_a,Uq,Wu];var Ra=[Xu];return{___divdi3:su,___emscripten_environ_constructor:ju,___errno_location:Lr,___muldi3:uu,___udivdi3:vu,__get_daylight:lu,__get_environ:nu,__get_timezone:mu,__get_tzname:ku,_bitshift64Ashr:wu,_bitshift64Lshr:xu,_bitshift64Shl:yu,_codo_mixer_callback:xp,_free:Cr,_i64Add:ou,_i64Subtract:pu,_llvm_bswap_i32:zu,_main:Db,_malloc:Br,_memcpy:Du,_memset:Eu,_mix_0:uq,_realloc:Er,_saveSetjmp:Au,_sbrk:Fu,_setThrew:Cu,_testSetjmp:Bu,dynCall_ii:Gu,dynCall_iii:Hu,dynCall_iiii:Iu,dynCall_iiiii:Ju,dynCall_v:Ku,dynCall_vi:Lu,dynCall_vii:Mu,dynCall_viii:Nu,dynCall_viiiii:Ou,establishStackSpace:Va,stackAlloc:Sa,stackRestore:Ua,stackSave:Ta}})
// EMSCRIPTEN_END_ASM
(asmGlobalArg, asmLibraryArg, buffer);
var ___divdi3 = Module["___divdi3"] = asm["___divdi3"];
var ___emscripten_environ_constructor = Module["___emscripten_environ_constructor"] = asm["___emscripten_environ_constructor"];
var ___errno_location = Module["___errno_location"] = asm["___errno_location"];
var ___muldi3 = Module["___muldi3"] = asm["___muldi3"];
var ___udivdi3 = Module["___udivdi3"] = asm["___udivdi3"];
var __get_daylight = Module["__get_daylight"] = asm["__get_daylight"];
var __get_environ = Module["__get_environ"] = asm["__get_environ"];
var __get_timezone = Module["__get_timezone"] = asm["__get_timezone"];
var __get_tzname = Module["__get_tzname"] = asm["__get_tzname"];
var _bitshift64Ashr = Module["_bitshift64Ashr"] = asm["_bitshift64Ashr"];
var _bitshift64Lshr = Module["_bitshift64Lshr"] = asm["_bitshift64Lshr"];
var _bitshift64Shl = Module["_bitshift64Shl"] = asm["_bitshift64Shl"];
var _codo_mixer_callback = Module["_codo_mixer_callback"] = asm["_codo_mixer_callback"];
var _free = Module["_free"] = asm["_free"];
var _i64Add = Module["_i64Add"] = asm["_i64Add"];
var _i64Subtract = Module["_i64Subtract"] = asm["_i64Subtract"];
var _llvm_bswap_i32 = Module["_llvm_bswap_i32"] = asm["_llvm_bswap_i32"];
var _main = Module["_main"] = asm["_main"];
var _malloc = Module["_malloc"] = asm["_malloc"];
var _memcpy = Module["_memcpy"] = asm["_memcpy"];
var _memset = Module["_memset"] = asm["_memset"];
var _mix_0 = Module["_mix_0"] = asm["_mix_0"];
var _realloc = Module["_realloc"] = asm["_realloc"];
var _saveSetjmp = Module["_saveSetjmp"] = asm["_saveSetjmp"];
var _sbrk = Module["_sbrk"] = asm["_sbrk"];
var _setThrew = Module["_setThrew"] = asm["_setThrew"];
var _testSetjmp = Module["_testSetjmp"] = asm["_testSetjmp"];
var establishStackSpace = Module["establishStackSpace"] = asm["establishStackSpace"];
var stackAlloc = Module["stackAlloc"] = asm["stackAlloc"];
var stackRestore = Module["stackRestore"] = asm["stackRestore"];
var stackSave = Module["stackSave"] = asm["stackSave"];
var dynCall_ii = Module["dynCall_ii"] = asm["dynCall_ii"];
var dynCall_iii = Module["dynCall_iii"] = asm["dynCall_iii"];
var dynCall_iiii = Module["dynCall_iiii"] = asm["dynCall_iiii"];
var dynCall_iiiii = Module["dynCall_iiiii"] = asm["dynCall_iiiii"];
var dynCall_v = Module["dynCall_v"] = asm["dynCall_v"];
var dynCall_vi = Module["dynCall_vi"] = asm["dynCall_vi"];
var dynCall_vii = Module["dynCall_vii"] = asm["dynCall_vii"];
var dynCall_viii = Module["dynCall_viii"] = asm["dynCall_viii"];
var dynCall_viiiii = Module["dynCall_viiiii"] = asm["dynCall_viiiii"];
Module["asm"] = asm;
Module["ccall"] = ccall;
Module["getValue"] = getValue;
Module["getMemory"] = getMemory;
Module["addRunDependency"] = addRunDependency;
Module["removeRunDependency"] = removeRunDependency;
Module["FS_createFolder"] = FS.createFolder;
Module["FS_createPath"] = FS.createPath;
Module["FS_createDataFile"] = FS.createDataFile;
Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
Module["FS_createLazyFile"] = FS.createLazyFile;
Module["FS_createLink"] = FS.createLink;
Module["FS_createDevice"] = FS.createDevice;
Module["FS_unlink"] = FS.unlink;
if (memoryInitializer) {
if (!isDataURI(memoryInitializer)) {
memoryInitializer = locateFile(memoryInitializer);
}
if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) {
var data = Module["readBinary"](memoryInitializer);
HEAPU8.set(data, GLOBAL_BASE);
} else {
addRunDependency("memory initializer");
var applyMemoryInitializer = function(data) {
if (data.byteLength) data = new Uint8Array(data);
HEAPU8.set(data, GLOBAL_BASE);
if (Module["memoryInitializerRequest"]) delete Module["memoryInitializerRequest"].response;
removeRunDependency("memory initializer");
};
var doBrowserLoad = function() {
Module["readAsync"](memoryInitializer, applyMemoryInitializer, function() {
throw "could not load memory initializer " + memoryInitializer;
});
};
var memoryInitializerBytes = tryParseAsDataURI(memoryInitializer);
if (memoryInitializerBytes) {
applyMemoryInitializer(memoryInitializerBytes.buffer);
} else if (Module["memoryInitializerRequest"]) {
var useRequest = function() {
var request = Module["memoryInitializerRequest"];
var response = request.response;
if (request.status !== 200 && request.status !== 0) {
var data = tryParseAsDataURI(Module["memoryInitializerRequestURL"]);
if (data) {
response = data.buffer;
} else {
console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: " + request.status + ", retrying " + memoryInitializer);
doBrowserLoad();
return;
}
}
applyMemoryInitializer(response);
};
if (Module["memoryInitializerRequest"].response) {
setTimeout(useRequest, 0);
} else {
Module["memoryInitializerRequest"].addEventListener("load", useRequest);
}
} else {
doBrowserLoad();
}
}
}
function ExitStatus(status) {
this.name = "ExitStatus";
this.message = "Program terminated with exit(" + status + ")";
this.status = status;
}
ExitStatus.prototype = new Error();
ExitStatus.prototype.constructor = ExitStatus;
var calledMain = false;
dependenciesFulfilled = function runCaller() {
if (!Module["calledRun"]) run();
if (!Module["calledRun"]) dependenciesFulfilled = runCaller;
};
Module["callMain"] = function callMain(args) {
args = args || [];
ensureInitRuntime();
var argc = args.length + 1;
var argv = stackAlloc((argc + 1) * 4);
HEAP32[argv >> 2] = allocateUTF8OnStack(Module["thisProgram"]);
for (var i = 1; i < argc; i++) {
HEAP32[(argv >> 2) + i] = allocateUTF8OnStack(args[i - 1]);
}
HEAP32[(argv >> 2) + argc] = 0;
try {
var ret = Module["_main"](argc, argv, 0);
exit(ret, true);
} catch (e) {
if (e instanceof ExitStatus) {
return;
} else if (e == "SimulateInfiniteLoop") {
Module["noExitRuntime"] = true;
return;
} else {
var toLog = e;
if (e && typeof e === "object" && e.stack) {
toLog = [ e, e.stack ];
}
err("exception thrown: " + toLog);
Module["quit"](1, e);
}
} finally {
calledMain = true;
}
};
function run(args) {
args = args || Module["arguments"];
if (runDependencies > 0) {
return;
}
preRun();
if (runDependencies > 0) return;
if (Module["calledRun"]) return;
function doRun() {
if (Module["calledRun"]) return;
Module["calledRun"] = true;
if (ABORT) return;
ensureInitRuntime();
preMain();
if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
if (Module["_main"] && shouldRunNow) Module["callMain"](args);
postRun();
}
if (Module["setStatus"]) {
Module["setStatus"]("Running...");
setTimeout(function() {
setTimeout(function() {
Module["setStatus"]("");
}, 1);
doRun();
}, 1);
} else {
doRun();
}
}
Module["run"] = run;
function exit(status, implicit) {
if (implicit && Module["noExitRuntime"] && status === 0) {
return;
}
if (Module["noExitRuntime"]) {} else {
ABORT = true;
EXITSTATUS = status;
exitRuntime();
if (Module["onExit"]) Module["onExit"](status);
}
Module["quit"](status, new ExitStatus(status));
}
function abort(what) {
if (Module["onAbort"]) {
Module["onAbort"](what);
}
if (what !== undefined) {
out(what);
err(what);
what = JSON.stringify(what);
} else {
what = "";
}
ABORT = true;
EXITSTATUS = 1;
throw "abort(" + what + "). Build with -s ASSERTIONS=1 for more info.";
}
Module["abort"] = abort;
if (Module["preInit"]) {
if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ];
while (Module["preInit"].length > 0) {
Module["preInit"].pop()();
}
}
var shouldRunNow = true;
if (Module["noInitialRun"]) {
shouldRunNow = false;
}
Module["noExitRuntime"] = true;
run();