entity-serves
Version:
Backend for entity.works, a Dead by Daylight wiki.
6 lines • 32.5 kB
JavaScript
/*!
*** EntityServes 3.6.0
*** Copyright © 2020, Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid)
*** @license MIT
!*/!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=77)}([function(t,e){t.exports=require("sequelize")},function(t,e,r){"use strict";r.r(e),r.d(e,"schema",(function(){return u}));var n=r(0),o=r.n(n),a=r(8);class i extends o.a.Model{static associate(){}async createLogin(){return await a.default.create({UserId:this.id})}}const u={title:{type:o.a.STRING(64),allowNull:!1},name:{type:o.a.STRING(64),allowNull:!1,unique:!0},password:{type:o.a.CHAR(60),allowNull:!1}};e.default=i},function(t,e,r){"use strict";r.r(e),r.d(e,"schema",(function(){return u})),r.d(e,"modelOptions",(function(){return c}));var n=r(39),o=r(0),a=r.n(o);class i extends a.a.Model{static associate(t){i.belongsTo(t.User,{foreignKey:{allowNull:!1}})}static async addBuild(t,e,r){return await i.create({type:t,UserId:e,data:r,seoLinkId:Object(n.paramCase)(r.title||Object(n.paramCase)(t))})}}const u={type:{type:a.a.STRING(32),allowNull:!1},data:{type:a.a.JSONB,allowNull:!1},seoLinkId:a.a.STRING},c={paranoid:!0};e.default=i},function(t,e,r){var n=r(42),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();t.exports=a},function(t,e){var r=Array.isArray;t.exports=r},function(t,e,r){"use strict";r.d(e,"b",(function(){return c}));var n=r(12),o=r.n(n),a=r(69),i=r.n(a);const u=new o.a({name:"EntityServes",version:"3.6.0",insecurePort:13251,database:"entityServes",useGot:!0,databaseExtensions:"hstore",koaSession:{key:"abc"},configSetup:{defaults:i()}}),c=u.logger;u.got,u.config,u.appFolder,u.koa,e.a=u},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,r){var n=r(94),o=r(97);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},function(t,e,r){"use strict";r.r(e),r.d(e,"schema",(function(){return i}));var n=r(0),o=r.n(n);class a extends o.a.Model{static associate(t){a.belongsTo(t.User,{foreignKey:{allowNull:!1}})}}const i={apiKey:{type:o.a.UUID,defaultValue:o.a.UUIDV4,allowNull:!1,unique:!0}};e.default=a},function(t,e,r){var n=r(4),o=r(85),a=r(88),i=r(112);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:a(i(t))}},function(t,e,r){var n=r(13),o=r(86),a=r(87),i=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":i&&i in Object(t)?o(t):a(t)}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e){t.exports=require("jaid-core")},function(t,e,r){var n=r(3).Symbol;t.exports=n},function(t,e,r){var n=r(23),o=r(48);t.exports=function(t,e,r,a){var i=!r;r||(r={});for(var u=-1,c=e.length;++u<c;){var s=e[u],f=a?a(r[s],t[s],s,r,t):void 0;void 0===f&&(f=t[s]),i?o(r,s,f):n(r,s,f)}return r}},function(t,e,r){var n=r(7)(Object,"create");t.exports=n},function(t,e,r){var n=r(102),o=r(103),a=r(104),i=r(105),u=r(106);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=a,c.prototype.has=i,c.prototype.set=u,t.exports=c},function(t,e,r){var n=r(46);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},function(t,e,r){var n=r(108);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},function(t,e,r){var n=r(21);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},function(t,e){t.exports=require("bcrypt")},function(t,e,r){var n=r(10),o=r(6);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},function(t,e,r){var n=r(7)(r(3),"Map");t.exports=n},function(t,e,r){var n=r(48),o=r(46),a=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var i=t[e];a.call(t,e)&&o(i,r)&&(void 0!==r||e in t)||n(t,e,r)}},function(t,e){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&r.test(t))&&t>-1&&t%1==0&&e>t}},function(t,e,r){var n=r(118),o=r(6),a=Object.prototype,i=a.hasOwnProperty,u=a.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(t){return o(t)&&i.call(t,"callee")&&!u.call(t,"callee")};t.exports=c},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&9007199254740991>=t}},function(t,e){t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},function(t,e,r){var n=r(53),o=r(142),a=r(56);t.exports=function(t){return a(t)?n(t):o(t)}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,r){(function(t){var n=r(42),o=e&&!e.nodeType&&e,a=o&&"object"==typeof t&&t&&!t.nodeType&&t,i=a&&a.exports===o&&n.process,u=function(){try{return a&&a.require&&a.require("util").types||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=u}).call(this,r(29)(t))},function(t,e){var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},function(t,e,r){var n=r(150),o=r(58),a=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,u=i?function(t){return null==t?[]:(t=Object(t),n(i(t),(function(e){return a.call(t,e)})))}:o;t.exports=u},function(t,e,r){var n=r(55)(Object.getPrototypeOf,Object);t.exports=n},function(t,e,r){var n=r(153),o=r(22),a=r(154),i=r(155),u=r(156),c=r(10),s=r(45),f=s(n),l=s(o),p=s(a),d=s(i),v=s(u),y=c;(n&&"[object DataView]"!=y(new n(new ArrayBuffer(1)))||o&&"[object Map]"!=y(new o)||a&&"[object Promise]"!=y(a.resolve())||i&&"[object Set]"!=y(new i)||u&&"[object WeakMap]"!=y(new u))&&(y=function(t){var e=c(t),r="[object Object]"==e?t.constructor:void 0,n=r?s(r):"";if(n)switch(n){case f:return"[object DataView]";case l:return"[object Map]";case p:return"[object Promise]";case d:return"[object Set]";case v:return"[object WeakMap]"}return e}),t.exports=y},function(t,e,r){var n=r(159);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},function(t,e,r){"use strict";r.r(e),r.d(e,"schema",(function(){return u}));var n=r(0),o=r.n(n),a=r(8);class i extends o.a.Model{static associate(t){i.belongsTo(t.User)}async createLogin(){return await a.default.create({UserId:this.id})}}const u={type:{type:o.a.STRING(64),allowNull:!1},payload:o.a.JSONB,time:{type:o.a.INTEGER,allowNull:!1},result:o.a.JSONB};e.default=i},function(t,e){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},function(t,e){t.exports=require("param-case")},function(t,e,r){"use strict";r.r(e);var n=r(74),o=r.n(n),a=r(2),i=r(1);e.default=async(t,e)=>{if(!t.userId)return{error:"Not logged in!"};const r=await i.default.findByPk(t.userId),n=await a.default.addBuild(e.formType,r.id,e.formData);return o()(n,["id","seoLinkId"])}},function(t,e,r){var n=r(9),o=r(19);t.exports=function(t,e){for(var r=0,a=(e=n(e,t)).length;null!=t&&a>r;)t=t[o(e[r++])];return r&&r==a?t:void 0}},function(t,e){var r="object"==typeof global&&global&&global.Object===Object&&global;t.exports=r},function(t,e,r){var n=r(91),o=r(107),a=r(109),i=r(110),u=r(111);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=a,c.prototype.has=i,c.prototype.set=u,t.exports=c},function(t,e,r){var n=r(10),o=r(11);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e){var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},function(t,e,r){var n=r(49);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},function(t,e,r){var n=r(7),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},function(t,e,r){var n=r(119),o=r(122),a=r(124);t.exports=function(t){return a(o(t,void 0,n),t+"")}},function(t,e,r){"use strict";r.r(e),e.default=()=>({version:"3.6.0"})},function(t,e,r){"use strict";r.r(e);var n=r(75),o=r.n(n),a=r(2),i=r(1);e.default=async(t,e)=>{const r=await a.default.findByPk(+e,{attributes:["UserId","data","type","createdAt","updatedAt"],raw:!0});if(!r)return null;const n=await i.default.findByPk(r.UserId,{attributes:["name","title"],raw:!0});return{...o()(r,"UserId"),userName:n.name,userTitle:n.title}}},function(t,e,r){var n=r(138),o=r(25),a=r(4),i=r(54),u=r(24),c=r(140),s=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=a(t),f=!r&&o(t),l=!r&&!f&&i(t),p=!r&&!f&&!l&&c(t),d=r||f||l||p,v=d?n(t.length,String):[],y=v.length;for(var b in t)!e&&!s.call(t,b)||d&&("length"==b||l&&("offset"==b||"parent"==b)||p&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||u(b,y))||v.push(b);return v}},function(t,e,r){(function(t){var n=r(3),o=r(139),a=e&&!e.nodeType&&e,i=a&&"object"==typeof t&&t&&!t.nodeType&&t,u=i&&i.exports===a?n.Buffer:void 0,c=(u?u.isBuffer:void 0)||o;t.exports=c}).call(this,r(29)(t))},function(t,e){t.exports=function(t,e){return function(r){return t(e(r))}}},function(t,e,r){var n=r(44),o=r(26);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},function(t,e,r){var n=r(53),o=r(145),a=r(56);t.exports=function(t){return a(t)?n(t,!0):o(t)}},function(t,e){t.exports=function(){return[]}},function(t,e,r){var n=r(27),o=r(34),a=r(33),i=r(58),u=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,a(t)),t=o(t);return e}:i;t.exports=u},function(t,e,r){var n=r(27),o=r(4);t.exports=function(t,e,r){var a=e(t);return o(t)?a:n(a,r(t))}},function(t,e,r){var n=r(60),o=r(59),a=r(57);t.exports=function(t){return n(t,a,o)}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n),a=r(2);e.default=async()=>{const t=await a.default.findAll({attributes:["type",[o.a.fn("COUNT","id"),"count"]],group:["type"],raw:!0});return Object.values(t)}},function(t,e,r){"use strict";r.r(e);var n=r(76),o=r.n(n),a=r(0),i=r(2),u=r(1);e.default=async(t,e)=>{const r={};if("perk"!==e.filterType)return null;{const t=o.a.perks[e.value];r.type="killer"===t.for?"killerLoadout":"survivorLoadout",r[a.Op.or]=[1,2,3,4].map(e=>({data:{[`perk${e}`]:t.id}}))}return await i.default.findAndCountAll({where:r,limit:e.limit||10,attributes:["UserId","data","type","createdAt","updatedAt"],raw:!0,order:[["id","DESC"]],include:[{model:u.default,attributes:["name","title"]}]})}},function(t,e,r){"use strict";r.r(e);var n=r(2);e.default=async(t,e)=>{const r=await n.default.findAll({where:e.where,limit:e.limit||10,attributes:["id","data","type","seoLinkId","createdAt","updatedAt"],include:[{association:"User",attributes:["name","title"]}],order:[["updatedAt","DESC"]],raw:!0});return Object.values(r)}},function(t,e,r){"use strict";r.r(e);var n=r(2),o=r(1);e.default=async(t,e)=>{const r=e.toLowerCase(),a=await o.default.findOne({where:{name:r},attributes:["id","title","name","createdAt"],raw:!0});return a?{user:a,latestBuilds:await n.default.findAndCountAll({where:{UserId:a.id},limit:10,attributes:["id","data","type","seoLinkId","createdAt","updatedAt"],order:[["updatedAt","DESC"]],raw:!0})}:null}},function(t,e,r){"use strict";r.r(e);var n=r(20),o=r.n(n),a=r(1);e.default=async(t,e)=>{const r=e.user.toLowerCase(),n=await a.default.findOne({where:{name:r}});if(!n)return{error:"User not found!"};if(!await o.a.compare(e.password,n.password))return{error:"Incorrect password!"};const i=await n.createLogin();return t.client.apiKey=i.apiKey,t.client.userId=n.id,{title:n.title,name:n.name,key:i.apiKey}}},function(t,e,r){"use strict";r.r(e);var n=r(20),o=r.n(n),a=r(1);e.default=async(t,e)=>{const r=e.user.toLowerCase();if(await a.default.findOne({where:{name:r}}))return{error:"Already exists!"};const n=await o.a.hash(e.password,5),i=await a.default.create({title:e.user,name:r,password:n}),u=await i.createLogin();return{title:i.title,name:i.name,key:u.apiKey}}},function(t,e){t.exports=require("yargs")},function(t,e){t.exports={twitchClientCallbackUrl:"https://server.preis.farm/auth/twitch/callback",loginRedirectUrl:"https://preis.farm",frontendHost:"entity.works"}},function(t,e){t.exports=require("jaid-core-dashboard")},function(t,e){t.exports=require("cookie")},function(t,e){t.exports=require("socket.io")},function(t,e){t.exports=require("socket-enhance")},function(t,e,r){var n=r(83),o=r(50)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},function(t,e,r){var n=r(47),o=r(129),a=r(170),i=r(9),u=r(14),c=r(173),s=r(50),f=r(61),l=s((function(t,e){var r={};if(null==t)return r;var s=!1;e=n(e,(function(e){return e=i(e,t),s||(s=e.length>1),e})),u(t,f(t),r),s&&(r=o(r,7,c));for(var l=e.length;l--;)a(r,e[l]);return r}));t.exports=l},function(t,e){t.exports=require("dead-by-daylight")},function(t,e,r){"use strict";r.r(e);var n=r(68),o=r.n(n),a=r(5);function i(t){var e;(null===a.a||void 0===a.a||null===(e=a.a.logger)||void 0===e?void 0:e.error)?a.a.logger.error(t):console.error(t)}process.on("unhandledRejection",t=>{i(t?`Unhandled promise rejection: ${(null==t?void 0:t.message)||t}`:"Unhandled promise rejection"),(null==t?void 0:t.stack)&&i(t.stack)}),o.a.scriptName("entity-serves").version("3.6.0").command("$0","Backend for entity.works, a Dead by Daylight wiki.",{},(function(){(async function(){const t={},e=r(78);for(const r of e.keys()){const{pluginName:n}=r.match(/[/\\](?<pluginName>.+?)[/\\]index\.js$/).groups;t[n]=e(r).default}await a.a.init(t)})().catch(t=>{i("Core process crashed"),i(t),process.exit(1)})})).argv},function(t,e,r){var n={"./dashboard/index.js":79,"./main/index.js":80,"./socketServer/index.js":175};function o(t){var e=a(t);return r(e)}function a(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=a,t.exports=o,o.id=78},function(t,e,r){"use strict";r.r(e);var n=r(70),o=r.n(n);e.default=new o.a},function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return o}));var n=r(12);class o extends n.JaidCorePlugin{collectModels(){const t={},e=r(81);for(const r of e.keys())t[r.match(/\.\/(?<key>[\da-z]+)\./i).groups.key]=e(r);return t}}},function(t,e,r){var n={"./ApiCall.js":37,"./Build.js":2,"./Login.js":8,"./User.js":1};function o(t){var e=a(t);return r(e)}function a(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=a,t.exports=o,o.id=81},function(t,e,r){var n={"./addBuild":40,"./addBuild.js":40,"./getBackendInfo":51,"./getBackendInfo.js":51,"./getBuild":52,"./getBuild.js":52,"./getBuildTypes":62,"./getBuildTypes.js":62,"./getBuilds":63,"./getBuilds.js":63,"./getLatestBuilds":64,"./getLatestBuilds.js":64,"./getProfile":65,"./getProfile.js":65,"./login":66,"./login.js":66,"./register":67,"./register.js":67};function o(t){var e=a(t);return r(e)}function a(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=a,t.exports=o,o.id=82},function(t,e,r){var n=r(84),o=r(115);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},function(t,e,r){var n=r(41),o=r(114),a=r(9);t.exports=function(t,e,r){for(var i=-1,u=e.length,c={};++i<u;){var s=e[i],f=n(t,s);r(f,s)&&o(c,a(s,t),f)}return c}},function(t,e,r){var n=r(4),o=r(21),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||i.test(t)||!a.test(t)||null!=e&&t in Object(e)}},function(t,e,r){var n=r(13),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,u=n?n.toStringTag:void 0;t.exports=function(t){var e=a.call(t,u),r=t[u];try{t[u]=void 0;var n=!0}catch(t){}var o=i.call(t);return n&&(e?t[u]=r:delete t[u]),o}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},function(t,e,r){var n=r(89)((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,(function(t,r,n,o){e.push(n?o.replace(/\\(\\)?/g,"$1"):r||t)})),e}));t.exports=n},function(t,e,r){var n=r(90);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},function(t,e,r){var n=r(43);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},function(t,e,r){var n=r(92),o=r(16),a=r(22);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(a||o),string:new n}}},function(t,e,r){var n=r(93),o=r(98),a=r(99),i=r(100),u=r(101);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=a,c.prototype.has=i,c.prototype.set=u,t.exports=c},function(t,e,r){var n=r(15);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(t,e,r){var n=r(44),o=r(95),a=r(11),i=r(45),u=Function.prototype,c=Object.prototype,s=u.toString,f=c.hasOwnProperty,l=RegExp("^"+s.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!a(t)||o(t))&&(n(t)?l:/^\[object .+?Constructor\]$/).test(i(t))}},function(t,e,r){var n,o=r(96),a=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!a&&a in t}},function(t,e,r){var n=r(3)["__core-js_shared__"];t.exports=n},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,r){var n=r(15),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},function(t,e,r){var n=r(15),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},function(t,e,r){var n=r(15);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,r){var n=r(17),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return r>=0&&(r==e.length-1?e.pop():o.call(e,r,1),--this.size,!0)}},function(t,e,r){var n=r(17);t.exports=function(t){var e=this.__data__,r=n(e,t);return 0>r?void 0:e[r][1]}},function(t,e,r){var n=r(17);t.exports=function(t){return n(this.__data__,t)>-1}},function(t,e,r){var n=r(17);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return 0>o?(++this.size,r.push([t,e])):r[o][1]=e,this}},function(t,e,r){var n=r(18);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(18);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(18);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(18);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},function(t,e,r){var n=r(113);t.exports=function(t){return null==t?"":n(t)}},function(t,e,r){var n=r(13),o=r(47),a=r(4),i=r(21),u=n?n.prototype:void 0,c=u?u.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(a(e))return o(e,t)+"";if(i(e))return c?c.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},function(t,e,r){var n=r(23),o=r(9),a=r(24),i=r(11),u=r(19);t.exports=function(t,e,r,c){if(!i(t))return t;for(var s=-1,f=(e=o(e,t)).length,l=f-1,p=t;null!=p&&++s<f;){var d=u(e[s]),v=r;if(s!=l){var y=p[d];void 0===(v=c?c(y,d,p):void 0)&&(v=i(y)?y:a(e[s+1])?[]:{})}n(p,d,v),p=p[d]}return t}},function(t,e,r){var n=r(116),o=r(117);t.exports=function(t,e){return null!=t&&o(t,e,n)}},function(t,e){t.exports=function(t,e){return null!=t&&e in Object(t)}},function(t,e,r){var n=r(9),o=r(25),a=r(4),i=r(24),u=r(26),c=r(19);t.exports=function(t,e,r){for(var s=-1,f=(e=n(e,t)).length,l=!1;++s<f;){var p=c(e[s]);if(!(l=null!=t&&r(t,p)))break;t=t[p]}return l||++s!=f?l:!!(f=null==t?0:t.length)&&u(f)&&i(p,f)&&(a(t)||o(t))}},function(t,e,r){var n=r(10),o=r(6);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},function(t,e,r){var n=r(120);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},function(t,e,r){var n=r(27),o=r(121);t.exports=function t(e,r,a,i,u){var c=-1,s=e.length;for(a||(a=o),u||(u=[]);++c<s;){var f=e[c];r>0&&a(f)?r>1?t(f,r-1,a,i,u):n(u,f):i||(u[u.length]=f)}return u}},function(t,e,r){var n=r(13),o=r(25),a=r(4),i=n?n.isConcatSpreadable:void 0;t.exports=function(t){return a(t)||o(t)||!!(i&&t&&t[i])}},function(t,e,r){var n=r(123),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var a=arguments,i=-1,u=o(a.length-e,0),c=Array(u);++i<u;)c[i]=a[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=a[i];return s[e]=r(c),n(t,this,s)}}},function(t,e){t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},function(t,e,r){var n=r(125),o=r(128)(n);t.exports=o},function(t,e,r){var n=r(126),o=r(49),a=r(127),i=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:a;t.exports=i},function(t,e){t.exports=function(t){return function(){return t}}},function(t,e){t.exports=function(t){return t}},function(t,e){var r=Date.now;t.exports=function(t){var e=0,n=0;return function(){var o=r(),a=16-(o-n);if(n=o,a>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,r){var n=r(130),o=r(136),a=r(23),i=r(137),u=r(144),c=r(147),s=r(148),f=r(149),l=r(151),p=r(152),d=r(61),v=r(35),y=r(157),b=r(158),h=r(164),x=r(4),j=r(54),g=r(166),w=r(11),_=r(168),m=r(28),O={};O["[object Arguments]"]=O["[object Array]"]=O["[object ArrayBuffer]"]=O["[object DataView]"]=O["[object Boolean]"]=O["[object Date]"]=O["[object Float32Array]"]=O["[object Float64Array]"]=O["[object Int8Array]"]=O["[object Int16Array]"]=O["[object Int32Array]"]=O["[object Map]"]=O["[object Number]"]=O["[object Object]"]=O["[object RegExp]"]=O["[object Set]"]=O["[object String]"]=O["[object Symbol]"]=O["[object Uint8Array]"]=O["[object Uint8ClampedArray]"]=O["[object Uint16Array]"]=O["[object Uint32Array]"]=!0,O["[object Error]"]=O["[object Function]"]=O["[object WeakMap]"]=!1,t.exports=function t(e,r,A,k,S,I){var U,P=1&r,N=2&r,B=4&r;if(A&&(U=S?A(e,k,S,I):A(e)),void 0!==U)return U;if(!w(e))return e;var T=x(e);if(T){if(U=y(e),!P)return s(e,U)}else{var C=v(e),D="[object Function]"==C||"[object GeneratorFunction]"==C;if(j(e))return c(e,P);if("[object Object]"==C||"[object Arguments]"==C||D&&!S){if(U=N||D?{}:h(e),!P)return N?l(e,u(U,e)):f(e,i(U,e))}else{if(!O[C])return S?e:{};U=b(e,C,P)}}I||(I=new n);var E=I.get(e);if(E)return E;I.set(e,U),_(e)?e.forEach((function(n){U.add(t(n,r,A,n,e,I))})):g(e)&&e.forEach((function(n,o){U.set(o,t(n,r,A,o,e,I))}));var M=B?N?d:p:N?keysIn:m,z=T?void 0:M(e);return o(z||e,(function(n,o){z&&(n=e[o=n]),a(U,o,t(n,r,A,o,e,I))})),U}},function(t,e,r){var n=r(16),o=r(131),a=r(132),i=r(133),u=r(134),c=r(135);function s(t){var e=this.__data__=new n(t);this.size=e.size}s.prototype.clear=o,s.prototype.delete=a,s.prototype.get=i,s.prototype.has=u,s.prototype.set=c,t.exports=s},function(t,e,r){var n=r(16);t.exports=function(){this.__data__=new n,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,r){var n=r(16),o=r(22),a=r(43);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var i=r.__data__;if(!o||199>i.length)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new a(i)}return r.set(t,e),this.size=r.size,this}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},function(t,e,r){var n=r(14),o=r(28);t.exports=function(t,e){return t&&n(e,o(e),t)}},function(t,e){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},function(t,e){t.exports=function(){return!1}},function(t,e,r){var n=r(141),o=r(30),a=r(31),i=a&&a.isTypedArray,u=i?o(i):n;t.exports=u},function(t,e,r){var n=r(10),o=r(26),a=r(6),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(t){return a(t)&&o(t.length)&&!!i[n(t)]}},function(t,e,r){var n=r(32),o=r(143),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))a.call(t,r)&&"constructor"!=r&&e.push(r);return e}},function(t,e,r){var n=r(55)(Object.keys,Object);t.exports=n},function(t,e,r){var n=r(14),o=r(57);t.exports=function(t,e){return t&&n(e,o(e),t)}},function(t,e,r){var n=r(11),o=r(32),a=r(146),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return a(t);var e=o(t),r=[];for(var u in t)("constructor"!=u||!e&&i.call(t,u))&&r.push(u);return r}},function(t,e){t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},function(t,e,r){(function(t){var n=r(3),o=e&&!e.nodeType&&e,a=o&&"object"==typeof t&&t&&!t.nodeType&&t,i=a&&a.exports===o?n.Buffer:void 0,u=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=u?u(r):new t.constructor(r);return t.copy(n),n}}).call(this,r(29)(t))},function(t,e){t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},function(t,e,r){var n=r(14),o=r(33);t.exports=function(t,e){return n(t,o(t),e)}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,a=[];++r<n;){var i=t[r];e(i,r,t)&&(a[o++]=i)}return a}},function(t,e,r){var n=r(14),o=r(59);t.exports=function(t,e){return n(t,o(t),e)}},function(t,e,r){var n=r(60),o=r(33),a=r(28);t.exports=function(t){return n(t,a,o)}},function(t,e,r){var n=r(7)(r(3),"DataView");t.exports=n},function(t,e,r){var n=r(7)(r(3),"Promise");t.exports=n},function(t,e,r){var n=r(7)(r(3),"Set");t.exports=n},function(t,e,r){var n=r(7)(r(3),"WeakMap");t.exports=n},function(t,e){var r=Object.prototype.hasOwnProperty;t.exports=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&r.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},function(t,e,r){var n=r(36),o=r(160),a=r(161),i=r(162),u=r(163);t.exports=function(t,e,r){var c=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new c(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return u(t,r);case"[object Map]":return new c;case"[object Number]":case"[object String]":return new c(t);case"[object RegExp]":return a(t);case"[object Set]":return new c;case"[object Symbol]":return i(t)}}},function(t,e,r){var n=r(3).Uint8Array;t.exports=n},function(t,e,r){var n=r(36);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},function(t,e){var r=/\w*$/;t.exports=function(t){var e=new t.constructor(t.source,r.exec(t));return e.lastIndex=t.lastIndex,e}},function(t,e,r){var n=r(13),o=n?n.prototype:void 0,a=o?o.valueOf:void 0;t.exports=function(t){return a?Object(a.call(t)):{}}},function(t,e,r){var n=r(36);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},function(t,e,r){var n=r(165),o=r(34),a=r(32);t.exports=function(t){return"function"!=typeof t.constructor||a(t)?{}:n(o(t))}},function(t,e,r){var n=r(11),o=Object.create,a=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=a},function(t,e,r){var n=r(167),o=r(30),a=r(31),i=a&&a.isMap,u=i?o(i):n;t.exports=u},function(t,e,r){var n=r(35),o=r(6);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},function(t,e,r){var n=r(169),o=r(30),a=r(31),i=a&&a.isSet,u=i?o(i):n;t.exports=u},function(t,e,r){var n=r(35),o=r(6);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},function(t,e,r){var n=r(9),o=r(38),a=r(171),i=r(19);t.exports=function(t,e){return e=n(e,t),null==(t=a(t,e))||delete t[i(o(e))]}},function(t,e,r){var n=r(41),o=r(172);t.exports=function(t,e){return 2>e.length?t:n(t,o(e,0,-1))}},function(t,e){t.exports=function(t,e,r){var n=-1,o=t.length;0>e&&(e=-e>o?0:o+e),0>(r=r>o?o:r)&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(o);++n<o;)a[n]=t[n+e];return a}},function(t,e,r){var n=r(174);t.exports=function(t){return n(t)?void 0:t}},function(t,e,r){var n=r(10),o=r(34),a=r(6),i=Function.prototype,u=Object.prototype,c=i.toString,s=u.hasOwnProperty,f=c.call(Object);t.exports=function(t){if(!a(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=s.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==f}},function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return h}));var n=r(38),o=r.n(n),a=r(71),i=r.n(a),u=r(12),c=r(72),s=r.n(c),f=r(73),l=r.n(f),p=r(5),d=new l.a({logger:p.b}),v=r(37),y=r(8);const b=r(82);class h extends u.JaidCorePlugin{init(){this.socketServer=s()(this.core.insecureServer),this.socketServer.on("connection",async t=>{if(t.handshake.headers.cookie){const e=i.a.parse(t.handshake.headers.cookie).login;if(e){const r=JSON.parse(e);if(r.key){t.apiKey=r.key;const e=await y.default.findOne({where:{apiKey:t.apiKey},attributes:["UserId"],raw:!0});e?t.userId=e.UserId:t.emit("invalidateLogin")}}}for(const[e,r]of Object.entries(this.commands))t.on(e,async(...n)=>{const a={client:t,userId:t.userId,logger:this.logger},i=Date.now(),u=n.length>1?n.slice(0,-1):null,c=await r.default(a,...n),s=Date.now()-i;v.default.create({result:c,time:s,type:e,payload:u,UserId:t.userId}),void 0!==c&&o()(n)(c)})}),d.enhanceServer(this.socketServer),this.commands=b.keys().reduce((t,e)=>(t[e.match(/\.\/(?<key>[\da-z]+)/i).groups.key]=b(e),t),{})}}}]);