UNPKG

devshare

Version:

Library to communicate with devshare development sharing platform.

11 lines 523 kB
/*! devshare.js v0.4.0-alpha | (c) Prescott Prue */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("firepad")):"function"==typeof define&&define.amd?define(["firepad"],e):"object"==typeof exports?exports.Devshare=e(require("firepad")):t.Devshare=e(t.Firepad)}(this,function(__WEBPACK_EXTERNAL_MODULE_275__){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="/dist/",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.templates=e.template=e.init=e.getCurrentUser=e.signup=e.logout=e.login=e.authWithProvider=e.auth=e.users=e.user=e.projects=e.project=void 0;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=n(57),a=r(o),s=n(56),u=r(s),c=n(113),h=r(c),f=n(59),l=r(f),d=n(11),p=r(d),g=n(58),v=r(g),b=n(22),y=r(b),m=n(2),w=n(38),_=r(w),k=n(4),E=r(k),S={projects:a.default,project:u.default,users:h.default,user:l.default,templates:v.default,template:y.default,init:m.init,firebase:_.default,constants:E.default};e.default=i({},S,p.default);var x=(e.project=u.default,e.projects=a.default,e.user=l.default,e.users=h.default,e.auth=p.default,p.default.authWithProvider),A=p.default.login,T=p.default.logout,O=p.default.signup,I=p.default.getCurrentUser;e.authWithProvider=x,e.login=A,e.logout=T,e.signup=O,e.getCurrentUser=I,e.init=m.init,e.template=y.default,e.templates=v.default},function(t,e,n){"use strict";function r(t){var e=null;return e=u.uint8array?new Uint8Array(t.length):new Array(t.length),o(t,e)}function i(t){return t}function o(t,e){for(var n=0;n<t.length;++n)e[n]=255&t.charCodeAt(n);return e}function a(t){var n=65536,r=e.getTypeOf(t),i=!0;if("uint8array"===r?i=d.applyCanBeUsed.uint8array:"nodebuffer"===r&&(i=d.applyCanBeUsed.nodebuffer),i)for(;n>1;)try{return d.stringifyByChunk(t,r,n)}catch(t){n=Math.floor(n/2)}return d.stringifyByChar(t)}function s(t,e){for(var n=0;n<t.length;n++)e[n]=t[n];return e}var u=n(8),c=n(68),h=n(25),f=n(115),l=n(19);e.newBlob=function(t,n){e.checkSupport("blob");try{return new Blob(t,{type:n})}catch(e){try{for(var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,i=new r,o=0;o<t.length;o++)i.append(t[o]);return i.getBlob(n)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(t,e,n){var r=[],i=0,o=t.length;if(o<=n)return String.fromCharCode.apply(null,t);for(;i<o;)"array"===e||"nodebuffer"===e?r.push(String.fromCharCode.apply(null,t.slice(i,Math.min(i+n,o)))):r.push(String.fromCharCode.apply(null,t.subarray(i,Math.min(i+n,o)))),i+=n;return r.join("")},stringifyByChar:function(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},applyCanBeUsed:{uint8array:function(){try{return u.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return u.nodebuffer&&1===String.fromCharCode.apply(null,h.newBuffer(1)).length}catch(t){return!1}}()}};e.applyFromCharCode=a;var p={};p.string={string:i,array:function(t){return o(t,new Array(t.length))},arraybuffer:function(t){return p.string.uint8array(t).buffer},uint8array:function(t){return o(t,new Uint8Array(t.length))},nodebuffer:function(t){return o(t,h.newBuffer(t.length))}},p.array={string:a,array:i,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return h.newBuffer(t)}},p.arraybuffer={string:function(t){return a(new Uint8Array(t))},array:function(t){return s(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:i,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return h.newBuffer(new Uint8Array(t))}},p.uint8array={string:a,array:function(t){return s(t,new Array(t.length))},arraybuffer:function(t){var e=new Uint8Array(t.length);return t.length&&e.set(t,0),e.buffer},uint8array:i,nodebuffer:function(t){return h.newBuffer(t)}},p.nodebuffer={string:a,array:function(t){return s(t,new Array(t.length))},arraybuffer:function(t){return p.nodebuffer.uint8array(t).buffer},uint8array:function(t){return s(t,new Uint8Array(t.length))},nodebuffer:i},e.transformTo=function(t,n){if(n||(n=""),!t)return n;e.checkSupport(t);var r=e.getTypeOf(n),i=p[r][t](n);return i},e.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":u.nodebuffer&&h.isBuffer(t)?"nodebuffer":u.uint8array&&t instanceof Uint8Array?"uint8array":u.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},e.checkSupport=function(t){var e=u[t.toLowerCase()];if(!e)throw new Error(t+" is not supported by this platform")},e.MAX_VALUE_16BITS=65535,e.MAX_VALUE_32BITS=-1,e.pretty=function(t){var e,n,r="";for(n=0;n<(t||"").length;n++)e=t.charCodeAt(n),r+="\\x"+(e<16?"0":"")+e.toString(16).toUpperCase();return r},e.delay=function(t,e,n){f(function(){t.apply(n||null,e||[])})},e.inherits=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n},e.extend=function(){var t,e,n={};for(t=0;t<arguments.length;t++)for(e in arguments[t])arguments[t].hasOwnProperty(e)&&"undefined"==typeof n[e]&&(n[e]=arguments[t][e]);return n},e.prepareContent=function(t,n,i,o,a){var s=l.Promise.resolve(n).then(function(t){var e=u.blob&&(t instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t))!==-1);return e&&"undefined"!=typeof FileReader?new l.Promise(function(e,n){var r=new FileReader;r.onload=function(t){e(t.target.result)},r.onerror=function(t){n(t.target.error)},r.readAsArrayBuffer(t)}):t});return s.then(function(n){var s=e.getTypeOf(n);return s?("arraybuffer"===s?n=e.transformTo("uint8array",n):"string"===s&&(a?n=c.decode(n):i&&o!==!0&&(n=r(n))),n):l.Promise.reject(new Error("The data of '"+t+"' is in an unsupported format !"))})}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.getChild=e.search=e.unsync=e.sync=e.remove=e.update=e.add=e.push=e.setWithPriority=e.setWithMeta=e.set=e.get=e.createFirebaseRef=e.createFirebaseUrl=e.storage=e.init=void 0;var i=n(243),o=r(i),a=n(3),s=r(a),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=n(38),h=r(c),f=n(35),l=n(4),d=n(11),p=(e.init=function(t){var e=t?l.firebase[t.env]:l.firebase.prod;try{h.default.initializeApp(e)}catch(t){console.warn("You only need to initialize Firebase once",JSON.stringify(t))}return h.default},e.storage=function(){return h.default.storage()},e.createFirebaseUrl=function(t){return function(){return(0,s.default)(t)||(t=[t]),t.map(function(t){return t&&(0,o.default)(t)?t.replace(/[.]/g,":").replace(/[#$[\]]/g,"_-_"):t}).join("/")}}),g=e.createFirebaseRef=function(t){return function(){return h.default.database().ref(p(t)())}},v=e.get=function(t){return function(){return g(t)().once("value").then(function(t){return t.val()})}},b=e.set=function(t){return function(e,n){return g(t)()[n?"setWithPriority":"set"](e).then(function(t){return t?t.val():e})}},y=e.setWithMeta=function(t){return function(e,n){var r=u({},e,{createdAt:h.default.database.ServerValue.TIMESTAMP});return(0,d.getCurrentUser)()&&(r.createdBy=(0,d.getCurrentUser)().uid),g(t)().set(r).then(function(t){return t?t.val():e})}},m=(e.setWithPriority=function(t){return function(e,n){return g(t)().setWithPriority(e).then(function(t){return t?t.val():e})}},e.push=function(t){return function(e,n){var r=g(t)().push();return r[n?"setWithPriority":"set"](e).then(function(t){return t?u({},{key:r.key},t):u(e,{key:r.key})})}}),w=e.add=m,_=e.update=function(t){return function(e){return g(t)().update(e).then(function(t){return t?t.val():e})}},k=e.remove=function(t){return function(){return g(t)().remove().then(function(t){return null})}},E=e.sync=function(t){return function(e){return g(t)().on("value",function(t){return e(u(t.val(),{ref:t.ref}))})}},S=(e.unsync=function(t){return function(e){g(t)().off("value",e,e)}},e.search=function(t){return function(e,n){return g(t)().orderByChild(e).startAt(n).once("value").then(function(t){return t.val()})}},e.getChild=function(t){return function(e){return g(t)().child(e).once("value").then(function(t){return t.val()})}});e.default=function(t,e){var n={get:v,getChild:S,set:b,setWithMeta:y,add:w,sync:E,update:_,remove:k,createFirebaseUrl:p,createFirebaseRef:g};return(0,f.typeReducer)(t,e,n,"firebaser")}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={paths:{files:"files",users:"users",uids:"uids",projects:"projects",projectNames:"projectNames",usernames:"usernames",requests:"requests",templateFiles:"templateFiles",templates:"templates"},github:{apiUrl:"https://api.github.com"},firebase:{prod:{apiKey:"AIzaSyBQw-StxUsUhoQwZqaawegUFO7YOyG_HDA",authDomain:"devshare-1.firebaseapp.com",databaseURL:"https://devshare-1.firebaseio.com",storageBucket:"devshare-1.appspot.com"},stg:{apiKey:"AIzaSyBuwR21cO0lMzMr_T-Dl_jG1dsORXZ1fwY",authDomain:"devshare-stg.firebaseapp.com",databaseURL:"https://devshare-stg.firebaseio.com",storageBucket:"devshare-stg.appspot.com"},int:{apiKey:"AIzaSyDiVbMbj7nPXTBXxZlr_HiZ2AOY7yXWkYY",authDomain:"devshare-int.firebaseapp.com",databaseURL:"https://devshare-int.firebaseio.com",storageBucket:"devshare-int.appspot.com"},dev:{apiKey:"AIzaSyDiVbMbj7nPXTBXxZlr_HiZ2AOY7yXWkYY",authDomain:"devshare-int.firebaseapp.com",databaseURL:"https://devshare-int.firebaseio.com",storageBucket:"devshare-int.appspot.com"}},highlightColors:["#FF0000","#FF00F1","#F1C40F","#D35400","#FF08","#2980B9","#9B59B6"],zipSuffix:"-devShare-export"},t.exports=e.default},function(t,e){"use strict";function n(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var n=0;n<this._listeners[t].length;n++)this._listeners[t][n].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.end()}),t.on("error",function(t){e.error(t)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var t=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},t.exports=n},function(t,e,n){(function(t){/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> * @license MIT */ "use strict";function r(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(i()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=a.prototype):(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return s(this,t,e,n)}function s(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?d(t,e,n,r):"string"==typeof e?f(t,e,n):p(t,e)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e,n,r){return u(e),e<=0?o(t,e):void 0!==n?"string"==typeof r?o(t,e).fill(n,r):o(t,e).fill(n):o(t,e)}function h(t,e){if(u(e),t=o(t,e<0?0:0|g(e)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function f(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|b(e,n);t=o(t,r);var i=t.write(e,n);return i!==r&&(t=t.slice(0,i)),t}function l(t,e){var n=e.length<0?0:0|g(e.length);t=o(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),a.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=a.prototype):t=l(t,e),t}function p(t,e){if(a.isBuffer(e)){var n=0|g(e.length);return t=o(t,n),0===t.length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||Z(e.length)?o(t,0):l(t,e);if("Buffer"===e.type&&Q(e.data))return l(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function g(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function v(t){return+t!=t&&(t=0),a.alloc(+t)}function b(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(t).length;default:if(r)return K(t).length;e=(""+e).toLowerCase(),r=!0}}function y(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return O(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function w(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:_(t,e,n,r,i);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):_(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function _(t,e,n,r,i){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,u=e.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}var c;if(i){var h=-1;for(c=n;c<s;c++)if(o(t,c)===o(e,h===-1?0:c-h)){if(h===-1&&(h=c),c-h+1===u)return h*a}else h!==-1&&(c-=c-h),h=-1}else for(n+u>s&&(n=s-u),c=n;c>=0;c--){for(var f=!0,l=0;l<u;l++)if(o(t,c+l)!==o(e,l)){f=!1;break}if(f)return c}return-1}function k(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function E(t,e,n,r){return G(K(e,t.length-n),t,n,r)}function S(t,e,n,r){return G(V(e),t,n,r)}function x(t,e,n,r){return S(t,e,n,r)}function A(t,e,n,r){return G(X(e),t,n,r)}function T(t,e,n,r){return G(Y(e,t.length-n),t,n,r)}function O(t,e,n){return 0===e&&n===t.length?J.fromByteArray(t):J.fromByteArray(t.slice(e,n))}function I(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,c,h,f;switch(s){case 1:o<128&&(a=o);break;case 2:u=t[i+1],128===(192&u)&&(f=(31&o)<<6|63&u,f>127&&(a=f));break;case 3:u=t[i+1],c=t[i+2],128===(192&u)&&128===(192&c)&&(f=(15&o)<<12|(63&u)<<6|63&c,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:u=t[i+1],c=t[i+2],h=t[i+3],128===(192&u)&&128===(192&c)&&128===(192&h)&&(f=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&h,f>65535&&f<1114112&&(a=f))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return j(r)}function j(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=tt));return n}function R(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function C(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function P(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=q(t[o]);return i}function N(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function L(t,e,n){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,r,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function U(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function F(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(t,e,n,r,i){return i||F(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(t,e,n,r,23,4),n+4}function z(t,e,n,r,i){return i||F(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(t,e,n,r,52,8),n+8}function W(t){if(t=H(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function K(t,e){e=e||1/0;for(var n,r=t.length,i=null,o=[],a=0;a<r;++a){if(n=t.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function Y(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function X(t){return J.toByteArray(W(t))}function G(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Z(t){return t!==t}var J=n(114),$=n(133),Q=n(67);e.Buffer=a,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:r(),e.kMaxLength=i(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,n){return s(null,t,e,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,n){return c(null,t,e,n)},a.allocUnsafe=function(t){return h(null,t)},a.allocUnsafeSlow=function(t){return h(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},a.isEncoding=function(t){switch(String(t).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!0;default:return!1}},a.concat=function(t,e){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=a.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},a.byteLength=b,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?I(this,0,t):y.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,e,n,r,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,i>>>=0,this===t)return 0;for(var o=i-r,s=n-e,u=Math.min(o,s),c=this.slice(r,i),h=t.slice(e,n),f=0;f<u;++f)if(c[f]!==h[f]){o=c[f],s=h[f];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},a.prototype.indexOf=function(t,e,n){return w(this,t,e,n,!0)},a.prototype.lastIndexOf=function(t,e,n){return w(this,t,e,n,!1)},a.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return k(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":return S(this,t,e,n);case"latin1":case"binary":return x(this,t,e,n);case"base64":return A(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var r;if(a.TYPED_ARRAY_SUPPORT)r=this.subarray(t,e),r.__proto__=a.prototype;else{var i=e-t;r=new a(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},a.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},a.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},a.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},a.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},a.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},a.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),$.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),$.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),$.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),$.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){var i=Math.pow(2,8*n)-1;D(this,t,e,n,i,0)}var o=1,a=0;for(this[e]=255&t;++a<n&&(o*=256);)this[e+a]=t/o&255;return e+n},a.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){var i=Math.pow(2,8*n)-1;D(this,t,e,n,i,0)}var o=n-1,a=1;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=t/a&255;return e+n},a.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},a.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):U(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):U(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,n){return B(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return B(this,t,e,!1,n)},a.prototype.writeDoubleLE=function(t,e,n){return z(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return z(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},a.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=a.isBuffer(t)?t:K(new a(t,r).toString()),u=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%u]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(e,function(){return this}())},function(t,e,n){var r=n(85),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},function(t,e,n){(function(t){"use strict";if(e.base64=!0,e.array=!0,e.string=!0,e.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,e.nodebuffer="undefined"!=typeof t,e.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)e.blob=!1;else{var r=new ArrayBuffer(0);try{e.blob=0===new Blob([r],{type:"application/zip"}).size}catch(t){try{var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,o=new i;o.append(r),e.blob=0===o.getBlob("application/zip").size}catch(t){e.blob=!1}}}try{e.nodestream=!!n(71).Readable}catch(t){e.nodestream=!1}}).call(e,n(6).Buffer)},function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)return void t.set(e.subarray(n,n+r),i);for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){var e,n,r,i,o,a;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(a=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)o=t[e],a.set(o,i),i+=o.length;return a}},i={arraySet:function(t,e,n,r,i){for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(n)},function(t,e,n){"use strict";function r(t){return this instanceof r?(c.call(this,t),h.call(this,t),t&&t.readable===!1&&(this.readable=!1),t&&t.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,t&&t.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(t)}function i(){this.allowHalfOpen||this._writableState.ended||s(o,this)}function o(t){t.end()}var a=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=r;var s=n(52),u=n(17);u.inherits=n(12);var c=n(103),h=n(54);u.inherits(r,c);for(var f=a(h.prototype),l=0;l<f.length;l++){var d=f[l];r.prototype[d]||(r.prototype[d]=h.prototype[d])}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.updateEmail=e.updateUser=e.getCurrentUser=e.signup=e.logout=e.login=e.createUserProfile=void 0;var o=n(238),a=r(o),s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=n(38),c=r(u),h=n(56),f=r(h),l=n(2),d=n(60),p=n(4),g=function(t){var e=t.email,n=t.password,r=t.provider,i=t.type,o=t.token;if(r){if(o)return{method:"signInWithCredential",params:[r,o]};var s=new(c.default.auth[(0,a.default)(r)+"AuthProvider"]);return s.addScope("email"),"github"===r.toLowerCase()&&(s.addScope("user"),s.addScope("repo")),"popup"===i?{method:"signInWithPopup",params:[s]}:{method:"signInWithRedirect",params:[s]}}return o?{method:"signInWithCustomToken",params:[o]}:{method:"signInWithEmailAndPassword",params:[e,n]}},v=function(t){var e=t.email,n=t.username,r=t.avatarUrl,i=t.providerData,o=t.uid,a=i&&i[0];n||(n=a.email.split("@")[0].replace(/[^\w\s]/gi,"")),a.photoURL&&(r=a.photoURL);var s={email:e,username:n};if(i){s.providerData={};var u=i[0];s.providerData[u.providerId.split(".")[0]]=u}return r&&(s.avatarUrl=r),s.uid=o,s},b=e.createUserProfile=function(t){var e=v(t);return(0,l.get)([p.paths.users,t.uid])().then(function(n){return n||Promise.all([(0,l.set)([p.paths.users,t.uid])(e),(0,l.set)([p.paths.usernames,t.uid])(e.username),(0,l.set)([p.paths.uids,e.username])(t.uid)]).then(function(){return e})})},y=e.login=function(t,e){var n;if(!t.email&&!t.username&&!t.provider)return Promise.reject({message:"Username/Email or Provider is required to login "});var r=g(t),o=r.method,a=r.params;return(n=c.default.auth())[o].apply(n,i(a)).then(function(t){return t.credential&&"github.com"===t.credential.provider?(0,d.getWithHeaders)(p.github.apiUrl+"/user")({Authorization:"token "+t.credential.accessToken}).then(function(e){var n=e.login;return t.user.username=n,t}):t}).then(function(t){return t.email?t:b(t.user)}).then(function(t){return e?(0,f.default)("anon",e).clone(t.username,e).then(function(e){return t}).catch(function(e){return s(t,{error:e})}):t})},m=e.logout=function(){return c.default.auth().signOut()},w=e.signup=function(t,e){var n=t.username,r=t.email,i=t.password,o=t.project,a=t.name,s=t.provider;return r&&n&&i?n.match(/[\/\s]/g)?Promise.reject("Username may not contain spaces"):n.match(/[.$#[\]\/]/g)?Promise.reject("Username may contain symbols except for ., $, #, [, ], /"):(o&&(e=o),a||(a=n),s?y({provider:s},e):c.default.auth().createUserWithEmailAndPassword(r,i).then(function(t){var i=t.providerData,s=t.uid;return b({username:n,email:r,name:a,providerData:i,uid:s}).then(function(t){return e?o("anon",e).clone(n,e).then(function(e){return t}):t})})):Promise.reject("email, username and password are required")},_=e.getCurrentUser=function(){return c.default.auth().currentUser},k=e.updateUser=function(t){var e=_();return e.updateProfile(t).then(function(){return(0,l.update)([p.paths.users,e.uid])(t)}).then(function(){return e})},E=e.updateEmail=function(t){var e=_();return e.updateEmail(t).then(function(){return(0,l.update)([p.paths.users,e.uid])({email:t})}).then(function(){return e})};e.default={getCurrentUser:_,updateUser:k,updateEmail:E,login:y,logout:m,signup:w}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";function r(){u.call(this,"utf-8 decode"),this.leftOver=null}function i(){u.call(this,"utf-8 encode")}for(var o=n(1),a=n(8),s=n(25),u=n(5),c=new Array(256),h=0;h<256;h++)c[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;c[254]=c[254]=1;var f=function(t){var e,n,r,i,o,s=t.length,u=0;for(i=0;i<s;i++)n=t.charCodeAt(i),55296===(64512&n)&&i+1<s&&(r=t.charCodeAt(i+1),56320===(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),u+=n<128?1:n<2048?2:n<65536?3:4;for(e=a.uint8array?new Uint8Array(u):new Array(u),o=0,i=0;o<u;i++)n=t.charCodeAt(i),55296===(64512&n)&&i+1<s&&(r=t.charCodeAt(i+1),56320===(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?e[o++]=n:n<2048?(e[o++]=192|n>>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e},l=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&128===(192&t[n]);)n--;return n<0?e:0===n?e:n+c[t[n]]>e?n:e},d=function(t){var e,n,r,i,a=t.length,s=new Array(2*a);for(n=0,e=0;e<a;)if(r=t[e++],r<128)s[n++]=r;else if(i=c[r],i>4)s[n++]=65533,e+=i-1;else{for(r&=2===i?31:3===i?15:7;i>1&&e<a;)r=r<<6|63&t[e++],i--;i>1?s[n++]=65533:r<65536?s[n++]=r:(r-=65536,s[n++]=55296|r>>10&1023,s[n++]=56320|1023&r)}return s.length!==n&&(s.subarray?s=s.subarray(0,n):s.length=n),o.applyFromCharCode(s)};e.utf8encode=function(t){return a.nodebuffer?s.newBuffer(t,"utf-8"):f(t)},e.utf8decode=function(t){return a.nodebuffer?o.transformTo("nodebuffer",t).toString("utf-8"):(t=o.transformTo(a.uint8array?"uint8array":"array",t),d(t))},o.inherits(r,u),r.prototype.processChunk=function(t){var n=o.transformTo(a.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var r=n;n=new Uint8Array(r.length+this.leftOver.length),n.set(this.leftOver,0),n.set(r,this.leftOver.length)}else n=this.leftOver.concat(n);this.leftOver=null}var i=l(n),s=n;i!==n.length&&(a.uint8array?(s=n.subarray(0,i),this.leftOver=n.subarray(i,n.length)):(s=n.slice(0,i),this.leftOver=n.slice(i,n.length))),this.push({data:e.utf8decode(s),meta:t.meta})},r.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:e.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},e.Utf8DecodeWorker=r,o.inherits(i,u),i.prototype.processChunk=function(t){this.push({data:e.utf8encode(t.data),meta:t.meta})},e.Utf8EncodeWorker=i},function(t,e,n){function r(t){return null==t?void 0===t?u:s:c&&c in Object(t)?o(t):a(t)}var i=n(27),o=n(197),a=n(224),s="[object Null]",u="[object Undefined]",c=i?i.toStringTag:void 0;t.exports=r},function(t,e,n){function r(t,e){var n=o(t,e);return i(n)?n:void 0}var i=n(173),o=n(200);t.exports=r},function(t,e){function n(t){return null!=t&&"object"==typeof t}t.exports=n},function(t,e,n){(function(t){function n(t){return Array.isArray?Array.isArray(t):"[object Array]"===v(t)}function r(t){return"boolean"==typeof t}function i(t){return null===t}function o(t){return null==t}function a(t){return"number"==typeof t}function s(t){return"string"==typeof t}function u(t){return"symbol"==typeof t}function c(t){return void 0===t}function h(t){return"[object RegExp]"===v(t)}function f(t){return"object"==typeof t&&null!==t}function l(t){return"[object Date]"===v(t)}function d(t){return"[object Error]"===v(t)||t instanceof Error}function p(t){return"function"==typeof t}function g(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function v(t){return Object.prototype.toString.call(t)}e.isArray=n,e.isBoolean=r,e.isNull=i,e.isNullOrUndefined=o,e.isNumber=a,e.isString=s,e.isSymbol=u,e.isUndefined=c,e.isRegExp=h,e.isObject=f,e.isDate=l,e.isError=d,e.isFunction=p,e.isPrimitive=g,e.isBuffer=t.isBuffer}).call(e,n(6).Buffer)},function(t,e){(function(e){var n=function(){/*! @license Firebase v3.7.0 Build: 3.7.0-rc.2 Terms: https://firebase.google.com/terms/ */ var t=null;return function(){function n(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var r in e)e.hasOwnProperty(r)&&(t[r]=n(t[r],e[r]));return t}function r(t,e){return t=new mt(t,e),t.subscribe.bind(t)}function i(t){if("object"!=typeof t||null===t)return!1;var e;e=["next","error","complete"],p();var n=e[Symbol.iterator];for(e=n?n.call(e):g(e),n=e.next();!n.done;n=e.next())if(n=n.value,n in t&&"function"==typeof t[n])return!0;return!1}function o(){}function a(){function t(t){t=t||"[DEFAULT]";var e=o[t];return void 0===e&&s("no-app",{name:t}),e}function e(t,e){Object.keys(u).forEach(function(n){n=i(t,n),null!==n&&c[n]&&c[n](e,t)})}function i(t,e){if("serverAuth"===e)return null;var n=e;return t=t.options,"auth"===e&&(t.serviceAccount||t.credential)&&(n="serverAuth","serverAuth"in u||s("sa-not-supported")),n}var o={},u={},c={},h={__esModule:!0,initializeApp:function(t,r){return void 0===r?r="[DEFAULT]":"string"==typeof r&&""!==r||s("bad-app-name",{name:r+""}),void 0!==o[r]&&s("duplicate-app",{name:r}),t=new At(t,r,h),o[r]=t,e(t,"create"),void 0!=t.INTERNAL&&void 0!=t.INTERNAL.getToken||n(t,{INTERNAL:{getUid:function(){return null},getToken:function(){return xt.resolve(null)},addAuthTokenListener:function(){},removeAuthTokenListener:function(){}}}),t},app:t,apps:null,Promise:xt,SDK_VERSION:"0.0.0",INTERNAL:{registerService:function(e,r,i,o){return u[e]&&s("duplicate-service",{name:e}),u[e]=r,o&&(c[e]=o),r=function(n){return void 0===n&&(n=t()),n[e]()},void 0!==i&&n(r,i),h[e]=r},createFirebaseNamespace:a,extendNamespace:function(t){n(h,t)},createSubscribe:r,ErrorFactory:St,removeApp:function(t){e(o[t],"delete"),delete o[t]},factories:u,useAsService:i,Promise:nt,deepExtend:n}};return h.default=h,Object.defineProperty(h,"apps",{get:function(){return Object.keys(o).map(function(t){return o[t]})}}),t.App=At,h}function s(t,e){throw Ot.create(t,e)}var u,c="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){if(n.get||n.set)throw new TypeError("ES3 does not support getters and setters.");t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)},h="undefined"!=typeof window&&window===this?this:"undefined"!=typeof e&&null!=e?e:this,f=function(){f=function(){},h.Symbol||(h.Symbol=d)},l=0,d=function(t){return"jscomp_symbol_"+(t||"")+l++},p=function(){f();var t=h.Symbol.iterator;t||(t=h.Symbol.iterator=h.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&c(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return g(this)}}),p=function(){}},g=function(t){var e=0;return v(function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}})},v=function(t){return p(),t={next:t},t[h.Symbol.iterator]=function(){return this},t},b=this,y=function(){},m=function(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&"undefined"!=typeof t.splice&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof t.call&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&"undefined"==typeof t.call)return"object";return e},w=function(t){return"function"==m(t)},_=function(t,e,n){return t.call.apply(t.bind,arguments)},k=function(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}},E=function(t,e,n){return E=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?_:k,E.apply(null,arguments)},S=function(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}},x=function(t,e){function n(){}n.prototype=e.prototype,t.ha=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.base=function(t,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[n].apply(t,i)}};u="undefined"!=typeof window?window:"undefined"!=typeof self?self:e;var A=function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},T=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},O=function(t,e){var n,r={};for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>e.indexOf(n)&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)0>e.indexOf(n[i])&&(r[n[i]]=t[n[i]])}return r},I=function(t,e,n,r){var i,o=arguments.length,a=3>o?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if(i=u.Reflect,"object"==typeof i&&"function"==typeof i.decorate)a=i.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(3>o?i(a):3<o?i(e,n,a):i(e,n))||a);return 3<o&&a&&Object.defineProperty(e,n,a),a},j=function(t,e){var n=u.Reflect;if("object"==typeof n&&"function"==typeof n.metadata)return n.metadata(t,e)},R=function(t,e){return function(n,r){e(n,r,t)}},C=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e)).next())})},P=function(t,e){function n(t){return function(e){return r([t,e])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(a=a.call(o,n[1])).done)return a;switch(o=0,a&&(n=[0,a.value]),n[0]){case 0:case 1:a=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,o=n[1],n=[0];continue;case 7:n=s.G.pop(),s.I.pop();continue;default:if(a=s.I,!(a=0<a.length&&a[a.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3]))s.label=n[1];else if(6===n[0]&&s.label<a[1])s.label=a[1],a=n;else{if(!(a&&s.label<a[2])){a[2]&&s.G.pop(),s.I.pop();continue}s.label=a[2],s.G.push(n)}}n=e.call(t,s)}catch(t){n=[6,t],o=0}finally{i=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,a,s={label:0,ga:function(){if(1&a[0])throw a[1];return a[1]},I:[],G:[]};return{next:n(0),throw:n(1),return:n(2)}};"undefined"!=typeof u.S&&u.S||(u.__extends=A,u.__assign=T,u.__rest=O,u.__extends=A,u.__decorate=I,u.__metadata=j,u.__param=R,u.__awaiter=C,u.__generator=P);var N=function(t){if(Error.captureStackTrace)Error.captureStackTrace(this,N);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))};x(N,Error),N.prototype.name="CustomError";var L=function(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1<n.length;)r+=n.shift()+i.shift();return r+n.join("%s")},D=function(t,e){e.unshift(t),N.call(this,L.apply(null,e)),e.shift()};x(D,N),D.prototype.name="AssertionError";var U=function(t,e,n,r){var i="Assertion failed";if(n)var i=i+(": "+n),o=r;else t&&(i+=": "+t,o=e);throw new D(""+i,o||[])},M=function(t,e,n){t||U("",null,e,Array.prototype.