Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WARNING! This file contains some subset of JS that is not supported by type inference.
- // You can try checking 'Transpile to ES5' checkbox if you want the types to be inferred
- /**
- * @license
- Yusuke Kawasaki
- @license MIT
- @constructor
- @see https://github.com/kawanet/event-lite
- @see http://kawanet.github.io/event-lite/EventLite.html
- @example
- var EventLite = require("event-lite");
- function MyClass() {...} // your class
- EventLite.mixin(MyClass.prototype); // import event methods
- var obj = new MyClass();
- obj.on("foo", function() {...}); // add event listener
- obj.once("bar", function() {...}); // add one-time event listener
- obj.emit("foo"); // dispatch event
- obj.emit("bar"); // dispatch another event
- obj.off("foo"); // remove event listener
- The buffer module from node.js, for the browser.
- @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
- @license MIT
- */
- 'use strict';
- !function(m) {
- function t(i) {
- if (n[i]) {
- return n[i].exports;
- }
- var module = n[i] = {
- i : i,
- l : false,
- exports : {}
- };
- return m[i].call(module.exports, module, module.exports, t), module.l = true, module.exports;
- }
- var n = {};
- t.m = m;
- t.c = n;
- t.d = function(i, name, n) {
- if (!t.o(i, name)) {
- Object.defineProperty(i, name, {
- enumerable : true,
- get : n
- });
- }
- };
- t.r = function(input) {
- if ("undefined" != typeof Symbol && Symbol.toStringTag) {
- Object.defineProperty(input, Symbol.toStringTag, {
- value : "Module"
- });
- }
- Object.defineProperty(input, "__esModule", {
- value : true
- });
- };
- t.t = function(val, byteOffset) {
- if (1 & byteOffset && (val = t(val)), 8 & byteOffset) {
- return val;
- }
- if (4 & byteOffset && "object" == typeof val && val && val.__esModule) {
- return val;
- }
- var d = Object.create(null);
- if (t.r(d), Object.defineProperty(d, "default", {
- enumerable : true,
- value : val
- }), 2 & byteOffset && "string" != typeof val) {
- var s;
- for (s in val) {
- t.d(d, s, function(attrPropertyName) {
- return val[attrPropertyName];
- }.bind(null, s));
- }
- }
- return d;
- };
- t.n = function(module) {
- var n = module && module.__esModule ? function() {
- return module.default;
- } : function() {
- return module;
- };
- return t.d(n, "a", n), n;
- };
- t.o = function(e, input) {
- return Object.prototype.hasOwnProperty.call(e, input);
- };
- t.p = "";
- t(t.s = 112);
- }([function(canCreateDiscussions, exports, require) {
- function alloc(obj) {
- return auto(this).alloc(obj);
- }
- function auto(that) {
- return isBuffer(that) ? BufferBuffer : isView(that) ? BufferUint8Array : isArray(that) ? BufferArray : hasBuffer ? BufferBuffer : hasArrayBuffer ? BufferUint8Array : BufferArray;
- }
- function _false() {
- return false;
- }
- function _is(o, key) {
- return o = "[object " + o + "]", function(object) {
- return null != object && {}.toString.call(key ? object[key] : object) === o;
- };
- }
- var Buffer = exports.global = require(27);
- var hasBuffer = exports.hasBuffer = Buffer && !!Buffer.isBuffer;
- var hasArrayBuffer = exports.hasArrayBuffer = "undefined" != typeof ArrayBuffer;
- var isArray = exports.isArray = require(9);
- exports.isArrayBuffer = hasArrayBuffer ? function(value) {
- return value instanceof ArrayBuffer || _isArrayBuffer(value);
- } : _false;
- var isBuffer = exports.isBuffer = hasBuffer ? Buffer.isBuffer : _false;
- var isView = exports.isView = hasArrayBuffer ? ArrayBuffer.isView || _is("ArrayBuffer", "buffer") : _false;
- exports.alloc = alloc;
- exports.concat = function(object, length) {
- if (!length) {
- length = 0;
- Array.prototype.forEach.call(object, function(spu_tag) {
- length = length + spu_tag.length;
- });
- }
- var ref = this !== exports && this || object[0];
- var result = alloc.call(ref, length);
- var i = 0;
- return Array.prototype.forEach.call(object, function(stat) {
- i = i + p.copy.call(stat, result, i);
- }), result;
- };
- exports.from = function(a) {
- return "string" == typeof a ? function(fields) {
- var parent = 3 * fields.length;
- var element = alloc.call(this, parent);
- var document = p.write.call(element, fields);
- return parent !== document && (element = p.slice.call(element, 0, document)), element;
- }.call(this, a) : auto(this).from(a);
- };
- var BufferArray = exports.Array = require(30);
- var BufferBuffer = exports.Buffer = require(31);
- var BufferUint8Array = exports.Uint8Array = require(32);
- var p = exports.prototype = require(10);
- var _isArrayBuffer = _is("ArrayBuffer");
- }, function(data, canCreateDiscussions, moment) {
- (function(eslint) {
- data.exports.isProd = void 0 !== eslint && !!eslint.env.IS_PROD || "undefined" != typeof location && "127.0.0.1" !== location.hostname && "localhost" !== location.hostname && !location.hostname.startsWith("192.168.");
- data.exports.enableHttps = data.exports.isProd;
- data.exports.serverTickRate = 1e3 / 30;
- data.exports.serverSendRate = 100;
- data.exports.clientSendRate = 1e3 / 30;
- data.exports.dltMx = Math.round(1e3 / 30);
- data.exports.streamUpdate = 1e4;
- data.exports.maxPlayers = 8;
- data.exports.serverSpread = 3;
- data.exports.minServerSpace = 3;
- data.exports.gamesPerServer = 5;
- data.exports.serverBrowserRate = 1e4;
- data.exports.maxPlayersTotal = data.exports.maxPlayers * data.exports.gamesPerServer + 50;
- data.exports.kickTimer = 9e4;
- data.exports.apiURL = void 0 === eslint ? data.exports.isProd ? "krunker.io" == location.hostname ? "https://api.krunker.io" : "https://api_beta.krunker.io" : "http://127.0.0.1:5060" : data.exports.isProd ? "krunker_prod" == eslint.env.VULTR_SCHEME ? "https://api.krunker.io" : "https://api_beta.krunker.io" : "http://127.0.0.1:5060";
- data.exports.needsRestart = false;
- data.exports.rewardTime = 432e5;
- data.exports.rewardMinLvl = 5;
- data.exports.endTimer = 2e4;
- data.exports.endAnim = 5e3;
- data.exports.thirdPZ = 14;
- data.exports.thirdPX = 5;
- data.exports.serverConfig = [{
- name : "Players",
- varN : "maxPlayers",
- def : 2,
- max : 10,
- maxF : 16,
- min : 1,
- step : 1
- }, {
- name : "Min Players",
- varN : "minPlayers",
- def : 0,
- max : 10,
- maxF : 16,
- min : 0,
- step : 1
- }, {
- name : "Lives",
- varN : "lives",
- def : 0,
- max : 10,
- min : 0,
- step : 1
- }, {
- name : "Minutes",
- varN : "gameTime",
- def : 4,
- max : 60,
- min : 0,
- step : 1
- }, {
- name : "Gravity",
- varN : "gravMlt",
- dontChange : true,
- def : 1,
- max : 2,
- min : .1,
- step : .1
- }, {
- name : "Jump Force",
- varN : "jumpMlt",
- dontChange : true,
- def : 1,
- max : 3,
- min : .1,
- step : .1
- }, {
- name : "Time Scale",
- varN : "deltaMlt",
- dontChange : true,
- def : 1,
- max : 1.5,
- min : .1,
- step : .1
- }, {
- name : "Strafe Speed",
- varN : "strafeSpd",
- dontChange : true,
- def : 1.2,
- max : 2,
- min : 1,
- step : .1
- }, {
- name : "Health Multiplier",
- varN : "healthMlt",
- dontChange : true,
- def : 1,
- max : 3,
- min : .1,
- step : .1
- }, {
- name : "Spectating",
- varN : "allowSpect",
- def : true,
- bool : true
- }, {
- name : "Kill Rewards",
- varN : "killRewards",
- dontChange : true,
- def : true,
- bool : true
- }, {
- name : "Sliding",
- varN : "canSlide",
- def : true,
- bool : true
- }, {
- name : "Auto Jump",
- varN : "autoJump",
- bool : true
- }, {
- name : "3rd Person",
- varN : "thirdPerson",
- bool : true
- }, {
- name : "Hide Nametags",
- varN : "nameTags",
- bool : true
- }];
- data.exports.prefabIDS = ["CUBE", "CRATE", "BARREL", "LADDER", "PLANE", "SPAWN_POINT", "CAMERA_POSITION", "VEHICLE", "STACK", "RAMP", "SCORE_ZONE", "BILLBOARD", "DEATH_ZONE", "PARTICLES", "OBJECTIVE", "TREE", "CONE", "CONTAINER", "GRASS", "CONTAINERR", "ACIDBARREL", "DOOR", "WINDOW", "FLAG"];
- data.exports.textureIDS = ["WALL", "DIRT", "FLOOR", "GRID", "GREY", "DEFAULT", "ROOF", "FLAG", "GRASS", "CHECK", "LINES", "BRICK"];
- data.exports.objectLimit = 3500;
- data.exports.objectLimitF = 6e3;
- data.exports.spawnLimit = 20;
- data.exports.gravity = 15e-5;
- data.exports.deathY = -100;
- data.exports.skyScale = 18e3;
- data.exports.shadowDst = 1200;
- data.exports.shadowRes = 1024;
- data.exports.shadowOff = .004;
- data.exports.lightDistance = 500;
- data.exports.cornerPad = 1;
- data.exports.cornerScl = 2.5;
- data.exports.cornerH = 7;
- data.exports.wallH = 5;
- data.exports.wallW = .8;
- data.exports.crateScale = 6;
- data.exports.stackScale = 6;
- data.exports.barrelScale = 4;
- data.exports.acidbarrelScale = data.exports.barrelScale;
- data.exports.treeScale = 10;
- data.exports.doorScale = 5;
- data.exports.windowScale = 6;
- data.exports.coneScale = 4;
- data.exports.containerScale = 7;
- data.exports.containerrScale = data.exports.containerScale;
- data.exports.grassScale = 32;
- data.exports.vehicleScale = 20;
- data.exports.barrelMlt = 1;
- data.exports.ladderWidth = 3.2;
- data.exports.ladderScale = .5;
- data.exports.terrainGrid = 8;
- data.exports.maxTerrainS = 4e3;
- data.exports.otherSoundMlt = .55;
- data.exports.maxParticles = 100;
- data.exports.explosionRange = 200;
- data.exports.chatMaxLength = 70;
- data.exports.chatInterval = 800;
- data.exports.voiceChatInterval = 2e3;
- data.exports.voiceChatMaxLength = 5;
- data.exports.movDirs = [];
- var counter = 0;
- for (; 8 > counter; ++counter) {
- data.exports.movDirs.push(-Math.PI + (counter + 1) * Math.PI / 4);
- }
- data.exports.interpolation = 1.1;
- data.exports.stateHistory = 1e3;
- data.exports.syncFreq = 800;
- data.exports.pingCount = 10;
- data.exports.mouseSens = .0024;
- data.exports.camChaseTrn = .0022;
- data.exports.camChaseSpd = .0012;
- data.exports.camChaseSen = .2;
- data.exports.camChaseDst = 24;
- data.exports.menuCamDist = 200;
- data.exports.menuCamAngle = -.5;
- data.exports.menuCamSpeed = .1;
- data.exports.idleAnimS = .0019;
- data.exports.animMult = 1.2;
- data.exports.leanPull = .99;
- data.exports.leanSens = .05;
- data.exports.leanMax = .16;
- data.exports.leanPullZ = .99;
- data.exports.leanMltZ = .03;
- data.exports.bobMltY = .024;
- data.exports.bobMltZ = .02;
- data.exports.bobPullY = .985;
- data.exports.bobPullZ = .99;
- data.exports.landPull = .994;
- data.exports.landPullV = .985;
- data.exports.landOff = .15;
- data.exports.aimAnimMlt = .18;
- data.exports.aimSlow = .55;
- data.exports.aimJumpSlow = .85;
- data.exports.stepAnim = .075;
- data.exports.stepMlt = .25;
- data.exports.stepPull = .995;
- data.exports.maxHealth = 100;
- data.exports.passiveInc = 500;
- data.exports.cameraHeight = 1.5;
- data.exports.playerSpeed = 42e-5;
- data.exports.ladderSpeed = .035;
- data.exports.ladderDecel = .97;
- data.exports.slideDecel = .999;
- data.exports.groundDecel = .99;
- data.exports.airSpeed = 47e-6;
- data.exports.airDecel = .9996;
- data.exports.jumpVel = .072;
- data.exports.jumpPush = .1;
- data.exports.decelMin = 1e-4;
- data.exports.climbHeight = 3;
- data.exports.wpnSpin = .018;
- data.exports.materialDens = {
- flesh : .2,
- default : .5
- };
- data.exports.nameOffset = .6;
- data.exports.nameOffsetHat = .8;
- data.exports.maxNameLength = 14;
- data.exports.maxPassLength = 16;
- data.exports.playerHeight = 11;
- data.exports.chestWidth = 2.6;
- data.exports.chestScale = 1.3;
- data.exports.armScale = 1.3;
- data.exports.legScale = 1.3;
- data.exports.uArmLength = 2.7;
- data.exports.armInset = -.1;
- data.exports.lArmLength = 2.7;
- data.exports.headScale = 2;
- data.exports.armOff = -.8;
- data.exports.legHeight = 4.2;
- data.exports.playerScale = (2 * data.exports.armScale + data.exports.chestWidth + data.exports.armInset) / 2;
- data.exports.hitBoxPad = 1;
- data.exports.tracerMinDst = 20;
- data.exports.tracerMaxDst = 500;
- data.exports.tracerChance = 1;
- data.exports.crouchLean = -.1 * Math.PI;
- data.exports.crouchDst = 3;
- data.exports.crouchSlow = .3;
- data.exports.crouchSpeed = .007;
- data.exports.crouchJump = .25;
- data.exports.crouchSpread = .4;
- data.exports.crouchAnim = 8e-4;
- data.exports.crouchAnimMlt = .5;
- data.exports.spreadMove = 30;
- data.exports.spreadFall = 35;
- data.exports.spreadRecover = .985;
- data.exports.spreadAdj = 63e-5;
- data.exports.spreadMlt = 400;
- data.exports.recoilMlt = .3;
- data.exports.flagMsg = "You have the Flag";
- data.exports.flagZoneS = 24;
- data.exports.flagZoneH = 36;
- data.exports.flagScale = 12;
- data.exports.flagOff = 6;
- data.exports.flagHOff = 15;
- data.exports.maxLevel = 102;
- data.exports.assistTime = 5e3;
- data.exports.assistScore = 25;
- data.exports.assistMin = 20;
- data.exports.medalAnim = 1e3;
- data.exports.medalDelay = 900;
- data.exports.scoreStreak = 2e3;
- data.exports.feedTimer = 2e3;
- data.exports.spinTimer = 1800;
- data.exports.endStats = ["sid", "name", "score", "kills", "deaths", "reward"];
- data.exports.endForm = {
- reward : function(value) {
- return value ? "<span style='color:#F8C55C'>+" + value + "</span> KR" : "NONE";
- },
- time : function(options, settings, callback) {
- return callback.timer || "DNF";
- },
- infected : function($sealed, $struct, $key) {
- return $key.convs;
- },
- found : function(token, position, callback) {
- return callback.convs;
- }
- };
- data.exports.hitLife = 2e3;
- data.exports.regenDelay = 5e3;
- data.exports.regenVal = .1;
- data.exports.sprayTimer = 1e3;
- data.exports.sprayRange = 25;
- data.exports.sprayScale = 15;
- data.exports.deathDelay = 2800;
- data.exports.deathFollowD = 100;
- data.exports.suicides = ["suicide", "uninstall life", "toaster bath", "alt f4", "not alive", "neck rope", "sudoku", "scooter ankle", "death.exe"];
- data.exports.fov = 70;
- data.exports.viewDist = 2e3;
- data.exports.nameVisRate = 200;
- data.exports.worldUV = 60;
- data.exports.ambientVal = .8;
- data.exports.ambD = 2;
- data.exports.ambMlt = 15;
- data.exports.ambOff = .09;
- data.exports.ambScale = 10;
- data.exports.ambDiv = 20;
- data.exports.ambSFactor = 1;
- data.exports.ambBleed = 0;
- data.exports.boosterSpd = .002;
- data.exports.rankVar = .03;
- data.exports.newDataInterval = 12e4;
- data.exports.socials = ["leaders", "profile", "maps"];
- data.exports.leaderQueries = ["score", "kills", "wins", "timeplayed", "funds", "clan"];
- data.exports.leaderCal = {
- player_score : function(numRays) {
- var r = Math.max(1, Math.floor(data.exports.rankVar * Math.sqrt(numRays)));
- return "<span class='floatR'><img src='./img/levels/" + Math.max(Math.min(data.exports.maxLevel - 2, r.roundToNearest(3) - 2), 0) + ".png' class='rnkIcon'>" + r + "</span>";
- },
- player_kills : function(canCreateDiscussions) {
- return canCreateDiscussions + "<span class='lName'> kills</span>";
- },
- player_wins : function(canCreateDiscussions) {
- return canCreateDiscussions + "<span class='lName'> wins</span>";
- },
- player_funds : function(canCreateDiscussions) {
- return canCreateDiscussions + " KR";
- },
- player_timeplayed : function(canCreateDiscussions) {
- var time = canCreateDiscussions / 1e3 / 60;
- var whiteRating = parseInt(time % 60);
- time = time / 60;
- var minutes = parseInt(time % 24);
- time = time / 24;
- var hours = parseInt(time);
- return (hours ? hours + "d " : "") + (minutes ? minutes + "h " : "") + (whiteRating || 0) + "m ";
- }
- };
- data.exports.regionNames = {
- local : "Local",
- "us-nj" : "New Jersey",
- "us-il" : "Chicago",
- "us-tx" : "Dallas",
- "us-wa" : "Seattle",
- "us-ca-la" : "Los Angeles",
- "us-ga" : "Atlanta",
- "nl-ams" : "Amsterdam",
- "gb-lon" : "London",
- "de-fra" : "Frankfurt",
- "us-ca-sv" : "Silicon Valley",
- "au-syd" : "Sydney",
- "fr-par" : "Paris",
- "jb-hnd" : "Tokyo",
- "us-fl" : "Miami",
- sgp : "Singapore"
- };
- }).call(this, moment(13));
- }, , function(self, canCreateDiscussions, moment) {
- (function(toStage) {
- const target = moment(1);
- self.exports.keyboardMap = ["", "", "", "CANCEL", "", "", "HELP", "", "BACK_SPACE", "TAB", "", "", "CLEAR", "ENTER", "ENTER_SPECIAL", "", "SHIFT", "CONTROL", "ALT", "PAUSE", "CAPS_LOCK", "KANA", "EISU", "JUNJA", "FINAL", "HANJA", "", "ESCAPE", "CONVERT", "NONCONVERT", "ACCEPT", "MODECHANGE", "SPACE", "PAGE_UP", "PAGE_DOWN", "END", "HOME", "LEFT", "UP", "RIGHT", "DOWN", "SELECT", "PRINT", "EXECUTE", "PRINTSCREEN", "INSERT", "DELETE", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "COLON",
- "SEMICOLON", "LESS_THAN", "EQUALS", "GREATER_THAN", "QUESTION_MARK", "AT", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "OS_KEY", "", "CONTEXT_MENU", "", "SLEEP", "NUMPAD0", "NUMPAD1", "NUMPAD2", "NUMPAD3", "NUMPAD4", "NUMPAD5", "NUMPAD6", "NUMPAD7", "NUMPAD8", "NUMPAD9", "MULTIPLY", "ADD", "SEPARATOR", "SUBTRACT", "DECIMAL", "DIVIDE", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
- "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", "", "", "", "", "", "", "", "", "NUM_LOCK", "SCROLL_LOCK", "WIN_OEM_FJ_JISHO", "WIN_OEM_FJ_MASSHOU", "WIN_OEM_FJ_TOUROKU", "WIN_OEM_FJ_LOYA", "WIN_OEM_FJ_ROYA", "", "", "", "", "", "", "", "", "", "CIRCUMFLEX", "EXCLAMATION", "DOUBLE_QUOTE", "HASH", "DOLLAR", "PERCENT", "AMPERSAND", "UNDERSCORE", "OPEN_PAREN", "CLOSE_PAREN", "ASTERISK", "PLUS", "PIPE", "HYPHEN_MINUS", "OPEN_CURLY_BRACKET", "CLOSE_CURLY_BRACKET",
- "TILDE", "", "", "", "", "VOLUME_MUTE", "VOLUME_DOWN", "VOLUME_UP", "", "", "SEMICOLON", "EQUALS", "COMMA", "MINUS", "PERIOD", "SLASH", "BACK_QUOTE", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "OPEN_BRACKET", "BACK_SLASH", "CLOSE_BRACKET", "QUOTE", "", "META", "ALTGR", "", "WIN_ICO_HELP", "WIN_ICO_00", "", "WIN_ICO_CLEAR", "", "", "WIN_OEM_RESET", "WIN_OEM_JUMP", "WIN_OEM_PA1", "WIN_OEM_PA2", "WIN_OEM_PA3", "WIN_OEM_WSCTRL", "WIN_OEM_CUSEL",
- "WIN_OEM_ATTN", "WIN_OEM_FINISH", "WIN_OEM_COPY", "WIN_OEM_AUTO", "WIN_OEM_ENLW", "WIN_OEM_BACKTAB", "ATTN", "CRSEL", "EXSEL", "EREOF", "PLAY", "ZOOM", "", "PA1", "WIN_OEM_CLEAR", ""];
- self.exports.getB64Size = function() {
- };
- Number.prototype.round = function(val) {
- return +this.toFixed(val);
- };
- String.prototype.escape = function() {
- return (this + "").replace(/[\\"']/g, "\\$&").replace(/\u0000/g, "\\0");
- };
- Number.prototype.roundToNearest = function(num) {
- return 0 < this ? Math.ceil(this / num) * num : 0 > this ? Math.floor(this / num) * num : this;
- };
- self.exports.isURL = function(str_url) {
- try {
- return /^(https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(:\d+)?(\/[-a-z\d%@_.~+&:]*)*(\?[;&a-z\d%@_.,~+&:=-]*)?(#[-a-z\d_]*)?$/i.test(str_url);
- } catch (t) {
- }
- return false;
- };
- self.exports.arrayAverage = function(array) {
- var sum = 0;
- var i = 0;
- for (; i < array.length; i++) {
- sum = sum + array[i];
- }
- return sum / array.length;
- };
- self.exports.countInArray = function(val, arr) {
- var count = 0;
- var bufferIdx = 0;
- for (; bufferIdx < val.length; bufferIdx++) {
- if (val[bufferIdx] === arr) {
- count++;
- }
- }
- return count;
- };
- self.exports.formatNum = function(n) {
- var base = Math.floor(Math.log(Math.abs(n)) / Math.log(1e3));
- var suffix = "kmb"[base - 1];
- return suffix ? (n / Math.pow(1e3, base)).toFixed(1) + suffix : "" + n;
- };
- self.exports.randInt = function(min, max) {
- return Math.floor(Math.random() * (max - min + 1)) + min;
- };
- self.exports.randFloat = function(min, max) {
- return Math.random() * (max - min) + min;
- };
- self.exports.getRandom = function(array) {
- return array[self.exports.randInt(0, array.length - 1)];
- };
- self.exports.getDistance = function(b, p, a, x) {
- return Math.sqrt((a = a - b) * a + (x = x - p) * x);
- };
- self.exports.getDistance3D = function(y, size, k, dist, t, j) {
- var b = y - dist;
- var c = size - t;
- var i = k - j;
- return Math.sqrt(b * b + c * c + i * i);
- };
- self.exports.getAnglesSSS = function(g, s, r) {
- var as = Math.acos((s * s + r * r - g * g) / (2 * s * r));
- var o = Math.acos((r * r + g * g - s * s) / (2 * r * g));
- var distance = Math.PI - as - o;
- return [-as - Math.PI / 2, o, distance];
- };
- self.exports.getXDir = function(u, r, c, val, n, s) {
- var z = Math.abs(r - n);
- var m = self.exports.getDistance3D(u, r, c, val, n, s);
- return Math.asin(z / m) * (r > n ? -1 : 1);
- };
- self.exports.getAngleDist = function(angle, startAngle) {
- return Math.atan2(Math.sin(startAngle - angle), Math.cos(angle - startAngle));
- };
- self.exports.getAngleDist2 = function(y2, t) {
- var difference = Math.abs(t - y2) % (2 * Math.PI);
- return difference > Math.PI ? 2 * Math.PI - difference : difference;
- };
- self.exports.toRad = function(n) {
- return n * (Math.PI / 180);
- };
- self.exports.getDirection = function(point1X, point1Y, point2X, point2Y) {
- return Math.atan2(point1Y - point2Y, point1X - point2X);
- };
- self.exports.lerp = function(minIn, maxIn, minOut) {
- return minIn + (maxIn - minIn) * minOut;
- };
- self.exports.orderByScore = function(a, b) {
- return b.score - a.score;
- };
- self.exports.orderByKills = function(player, data) {
- return data.kills - player.kills;
- };
- self.exports.orderByDst = function(_pointA, _pointM) {
- return _pointA.dst - _pointM.dst;
- };
- self.exports.orderByNum = function(p, n) {
- return p - n;
- };
- self.exports.capFirst = function(string) {
- return string.charAt(0).toUpperCase() + string.slice(1);
- };
- self.exports.truncateText = function(str, length) {
- return str.length > length ? str.substring(0, length) + "..." : str;
- };
- self.exports.randomString = function(max) {
- var token = "";
- var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- var i = 0;
- for (; i < max; i++) {
- token = token + possible.charAt(Math.floor(Math.random() * possible.length));
- }
- return token;
- };
- self.exports.formatNumCash = function(litresInCubicFeet) {
- return parseFloat(Math.round(100 * litresInCubicFeet) / 100).toFixed(2);
- };
- self.exports.getKeyName = function(name) {
- return self.exports.keyboardMap[name];
- };
- self.exports.getTime = function(index, e) {
- var B = parseInt(index % 1e3 / 100);
- var limit = parseInt(index / 1e3 % 60);
- var b = parseInt(index / 6e4 % 60);
- return (b = 10 > b ? "0" + b : b) + ":" + (limit = 10 > limit ? "0" + limit : limit) + (e ? "." + B : "");
- };
- self.exports.getReadableTime = function(type) {
- var time = type / 1e3 / 60;
- var whiteRating = parseInt(time % 60);
- time = time / 60;
- var minutes = parseInt(time % 24);
- time = time / 24;
- var hours = parseInt(time);
- return (hours ? hours + "d " : "") + (minutes ? minutes + "h " : "") + (whiteRating || 0) + "m ";
- };
- self.exports.getTimeH = function(canCreateDiscussions) {
- parseInt(canCreateDiscussions % 1e3 / 100);
- var b = Math.floor(canCreateDiscussions / 1e3 % 60);
- var ry = Math.floor(canCreateDiscussions / 6e4 % 60);
- var limit = Math.floor(canCreateDiscussions / 36e5 % 24);
- return (limit = 10 > limit ? "0" + limit : limit) + ":" + (ry = 10 > ry ? "0" + ry : ry) + ":" + (b = 10 > b ? "0" + b : b);
- };
- self.exports.scrambleS = function(data) {
- return data && data.replace ? data.replace(/.(.)?/g, "$1") + ("d" + data).replace(/.(.)?/g, "$1") : data;
- };
- self.exports.fixTo = function(options, length) {
- return parseFloat(options.toFixed(length));
- };
- self.exports.limit = function(x, max) {
- return x < -max ? -max : x > max ? max : x;
- };
- self.exports.limitMM = function(left, limitLeft, limitRight) {
- return left < limitLeft ? limitLeft : left > limitRight ? limitRight : left;
- };
- self.exports.cropVal = function(c, e) {
- return c <= e && c >= -e ? 0 : c;
- };
- self.exports.isNumber = function(value) {
- return null != value && "number" == typeof value && !isNaN(value) && isFinite(value);
- };
- self.exports.arrayInts = function(indices) {
- var i = 0;
- for (; i < indices.length; ++i) {
- if (!self.exports.isNumber(indices[i])) {
- return false;
- }
- }
- return true;
- };
- self.exports.isArray = function(value) {
- return !!value && value.constructor === Array;
- };
- self.exports.isString = function(string) {
- return string && "string" == typeof string;
- };
- self.exports.lineInRect = function(first, depth, pos, n, scale, i, time, value, to, j, y2, size) {
- var y = (time - first) * n;
- var x = (j - first) * n;
- var top = (to - pos) * i;
- var progress = (size - pos) * i;
- var imageHeight = (value - depth) * scale;
- var newX = (y2 - depth) * scale;
- var costSum = Math.max(Math.max(Math.min(y, x), Math.min(top, progress)), Math.min(imageHeight, newX));
- var gasSum = Math.min(Math.min(Math.max(y, x), Math.max(top, progress)), Math.max(imageHeight, newX));
- return !(0 > gasSum) && !(costSum > gasSum) && costSum;
- };
- self.exports.pointInBox3D = function(comparisonY, comparisonX, y, b, dist) {
- return dist = dist || 0, comparisonY >= b.x - b.width - dist && comparisonY <= b.x + b.width + dist && comparisonX >= b.y - b.height - dist && comparisonX <= b.y + b.height + dist && y >= b.z - b.length - dist && y <= b.z + b.length + dist;
- };
- self.exports.similar = function(b, a, opts) {
- return opts = opts || 0, Math.abs(b - a) <= opts;
- };
- self.exports.pointInBox = function(pos, e, start, n, end, el, box) {
- return box ? pos >= start && pos <= end && e >= n && e <= el : pos > start && pos < end && e > n && e < el;
- };
- self.exports.sharePos = function(a, b, tolerance) {
- return tolerance = tolerance || 0, Math.abs(a.x - b.x) <= tolerance && Math.abs(a.y - b.y) <= tolerance && Math.abs(a.z - b.z) <= tolerance && Math.abs(a.d - b.d) <= tolerance;
- };
- self.exports.cdv = {
- x : "width",
- y : "height",
- z : "length"
- };
- self.exports.boxIntersection = function(size, r, i, axis, m) {
- var z = self.exports.cdv[i];
- var dim = self.exports.cdv[axis];
- var length = size[i] - size[z] - .1;
- var start = r[i] - r[z] - .1;
- var x = size[i] + size[z] + .1;
- var y = r[i] + r[z] + .1;
- var value = size[axis] - size[dim] - .1;
- var val = r[axis] - r[dim] - .1;
- var a = size[axis] + size[dim] + .1;
- var b = r[axis] + r[dim] + .1;
- var total = Math.max(length, start);
- var target = Math.min(x, y);
- if (target >= total) {
- var ast = Math.max(value, val);
- var merger = Math.min(a, b);
- if (merger >= ast) {
- var lines = [{
- [i]:total,
- [axis]:ast,
- d : m[0]
- }, {
- [i]:target,
- [axis]:merger,
- d : m[1]
- }, {
- [i]:total,
- [axis]:merger,
- d : m[2]
- }, {
- [i]:target,
- [axis]:ast,
- d : m[3]
- }];
- var j = lines.length - 1;
- for (; 0 <= j; --j) {
- if (lines[j][i] == x && lines[j][i] == y || lines[j][i] == length && lines[j][i] == start || lines[j][axis] == a && lines[j][axis] == b || lines[j][axis] == value && lines[j][axis] == val || self.exports.pointInBox(lines[j][i], lines[j][axis], length, value, x, a) || self.exports.pointInBox(lines[j][i], lines[j][axis], start, val, y, b)) {
- lines[j].dontUse = true;
- }
- }
- return lines;
- }
- }
- return null;
- };
- self.exports.boxCornerIntersection = function(size, r, x, axis) {
- var z = self.exports.cdv[x];
- var dim = self.exports.cdv[axis];
- var y = size[x] - size[z];
- var valueBeginIndex = r[x] - r[z];
- var u = size[x] + size[z];
- var DLF = r[x] + r[z];
- var l = size[axis] - size[dim];
- var mayaK2Icon = r[axis] - r[dim];
- var h = size[axis] + size[dim];
- var $noRangeMsg = r[axis] + r[dim];
- var data = [{
- [x]:y,
- [axis]:l,
- d : Math.PI / 2
- }, {
- [x]:y,
- [axis]:h,
- d : Math.PI
- }, {
- [x]:u,
- [axis]:l,
- d : 0
- }, {
- [x]:u,
- [axis]:h,
- d : -Math.PI / 2
- }];
- var i = data.length - 1;
- for (; 0 <= i; --i) {
- data[i].i = i;
- if (!self.exports.pointInBox(data[i][x], data[i][axis], valueBeginIndex, mayaK2Icon, DLF, $noRangeMsg, true)) {
- data.splice(i, 1);
- }
- }
- return data.length ? data : null;
- };
- self.exports.getIntersection = function(pos, b, k) {
- var i = self.exports.cdv[k];
- var fromIndex = pos[k] - pos[i];
- var a = b[k] - b[i];
- var deltaTime = pos[k] + pos[i];
- var gl = b[k] + b[i];
- var u = Math.max(fromIndex, a);
- var v = Math.min(deltaTime, gl);
- if (v >= u) {
- var pagesNum = (v - u) / 2;
- return {
- [k]:u + pagesNum,
- [i]:pagesNum
- };
- }
- return null;
- };
- self.exports.limitRectVal = function(values, array, i) {
- var j = self.exports.cdv[i];
- if (values[i] - values[j] < array[i] - array[j]) {
- var dx = (array[i] - array[j] - (values[i] - values[j])) / 2;
- values[j] -= dx;
- values[i] += dx;
- }
- if (values[i] + values[j] > array[i] + array[j]) {
- dx = (values[i] + values[j] - (array[i] + array[j])) / 2;
- values[j] -= dx;
- values[i] -= dx;
- }
- };
- self.exports.getMaxRect = function(data, p, i) {
- var x;
- var lastY;
- var b;
- var y;
- var d = self.exports.cdv[p];
- var k = self.exports.cdv[i];
- var s = 0;
- for (; s < data.length; ++s) {
- x = null == x ? data[s][p] - data[s][d] : Math.min(data[s][p] - data[s][d], x);
- b = null == b ? data[s][p] + data[s][d] : Math.max(data[s][p] + data[s][d], b);
- lastY = null == lastY ? data[s][i] - data[s][k] : Math.min(data[s][i] - data[s][k], lastY);
- y = null == y ? data[s][i] + data[s][k] : Math.max(data[s][i] + data[s][k], y);
- }
- return {
- [p]:(x + b) / 2,
- [i]:(lastY + y) / 2,
- [d]:Math.abs(b - x) / 2,
- [k]:Math.abs(y - lastY) / 2
- };
- };
- self.exports.limitRect = function(o, f, i, m, b, status, index, name) {
- var output = self.exports.getMaxRect(status, index, name);
- var key = self.exports.cdv[index];
- var prop = self.exports.cdv[name];
- var data = {};
- if (data[index] = o, data[name] = f, data[key] = i, data[prop] = m, self.exports.limitRectVal(data, output, index), self.exports.limitRectVal(data, output, name), 0 == b || b == Math.PI) {
- var fieldValue = data[key];
- data[key] = data[prop];
- data[prop] = fieldValue;
- }
- return data;
- };
- self.exports.progressOnLine = function(l, p, r, i, v, n) {
- var w = r - l;
- var x = i - p;
- var scale = Math.sqrt(w * w + x * x);
- return ((w = w / scale) * (v - l) + (x = x / scale) * (n - p)) / Math.sqrt(Math.pow(r - l, 2) + Math.pow(i - p, 2));
- };
- self.exports.generateSID = function(bones) {
- var sid = 0;
- var r = true;
- for (; r;) {
- r = false;
- sid++;
- var i = 0;
- for (; i < bones.length; ++i) {
- if (bones[i].sid == sid) {
- r = true;
- break;
- }
- }
- }
- return sid;
- };
- self.exports.levelIconId = function(canCreateDiscussions) {
- return Math.max(Math.min(target.maxLevel - 2, canCreateDiscussions.roundToNearest(3) - 2), 0);
- };
- self.exports.copyToClipboard = function(data) {
- const textarea = document.createElement("textarea");
- textarea.value = data;
- textarea.setAttribute("readonly", "");
- textarea.style.position = "absolute";
- textarea.style.left = "-9999px";
- document.body.appendChild(textarea);
- const stored_selection = !!(0 < document.getSelection().rangeCount) && document.getSelection().getRangeAt(0);
- textarea.select();
- document.execCommand("copy");
- document.body.removeChild(textarea);
- if (stored_selection) {
- document.getSelection().removeAllRanges();
- document.getSelection().addRange(stored_selection);
- }
- };
- var o = function(e, l) {
- return e.concat(l);
- };
- Array.prototype.flatMap = function(a) {
- return function(name, e) {
- return e.map(name).reduce(o, []);
- }(a, this);
- };
- var privateMethods = moment(26);
- self.exports.encodeNetworkMessage = function(value, key) {
- let n = privateMethods.encode(value);
- let o = new Uint8Array(n.length + 2);
- return o.set(self.exports.encodeShort(key), 0), o.set(n, 2), o;
- };
- self.exports.decodeNetworkMessage = function(basic_data) {
- basic_data = new Uint8Array(basic_data);
- let r = self.exports.decodeShort(basic_data[0], basic_data[1]);
- let s = basic_data.slice(2);
- return [privateMethods.decode(s), r];
- };
- self.exports.rotateNumber = function(preventPushState, id) {
- return 255 & preventPushState + id;
- };
- self.exports.encodeShort = function(s) {
- return [15 & s >> 4, 15 & s];
- };
- self.exports.decodeShort = function(byte1, byte2) {
- return (byte1 << 4) + byte2;
- };
- self.exports.restartIfNeeded = function(data) {
- if (target.needsRestart) {
- var i;
- for (i in data.sockets) {
- var host = data.sockets[i];
- host.send("error", "GAME UPDATING");
- host.close();
- }
- setTimeout(function() {
- toStage.exit();
- }, 1e3);
- }
- };
- }).call(this, moment(13));
- }, function(canCreateDiscussions, exports, require) {
- function Scope(options) {
- return this instanceof Scope ? (this.options = options, void this.init()) : new Scope(options);
- }
- function extend(a, b) {
- return a && b ? function() {
- return a.apply(this, arguments), b.apply(this, arguments);
- } : a || b;
- }
- function createCodec(options) {
- return new Scope(options);
- }
- var IS_ARRAY = require(9);
- exports.createCodec = createCodec;
- exports.install = function(object) {
- var name;
- for (name in object) {
- Scope.prototype[name] = extend(Scope.prototype[name], object[name]);
- }
- };
- exports.filter = function(filter) {
- return IS_ARRAY(filter) ? function(model) {
- function toDate(type, format) {
- return format(type);
- }
- return model = model.slice(), function(unLegalValue) {
- return model.reduce(toDate, unLegalValue);
- };
- }(filter) : filter;
- };
- var Bufferish = require(0);
- Scope.prototype.init = function() {
- var options = this.options;
- return options && options.uint8array && (this.bufferish = Bufferish.Uint8Array), this;
- };
- exports.preset = createCodec({
- preset : true
- });
- }, , function(canCreateDiscussions, proxy, require) {
- function init() {
- var options = this.options;
- return this.encode = function(options) {
- var grasshopper = WriteType.getWriteType(options);
- return function(tile, end) {
- var channelRiver = grasshopper[typeof end];
- if (!channelRiver) {
- throw new Error('Unsupported type "' + typeof end + '": ' + end);
- }
- channelRiver(tile, end);
- };
- }(options), options && options.preset && ExtPacker.setExtPackers(this), this;
- }
- var ExtBuffer = require(7).ExtBuffer;
- var ExtPacker = require(34);
- var WriteType = require(35);
- var CodecBase = require(4);
- CodecBase.install({
- addExtPacker : function(etype, Class, packer) {
- function extPacker(value) {
- return packer && (value = packer(value)), new ExtBuffer(value, etype);
- }
- packer = CodecBase.filter(packer);
- var name = Class.name;
- if (name && "Object" !== name) {
- var packers = this.extPackers || (this.extPackers = {});
- packers[name] = extPacker;
- } else {
- var list = this.extEncoderList || (this.extEncoderList = []);
- list.unshift([Class, extPacker]);
- }
- },
- getExtPacker : function(value) {
- var packers = this.extPackers || (this.extPackers = {});
- var c = value.constructor;
- var e = c && c.name && packers[c.name];
- if (e) {
- return e;
- }
- var b;
- var list = this.extEncoderList || (this.extEncoderList = []);
- var dataLen = list.length;
- var j = 0;
- for (; j < dataLen; j++) {
- if (b = list[j], c === b[0]) {
- return b[1];
- }
- }
- },
- init : init
- });
- proxy.preset = init.call(CodecBase.preset);
- }, function(canCreateDiscussions, exports, nextValFn) {
- exports.ExtBuffer = function Wysiwyg(element, options) {
- return this instanceof Wysiwyg ? (this.buffer = val.from(element), void(this.type = options)) : new Wysiwyg(element, options);
- };
- var val = nextValFn(0);
- }, function(canCreateDiscussions, asyncFile) {
- asyncFile.read = function(index, offset, n, b, a) {
- var i;
- var j;
- var saltLen = 8 * a - b - 1;
- var ms_controller = (1 << saltLen) - 1;
- var TIMEOUT_POLL_DECREMENT = ms_controller >> 1;
- var c = -7;
- var k = n ? a - 1 : 0;
- var m = n ? -1 : 1;
- var g = index[offset + k];
- k = k + m;
- i = g & (1 << -c) - 1;
- g = g >> -c;
- c = c + saltLen;
- for (; 0 < c; i = 256 * i + index[offset + k], k = k + m, c = c - 8) {
- }
- j = i & (1 << -c) - 1;
- i = i >> -c;
- c = c + b;
- for (; 0 < c; j = 256 * j + index[offset + k], k = k + m, c = c - 8) {
- }
- if (0 === i) {
- i = 1 - TIMEOUT_POLL_DECREMENT;
- } else {
- if (i === ms_controller) {
- return j ? NaN : 1 / 0 * (g ? -1 : 1);
- }
- j = j + Math.pow(2, b);
- i = i - TIMEOUT_POLL_DECREMENT;
- }
- return (g ? -1 : 1) * j * Math.pow(2, i - b);
- };
- asyncFile.write = function(a, v, offset, isLE, mLen, nBytes) {
- var x;
- var m;
- var c;
- var eLen = 8 * nBytes - mLen - 1;
- var j = (1 << eLen) - 1;
- var level = j >> 1;
- var rt = 23 === mLen ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
- var i = isLE ? 0 : nBytes - 1;
- var d = isLE ? 1 : -1;
- var y = 0 > v || 0 === v && 0 > 1 / v ? 1 : 0;
- v = Math.abs(v);
- if (isNaN(v) || v === 1 / 0) {
- m = isNaN(v) ? 1 : 0;
- x = j;
- } else {
- x = Math.floor(Math.log(v) / Math.LN2);
- if (1 > v * (c = Math.pow(2, -x))) {
- x--;
- c = c * 2;
- }
- if (2 <= (v = v + (1 <= x + level ? rt / c : rt * Math.pow(2, 1 - level))) * c) {
- x++;
- c = c / 2;
- }
- if (x + level >= j) {
- m = 0;
- x = j;
- } else {
- if (1 <= x + level) {
- m = (v * c - 1) * Math.pow(2, mLen);
- x = x + level;
- } else {
- m = v * Math.pow(2, level - 1) * Math.pow(2, mLen);
- x = 0;
- }
- }
- }
- for (; 8 <= mLen; a[offset + i] = 255 & m, i = i + d, m = m / 256, mLen = mLen - 8) {
- }
- x = x << mLen | m;
- eLen = eLen + mLen;
- for (; 0 < eLen; a[offset + i] = 255 & x, i = i + d, x = x / 256, eLen = eLen - 8) {
- }
- a[offset + i - d] |= 128 * y;
- };
- }, function(mixin, canCreateDiscussions) {
- var check = {}.toString;
- mixin.exports = Array.isArray || function(t) {
- return "[object Array]" == check.call(t);
- };
- }, function(canCreateDiscussions, exports, require) {
- function copy(target, targetStart, start, end) {
- var thisIsBuffer = Bufferish.isBuffer(this);
- var targetIsBuffer = Bufferish.isBuffer(target);
- if (thisIsBuffer && targetIsBuffer) {
- return this.copy(target, targetStart, start, end);
- }
- if (!brokenTypedArray && !thisIsBuffer && !targetIsBuffer && Bufferish.isView(this) && Bufferish.isView(target)) {
- var blimbs = start || null != end ? slice.call(this, start, end) : this;
- return target.set(blimbs, targetStart), blimbs.length;
- }
- return d.copy.call(this, target, targetStart, start, end);
- }
- function slice(start, end) {
- var f = this.slice || !brokenTypedArray && this.subarray;
- if (f) {
- return f.call(this, start, end);
- }
- var value = Bufferish.alloc.call(this, end - start);
- return copy.call(this, value, 0, start, end), value;
- }
- var p;
- var d = require(33);
- exports.copy = copy;
- exports.slice = slice;
- exports.toString = function() {
- return (!isBufferShim && Bufferish.isBuffer(this) ? this.toString : d.toString).apply(this, arguments);
- };
- exports.write = (p = "write", function() {
- var oldSetupComputes = this[p] || d[p];
- return oldSetupComputes.apply(this, arguments);
- });
- var Bufferish = require(0);
- var Buffer = Bufferish.global;
- var isBufferShim = Bufferish.hasBuffer && "TYPED_ARRAY_SUPPORT" in Buffer;
- var brokenTypedArray = isBufferShim && !Buffer.TYPED_ARRAY_SUPPORT;
- }, function(canCreateDiscussions, innerDOMObject, require) {
- (function(Buffer) {
- !function(lp) {
- function factory(name, v, _) {
- function load(buf, start, success, uuid) {
- return this instanceof load ? function(file, buffer, offset, value, raddix) {
- if (UINT8ARRAY && ARRAYBUFFER && (buffer instanceof ARRAYBUFFER && (buffer = new UINT8ARRAY(buffer)), value instanceof ARRAYBUFFER && (value = new UINT8ARRAY(value))), !(buffer || offset || value || storage)) {
- return void(file.buffer = parse(value, 0));
- }
- if (!isValidBuffer(buffer, offset)) {
- var _storage = storage || Array;
- raddix = offset;
- value = buffer;
- offset = 0;
- buffer = new _storage(8);
- }
- file.buffer = buffer;
- file.offset = offset = offset | 0;
- if (!(void 0 === value)) {
- if ("string" == typeof value) {
- (function(data, offset, match, raddix) {
- var index = 0;
- var pos = match.length;
- var high = 0;
- var low = 0;
- if ("-" === match[0]) {
- index++;
- }
- var chr;
- var lastCutIndex = index;
- for (; index < pos && 0 <= (chr = parseInt(match[index++], raddix));) {
- low = low * raddix + chr;
- high = high * raddix + Math.floor(low / 4294967296);
- low = low % 4294967296;
- }
- if (lastCutIndex) {
- high = ~high;
- if (low) {
- low = 4294967296 - low;
- } else {
- high++;
- }
- }
- writeInt32(data, offset + posL, high);
- writeInt32(data, offset + posH, low);
- })(buffer, offset, value, raddix || 10);
- } else {
- if (isValidBuffer(value, raddix)) {
- fromArray(buffer, offset, value, raddix);
- } else {
- if ("number" == typeof raddix) {
- writeInt32(buffer, offset + posL, value);
- writeInt32(buffer, offset + posH, raddix);
- } else {
- if (0 < value) {
- fn(buffer, offset, value);
- } else {
- if (0 > value) {
- start(buffer, offset, value);
- } else {
- fromArray(buffer, offset, value, 0);
- }
- }
- }
- }
- }
- }
- }(this, buf, start, success, uuid) : new load(buf, start, success, uuid);
- }
- function toNumber() {
- var buffer = this.buffer;
- var offset = this.offset;
- var high = readInt32(buffer, offset + posL);
- var low = readInt32(buffer, offset + posH);
- return _ || (high = high | 0), high ? 4294967296 * high + low : low;
- }
- function writeInt32(data, i, value) {
- data[i + s] = 255 & value;
- value = value >> 8;
- data[i + y] = 255 & value;
- value = value >> 8;
- data[i + x] = 255 & value;
- value = value >> 8;
- data[i + n] = 255 & value;
- }
- function readInt32(data, _) {
- return 16777216 * data[_ + n] + (data[_ + x] << 16) + (data[_ + y] << 8) + data[_ + s];
- }
- var posL = v ? 0 : 4;
- var posH = v ? 4 : 0;
- var n = v ? 0 : 3;
- var x = v ? 1 : 2;
- var y = v ? 2 : 1;
- var s = v ? 3 : 0;
- var fn = v ? height : hide;
- var start = v ? from : wrap;
- var proto = load.prototype;
- var isName = "is" + name;
- var _isInt64 = "_" + isName;
- return proto.buffer = void 0, proto.offset = 0, proto[_isInt64] = true, proto.toNumber = toNumber, proto.toString = function(radix) {
- var buffer = this.buffer;
- var offset = this.offset;
- var high = readInt32(buffer, offset + posL);
- var low = readInt32(buffer, offset + posH);
- var str = "";
- var data = !_ && 2147483648 & high;
- if (data) {
- high = ~high;
- low = 4294967296 - low;
- }
- radix = radix || 10;
- for (;;) {
- var mod = high % radix * 4294967296 + low;
- if (high = Math.floor(high / radix), low = Math.floor(mod / radix), str = (mod % radix).toString(radix) + str, !high && !low) {
- break;
- }
- }
- return data && (str = "-" + str), str;
- }, proto.toJSON = toNumber, proto.toArray = toArray, BUFFER && (proto.toBuffer = toBuffer), UINT8ARRAY && (proto.toArrayBuffer = toArrayBuffer), load[isName] = function(b) {
- return !(!b || !b[_isInt64]);
- }, lp[name] = load, load;
- }
- function toArray(array_like) {
- var child = this.buffer;
- var x = this.offset;
- return storage = null, false !== array_like && 0 === x && 8 === child.length && _dispatchToArray(child) ? child : parse(child, x);
- }
- function toBuffer(size) {
- var value = this.buffer;
- var offset = this.offset;
- if (storage = BUFFER, false !== size && 0 === offset && 8 === value.length && Buffer.isBuffer(value)) {
- return value;
- }
- var result = new BUFFER(8);
- return fromArray(result, 0, value, offset), result;
- }
- function toArrayBuffer(raw) {
- var buffer = this.buffer;
- var offset = this.offset;
- var arrbuf = buffer.buffer;
- if (storage = UINT8ARRAY, false !== raw && 0 === offset && arrbuf instanceof ARRAYBUFFER && 8 === arrbuf.byteLength) {
- return arrbuf;
- }
- var dest = new UINT8ARRAY(8);
- return fromArray(dest, 0, buffer, offset), dest.buffer;
- }
- function isValidBuffer(buffer, offset) {
- var len = buffer && buffer.length;
- return offset = offset | 0, len && offset + 8 <= len && "string" != typeof buffer[offset];
- }
- function fromArray(value, key, data, offset) {
- key = key | 0;
- offset = offset | 0;
- var o = 0;
- for (; 8 > o; o++) {
- value[key++] = 255 & data[offset++];
- }
- }
- function parse(t, x) {
- return Array.prototype.slice.call(t, x, x + 8);
- }
- function height(data, a, value) {
- var b = a + 8;
- for (; b > a;) {
- data[--b] = 255 & value;
- value = value / 256;
- }
- }
- function from(event, start, width) {
- var stop = start + 8;
- width++;
- for (; stop > start;) {
- event[--stop] = 255 ^ 255 & -width;
- width = width / 256;
- }
- }
- function hide(data, offset, value) {
- var extend = offset + 8;
- for (; offset < extend;) {
- data[offset++] = 255 & value;
- value = value / 256;
- }
- }
- function wrap(name, n, width) {
- var nid = n + 8;
- width++;
- for (; n < nid;) {
- name[n++] = 255 ^ 255 & -width;
- width = width / 256;
- }
- }
- var storage;
- var BUFFER = void 0 !== Buffer && Buffer;
- var UINT8ARRAY = "undefined" != typeof Uint8Array && Uint8Array;
- var ARRAYBUFFER = "undefined" != typeof ArrayBuffer && ArrayBuffer;
- var value = [0, 0, 0, 0, 0, 0, 0, 0];
- var _dispatchToArray = Array.isArray || function(_root) {
- return !!_root && "[object Array]" == Object.prototype.toString.call(_root);
- };
- factory("Uint64BE", true, true);
- factory("Int64BE", true, false);
- factory("Uint64LE", false, true);
- factory("Int64LE", false, false);
- }("string" != typeof innerDOMObject.nodeName ? innerDOMObject : this || {});
- }).call(this, require(16).Buffer);
- }, function(canCreateDiscussions, proxy, require) {
- function init() {
- var options = this.options;
- return this.decode = function(options) {
- var code = ReadToken.getReadToken(options);
- return function(a) {
- var k = f(a);
- var type = code[k];
- if (!type) {
- throw new Error("Invalid type: " + (k ? "0x" + k.toString(16) : k));
- }
- return type(a);
- };
- }(options), options && options.preset && ExtUnpacker.setExtUnpackers(this), this;
- }
- var ExtBuffer = require(7).ExtBuffer;
- var ExtUnpacker = require(37);
- var f = require(21).readUint8;
- var ReadToken = require(38);
- var CodecBase = require(4);
- CodecBase.install({
- addExtUnpacker : function(etype, unpacker) {
- (this.extUnpackers || (this.extUnpackers = []))[etype] = CodecBase.filter(unpacker);
- },
- getExtUnpacker : function(type) {
- return (this.extUnpackers || (this.extUnpackers = []))[type] || function(buffer) {
- return new ExtBuffer(buffer, type);
- };
- },
- init : init
- });
- proxy.preset = init.call(CodecBase.preset);
- }, function(mixin, canCreateDiscussions) {
- function defaultSetTimout() {
- throw new Error("setTimeout has not been defined");
- }
- function defaultClearTimeout() {
- throw new Error("clearTimeout has not been defined");
- }
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- return setTimeout(fun, 0);
- }
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- return cachedSetTimeout = setTimeout, setTimeout(fun, 0);
- }
- try {
- return cachedSetTimeout(fun, 0);
- } catch (e) {
- try {
- return cachedSetTimeout.call(null, fun, 0);
- } catch (e) {
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function cleanUpNextTick() {
- if (fm && f) {
- fm = false;
- if (f.length) {
- self = f.concat(self);
- } else {
- _testNo = -1;
- }
- if (self.length) {
- drainQueue();
- }
- }
- }
- function drainQueue() {
- if (!fm) {
- var timeout = runTimeout(cleanUpNextTick);
- fm = true;
- var _testLength = self.length;
- for (; _testLength;) {
- f = self;
- self = [];
- for (; ++_testNo < _testLength;) {
- if (f) {
- f[_testNo].run();
- }
- }
- _testNo = -1;
- _testLength = self.length;
- }
- f = null;
- fm = false;
- (function(marker) {
- if (cachedClearTimeout === clearTimeout) {
- return clearTimeout(marker);
- }
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- return cachedClearTimeout = clearTimeout, clearTimeout(marker);
- }
- try {
- cachedClearTimeout(marker);
- } catch (e) {
- try {
- return cachedClearTimeout.call(null, marker);
- } catch (e) {
- return cachedClearTimeout.call(this, marker);
- }
- }
- })(timeout);
- }
- }
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- function noop() {
- }
- var cachedSetTimeout;
- var cachedClearTimeout;
- var process = mixin.exports = {};
- !function() {
- try {
- cachedSetTimeout = "function" == typeof setTimeout ? setTimeout : defaultSetTimout;
- } catch (t) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- cachedClearTimeout = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout;
- } catch (t) {
- cachedClearTimeout = defaultClearTimeout;
- }
- }();
- var f;
- var self = [];
- var fm = false;
- var _testNo = -1;
- process.nextTick = function(value) {
- var args = Array(arguments.length - 1);
- if (1 < arguments.length) {
- var i = 1;
- for (; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- self.push(new Item(value, args));
- if (!(1 !== self.length || fm)) {
- runTimeout(drainQueue);
- }
- };
- Item.prototype.run = function() {
- this.fun.apply(null, this.array);
- };
- process.title = "browser";
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = "";
- process.versions = {};
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
- process.prependListener = noop;
- process.prependOnceListener = noop;
- process.listeners = function() {
- return [];
- };
- process.binding = function() {
- throw new Error("process.binding is not supported");
- };
- process.cwd = function() {
- return "/";
- };
- process.chdir = function() {
- throw new Error("process.chdir is not supported");
- };
- process.umask = function() {
- return 0;
- };
- }, function(canCreateDiscussions, colorsProto, require) {
- colorsProto.encode = function(object, options) {
- var encoder = new EncodeBuffer(options);
- return encoder.write(object), encoder.read();
- };
- var EncodeBuffer = require(15).EncodeBuffer;
- }, function(canCreateDiscussions, exports, require) {
- function EncodeBuffer(options) {
- if (!(this instanceof EncodeBuffer)) {
- return new EncodeBuffer(options);
- }
- if (options && (this.options = options, options.codec)) {
- var codec = this.codec = options.codec;
- if (codec.bufferish) {
- this.bufferish = codec.bufferish;
- }
- }
- }
- exports.EncodeBuffer = EncodeBuffer;
- var preset = require(6).preset;
- require(18).FlexEncoder.mixin(EncodeBuffer.prototype);
- EncodeBuffer.prototype.codec = preset;
- EncodeBuffer.prototype.write = function(type) {
- this.codec.encode(this, type);
- };
- }, function(canCreateDiscussions, exports, require) {
- (function(global) {
- function kMaxLength() {
- return Buffer.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
- }
- function callback(target, x) {
- if (kMaxLength() < x) {
- throw new RangeError("Invalid typed array length");
- }
- return Buffer.TYPED_ARRAY_SUPPORT ? (target = new Uint8Array(x)).__proto__ = Buffer.prototype : (null === target && (target = new Buffer(x)), target.length = x), target;
- }
- function Buffer(arg, type, length) {
- if (!(Buffer.TYPED_ARRAY_SUPPORT || this instanceof Buffer)) {
- return new Buffer(arg, type, length);
- }
- if ("number" == typeof arg) {
- if ("string" == typeof type) {
- throw new Error("If encoding is specified then the first argument must be a string");
- }
- return allocUnsafe(this, arg);
- }
- return parse(this, arg, type, length);
- }
- function parse(a, obj, v, x) {
- if ("number" == typeof obj) {
- throw new TypeError('"value" argument must not be a number');
- }
- return "undefined" != typeof ArrayBuffer && obj instanceof ArrayBuffer ? function(result, source, byteOffset, number) {
- if (source.byteLength, 0 > byteOffset || source.byteLength < byteOffset) {
- throw new RangeError("'offset' is out of bounds");
- }
- if (source.byteLength < byteOffset + (number || 0)) {
- throw new RangeError("'length' is out of bounds");
- }
- return source = void 0 === byteOffset && void 0 === number ? new Uint8Array(source) : void 0 === number ? new Uint8Array(source, byteOffset) : new Uint8Array(source, byteOffset, number), Buffer.TYPED_ARRAY_SUPPORT ? (result = source).__proto__ = Buffer.prototype : result = next(result, source), result;
- }(a, obj, v, x) : "string" == typeof obj ? function(result, string, value) {
- if (("string" != typeof value || "" === value) && (value = "utf8"), !Buffer.isEncoding(value)) {
- throw new TypeError('"encoding" must be a valid string encoding');
- }
- var undefined = 0 | byteLength(string, value);
- var i = (result = callback(result, undefined)).write(string, value);
- return i !== undefined && (result = result.slice(0, i)), result;
- }(a, obj, v) : function(result, obj) {
- if (Buffer.isBuffer(obj)) {
- var len = 0 | checked(obj.length);
- return 0 === (result = callback(result, len)).length ? result : (obj.copy(result, 0, 0, len), result);
- }
- if (obj) {
- if ("undefined" != typeof ArrayBuffer && obj.buffer instanceof ArrayBuffer || "length" in obj) {
- return "number" != typeof obj.length || function(value) {
- return value != value;
- }(obj.length) ? callback(result, 0) : next(result, obj);
- }
- if ("Buffer" === obj.type && copy(obj.data)) {
- return next(result, obj.data);
- }
- }
- throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
- }(a, obj);
- }
- function assertSize(length) {
- if ("number" != typeof length) {
- throw new TypeError('"size" argument must be a number');
- }
- if (0 > length) {
- throw new RangeError('"size" argument must not be negative');
- }
- }
- function allocUnsafe(that, size) {
- if (assertSize(size), that = callback(that, 0 > size ? 0 : 0 | checked(size)), !Buffer.TYPED_ARRAY_SUPPORT) {
- var i = 0;
- for (; i < size; ++i) {
- that[i] = 0;
- }
- }
- return that;
- }
- function next(val, obj) {
- var progress = 0 > obj.length ? 0 : 0 | checked(obj.length);
- val = callback(val, progress);
- var i = 0;
- for (; i < progress; i = i + 1) {
- val[i] = 255 & obj[i];
- }
- return val;
- }
- function checked(length) {
- if (length >= kMaxLength()) {
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes");
- }
- return 0 | length;
- }
- function byteLength(string, encoding) {
- if (Buffer.isBuffer(string)) {
- return string.length;
- }
- if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
- return string.byteLength;
- }
- if ("string" != typeof string) {
- string = "" + string;
- }
- var length = string.length;
- if (0 === length) {
- return 0;
- }
- var n = false;
- for (;;) {
- switch(encoding) {
- case "ascii":
- case "latin1":
- case "binary":
- return length;
- case "utf8":
- case "utf-8":
- case void 0:
- return get(string).length;
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return 2 * length;
- case "hex":
- return length >>> 1;
- case "base64":
- return init(string).length;
- default:
- if (n) {
- return get(string).length;
- }
- encoding = ("" + encoding).toLowerCase();
- n = true;
- }
- }
- }
- function swap(a, i, k) {
- var v = a[i];
- a[i] = a[k];
- a[k] = v;
- }
- function bidirectionalIndexOf(d, e, r, value, isInteger) {
- if (0 === d.length) {
- return -1;
- }
- if ("string" == typeof r ? (value = r, r = 0) : 2147483647 < r ? r = 2147483647 : -2147483648 > r && (r = -2147483648), r = +r, isNaN(r) && (r = isInteger ? 0 : d.length - 1), 0 > r && (r = d.length + r), r >= d.length) {
- if (isInteger) {
- return -1;
- }
- r = d.length - 1;
- } else {
- if (0 > r) {
- if (!isInteger) {
- return -1;
- }
- r = 0;
- }
- }
- if ("string" == typeof e && (e = Buffer.from(e, value)), Buffer.isBuffer(e)) {
- return 0 === e.length ? -1 : toString(d, e, r, value, isInteger);
- }
- if ("number" == typeof e) {
- return e = e & 255, Buffer.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? isInteger ? Uint8Array.prototype.indexOf.call(d, e, r) : Uint8Array.prototype.lastIndexOf.call(d, e, r) : toString(d, [e], r, value, isInteger);
- }
- throw new TypeError("val must be string, number or Buffer");
- }
- function toString(obj, el, y, value, p) {
- function get(v, i) {
- return 1 === indexSize ? v[i] : v.readUInt16BE(i * indexSize);
- }
- var a;
- var indexSize = 1;
- var b = obj.length;
- var offset = el.length;
- if (void 0 !== value && ("ucs2" === (value = (value + "").toLowerCase()) || "ucs-2" === value || "utf16le" === value || "utf-16le" === value)) {
- if (2 > obj.length || 2 > el.length) {
- return -1;
- }
- indexSize = 2;
- b = b / 2;
- offset = offset / 2;
- y = y / 2;
- }
- if (p) {
- var b = -1;
- a = y;
- for (; a < b; a++) {
- if (get(obj, a) !== get(el, -1 === b ? 0 : a - b)) {
- if (-1 !== b) {
- a = a - (a - b);
- }
- b = -1;
- } else {
- if (-1 === b && (b = a), a - b + 1 === offset) {
- return b * indexSize;
- }
- }
- }
- } else {
- if (y + offset > b) {
- y = b - offset;
- }
- a = y;
- for (; 0 <= a; a--) {
- var l = true;
- var key = 0;
- for (; key < offset; key++) {
- if (get(obj, a + key) !== get(el, key)) {
- l = false;
- break;
- }
- }
- if (l) {
- return a;
- }
- }
- }
- return -1;
- }
- function push(arr, line, idx, val) {
- idx = +idx || 0;
- var len = arr.length - idx;
- if (val) {
- if ((val = +val) > len) {
- val = len;
- }
- } else {
- val = len;
- }
- var dy = line.length;
- if (0 != dy % 2) {
- throw new TypeError("Invalid hex string");
- }
- if (val > dy / 2) {
- val = dy / 2;
- }
- var i;
- var j = 0;
- for (; j < val; ++j) {
- if (i = parseInt(line.substr(2 * j, 2), 16), isNaN(i)) {
- return j;
- }
- arr[idx + j] = i;
- }
- return j;
- }
- function read(str, value, count, type) {
- return fn(get(value, str.length - count), str, count, type);
- }
- function add(type, tree, name, status) {
- return fn(function(contents) {
- var result = [];
- var i = 0;
- for (; i < contents.length; ++i) {
- result.push(255 & contents.charCodeAt(i));
- }
- return result;
- }(tree), type, name, status);
- }
- function update(text, left, start, end) {
- return add(text, left, start, end);
- }
- function append(tx, id, name, type) {
- return fn(init(id), tx, name, type);
- }
- function map(param, data, i, status) {
- return fn(function(t, val) {
- var i;
- var index;
- var slice;
- var result = [];
- var k = 0;
- for (; k < t.length && !(0 > (val = val - 2)); ++k) {
- i = t.charCodeAt(k);
- index = i >> 8;
- slice = i % 256;
- result.push(slice);
- result.push(index);
- }
- return result;
- }(data, param.length - i), param, i, status);
- }
- function cb(buf, start, end) {
- return 0 === start && end === buf.length ? base64.fromByteArray(buf) : base64.fromByteArray(buf.slice(start, end));
- }
- function format(buf, start, count) {
- count = Math.min(buf.length, count);
- var result = [];
- var i = start;
- for (; i < count;) {
- var buf2;
- var toLine;
- var fromLine;
- var x;
- var intVal = buf[i];
- var h = null;
- var len = 239 < intVal ? 4 : 223 < intVal ? 3 : 191 < intVal ? 2 : 1;
- if (i + len <= count) {
- if (1 === len) {
- if (128 > intVal) {
- h = intVal;
- }
- } else {
- if (2 === len) {
- if (128 == (192 & (buf2 = buf[i + 1]))) {
- if (127 < (x = (31 & intVal) << 6 | 63 & buf2)) {
- h = x;
- }
- }
- } else {
- if (3 === len) {
- buf2 = buf[i + 1];
- toLine = buf[i + 2];
- if (128 == (192 & buf2) && 128 == (192 & toLine)) {
- if (2047 < (x = (15 & intVal) << 12 | (63 & buf2) << 6 | 63 & toLine) && (55296 > x || 57343 < x)) {
- h = x;
- }
- }
- } else {
- if (4 === len) {
- buf2 = buf[i + 1];
- toLine = buf[i + 2];
- fromLine = buf[i + 3];
- if (128 == (192 & buf2) && 128 == (192 & toLine) && 128 == (192 & fromLine)) {
- if (65535 < (x = (15 & intVal) << 18 | (63 & buf2) << 12 | (63 & toLine) << 6 | 63 & fromLine) && 1114112 > x) {
- h = x;
- }
- }
- }
- }
- }
- }
- }
- if (null === h) {
- h = 65533;
- len = 1;
- } else {
- if (65535 < h) {
- h = h - 65536;
- result.push(55296 | 1023 & h >>> 10);
- h = 56320 | 1023 & h;
- }
- }
- result.push(h);
- i = i + len;
- }
- return function(codePoints) {
- var length = codePoints.length;
- if (length <= limit) {
- return String.fromCharCode.apply(String, codePoints);
- }
- var str = "";
- var i = 0;
- for (; i < length;) {
- str = str + String.fromCharCode.apply(String, codePoints.slice(i, i = i + limit));
- }
- return str;
- }(result);
- }
- function slice(set, type, end) {
- var buffer = "";
- end = Math.min(set.length, end);
- var val = type;
- for (; val < end; ++val) {
- buffer = buffer + String.fromCharCode(127 & set[val]);
- }
- return buffer;
- }
- function ord(args, n, c) {
- var code = "";
- c = Math.min(args.length, c);
- var i = n;
- for (; i < c; ++i) {
- code = code + String.fromCharCode(args[i]);
- }
- return code;
- }
- function sprintf(tokens, s, index) {
- var length = tokens.length;
- if (!s || 0 > s) {
- s = 0;
- }
- if (!index || 0 > index || index > length) {
- index = length;
- }
- var str = "";
- var i = s;
- for (; i < index; ++i) {
- str = str + parseFloat(tokens[i]);
- }
- return str;
- }
- function p(p, c, n) {
- var m = p.slice(c, n);
- var s = "";
- var i = 0;
- for (; i < m.length; i = i + 2) {
- s = s + String.fromCharCode(m[i] + 256 * m[i + 1]);
- }
- return s;
- }
- function checkOffset(offset, ext, length) {
- if (0 != offset % 1 || 0 > offset) {
- throw new RangeError("offset is not uint");
- }
- if (offset + ext > length) {
- throw new RangeError("Trying to access beyond buffer length");
- }
- }
- function checkInt(buf, value, offset, ext, max, min) {
- if (!Buffer.isBuffer(buf)) {
- throw new TypeError('"buffer" argument must be a Buffer instance');
- }
- if (value > max || value < min) {
- throw new RangeError('"value" argument is out of bounds');
- }
- if (offset + ext > buf.length) {
- throw new RangeError("Index out of range");
- }
- }
- function objectWriteUInt16(buf, value, offset, littleEndian) {
- if (0 > value) {
- value = 65535 + value + 1;
- }
- var i = 0;
- var cell_amount = Math.min(buf.length - offset, 2);
- for (; i < cell_amount; ++i) {
- buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> 8 * (littleEndian ? i : 1 - i);
- }
- }
- function objectWriteUInt32(buf, value, offset, littleEndian) {
- if (0 > value) {
- value = 4294967295 + value + 1;
- }
- var i = 0;
- var cell_amount = Math.min(buf.length - offset, 4);
- for (; i < cell_amount; ++i) {
- buf[offset + i] = 255 & value >>> 8 * (littleEndian ? i : 3 - i);
- }
- }
- function write(items, cb, start, count) {
- if (start + count > items.length) {
- throw new RangeError("Index out of range");
- }
- if (0 > start) {
- throw new RangeError("Index out of range");
- }
- }
- function writeFloat(buffer, value, offset, littleEndian, noAssert) {
- return noAssert || write(buffer, 0, offset, 4), ieee754.write(buffer, value, offset, littleEndian, 23, 4), offset + 4;
- }
- function writeDouble(buffer, value, offset, littleEndian, noAssert) {
- return noAssert || write(buffer, 0, offset, 8), ieee754.write(buffer, value, offset, littleEndian, 52, 8), offset + 8;
- }
- function parseFloat(text) {
- return 16 > text ? "0" + text.toString(16) : text.toString(16);
- }
- function get(string, units) {
- units = units || 1 / 0;
- var data;
- var length = string.length;
- var blockReceived = null;
- var bytes = [];
- var i = 0;
- for (; i < length; ++i) {
- if (55295 < (data = string.charCodeAt(i)) && 57344 > data) {
- if (!blockReceived) {
- if (56319 < data) {
- if (-1 < (units = units - 3)) {
- bytes.push(239, 191, 189);
- }
- continue;
- }
- if (i + 1 === length) {
- if (-1 < (units = units - 3)) {
- bytes.push(239, 191, 189);
- }
- continue;
- }
- blockReceived = data;
- continue;
- }
- if (56320 > data) {
- if (-1 < (units = units - 3)) {
- bytes.push(239, 191, 189);
- }
- blockReceived = data;
- continue;
- }
- data = 65536 + (blockReceived - 55296 << 10 | data - 56320);
- } else {
- if (blockReceived && -1 < (units = units - 3)) {
- bytes.push(239, 191, 189);
- }
- }
- if (blockReceived = null, 128 > data) {
- if (0 > (units = units - 1)) {
- break;
- }
- bytes.push(data);
- } else {
- if (2048 > data) {
- if (0 > (units = units - 2)) {
- break;
- }
- bytes.push(192 | data >> 6, 128 | 63 & data);
- } else {
- if (65536 > data) {
- if (0 > (units = units - 3)) {
- break;
- }
- bytes.push(224 | data >> 12, 128 | 63 & data >> 6, 128 | 63 & data);
- } else {
- if (!(1114112 > data)) {
- throw new Error("Invalid code point");
- }
- if (0 > (units = units - 4)) {
- break;
- }
- bytes.push(240 | data >> 18, 128 | 63 & data >> 12, 128 | 63 & data >> 6, 128 | 63 & data);
- }
- }
- }
- }
- return bytes;
- }
- function init(str) {
- return base64.toByteArray(function(text) {
- if (2 > (text = function(s) {
- return s.trim ? s.trim() : s.replace(/^\s+|\s+$/g, "");
- }(text).replace(footnotePattern, "")).length) {
- return "";
- }
- for (; 0 != text.length % 4;) {
- text = text + "=";
- }
- return text;
- }(str));
- }
- function fn(self, data, index, value) {
- var i = 0;
- for (; i < value && !(i + index >= data.length || i >= self.length); ++i) {
- data[i + index] = self[i];
- }
- return i;
- }
- var base64 = require(28);
- var ieee754 = require(8);
- var copy = require(29);
- exports.Buffer = Buffer;
- exports.SlowBuffer = function(length) {
- return +length != length && (length = 0), Buffer.alloc(+length);
- };
- exports.INSPECT_MAX_BYTES = 50;
- Buffer.TYPED_ARRAY_SUPPORT = void 0 === global.TYPED_ARRAY_SUPPORT ? function() {
- try {
- var arr = new Uint8Array(1);
- return arr.__proto__ = {
- __proto__ : Uint8Array.prototype,
- foo : function() {
- return 42;
- }
- }, 42 === arr.foo() && "function" == typeof arr.subarray && 0 === arr.subarray(1, 1).byteLength;
- } catch (t) {
- return false;
- }
- }() : global.TYPED_ARRAY_SUPPORT;
- exports.kMaxLength = kMaxLength();
- Buffer.poolSize = 8192;
- Buffer._augment = function(arr) {
- return arr.__proto__ = Buffer.prototype, arr;
- };
- Buffer.from = function(obj, config, val) {
- return parse(null, obj, config, val);
- };
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- Buffer.prototype.__proto__ = Uint8Array.prototype;
- Buffer.__proto__ = Uint8Array;
- if ("undefined" != typeof Symbol && Symbol.species && Buffer[Symbol.species] === Buffer) {
- Object.defineProperty(Buffer, Symbol.species, {
- value : null,
- configurable : true
- });
- }
- }
- Buffer.alloc = function(value, length, attr) {
- return function(s, size, a, val) {
- return assertSize(size), 0 >= size ? callback(s, size) : void 0 === a ? callback(s, size) : "string" == typeof val ? callback(s, size).fill(a, val) : callback(s, size).fill(a);
- }(null, value, length, attr);
- };
- Buffer.allocUnsafe = function(size) {
- return allocUnsafe(null, size);
- };
- Buffer.allocUnsafeSlow = function(size) {
- return allocUnsafe(null, size);
- };
- Buffer.isBuffer = function(obj) {
- return !(null == obj || !obj._isBuffer);
- };
- Buffer.compare = function(path, e) {
- if (!Buffer.isBuffer(path) || !Buffer.isBuffer(e)) {
- throw new TypeError("Arguments must be Buffers");
- }
- if (path === e) {
- return 0;
- }
- var c = path.length;
- var a = e.length;
- var j = 0;
- var num = Math.min(c, a);
- for (; j < num; ++j) {
- if (path[j] !== e[j]) {
- c = path[j];
- a = e[j];
- break;
- }
- }
- return c < a ? -1 : a < c ? 1 : 0;
- };
- Buffer.isEncoding = function(encoding) {
- switch((encoding + "").toLowerCase()) {
- case "hex":
- case "utf8":
- case "utf-8":
- case "ascii":
- case "latin1":
- case "binary":
- case "base64":
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return true;
- default:
- return false;
- }
- };
- Buffer.concat = function(a, size) {
- if (!copy(a)) {
- throw new TypeError('"list" argument must be an Array of Buffers');
- }
- if (0 === a.length) {
- return Buffer.alloc(0);
- }
- var i;
- if (void 0 === size) {
- size = 0;
- i = 0;
- for (; i < a.length; ++i) {
- size = size + a[i].length;
- }
- }
- var buffer = Buffer.allocUnsafe(size);
- var b = 0;
- i = 0;
- for (; i < a.length; ++i) {
- var p = a[i];
- if (!Buffer.isBuffer(p)) {
- throw new TypeError('"list" argument must be an Array of Buffers');
- }
- p.copy(buffer, b);
- b = b + p.length;
- }
- return buffer;
- };
- Buffer.byteLength = byteLength;
- Buffer.prototype._isBuffer = true;
- Buffer.prototype.swap16 = function() {
- var i = this.length;
- if (0 != i % 2) {
- throw new RangeError("Buffer size must be a multiple of 16-bits");
- }
- var l = 0;
- for (; l < i; l = l + 2) {
- swap(this, l, l + 1);
- }
- return this;
- };
- Buffer.prototype.swap32 = function() {
- var l = this.length;
- if (0 != l % 4) {
- throw new RangeError("Buffer size must be a multiple of 32-bits");
- }
- var i = 0;
- for (; i < l; i = i + 4) {
- swap(this, i, i + 3);
- swap(this, i + 1, i + 2);
- }
- return this;
- };
- Buffer.prototype.swap64 = function() {
- var l = this.length;
- if (0 != l % 8) {
- throw new RangeError("Buffer size must be a multiple of 64-bits");
- }
- var i = 0;
- for (; i < l; i = i + 8) {
- swap(this, i, i + 7);
- swap(this, i + 1, i + 6);
- swap(this, i + 2, i + 5);
- swap(this, i + 3, i + 4);
- }
- return this;
- };
- Buffer.prototype.toString = function() {
- var n = 0 | this.length;
- return 0 == n ? "" : 0 === arguments.length ? format(this, 0, n) : function(encoding, n, i) {
- var j = false;
- if ((void 0 === n || 0 > n) && (n = 0), n > this.length) {
- return "";
- }
- if ((void 0 === i || i > this.length) && (i = this.length), 0 >= i) {
- return "";
- }
- if ((i = i >>> 0) <= (n = n >>> 0)) {
- return "";
- }
- if (!encoding) {
- encoding = "utf8";
- }
- for (;;) {
- switch(encoding) {
- case "hex":
- return sprintf(this, n, i);
- case "utf8":
- case "utf-8":
- return format(this, n, i);
- case "ascii":
- return slice(this, n, i);
- case "latin1":
- case "binary":
- return ord(this, n, i);
- case "base64":
- return cb(this, n, i);
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return p(this, n, i);
- default:
- if (j) {
- throw new TypeError("Unknown encoding: " + encoding);
- }
- encoding = (encoding + "").toLowerCase();
- j = true;
- }
- }
- }.apply(this, arguments);
- };
- Buffer.prototype.equals = function(a) {
- if (!Buffer.isBuffer(a)) {
- throw new TypeError("Argument must be a Buffer");
- }
- return this === a || 0 === Buffer.compare(this, a);
- };
- Buffer.prototype.inspect = function() {
- var pix_color = "";
- var max = exports.INSPECT_MAX_BYTES;
- return 0 < this.length && (pix_color = this.toString("hex", 0, max).match(/.{2}/g).join(" "), this.length > max && (pix_color = pix_color + " ... ")), "<Buffer " + pix_color + ">";
- };
- Buffer.prototype.compare = function(target, start, end, thisStart, thisEnd) {
- if (!Buffer.isBuffer(target)) {
- throw new TypeError("Argument must be a Buffer");
- }
- if (void 0 === start && (start = 0), void 0 === end && (end = target ? target.length : 0), void 0 === thisStart && (thisStart = 0), void 0 === thisEnd && (thisEnd = this.length), 0 > start || end > target.length || 0 > thisStart || thisEnd > this.length) {
- throw new RangeError("out of range index");
- }
- if (thisStart >= thisEnd && start >= end) {
- return 0;
- }
- if (thisStart >= thisEnd) {
- return -1;
- }
- if (start >= end) {
- return 1;
- }
- if (this === target) {
- return 0;
- }
- var x = (thisEnd = thisEnd >>> 0) - (thisStart = thisStart >>> 0);
- var y = (end = end >>> 0) - (start = start >>> 0);
- var spaceClick = Math.min(x, y);
- var thisCopy = this.slice(thisStart, thisEnd);
- var targetCopy = target.slice(start, end);
- var i = 0;
- for (; i < spaceClick; ++i) {
- if (thisCopy[i] !== targetCopy[i]) {
- x = thisCopy[i];
- y = targetCopy[i];
- break;
- }
- }
- return x < y ? -1 : y < x ? 1 : 0;
- };
- Buffer.prototype.includes = function(val, byteOffset, encoding) {
- return -1 !== this.indexOf(val, byteOffset, encoding);
- };
- Buffer.prototype.indexOf = function(val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
- };
- Buffer.prototype.lastIndexOf = function(val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
- };
- Buffer.prototype.write = function(value, start, end, encoding) {
- if (void 0 === start) {
- encoding = "utf8";
- end = this.length;
- start = 0;
- } else {
- if (void 0 === end && "string" == typeof start) {
- encoding = start;
- end = this.length;
- start = 0;
- } else {
- if (!isFinite(start)) {
- throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
- }
- start = start | 0;
- if (isFinite(end)) {
- end = end | 0;
- if (void 0 === encoding) {
- encoding = "utf8";
- }
- } else {
- encoding = end;
- end = void 0;
- }
- }
- }
- var len = this.length - start;
- if ((void 0 === end || end > len) && (end = len), 0 < value.length && (0 > end || 0 > start) || start > this.length) {
- throw new RangeError("Attempt to write outside buffer bounds");
- }
- if (!encoding) {
- encoding = "utf8";
- }
- var i = false;
- for (;;) {
- switch(encoding) {
- case "hex":
- return push(this, value, start, end);
- case "utf8":
- case "utf-8":
- return read(this, value, start, end);
- case "ascii":
- return add(this, value, start, end);
- case "latin1":
- case "binary":
- return update(this, value, start, end);
- case "base64":
- return append(this, value, start, end);
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return map(this, value, start, end);
- default:
- if (i) {
- throw new TypeError("Unknown encoding: " + encoding);
- }
- encoding = ("" + encoding).toLowerCase();
- i = true;
- }
- }
- };
- Buffer.prototype.toJSON = function() {
- return {
- type : "Buffer",
- data : Array.prototype.slice.call(this._arr || this, 0)
- };
- };
- var limit = 4096;
- Buffer.prototype.slice = function(start, end) {
- var newBuf;
- var len = this.length;
- if (0 > (start = ~~start) ? 0 > (start = start + len) && (start = 0) : start > len && (start = len), 0 > (end = void 0 === end ? len : ~~end) ? 0 > (end = end + len) && (end = 0) : end > len && (end = len), end < start && (end = start), Buffer.TYPED_ARRAY_SUPPORT) {
- (newBuf = this.subarray(start, end)).__proto__ = Buffer.prototype;
- } else {
- var sliceLen = end - start;
- newBuf = new Buffer(sliceLen, void 0);
- var i = 0;
- for (; i < sliceLen; ++i) {
- newBuf[i] = this[i + start];
- }
- }
- return newBuf;
- };
- Buffer.prototype.readUIntLE = function(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length);
- }
- var val = this[offset];
- var mul = 1;
- var i = 0;
- for (; ++i < byteLength && (mul = mul * 256);) {
- val = val + this[offset + i] * mul;
- }
- return val;
- };
- Buffer.prototype.readUIntBE = function(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length);
- }
- var val = this[offset + --byteLength];
- var mul = 1;
- for (; 0 < byteLength && (mul = mul * 256);) {
- val = val + this[offset + --byteLength] * mul;
- }
- return val;
- };
- Buffer.prototype.readUInt8 = function(offset, limit) {
- return limit || checkOffset(offset, 1, this.length), this[offset];
- };
- Buffer.prototype.readUInt16LE = function(offset, limit) {
- return limit || checkOffset(offset, 2, this.length), this[offset] | this[offset + 1] << 8;
- };
- Buffer.prototype.readUInt16BE = function(offset, limit) {
- return limit || checkOffset(offset, 2, this.length), this[offset] << 8 | this[offset + 1];
- };
- Buffer.prototype.readUInt32LE = function(offset, limit) {
- return limit || checkOffset(offset, 4, this.length), (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + 16777216 * this[offset + 3];
- };
- Buffer.prototype.readUInt32BE = function(offset, limit) {
- return limit || checkOffset(offset, 4, this.length), 16777216 * this[offset] + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
- };
- Buffer.prototype.readIntLE = function(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length);
- }
- var val = this[offset];
- var mul = 1;
- var i = 0;
- for (; ++i < byteLength && (mul = mul * 256);) {
- val = val + this[offset + i] * mul;
- }
- return val >= (mul = mul * 128) && (val = val - Math.pow(2, 8 * byteLength)), val;
- };
- Buffer.prototype.readIntBE = function(offset, byteLength, noAssert) {
- offset = offset | 0;
- byteLength = byteLength | 0;
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length);
- }
- var i = byteLength;
- var top = 1;
- var value = this[offset + --i];
- for (; 0 < i && (top = top * 256);) {
- value = value + this[offset + --i] * top;
- }
- return value >= (top = top * 128) && (value = value - Math.pow(2, 8 * byteLength)), value;
- };
- Buffer.prototype.readInt8 = function(offset, limit) {
- return limit || checkOffset(offset, 1, this.length), 128 & this[offset] ? -1 * (255 - this[offset] + 1) : this[offset];
- };
- Buffer.prototype.readInt16LE = function(offset, noAssert) {
- if (!noAssert) {
- checkOffset(offset, 2, this.length);
- }
- var r = this[offset] | this[offset + 1] << 8;
- return 32768 & r ? 4294901760 | r : r;
- };
- Buffer.prototype.readInt16BE = function(offset, noAssert) {
- if (!noAssert) {
- checkOffset(offset, 2, this.length);
- }
- var r = this[offset + 1] | this[offset] << 8;
- return 32768 & r ? 4294901760 | r : r;
- };
- Buffer.prototype.readInt32LE = function(offset, limit) {
- return limit || checkOffset(offset, 4, this.length), this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
- };
- Buffer.prototype.readInt32BE = function(offset, limit) {
- return limit || checkOffset(offset, 4, this.length), this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
- };
- Buffer.prototype.readFloatLE = function(offset, limit) {
- return limit || checkOffset(offset, 4, this.length), ieee754.read(this, offset, true, 23, 4);
- };
- Buffer.prototype.readFloatBE = function(offset, limit) {
- return limit || checkOffset(offset, 4, this.length), ieee754.read(this, offset, false, 23, 4);
- };
- Buffer.prototype.readDoubleLE = function(offset, limit) {
- return limit || checkOffset(offset, 8, this.length), ieee754.read(this, offset, true, 52, 8);
- };
- Buffer.prototype.readDoubleBE = function(offset, limit) {
- return limit || checkOffset(offset, 8, this.length), ieee754.read(this, offset, false, 52, 8);
- };
- Buffer.prototype.writeUIntLE = function(value, offset, byteLength, noAssert) {
- if (!(value = +value, offset = offset | 0, byteLength = byteLength | 0, noAssert)) {
- checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength) - 1, 0);
- }
- var mul = 1;
- var i = 0;
- this[offset] = 255 & value;
- for (; ++i < byteLength && (mul = mul * 256);) {
- this[offset + i] = 255 & value / mul;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeUIntBE = function(value, offset, byteLength, noAssert) {
- if (!(value = +value, offset = offset | 0, byteLength = byteLength | 0, noAssert)) {
- checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength) - 1, 0);
- }
- var i = byteLength - 1;
- var mul = 1;
- this[offset + i] = 255 & value;
- for (; 0 <= --i && (mul = mul * 256);) {
- this[offset + i] = 255 & value / mul;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeUInt8 = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 1, 255, 0), Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)), this[offset] = 255 & value, offset + 1;
- };
- Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, true), offset + 2;
- };
- Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8, this[offset + 1] = 255 & value) : objectWriteUInt16(this, value, offset, false), offset + 2;
- };
- Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset + 3] = value >>> 24, this[offset + 2] = value >>> 16, this[offset + 1] = value >>> 8, this[offset] = 255 & value) : objectWriteUInt32(this, value, offset, true), offset + 4;
- };
- Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24, this[offset + 1] = value >>> 16, this[offset + 2] = value >>> 8, this[offset + 3] = 255 & value) : objectWriteUInt32(this, value, offset, false), offset + 4;
- };
- Buffer.prototype.writeIntLE = function(value, offset, byteLength, noAssert) {
- if (value = +value, offset = offset | 0, !noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1);
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
- }
- var i = 0;
- var mul = 1;
- var s = 0;
- this[offset] = 255 & value;
- for (; ++i < byteLength && (mul = mul * 256);) {
- if (0 > value && 0 === s && 0 !== this[offset + i - 1]) {
- s = 1;
- }
- this[offset + i] = 255 & (value / mul >> 0) - s;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeIntBE = function(value, offset, byteLength, noAssert) {
- if (value = +value, offset = offset | 0, !noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1);
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
- }
- var i = byteLength - 1;
- var mul = 1;
- var s = 0;
- this[offset + i] = 255 & value;
- for (; 0 <= --i && (mul = mul * 256);) {
- if (0 > value && 0 === s && 0 !== this[offset + i + 1]) {
- s = 1;
- }
- this[offset + i] = 255 & (value / mul >> 0) - s;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeInt8 = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 1, 127, -128), Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)), 0 > value && (value = 255 + value + 1), this[offset] = 255 & value, offset + 1;
- };
- Buffer.prototype.writeInt16LE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, true), offset + 2;
- };
- Buffer.prototype.writeInt16BE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8, this[offset + 1] = 255 & value) : objectWriteUInt16(this, value, offset, false), offset + 2;
- };
- Buffer.prototype.writeInt32LE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8, this[offset + 2] = value >>> 16, this[offset + 3] = value >>> 24) : objectWriteUInt32(this, value, offset, true), offset + 4;
- };
- Buffer.prototype.writeInt32BE = function(value, offset, noAssert) {
- return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), 0 > value && (value = 4294967295 + value + 1), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24, this[offset + 1] = value >>> 16, this[offset + 2] = value >>> 8, this[offset + 3] = 255 & value) : objectWriteUInt32(this, value, offset, false), offset + 4;
- };
- Buffer.prototype.writeFloatLE = function(value, offset, noAssert) {
- return writeFloat(this, value, offset, true, noAssert);
- };
- Buffer.prototype.writeFloatBE = function(value, offset, noAssert) {
- return writeFloat(this, value, offset, false, noAssert);
- };
- Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) {
- return writeDouble(this, value, offset, true, noAssert);
- };
- Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) {
- return writeDouble(this, value, offset, false, noAssert);
- };
- Buffer.prototype.copy = function(target, targetStart, start, end) {
- if (start || (start = 0), end || 0 === end || (end = this.length), targetStart >= target.length && (targetStart = target.length), targetStart || (targetStart = 0), 0 < end && end < start && (end = start), end === start) {
- return 0;
- }
- if (0 === target.length || 0 === this.length) {
- return 0;
- }
- if (0 > targetStart) {
- throw new RangeError("targetStart out of bounds");
- }
- if (0 > start || start >= this.length) {
- throw new RangeError("sourceStart out of bounds");
- }
- if (0 > end) {
- throw new RangeError("sourceEnd out of bounds");
- }
- if (end > this.length) {
- end = this.length;
- }
- if (target.length - targetStart < end - start) {
- end = target.length - targetStart + start;
- }
- var i;
- var len = end - start;
- if (this === target && start < targetStart && targetStart < end) {
- i = len - 1;
- for (; 0 <= i; --i) {
- target[i + targetStart] = this[i + start];
- }
- } else {
- if (1e3 > len || !Buffer.TYPED_ARRAY_SUPPORT) {
- i = 0;
- for (; i < len; ++i) {
- target[i + targetStart] = this[i + start];
- }
- } else {
- Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
- }
- }
- return len;
- };
- Buffer.prototype.fill = function(value, start, end, encoding) {
- if ("string" == typeof value) {
- if ("string" == typeof start ? (encoding = start, start = 0, end = this.length) : "string" == typeof end && (encoding = end, end = this.length), 1 === value.length) {
- var test_value = value.charCodeAt(0);
- if (256 > test_value) {
- value = test_value;
- }
- }
- if (void 0 !== encoding && "string" != typeof encoding) {
- throw new TypeError("encoding must be a string");
- }
- if ("string" == typeof encoding && !Buffer.isEncoding(encoding)) {
- throw new TypeError("Unknown encoding: " + encoding);
- }
- } else {
- if ("number" == typeof value) {
- value = value & 255;
- }
- }
- if (0 > start || this.length < start || this.length < end) {
- throw new RangeError("Out of range index");
- }
- if (end <= start) {
- return this;
- }
- var i;
- if (start = start >>> 0, end = void 0 === end ? this.length : end >>> 0, value || (value = 0), "number" == typeof value) {
- i = start;
- for (; i < end; ++i) {
- this[i] = value;
- }
- } else {
- var colorPool = Buffer.isBuffer(value) ? value : get((new Buffer(value, encoding)).toString());
- var colorPoolSize = colorPool.length;
- i = 0;
- for (; i < end - start; ++i) {
- this[i + start] = colorPool[i % colorPoolSize];
- }
- }
- return this;
- };
- var footnotePattern = /[^+\/0-9A-Za-z-_]/g;
- }).call(this, require(24));
- }, function(canCreateDiscussions, $ctx16) {
- function write0(type) {
- return function(options) {
- var name = options.reserve(1);
- options.buffer[name] = type;
- };
- }
- var constant = $ctx16.uint8 = Array(256);
- var i = 0;
- for (; 255 >= i; i++) {
- constant[i] = write0(i);
- }
- }, function(canCreateDiscussions, exports, require) {
- function FlexDecoder() {
- if (!(this instanceof FlexDecoder)) {
- return new FlexDecoder;
- }
- }
- function FlexEncoder() {
- if (!(this instanceof FlexEncoder)) {
- return new FlexEncoder;
- }
- }
- function writeSerial() {
- throw new Error("method not implemented: write()");
- }
- function _fetch() {
- throw new Error("method not implemented: fetch()");
- }
- function read() {
- return this.buffers && this.buffers.length ? (this.flush(), this.pull()) : this.fetch();
- }
- function push(num) {
- (this.buffers || (this.buffers = [])).push(num);
- }
- function pull() {
- return (this.buffers || (this.buffers = [])).shift();
- }
- function mixinFactory(obj) {
- return function(klass) {
- var prop;
- for (prop in obj) {
- klass[prop] = obj[prop];
- }
- return klass;
- };
- }
- exports.FlexDecoder = FlexDecoder;
- exports.FlexEncoder = FlexEncoder;
- var Bufferish = require(0);
- var MIN_BUFFER_SIZE = 2048;
- var MAX_BUFFER_SIZE = 65536;
- var BUFFER_SHORTAGE = "BUFFER_SHORTAGE";
- FlexDecoder.mixin = mixinFactory({
- bufferish : Bufferish,
- write : function(chunk) {
- var prev = this.offset ? Bufferish.prototype.slice.call(this.buffer, this.offset) : this.buffer;
- this.buffer = prev ? chunk ? this.bufferish.concat([prev, chunk]) : prev : chunk;
- this.offset = 0;
- },
- fetch : _fetch,
- flush : function() {
- for (; this.offset < this.buffer.length;) {
- var value;
- var offset = this.offset;
- try {
- value = this.fetch();
- } catch (e) {
- if (e && e.message != BUFFER_SHORTAGE) {
- throw e;
- }
- this.offset = offset;
- break;
- }
- this.push(value);
- }
- },
- push : push,
- pull : pull,
- read : read,
- reserve : function(length) {
- var offset = this.offset;
- var end = offset + length;
- if (end > this.buffer.length) {
- throw new Error(BUFFER_SHORTAGE);
- }
- return this.offset = end, offset;
- },
- offset : 0
- });
- FlexDecoder.mixin(FlexDecoder.prototype);
- FlexEncoder.mixin = mixinFactory({
- bufferish : Bufferish,
- write : writeSerial,
- fetch : function() {
- var start = this.start;
- if (start < this.offset) {
- var end = this.start = this.offset;
- return Bufferish.prototype.slice.call(this.buffer, start, end);
- }
- },
- flush : function() {
- for (; this.start < this.offset;) {
- var value = this.fetch();
- if (value) {
- this.push(value);
- }
- }
- },
- push : push,
- pull : function() {
- var length = this.buffers || (this.buffers = []);
- var e = 1 < length.length ? this.bufferish.concat(length) : length[0];
- return length.length = 0, e;
- },
- read : read,
- reserve : function(length) {
- var offset = 0 | length;
- if (this.buffer) {
- var n = this.buffer.length;
- var pageIndex = 0 | this.offset;
- var index = pageIndex + offset;
- if (index < n) {
- return this.offset = index, pageIndex;
- }
- this.flush();
- length = Math.max(length, Math.min(2 * n, this.maxBufferSize));
- }
- return length = Math.max(length, this.minBufferSize), this.buffer = this.bufferish.alloc(length), this.start = 0, this.offset = offset, 0;
- },
- send : function(obj) {
- var length = obj.length;
- if (length > this.minBufferSize) {
- this.flush();
- this.push(obj);
- } else {
- var offset = this.reserve(length);
- Bufferish.prototype.copy.call(obj, this.buffer, offset);
- }
- },
- maxBufferSize : MAX_BUFFER_SIZE,
- minBufferSize : MIN_BUFFER_SIZE,
- offset : 0,
- start : 0
- });
- FlexEncoder.mixin(FlexEncoder.prototype);
- }, function(canCreateDiscussions, yeast, require) {
- yeast.decode = function(input, options) {
- var decoder = new DecodeBuffer(options);
- return decoder.write(input), decoder.read();
- };
- var DecodeBuffer = require(20).DecodeBuffer;
- }, function(canCreateDiscussions, exports, require) {
- function DecodeBuffer(options) {
- if (!(this instanceof DecodeBuffer)) {
- return new DecodeBuffer(options);
- }
- if (options && (this.options = options, options.codec)) {
- var codec = this.codec = options.codec;
- if (codec.bufferish) {
- this.bufferish = codec.bufferish;
- }
- }
- }
- exports.DecodeBuffer = DecodeBuffer;
- var preset = require(12).preset;
- require(18).FlexDecoder.mixin(DecodeBuffer.prototype);
- DecodeBuffer.prototype.codec = preset;
- DecodeBuffer.prototype.fetch = function() {
- return this.codec.decode(this);
- };
- }, function(canCreateDiscussions, exports, require) {
- function array(decoder, node) {
- var i;
- var result = {};
- var v = Array(node);
- var value = Array(node);
- var decode = decoder.codec.decode;
- i = 0;
- for (; i < node; i++) {
- v[i] = decode(decoder);
- value[i] = decode(decoder);
- }
- i = 0;
- for (; i < node; i++) {
- result[v[i]] = value[i];
- }
- return result;
- }
- function map_to_map(decoder, value) {
- var i;
- var result = new Map;
- var v = Array(value);
- var params = Array(value);
- var decode = decoder.codec.decode;
- i = 0;
- for (; i < value; i++) {
- v[i] = decode(decoder);
- params[i] = decode(decoder);
- }
- i = 0;
- for (; i < value; i++) {
- result.set(v[i], params[i]);
- }
- return result;
- }
- function parse(c, length) {
- var result = Array(length);
- var fn = c.codec.decode;
- var i = 0;
- for (; i < length; i++) {
- result[i] = fn(c);
- }
- return result;
- }
- function str(decoder, len) {
- var index = decoder.reserve(len);
- return BufferProto.toString.call(decoder.buffer, "utf-8", index, index + len);
- }
- function bin_buffer(decoder, len) {
- var start = decoder.reserve(len);
- var value = BufferProto.slice.call(decoder.buffer, start, start + len);
- return Bufferish.from(value);
- }
- function bin_arraybuffer(decoder, len) {
- var start = decoder.reserve(len);
- var i = BufferProto.slice.call(decoder.buffer, start, start + len);
- return Bufferish.Uint8Array.from(i).buffer;
- }
- function ext(decoder, len) {
- var start = decoder.reserve(len + 1);
- var type = decoder.buffer[start++];
- var end = start + len;
- var decodeUtf8 = decoder.codec.getExtUnpacker(type);
- if (!decodeUtf8) {
- throw new Error("Invalid ext type: " + (type ? "0x" + type.toString(16) : type));
- }
- return decodeUtf8(BufferProto.slice.call(decoder.buffer, start, end));
- }
- function uint8(options) {
- var command = options.reserve(1);
- return options.buffer[command];
- }
- function int8(options) {
- var id = options.reserve(1);
- var itemm = options.buffer[id];
- return 128 & itemm ? itemm - 256 : itemm;
- }
- function uint16(tag) {
- var openFileIdIndex = tag.reserve(2);
- var openFilesIds = tag.buffer;
- return openFilesIds[openFileIdIndex++] << 8 | openFilesIds[openFileIdIndex];
- }
- function int16(tag) {
- var openFileIdIndex = tag.reserve(2);
- var openFilesIds = tag.buffer;
- var n = openFilesIds[openFileIdIndex++] << 8 | openFilesIds[openFileIdIndex];
- return 32768 & n ? n - 65536 : n;
- }
- function uint32(tag) {
- var openFileIdIndex = tag.reserve(4);
- var openFilesIds = tag.buffer;
- return 16777216 * openFilesIds[openFileIdIndex++] + (openFilesIds[openFileIdIndex++] << 16) + (openFilesIds[openFileIdIndex++] << 8) + openFilesIds[openFileIdIndex];
- }
- function int32(tag) {
- var openFileIdIndex = tag.reserve(4);
- var openFilesIds = tag.buffer;
- return openFilesIds[openFileIdIndex++] << 24 | openFilesIds[openFileIdIndex++] << 16 | openFilesIds[openFileIdIndex++] << 8 | openFilesIds[openFileIdIndex];
- }
- function read(len, method) {
- return function(decoder) {
- var start = decoder.reserve(len);
- return method.call(decoder.buffer, start, lastRow);
- };
- }
- function readUInt64BE(start) {
- return (new Uint64BE(this, start)).toNumber();
- }
- function readInt64BE(start) {
- return (new Int64BE(this, start)).toNumber();
- }
- function readUInt64BE_int64(start) {
- return new Uint64BE(this, start);
- }
- function readInt64BE_int64(start) {
- return new Int64BE(this, start);
- }
- function readFloatBE(offset) {
- return textUtils.read(this, offset, false, 23, 4);
- }
- function readDoubleBE(offset) {
- return textUtils.read(this, offset, false, 52, 8);
- }
- var textUtils = require(8);
- var Int64Buffer = require(11);
- var Uint64BE = Int64Buffer.Uint64BE;
- var Int64BE = Int64Buffer.Int64BE;
- exports.getReadFormat = function(options) {
- var binarraybuffer = Bufferish.hasArrayBuffer && options && options.binarraybuffer;
- var int64 = options && options.int64;
- return {
- map : HAS_MAP && options && options.usemap ? map_to_map : array,
- array : parse,
- str : str,
- bin : binarraybuffer ? bin_arraybuffer : bin_buffer,
- ext : ext,
- uint8 : uint8,
- uint16 : uint16,
- uint32 : uint32,
- uint64 : read(8, int64 ? readUInt64BE_int64 : readUInt64BE),
- int8 : int8,
- int16 : int16,
- int32 : int32,
- int64 : read(8, int64 ? readInt64BE_int64 : readInt64BE),
- float32 : read(4, readFloatBE),
- float64 : read(8, readDoubleBE)
- };
- };
- exports.readUint8 = uint8;
- var Bufferish = require(0);
- var BufferProto = require(10);
- var HAS_MAP = "undefined" != typeof Map;
- var lastRow = true;
- }, function(module, canCreateDiscussions, isSlidingUp) {
- !function(a) {
- function r(s) {
- var i;
- for (i in methods) {
- s[i] = methods[i];
- }
- return s;
- }
- function off(type, func) {
- var data;
- var self = this;
- if (arguments.length) {
- if (func) {
- if (data = get(self, type, true)) {
- if (!(data = data.filter(function(test) {
- return test !== func && test.originalListener !== func;
- })).length) {
- return off.call(self, type);
- }
- self.listeners[type] = data;
- }
- } else {
- if ((data = self.listeners) && (delete data[type], !Object.keys(data).length)) {
- return off.call(self);
- }
- }
- } else {
- delete self.listeners;
- }
- return self;
- }
- function get(data, event, element) {
- if (!element || data.listeners) {
- var animationConfigs = data.listeners || (data.listeners = {});
- return animationConfigs[event] || (animationConfigs[event] = []);
- }
- }
- module.exports = a;
- var methods = {
- on : function(type, name) {
- return get(this, type).push(name), this;
- },
- once : function(type, func) {
- function wrap() {
- off.call(context, type, wrap);
- func.apply(this, arguments);
- }
- var context = this;
- return wrap.originalListener = func, get(context, type).push(wrap), context;
- },
- off : off,
- emit : function(e, name) {
- var data = this;
- var state = get(data, e, true);
- if (!state) {
- return false;
- }
- var _len8 = arguments.length;
- if (1 === _len8) {
- state.forEach(function(t) {
- t.call(data);
- });
- } else {
- if (2 === _len8) {
- state.forEach(function(t) {
- t.call(data, name);
- });
- } else {
- var cmd_args = Array.prototype.slice.call(arguments, 1);
- state.forEach(function(t) {
- t.apply(data, cmd_args);
- });
- }
- }
- return !!state.length;
- }
- };
- r(a.prototype);
- a.mixin = r;
- }(function Range() {
- if (!(this instanceof Range)) {
- return new Range;
- }
- });
- }, , function(module, canCreateDiscussions) {
- var g = function() {
- return this;
- }();
- try {
- g = g || (new Function("return this"))();
- } catch (t) {
- if ("object" == typeof window) {
- g = window;
- }
- }
- module.exports = g;
- }, , function(canCreateDiscussions, exports, require) {
- exports.encode = require(14).encode;
- exports.decode = require(19).decode;
- exports.Encoder = require(39).Encoder;
- exports.Decoder = require(40).Decoder;
- exports.createCodec = require(41).createCodec;
- exports.codec = require(42).codec;
- }, function(module, canCreateDiscussions, require) {
- (function(Buffer) {
- function c(B) {
- return B && B.isBuffer && B;
- }
- module.exports = c(void 0 !== Buffer && Buffer) || c(this.Buffer) || c("undefined" != typeof window && window.Buffer) || this.Buffer;
- }).call(this, require(16).Buffer);
- }, function(canCreateDiscussions, exports, isSlidingUp) {
- function placeHoldersCount(b64) {
- var len = b64.length;
- if (0 < len % 4) {
- throw new Error("Invalid string. Length must be a multiple of 4");
- }
- var j = b64.indexOf("=");
- return -1 === j && (j = len), [j, j === len ? 0 : 4 - j % 4];
- }
- function tripletToBase64(num) {
- return c[63 & num >> 18] + c[63 & num >> 12] + c[63 & num >> 6] + c[63 & num];
- }
- function encodeChunk(uint8, start, end) {
- var temp;
- var output = [];
- var i = start;
- for (; i < end; i = i + 3) {
- temp = (16711680 & uint8[i] << 16) + (65280 & uint8[i + 1] << 8) + (255 & uint8[i + 2]);
- output.push(tripletToBase64(temp));
- }
- return output.join("");
- }
- exports.byteLength = function(string) {
- var parts = placeHoldersCount(string);
- var url = parts[0];
- var app = parts[1];
- return 3 * (url + app) / 4 - app;
- };
- exports.toByteArray = function(b64) {
- var MASK;
- var _range$toJSON2 = placeHoldersCount(b64);
- var begin = _range$toJSON2[0];
- var end = _range$toJSON2[1];
- var result = new ByteArray(function(addedRenderer, isBegin, end2) {
- return 3 * (isBegin + end2) / 4 - end2;
- }(0, begin, end));
- var j = 0;
- var b = 0 < end ? begin - 4 : begin;
- var i = 0;
- for (; i < b; i = i + 4) {
- MASK = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
- result[j++] = 255 & MASK >> 16;
- result[j++] = 255 & MASK >> 8;
- result[j++] = 255 & MASK;
- }
- return 2 === end && (MASK = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4, result[j++] = 255 & MASK), 1 === end && (MASK = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2, result[j++] = 255 & MASK >> 8, result[j++] = 255 & MASK), result;
- };
- exports.fromByteArray = function(uint8) {
- var f;
- var len = uint8.length;
- var extraBytes = len % 3;
- var parts = [];
- var maxChunkLength = 16383;
- var i = 0;
- var len2 = len - extraBytes;
- for (; i < len2; i = i + maxChunkLength) {
- parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
- }
- return 1 === extraBytes ? (f = uint8[len - 1], parts.push(c[f >> 2] + c[63 & f << 4] + "==")) : 2 === extraBytes && (f = (uint8[len - 2] << 8) + uint8[len - 1], parts.push(c[f >> 10] + c[63 & f >> 4] + c[63 & f << 2] + "=")), parts.join("");
- };
- var c = [];
- var revLookup = [];
- var ByteArray = "undefined" == typeof Uint8Array ? Array : Uint8Array;
- var obj = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var i = 0;
- var patchLen = obj.length;
- for (; i < patchLen; ++i) {
- c[i] = obj[i];
- revLookup[obj.charCodeAt(i)] = i;
- }
- revLookup[45] = 62;
- revLookup[95] = 63;
- }, function(mixin, canCreateDiscussions) {
- var check = {}.toString;
- mixin.exports = Array.isArray || function(t) {
- return "[object Array]" == check.call(t);
- };
- }, function(config, exports, require) {
- function _toArray(obj) {
- return Array(obj);
- }
- var Bufferish = require(0);
- (exports = config.exports = _toArray(0)).alloc = _toArray;
- exports.concat = Bufferish.concat;
- exports.from = function(value) {
- if (!Bufferish.isBuffer(value) && Bufferish.isView(value)) {
- value = Bufferish.Uint8Array.from(value);
- } else {
- if (Bufferish.isArrayBuffer(value)) {
- value = new Uint8Array(value);
- } else {
- if ("string" == typeof value) {
- return Bufferish.from.call(exports, value);
- }
- if ("number" == typeof value) {
- throw new TypeError('"value" argument must not be a number');
- }
- }
- }
- return Array.prototype.slice.call(value);
- };
- }, function(mixin, exports, require) {
- function alloc(obj) {
- return new Buffer(obj);
- }
- var Bufferish = require(0);
- var Buffer = Bufferish.global;
- (exports = mixin.exports = Bufferish.hasBuffer ? alloc(0) : []).alloc = Bufferish.hasBuffer && Buffer.alloc || alloc;
- exports.concat = Bufferish.concat;
- exports.from = function(value) {
- if (!Bufferish.isBuffer(value) && Bufferish.isView(value)) {
- value = Bufferish.Uint8Array.from(value);
- } else {
- if (Bufferish.isArrayBuffer(value)) {
- value = new Uint8Array(value);
- } else {
- if ("string" == typeof value) {
- return Bufferish.from.call(exports, value);
- }
- if ("number" == typeof value) {
- throw new TypeError('"value" argument must not be a number');
- }
- }
- }
- return Buffer.from && 1 !== Buffer.from.length ? Buffer.from(value) : new Buffer(value);
- };
- }, function(mixin, exports, require) {
- function alloc(obj) {
- return new Uint8Array(obj);
- }
- var Bufferish = require(0);
- (exports = mixin.exports = Bufferish.hasArrayBuffer ? alloc(0) : []).alloc = alloc;
- exports.concat = Bufferish.concat;
- exports.from = function(value) {
- if (Bufferish.isView(value)) {
- var byteOffset = value.byteOffset;
- var byteLength = value.byteLength;
- if ((value = value.buffer).byteLength !== byteLength) {
- if (value.slice) {
- value = value.slice(byteOffset, byteOffset + byteLength);
- } else {
- if ((value = new Uint8Array(value)).byteLength !== byteLength) {
- value = Array.prototype.slice.call(value, byteOffset, byteOffset + byteLength);
- }
- }
- }
- } else {
- if ("string" == typeof value) {
- return Bufferish.from.call(exports, value);
- }
- if ("number" == typeof value) {
- throw new TypeError('"value" argument must not be a number');
- }
- }
- return new Uint8Array(value);
- };
- }, function(canCreateDiscussions, e) {
- e.copy = function(target, targetStart, start, end) {
- var i;
- if (!start) {
- start = 0;
- }
- if (!(end || 0 === end)) {
- end = this.length;
- }
- if (!targetStart) {
- targetStart = 0;
- }
- var count = end - start;
- if (target === this && start < targetStart && targetStart < end) {
- i = count - 1;
- for (; 0 <= i; i--) {
- target[i + targetStart] = this[i + start];
- }
- } else {
- i = 0;
- for (; i < count; i++) {
- target[i + targetStart] = this[i + start];
- }
- }
- return count;
- };
- e.toString = function(radix, digits, n) {
- var values = this;
- var index = 0 | digits;
- if (!n) {
- n = values.length;
- }
- var msg = "";
- var end = 0;
- for (; index < n;) {
- if (128 > (end = values[index++])) {
- msg = msg + String.fromCharCode(end);
- } else {
- if (192 == (224 & end)) {
- end = (31 & end) << 6 | 63 & values[index++];
- } else {
- if (224 == (240 & end)) {
- end = (15 & end) << 12 | (63 & values[index++]) << 6 | 63 & values[index++];
- } else {
- if (240 == (248 & end)) {
- end = (7 & end) << 18 | (63 & values[index++]) << 12 | (63 & values[index++]) << 6 | 63 & values[index++];
- }
- }
- }
- if (65536 <= end) {
- end = end - 65536;
- msg = msg + String.fromCharCode(55296 + (end >>> 10), 56320 + (1023 & end));
- } else {
- msg = msg + String.fromCharCode(end);
- }
- }
- }
- return msg;
- };
- e.write = function(t, offset) {
- var reverseItemData = this;
- var currentPage = offset || (offset = offset | 0);
- var cs = t.length;
- var updatedReverseItemControlData = 0;
- var c = 0;
- for (; c < cs;) {
- if (128 > (updatedReverseItemControlData = t.charCodeAt(c++))) {
- reverseItemData[currentPage++] = updatedReverseItemControlData;
- } else {
- if (2048 > updatedReverseItemControlData) {
- reverseItemData[currentPage++] = 192 | updatedReverseItemControlData >>> 6;
- reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData;
- } else {
- if (55296 > updatedReverseItemControlData || 57343 < updatedReverseItemControlData) {
- reverseItemData[currentPage++] = 224 | updatedReverseItemControlData >>> 12;
- reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData >>> 6;
- reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData;
- } else {
- updatedReverseItemControlData = 65536 + (updatedReverseItemControlData - 55296 << 10 | t.charCodeAt(c++) - 56320);
- reverseItemData[currentPage++] = 240 | updatedReverseItemControlData >>> 18;
- reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData >>> 12;
- reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData >>> 6;
- reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData;
- }
- }
- }
- }
- return currentPage - offset;
- };
- }, function(canCreateDiscussions, exports, require) {
- function encode(name) {
- return encoder || (encoder = require(14).encode), encoder(name);
- }
- function packValueOf(value) {
- return value.valueOf();
- }
- function packRegExp(value) {
- (value = RegExp.prototype.toString.call(value).split("/")).shift();
- var htmlArray = [value.pop()];
- return htmlArray.unshift(value.join("/")), htmlArray;
- }
- function packError(res) {
- var out = {};
- var key;
- for (key in ERROR_COLUMNS) {
- out[key] = res[key];
- }
- return out;
- }
- exports.setExtPackers = function(codec) {
- codec.addExtPacker(14, Error, [packError, encode]);
- codec.addExtPacker(1, EvalError, [packError, encode]);
- codec.addExtPacker(2, RangeError, [packError, encode]);
- codec.addExtPacker(3, ReferenceError, [packError, encode]);
- codec.addExtPacker(4, SyntaxError, [packError, encode]);
- codec.addExtPacker(5, TypeError, [packError, encode]);
- codec.addExtPacker(6, URIError, [packError, encode]);
- codec.addExtPacker(10, RegExp, [packRegExp, encode]);
- codec.addExtPacker(11, Boolean, [packValueOf, encode]);
- codec.addExtPacker(12, String, [packValueOf, encode]);
- codec.addExtPacker(13, Date, [Number, encode]);
- codec.addExtPacker(15, Number, [packValueOf, encode]);
- if ("undefined" != typeof Uint8Array) {
- codec.addExtPacker(17, Int8Array, packTypedArray);
- codec.addExtPacker(18, Uint8Array, packTypedArray);
- codec.addExtPacker(19, Int16Array, packTypedArray);
- codec.addExtPacker(20, Uint16Array, packTypedArray);
- codec.addExtPacker(21, Int32Array, packTypedArray);
- codec.addExtPacker(22, Uint32Array, packTypedArray);
- codec.addExtPacker(23, Float32Array, packTypedArray);
- if ("undefined" != typeof Float64Array) {
- codec.addExtPacker(24, Float64Array, packTypedArray);
- }
- if ("undefined" != typeof Uint8ClampedArray) {
- codec.addExtPacker(25, Uint8ClampedArray, packTypedArray);
- }
- codec.addExtPacker(26, ArrayBuffer, packTypedArray);
- codec.addExtPacker(29, DataView, packTypedArray);
- }
- if (Bufferish.hasBuffer) {
- codec.addExtPacker(27, Buffer, Bufferish.from);
- }
- };
- var encoder;
- var Bufferish = require(0);
- var Buffer = Bufferish.global;
- var packTypedArray = Bufferish.Uint8Array.from;
- var ERROR_COLUMNS = {
- name : 1,
- message : 1,
- stack : 1,
- columnNumber : 1,
- fileName : 1,
- lineNumber : 1
- };
- }, function(canCreateDiscussions, exports, require) {
- var getName = require(9);
- var Int64Buffer = require(11);
- var Uint64BE = Int64Buffer.Uint64BE;
- var Int64BE = Int64Buffer.Int64BE;
- var Bufferish = require(0);
- var f = require(10);
- var WriteToken = require(36);
- var uint8 = require(17).uint8;
- var Date = require(7).ExtBuffer;
- var HAS_UINT8ARRAY = "undefined" != typeof Uint8Array;
- var HAS_MAP = "undefined" != typeof Map;
- var shapePathsCollection = [];
- shapePathsCollection[1] = 212;
- shapePathsCollection[2] = 213;
- shapePathsCollection[4] = 214;
- shapePathsCollection[8] = 215;
- shapePathsCollection[16] = 216;
- exports.getWriteType = function(options) {
- function object(encoder, value) {
- if (null === value) {
- return nil(encoder, value);
- }
- if (isBuffer(value)) {
- return bin(encoder, value);
- }
- if (getName(value)) {
- return function(encoder, data) {
- var length = data.length;
- token[16 > length ? 144 + length : 65535 >= length ? 220 : 221](encoder, length);
- var encode = encoder.codec.encode;
- var i = 0;
- for (; i < length; i++) {
- encode(encoder, data[i]);
- }
- }(encoder, value);
- }
- if (Uint64BE.isUint64BE(value)) {
- return function(encoder, in_value) {
- token[207](encoder, in_value.toArray());
- }(encoder, value);
- }
- if (Int64BE.isInt64BE(value)) {
- return function(encoder, in_value) {
- token[211](encoder, in_value.toArray());
- }(encoder, value);
- }
- var string = encoder.codec.getExtPacker(value);
- return string && (value = string(value)), value instanceof Date ? function(encoder, value) {
- var data = value.buffer;
- var length = data.length;
- var type = shapePathsCollection[length] || (255 > length ? 199 : 65535 >= length ? 200 : 201);
- token[type](encoder, length);
- uint8[value.type](encoder);
- encoder.send(data);
- }(encoder, value) : void map(encoder, value);
- }
- function nil(encoder, value) {
- token[192](encoder, value);
- }
- function bin_buffer(encoder, value) {
- var length = value.length;
- var type = 255 > length ? 196 : 65535 >= length ? 197 : 198;
- token[type](encoder, length);
- encoder.send(value);
- }
- function obj_to_map(encoder, value) {
- var r = Object.keys(value);
- var i = r.length;
- var type = 16 > i ? 128 + i : 65535 >= i ? 222 : 223;
- token[type](encoder, i);
- var encode = encoder.codec.encode;
- r.forEach(function(i) {
- encode(encoder, i);
- encode(encoder, value[i]);
- });
- }
- var token = WriteToken.getWriteToken(options);
- var useraw = options && options.useraw;
- var binarraybuffer = HAS_UINT8ARRAY && options && options.binarraybuffer;
- var isBuffer = binarraybuffer ? Bufferish.isArrayBuffer : Bufferish.isBuffer;
- var bin = binarraybuffer ? function(encoder, value) {
- bin_buffer(encoder, new Uint8Array(value));
- } : bin_buffer;
- var map = HAS_MAP && options && options.usemap ? function(encoder, value) {
- if (!(value instanceof Map)) {
- return obj_to_map(encoder, value);
- }
- var i = value.size;
- var type = 16 > i ? 128 + i : 65535 >= i ? 222 : 223;
- token[type](encoder, i);
- var encode = encoder.codec.encode;
- value.forEach(function(password, version) {
- encode(encoder, version);
- encode(encoder, password);
- });
- } : obj_to_map;
- return {
- boolean : function(key, value) {
- var type = value ? 195 : 194;
- token[type](key, value);
- },
- function : nil,
- number : function(encoder, value) {
- var rbd = 0 | value;
- if (value === rbd) {
- token[-32 <= rbd && 127 >= rbd ? 255 & rbd : 0 <= rbd ? 255 >= rbd ? 204 : 65535 >= rbd ? 205 : 206 : -128 <= rbd ? 208 : -32768 <= rbd ? 209 : 210](encoder, rbd);
- } else {
- token[203](encoder, value);
- }
- },
- object : useraw ? function(encoder, value) {
- return isBuffer(value) ? function(encoder, properties) {
- var length = properties.length;
- token[32 > length ? 160 + length : 65535 >= length ? 218 : 219](encoder, length);
- encoder.send(properties);
- }(encoder, value) : void object(encoder, value);
- } : object,
- string : function($) {
- return function(options, line) {
- var n = line.length;
- var size = 5 + 3 * n;
- options.offset = options.reserve(size);
- var data = options.buffer;
- var start = $(n);
- var i = options.offset + start;
- n = f.write.call(data, line, i);
- var stop = $(n);
- if (start !== stop) {
- var end = i + n;
- f.copy.call(data, data, i + stop - start, i, end);
- }
- var method = 1 === stop ? 160 + n : 3 >= stop ? 215 + stop : 219;
- token[method](options, n);
- options.offset += n;
- };
- }(useraw ? function(canCreateDiscussions) {
- return 32 > canCreateDiscussions ? 1 : 65535 >= canCreateDiscussions ? 3 : 5;
- } : function(canCreateDiscussions) {
- return 32 > canCreateDiscussions ? 1 : 255 >= canCreateDiscussions ? 2 : 65535 >= canCreateDiscussions ? 3 : 5;
- }),
- symbol : nil,
- undefined : nil
- };
- };
- }, function(canCreateDiscussions, exports, require) {
- function init_token() {
- var token = a.slice();
- return token[196] = write4(196), token[197] = write1(197), token[198] = write2(198), token[199] = write4(199), token[200] = write1(200), token[201] = write2(201), token[202] = writeN(202, 4, Buffer_prototype.writeFloatBE || writeFloatBE, true), token[203] = writeN(203, 8, Buffer_prototype.writeDoubleBE || writeDoubleBE, true), token[204] = write4(204), token[205] = write1(205), token[206] = write2(206), token[207] = writeN(207, 8, writeUInt64BE), token[208] = write4(208), token[209] = write1(209),
- token[210] = write2(210), token[211] = writeN(211, 8, writeInt64BE), token[217] = write4(217), token[218] = write1(218), token[219] = write2(219), token[220] = write1(220), token[221] = write2(221), token[222] = write1(222), token[223] = write2(223), token;
- }
- function write4(type) {
- return function(options, red) {
- var p = options.reserve(2);
- var data = options.buffer;
- data[p++] = type;
- data[p] = red;
- };
- }
- function write1(type) {
- return function(options, num) {
- var j = options.reserve(3);
- var data = options.buffer;
- data[j++] = type;
- data[j++] = num >>> 8;
- data[j] = num;
- };
- }
- function write2(type) {
- return function(options, num) {
- var j = options.reserve(5);
- var data = options.buffer;
- data[j++] = type;
- data[j++] = num >>> 24;
- data[j++] = num >>> 16;
- data[j++] = num >>> 8;
- data[j] = num;
- };
- }
- function writeN(type, len, method, noAssert) {
- return function(encoder, query) {
- var offset = encoder.reserve(len + 1);
- encoder.buffer[offset++] = type;
- method.call(encoder.buffer, query, offset, noAssert);
- };
- }
- function writeUInt64BE(value, offset) {
- new Uint64BE(this, offset, value);
- }
- function writeInt64BE(value, offset) {
- new Int64BE(this, offset, value);
- }
- function writeFloatBE(value, offset) {
- ieee754.write(this, value, offset, false, 23, 4);
- }
- function writeDoubleBE(value, offset) {
- ieee754.write(this, value, offset, false, 52, 8);
- }
- var ieee754 = require(8);
- var Int64Buffer = require(11);
- var Uint64BE = Int64Buffer.Uint64BE;
- var Int64BE = Int64Buffer.Int64BE;
- var a = require(17).uint8;
- var Bufferish = require(0);
- var Buffer = Bufferish.global;
- var c = Bufferish.hasBuffer && "TYPED_ARRAY_SUPPORT" in Buffer && !Buffer.TYPED_ARRAY_SUPPORT;
- var Buffer_prototype = Bufferish.hasBuffer && Buffer.prototype || {};
- exports.getWriteToken = function(options) {
- return options && options.uint8array ? function() {
- var token = init_token();
- return token[202] = writeN(202, 4, writeFloatBE), token[203] = writeN(203, 8, writeDoubleBE), token;
- }() : c || Bufferish.hasBuffer && options && options.safe ? function() {
- var token = a.slice();
- return token[196] = writeN(196, 1, Buffer.prototype.writeUInt8), token[197] = writeN(197, 2, Buffer.prototype.writeUInt16BE), token[198] = writeN(198, 4, Buffer.prototype.writeUInt32BE), token[199] = writeN(199, 1, Buffer.prototype.writeUInt8), token[200] = writeN(200, 2, Buffer.prototype.writeUInt16BE), token[201] = writeN(201, 4, Buffer.prototype.writeUInt32BE), token[202] = writeN(202, 4, Buffer.prototype.writeFloatBE), token[203] = writeN(203, 8, Buffer.prototype.writeDoubleBE), token[204] =
- writeN(204, 1, Buffer.prototype.writeUInt8), token[205] = writeN(205, 2, Buffer.prototype.writeUInt16BE), token[206] = writeN(206, 4, Buffer.prototype.writeUInt32BE), token[207] = writeN(207, 8, writeUInt64BE), token[208] = writeN(208, 1, Buffer.prototype.writeInt8), token[209] = writeN(209, 2, Buffer.prototype.writeInt16BE), token[210] = writeN(210, 4, Buffer.prototype.writeInt32BE), token[211] = writeN(211, 8, writeInt64BE), token[217] = writeN(217, 1, Buffer.prototype.writeUInt8), token[218] =
- writeN(218, 2, Buffer.prototype.writeUInt16BE), token[219] = writeN(219, 4, Buffer.prototype.writeUInt32BE), token[220] = writeN(220, 2, Buffer.prototype.writeUInt16BE), token[221] = writeN(221, 4, Buffer.prototype.writeUInt32BE), token[222] = writeN(222, 2, Buffer.prototype.writeUInt16BE), token[223] = writeN(223, 4, Buffer.prototype.writeUInt32BE), token;
- }() : init_token();
- };
- }, function(canCreateDiscussions, exports, require) {
- function decode(params) {
- return serialize || (serialize = require(19).decode), serialize(params);
- }
- function unpackRegExp(value) {
- return RegExp.apply(null, value);
- }
- function unpackError(Class) {
- return function(savedObject) {
- var out = new Class;
- var key;
- for (key in ERROR_COLUMNS) {
- out[key] = savedObject[key];
- }
- return out;
- };
- }
- function unpackClass(Class) {
- return function(deliver) {
- return new Class(deliver);
- };
- }
- function unpackArrayBuffer(value) {
- return (new Uint8Array(value)).buffer;
- }
- exports.setExtUnpackers = function(codec) {
- codec.addExtUnpacker(14, [decode, unpackError(Error)]);
- codec.addExtUnpacker(1, [decode, unpackError(EvalError)]);
- codec.addExtUnpacker(2, [decode, unpackError(RangeError)]);
- codec.addExtUnpacker(3, [decode, unpackError(ReferenceError)]);
- codec.addExtUnpacker(4, [decode, unpackError(SyntaxError)]);
- codec.addExtUnpacker(5, [decode, unpackError(TypeError)]);
- codec.addExtUnpacker(6, [decode, unpackError(URIError)]);
- codec.addExtUnpacker(10, [decode, unpackRegExp]);
- codec.addExtUnpacker(11, [decode, unpackClass(Boolean)]);
- codec.addExtUnpacker(12, [decode, unpackClass(String)]);
- codec.addExtUnpacker(13, [decode, unpackClass(Date)]);
- codec.addExtUnpacker(15, [decode, unpackClass(Number)]);
- if ("undefined" != typeof Uint8Array) {
- codec.addExtUnpacker(17, unpackClass(Int8Array));
- codec.addExtUnpacker(18, unpackClass(Uint8Array));
- codec.addExtUnpacker(19, [unpackArrayBuffer, unpackClass(Int16Array)]);
- codec.addExtUnpacker(20, [unpackArrayBuffer, unpackClass(Uint16Array)]);
- codec.addExtUnpacker(21, [unpackArrayBuffer, unpackClass(Int32Array)]);
- codec.addExtUnpacker(22, [unpackArrayBuffer, unpackClass(Uint32Array)]);
- codec.addExtUnpacker(23, [unpackArrayBuffer, unpackClass(Float32Array)]);
- if ("undefined" != typeof Float64Array) {
- codec.addExtUnpacker(24, [unpackArrayBuffer, unpackClass(Float64Array)]);
- }
- if ("undefined" != typeof Uint8ClampedArray) {
- codec.addExtUnpacker(25, unpackClass(Uint8ClampedArray));
- }
- codec.addExtUnpacker(26, unpackArrayBuffer);
- codec.addExtUnpacker(29, [unpackArrayBuffer, unpackClass(DataView)]);
- }
- if (Bufferish.hasBuffer) {
- codec.addExtUnpacker(27, unpackClass(Buffer));
- }
- };
- var serialize;
- var Bufferish = require(0);
- var Buffer = Bufferish.global;
- var ERROR_COLUMNS = {
- name : 1,
- message : 1,
- stack : 1,
- columnNumber : 1,
- fileName : 1,
- lineNumber : 1
- };
- }, function(canCreateDiscussions, exports, require) {
- function init_token(format) {
- var i;
- var token = Array(256);
- i = 0;
- for (; 127 >= i; i++) {
- token[i] = constant(i);
- }
- i = 128;
- for (; 143 >= i; i++) {
- token[i] = fix(i - 128, format.map);
- }
- i = 144;
- for (; 159 >= i; i++) {
- token[i] = fix(i - 144, format.array);
- }
- i = 160;
- for (; 191 >= i; i++) {
- token[i] = fix(i - 160, format.str);
- }
- token[192] = constant(null);
- token[193] = null;
- token[194] = constant(false);
- token[195] = constant(true);
- token[196] = flex(format.uint8, format.bin);
- token[197] = flex(format.uint16, format.bin);
- token[198] = flex(format.uint32, format.bin);
- token[199] = flex(format.uint8, format.ext);
- token[200] = flex(format.uint16, format.ext);
- token[201] = flex(format.uint32, format.ext);
- token[202] = format.float32;
- token[203] = format.float64;
- token[204] = format.uint8;
- token[205] = format.uint16;
- token[206] = format.uint32;
- token[207] = format.uint64;
- token[208] = format.int8;
- token[209] = format.int16;
- token[210] = format.int32;
- token[211] = format.int64;
- token[212] = fix(1, format.ext);
- token[213] = fix(2, format.ext);
- token[214] = fix(4, format.ext);
- token[215] = fix(8, format.ext);
- token[216] = fix(16, format.ext);
- token[217] = flex(format.uint8, format.str);
- token[218] = flex(format.uint16, format.str);
- token[219] = flex(format.uint32, format.str);
- token[220] = flex(format.uint16, format.array);
- token[221] = flex(format.uint32, format.array);
- token[222] = flex(format.uint16, format.map);
- token[223] = flex(format.uint32, format.map);
- i = 224;
- for (; 255 >= i; i++) {
- token[i] = constant(i - 256);
- }
- return token;
- }
- function constant(name) {
- return function() {
- return name;
- };
- }
- function flex(lenFunc, decodeFunc) {
- return function(decoder) {
- var len = lenFunc(decoder);
- return decodeFunc(decoder, len);
- };
- }
- function fix(index, method) {
- return function(Q98038813) {
- return method(Q98038813, index);
- };
- }
- var ReadFormat = require(21);
- exports.getReadToken = function(options) {
- var json = ReadFormat.getReadFormat(options);
- return options && options.useraw ? function(format) {
- var i;
- var obj = init_token(format).slice();
- obj[217] = obj[196];
- obj[218] = obj[197];
- obj[219] = obj[198];
- i = 160;
- for (; 191 >= i; i++) {
- obj[i] = fix(i - 160, format.bin);
- }
- return obj;
- }(json) : init_token(json);
- };
- }, function(canCreateDiscussions, exports, require) {
- function Encoder(options) {
- return this instanceof Encoder ? void EncodeBuffer.call(this, options) : new Encoder(options);
- }
- exports.Encoder = Encoder;
- var EventLite = require(22);
- var EncodeBuffer = require(15).EncodeBuffer;
- Encoder.prototype = new EncodeBuffer;
- EventLite.mixin(Encoder.prototype);
- Encoder.prototype.encode = function(chunk) {
- this.write(chunk);
- this.emit("data", this.read());
- };
- Encoder.prototype.end = function(data) {
- if (arguments.length) {
- this.encode(data);
- }
- this.flush();
- this.emit("end");
- };
- }, function(canCreateDiscussions, exports, require) {
- function Decoder(options) {
- return this instanceof Decoder ? void DecodeBuffer.call(this, options) : new Decoder(options);
- }
- exports.Decoder = Decoder;
- var EventLite = require(22);
- var DecodeBuffer = require(20).DecodeBuffer;
- Decoder.prototype = new DecodeBuffer;
- EventLite.mixin(Decoder.prototype);
- Decoder.prototype.decode = function(a) {
- if (arguments.length) {
- this.write(a);
- }
- this.flush();
- };
- Decoder.prototype.push = function(type) {
- this.emit("data", type);
- };
- Decoder.prototype.end = function(raw) {
- this.decode(raw);
- this.emit("end");
- };
- }, function(canCreateDiscussions, exports, require) {
- require(12);
- require(6);
- exports.createCodec = require(4).createCodec;
- }, function(canCreateDiscussions, exports, require) {
- require(12);
- require(6);
- exports.codec = {
- preset : require(4).preset
- };
- }, , , , , , function(module, canCreateDiscussions, _resolveReferenceNode) {
- var child = _resolveReferenceNode(1);
- var o = _resolveReferenceNode(3);
- var obj = _resolveReferenceNode(49);
- module.exports = {
- ahNum : 0,
- socket : null,
- connected : false,
- socketId : -1,
- sendQueue : [],
- connect : function(baseUrl, done, num) {
- if (!this.socket) {
- var protocol = child.enableHttps ? "wss:" : "ws:";
- var self = this;
- try {
- var s = false;
- this.socket = new WebSocket(protocol + baseUrl);
- this.socket.binaryType = "arraybuffer";
- this.socket.onmessage = function(event) {
- var name_list = o.decodeNetworkMessage(event.data)[0];
- var name = name_list[0];
- var item = name_list[1];
- if ("io-init" == name) {
- self.socketId = item[0];
- } else {
- num[name].apply(void 0, item);
- }
- };
- this.socket.onopen = function() {
- self.connected = true;
- done();
- for (let encodedPackets of self.sendQueue) {
- self.send(encodedPackets[0], ...encodedPackets[1]);
- }
- };
- this.socket.onclose = function() {
- self.connected = false;
- if (!s) {
- done("Disconnected. Try connecting to another server.");
- }
- };
- this.socket.onerror = function() {
- if (this.socket.readyState != WebSocket.OPEN) {
- s = true;
- console.error("Socket error", arguments);
- done("Socket error");
- }
- };
- } catch (host) {
- console.error("Socket connection error:", host);
- done(host);
- }
- }
- },
- send : function(key, ...j) {
- if (!this.socket || this.socket.readyState !== WebSocket.OPEN) {
- return console.warn("Socket not open yet", key, j), void this.sendQueue.push([key, j]);
- }
- this.ahNum = o.rotateNumber(this.ahNum, obj);
- var data = o.encodeNetworkMessage([key, j], this.ahNum);
- this.socket.send(data);
- },
- socketReady : function() {
- return this.socket && this.connected;
- }
- };
- }, function(mixin) {
- mixin.exports = 60133;
- }, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function(canCreateDiscussions, isSlidingUp, require) {
- function shortcutUrl(url) {
- return uri.searchParams.get(url);
- }
- var client = require(48);
- var config = require(1);
- var exports = require(3);
- var isNonIntegerStep = "undefined" != typeof Storage;
- window.getSavedVal = function(step) {
- return isNonIntegerStep ? localStorage.getItem(step) : null;
- };
- window.saveVal = function(b, status) {
- if (isNonIntegerStep) {
- localStorage.setItem(b, status);
- }
- };
- var state = getSavedVal("krunker_username");
- var PORT_SERVER_MESSAGES = getSavedVal("krunker_id");
- getSavedVal("krunker_token");
- if (state) {
- profileName.innerHTML = state;
- }
- var uri = new URL(window.location.href);
- window.openLink = function(event) {
- window.open(event, "_self");
- };
- window.searchMap = function() {
- var params = searchInput.value;
- if (params && "" != params) {
- window.open("./social.html?p=maps&q=search&s=" + params, "_self");
- }
- };
- window.playMap = function(loading) {
- window.saveVal("mapToLoad", loading);
- window.open("/", "_blank");
- };
- var boothId = shortcutUrl("p") || "leaders";
- var key = shortcutUrl("q");
- var cb = shortcutUrl("s") || null;
- if (!(key || "leaders" != boothId)) {
- key = "score";
- }
- if (!(key || "profile" != boothId)) {
- key = state;
- }
- if (!(key || "maps" != boothId)) {
- key = "votes";
- }
- document.getElementById(boothId).style.opacity = .5;
- var masterVideoId = config.isProd ? "krunker_social.krunker.io" : "127.0.0.1";
- var _ddoc = config.isProd ? 443 : 5070;
- client.connect("//" + masterVideoId + ":" + _ddoc + "/", function(canCreateDiscussions) {
- if (!canCreateDiscussions) {
- client.send("r", boothId, key, PORT_SERVER_MESSAGES, cb);
- }
- }, {
- 0 : function(clickRepeater, e, data, headers) {
- if ("profile" == clickRepeater) {
- if (data) {
- profileHolder.style.display = "block";
- var fsHTML = "";
- var d = Math.max(1, Math.floor(config.rankVar * Math.sqrt(data.player_score)));
- fsHTML = fsHTML + ("<div class='profileName'>" + data.player_name + (data.player_clan ? "<span style='color:rgba(0,0,0,0.4)'> [" + data.player_clan + "]</span>" : "") + (data.player_featured ? "<i class='material-icons' style='margin-left:5px;font-size:32px;color:rgba(0,0,0,0.4)'>check_circle</i>" : "") + "<img style='float:right' src='./img/levels/" + Math.max(Math.min(config.maxLevel - 2, d.roundToNearest(3) - 2), 0) + ".png' class='rnkIconL'></div>");
- fsHTML = fsHTML + "<div id='statHolder'>";
- fsHTML = fsHTML + ("<div class='pSt'>LVL<strong>" + d + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>KR<strong>" + data.player_funds + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>Score<strong>" + data.player_score + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>SPK<strong>" + (data.player_score / Math.max(data.player_kills, 1)).toFixed(2) + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>Kills<strong>" + data.player_kills + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>Deaths<strong>" + data.player_deaths + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>KDR<strong>" + (data.player_kills / Math.max(data.player_deaths, 1)).toFixed(2) + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>Games<strong>" + data.player_games_played + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>Wins<strong>" + data.player_wins + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>W/L<strong>" + (data.player_wins / Math.max(data.player_games_played, 1)).toFixed(2) + "</strong></div>");
- fsHTML = fsHTML + ("<div class='pSt'>Time<strong>" + exports.getReadableTime(data.player_timeplayed) + "</strong></div>");
- fsHTML = fsHTML + "</div>";
- hackerText.innerHTML = data.player_hack ? "HACKER" : "";
- profileData.innerHTML = fsHTML;
- }
- if (profileMaps.style.display = "none", headers && headers.length) {
- fsHTML = "<div style='font-size:24px;margin-top:-10px;margin-bottom:10px'>User Maps</div>";
- var i = 0;
- for (; i < headers.length; ++i) {
- fsHTML = fsHTML + ("<div style='height:40px'><div style='display:inline-block'><a style='color:#2196F3' href='javascript:;' onclick='playMap("" + headers[i].map_name.escape() + "")' class='lName'>" + headers[i].map_name + "</a></div><div style='float:right'><span>" + headers[i].map_votes + "</span></div></div>");
- }
- profileMaps.style.display = "inline-block";
- profileMaps.innerHTML = fsHTML;
- }
- } else {
- if ("maps" == clickRepeater) {
- mapsHolder.style.display = "block";
- fsHTML = "<div class='scrollItem'>";
- if (!data.length) {
- fsHTML = fsHTML + "<span style='color:rgba(0,0,0,0.4);'>No Maps found...</span>";
- }
- i = 0;
- for (; i < data.length; ++i) {
- fsHTML = fsHTML + ("<div style='height:80px'><div style='display:inline-block'><a style='color:#000' href='javascript:;' onclick='playMap("" + data[i].map_name.escape() + "")' class='lName'>" + data[i].map_name + "</a><div style='color:rgba(0,0,0,0.25)'> by <a style='color:rgba(0,0,0,0.5)' href='/social.html?p=profile&q=" + data[i].creatorname + "' class='lName'>" + data[i].creatorname + "</a></div></div><div style='float:right'><span id='mapVotes" + data[i].map_id + "'>" +
- data[i].map_votes + "</span></div></div>");
- }
- fsHTML = fsHTML + "</div>";
- mapList.innerHTML = fsHTML;
- } else {
- if ("leaders" == clickRepeater) {
- leaderHolder.style.display = "block";
- fsHTML = "<div class='scrollItem'>";
- i = 0;
- for (; i < data.length; ++i) {
- fsHTML = fsHTML + ("player_clan" == e ? "<div>" + (i + 1) + ". <a class='lName'>[" + data[i].clan_name + "]</a> (" + data[i].clan_membercount + ") " + (data[i].clan_hackcount ? "<span style='color:#E85656'>" + data[i].clan_hackcount + "</span>" : "") + "<span style='color:rgba(0,0,0,0.3)'> by <a href='/social.html?p=profile&q=" + data[i].creatorname + "' class='lName'>" + data[i].creatorname + "</a></span><div style='float:right'>" + data[i].clan_score + "</div></div>" : "<div>" + (i +
- 1) + ". <a href='/social.html?p=profile&q=" + data[i].player_name + "' class='lName' style='" + (data[i].player_hack ? "color:#E85656" : "") + "'>" + data[i].player_name + "</a>" + (data[i].player_clan ? "<span style='color:rgba(0,0,0,0.4)'> [" + data[i].player_clan + "]</span>" : "") + (data[i].player_featured ? "<i class='material-icons' style='margin-left:5px;font-size:26px;color:rgba(0,0,0,0.4)'>check_circle</i>" : "") + "<div style='float:right'>" + (config.leaderCal[e] ? config.leaderCal[e](data[i][e]) :
- data[i][e]) + "</div></div>");
- }
- fsHTML = fsHTML + "</div>";
- leaderList.innerHTML = fsHTML;
- }
- }
- }
- },
- 1 : function(bbls) {
- alert(bbls);
- }
- });
- }]);
Add Comment
Please, Sign In to add comment