kyper-grout
Version:
Library to communicate with tessellate application building/managing service.
8 lines • 329 kB
JavaScript
/*! grout.js v0.2.10 | (c) Kyper Digital Inc. */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Grout=e():t.Grout=e()}(this,function(){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}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(2),u=r(s),c=n(3),f=r(c),h=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(14),d=r(l),p=n(59),g=r(p),b=n(106),v=r(b),y=n(51),m=r(y),w=n(31),_=r(w),k=function(t){function e(t,n){i(this,e);var r=t&&(0,f["default"])(t)?t:d["default"].defaultProject,a=n&&(0,u["default"])(n)?n:d["default"].matterSettings;(0,u["default"])(t)&&(a=t);var s=o(this,Object.getPrototypeOf(e).call(this,r,d["default"].matterSettings));return d["default"].applySettings(a),s}return a(e,t),h(e,[{key:"Projects",value:function(t){return new _["default"]("users/"+t+"/projects")}},{key:"Project",value:function(t,e){return new v["default"](t,e)}},{key:"User",value:function(t){return new _["default"]("users/"+t)}},{key:"Group",value:function(t){var e=new m["default"](t);return e}},{key:"Template",value:function(t){var e=new _["default"]("templates/"+t);return e}},{key:"Users",get:function(){return new _["default"]("users")}},{key:"Groups",get:function(){var t=new _["default"]("groups");return t}},{key:"Templates",get:function(){var t=new _["default"]("templates");return t}}]),e}(g["default"]);e["default"]=k,t.exports=e["default"]},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){function r(t){return"string"==typeof t||!i(t)&&o(t)&&u.call(t)==a}var i=n(1),o=n(9),a="[object String]",s=Object.prototype,u=s.toString;t.exports=r},function(t,e,n){"use strict";function r(t){return t}function i(t,e){for(var n=0;n<t.length;++n)e[n]=255&t.charCodeAt(n);return e}function o(t){var n=65536,r=[],i=t.length,o=e.getTypeOf(t),a=0,s=!0;try{switch(o){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,c(0))}}catch(u){s=!1}if(!s){for(var f="",h=0;h<t.length;h++)f+=String.fromCharCode(t[h]);return f}for(;i>a&&n>1;)try{"array"===o||"nodebuffer"===o?r.push(String.fromCharCode.apply(null,t.slice(a,Math.min(a+n,i)))):r.push(String.fromCharCode.apply(null,t.subarray(a,Math.min(a+n,i)))),a+=n}catch(u){n=Math.floor(n/2)}return r.join("")}function a(t,e){for(var n=0;n<t.length;n++)e[n]=t[n];return e}var s=n(15),u=n(36),c=n(37);e.string2binary=function(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(255&t.charCodeAt(n));return e},e.arrayBuffer2Blob=function(t,n){e.checkSupport("blob"),n=n||"application/zip";try{return new Blob([t],{type:n})}catch(r){try{var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,o=new i;return o.append(t),o.getBlob(n)}catch(r){throw new Error("Bug : can't construct the Blob.")}}},e.applyFromCharCode=o;var f={};f.string={string:r,array:function(t){return i(t,new Array(t.length))},arraybuffer:function(t){return f.string.uint8array(t).buffer},uint8array:function(t){return i(t,new Uint8Array(t.length))},nodebuffer:function(t){return i(t,c(t.length))}},f.array={string:o,array:r,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return c(t)}},f.arraybuffer={string:function(t){return o(new Uint8Array(t))},array:function(t){return a(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:r,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return c(new Uint8Array(t))}},f.uint8array={string:o,array:function(t){return a(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:r,nodebuffer:function(t){return c(t)}},f.nodebuffer={string:o,array:function(t){return a(t,new Array(t.length))},arraybuffer:function(t){return f.nodebuffer.uint8array(t).buffer},uint8array:function(t){return a(t,new Uint8Array(t.length))},nodebuffer:r},e.transformTo=function(t,n){if(n||(n=""),!t)return n;e.checkSupport(t);var r=e.getTypeOf(n),i=f[r][t](n);return i},e.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":s.nodebuffer&&c.test(t)?"nodebuffer":s.uint8array&&t instanceof Uint8Array?"uint8array":s.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},e.checkSupport=function(t){var e=s[t.toLowerCase()];if(!e)throw new Error(t+" is not supported by this browser")},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"+(16>e?"0":"")+e.toString(16).toUpperCase();return r},e.findCompression=function(t){for(var e in u)if(u.hasOwnProperty(e)&&u[e].magic===t)return u[e];return null},e.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(14),o=r(i),a=n(59),s=r(a);e["default"]=new s["default"](o["default"].defaultProject,o["default"].matterSettings),t.exports=e["default"]},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;r>o;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;n>e;e++)r+=t[e].length;for(a=new Uint8Array(r),i=0,e=0,n=t.length;n>e;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;r>o;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 t&&t.__esModule?t:{"default":t}}function i(t,e){return t&&console[t]?console[t].apply(console,e):console.log.apply(console,e)}function o(t){var e="",n={};return(0,g["default"])(t)?!function(){t.func&&(e+=t.obj?"["+t.obj+"."+t.func+"()]\n ":t.file?"["+t.file+" > "+t.func+"()]\n ":"["+t.func+"()]\n ");var r=["func","obj","file"];(0,d["default"])((0,h["default"])((0,c["default"])(t),r),function(i){if(-1===r.indexOf(i)){if("description"===i||"message"===i)return e+=t[i];n[i]=t[i]}}),e+="\n"}():(0,s["default"])(t)&&(e=t),[e,n]}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),s=r(a),u=n(13),c=r(u),f=n(218),h=r(f),l=n(88),d=r(l),p=n(2),g=r(p),b=n(17),v=r(b),y={log:function(t){var e=o(t);"trace"===v["default"].logLevel&&i("log",e)},debug:function(t){var e=o(t);"trace"!==v["default"].logLevel&&"debug"!==v["default"].logLevel||i("debug",e)},info:function(t){if("trace"===v["default"].logLevel||"debug"===v["default"].logLevel||"info"===v["default"].logLevel){var e=o(t);i("info",e)}},warn:function(t){var e=o(t);"trace"!==v["default"].logLevel&&"debug"!==v["default"].logLevel&&"info"!==v["default"].logLevel&&"warn"!==v["default"].logLevel||i("warn",e)},error:function(t){var e=o(t);"trace"!==v["default"].logLevel&&"debug"!==v["default"].logLevel&&"info"!==v["default"].logLevel&&"warn"!==v["default"].logLevel&&"error"!==v["default"].logLevel&&"fatal"!==v["default"].logLevel||i("error",e)}};e["default"]=y,t.exports=e["default"]},function(t,e,n){(function(t,r){var i=n(169),o={"function":!0,object:!0},a=o[typeof e]&&e&&!e.nodeType?e:void 0,s=o[typeof t]&&t&&!t.nodeType?t:void 0,u=i(a&&s&&"object"==typeof r&&r),c=i(o[typeof self]&&self),f=i(o[typeof window]&&window),h=i(o[typeof this]&&this),l=u||f!==(h&&h.window)&&f||c||h||Function("return this")();t.exports=l}).call(e,n(102)(t),function(){return this}())},function(t,e){function n(t){return!!t&&"object"==typeof t}t.exports=n},function(t,e,n){var r=n(23),i=n(8),o=r(i,"Map");t.exports=o},function(t,e){function n(t){var e=typeof t;return"number"==e||"boolean"==e||"string"==e&&"__proto__"!=t||null==t}t.exports=n},function(t,e,n){function r(t){var e=i(t)?u.call(t):"";return e==o||e==a}var i=n(2),o="[object Function]",a="[object GeneratorFunction]",s=Object.prototype,u=s.toString;t.exports=r},function(t,e,n){function r(t){var e=c(t);if(!e&&!s(t))return o(t);var n=a(t),r=!!n,f=n||[],h=f.length;for(var l in t)!i(t,l)||r&&("length"==l||u(l,h))||e&&"constructor"==l||f.push(l);return f}var i=n(42),o=n(152),a=n(85),s=n(16),u=n(25),c=n(46);t.exports=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(89),a=r(o),s=n(91),u=r(s),c=n(94),f=r(c),h=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l={envs:{local:{isLocal:!0,serverUrl:"http://localhost:4000",logLevel:"trace"},dev:{serverUrl:"http://tessellate-stage.elasticbeanstalk.com",logLevel:"debug"},stage:{serverUrl:"http://tessellate-stage.elasticbeanstalk.com",logLevel:"info"},prod:{serverUrl:"http://tessellate.elasticbeanstalk.com",logLevel:"error"}},defaultServerUrl:"http://tessellate.elasticbeanstalk.com",tokenName:"grout",fbUrl:"https://kyper-tech.firebaseio.com/tessellate",defaultProject:"tessellate",aws:{region:"us-east-1",cognito:{poolId:"us-east-1:72a20ffd-c638-48b0-b234-3312b3e64b2e",params:{AuthRoleArn:"arn:aws:iam::823322155619:role/Cognito_TessellateUnauth_Role",UnauthRoleArn:"arn:aws:iam::823322155619:role/Cognito_TessellateAuth_Role"}}}},d=null,p="prod",g=null,b=!1,v=function(){function t(){return i(this,t),d||(d=this),(0,f["default"])(d,l)}return h(t,[{key:"applySettings",value:function(t){t&&(0,f["default"])(d,t)}},{key:"serverUrl",get:function(){var t=l.envs[p].serverUrl||l.defaultServerUrl;if("undefined"!=typeof window&&(0,u["default"])(window,"location")&&(0,u["default"])(window.location,"host")&&""!==window.location.host){var e=(0,a["default"])(l.envs,function(t){return t.serverUrl===window.location.host});e&&(t="")}return t}},{key:"logLevel",set:function(t){g=t},get:function(){return g?g:l.envs[p].logLevel}},{key:"envName",set:function(t){p=t}},{key:"env",get:function(){return l.envs[p]?l.envs[p]:void 0}},{key:"localServer",get:function(){return l.envs[p].isLocal||b}},{key:"matterSettings",get:function(){return{serverUrl:this.serverUrl,logLevel:this.logLevel,localServer:this.localServer}}}]),t}(),y=new v;e["default"]=y,t.exports=e["default"]},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 n=new ArrayBuffer(0);try{e.blob=0===new Blob([n],{type:"application/zip"}).size}catch(r){try{var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,o=new i;o.append(n),e.blob=0===o.getBlob("application/zip").size}catch(r){e.blob=!1}}}}).call(e,n(34).Buffer)},function(t,e,n){function r(t){return null!=t&&!("function"==typeof t&&o(t))&&a(i(t))}var i=n(184),o=n(12),a=n(29);t.exports=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(89),a=r(o),s=n(94),u=r(s),c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f={envs:{local:{serverUrl:"http://localhost:4000",logLevel:"trace"},dev:{serverUrl:"http://tessellate-stage.elasticbeanstalk.com",logLevel:"debug"},stage:{serverUrl:"http://tessellate-stage.elasticbeanstalk.com",logLevel:"info"},prod:{serverUrl:"http://tessellate.elasticbeanstalk.com",logLevel:"error"}},tokenName:"tessellate",tokenDataName:"tessellate-tokenData",tokenUserDataName:"tessellate-currentUser",oauthioKey:"sxwuB9Gci8-4pBH7xjD0V_jooNU",oauthioCDN:"https://s3.amazonaws.com/kyper-cdn/js/libs/oauthio-web/v0.5.0/oauth.min.js"},h=null,l="prod",d=null,p=function(){function t(){return i(this,t),h||((0,u["default"])(this,f),h=this),h}return c(t,[{key:"applySettings",value:function(t){t&&(0,u["default"])(this,t)}},{key:"serverUrl",get:function(){if("undefined"!=typeof window&&window.location&&window.location.host&&""!==window.location.host){var t=(0,a["default"])(f.envs,function(t){return t.serverUrl===window.location.host});if(t)return""}return f.envs[this.envName].serverUrl}},{key:"logLevel",set:function(t){d=t},get:function(){return d?d:f.envs[this.envName].logLevel}},{key:"envName",set:function(t){l=t},get:function(){return l}},{key:"env",get:function(){return f.envs[this.envName]?f.envs[this.envName]:void 0}}]),t}(),g=new p;e["default"]=g,t.exports=e["default"]},function(t,e,n){function r(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}var i=n(202),o=n(203),a=n(204),s=n(205),u=n(206);r.prototype.clear=i,r.prototype["delete"]=o,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,t.exports=r},function(t,e){function n(t,e){for(var n=-1,r=t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}t.exports=n},function(t,e,n){function r(t,e){for(var n=t.length;n--;)if(i(t[n][0],e))return n;return-1}var i=n(27);t.exports=r},function(t,e,n){var r=n(75),i=n(179),o=i(r);t.exports=o},function(t,e,n){function r(t){var e=typeof t;return"function"==e?t:null==t?a:"object"==e?s(t)?o(t[0],t[1]):i(t):u(t)}var i=n(154),o=n(155),a=n(92),s=n(1),u=n(220);t.exports=r},function(t,e,n){function r(t,e){var n=null==t?void 0:t[e];return i(n)?n:void 0}var i=n(214);t.exports=r},function(t,e){function n(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(n){}return e}t.exports=n},function(t,e){function n(t,e){return t="number"==typeof t||i.test(t)?+t:-1,e=null==e?r:e,t>-1&&t%1==0&&e>t}var r=9007199254740991,i=/^(?:0|[1-9]\d*)$/;t.exports=n},function(t,e,n){var r=n(23),i=r(Object,"create");t.exports=i},function(t,e){function n(t,e){return t===e||t!==t&&e!==e}t.exports=n},function(t,e,n){function r(t){return i(t)&&s.call(t,"callee")&&(!c.call(t,"callee")||u.call(t)==o)}var i=n(47),o="[object Arguments]",a=Object.prototype,s=a.hasOwnProperty,u=a.toString,c=a.propertyIsEnumerable;t.exports=r},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e,n){function r(t){for(var e=-1,n=s(t),r=i(t),u=r.length,f=o(t),h=!!f,l=f||[],d=l.length;++e<u;){var p=r[e];h&&("length"==p||a(p,d))||"constructor"==p&&(n||!c.call(t,p))||l.push(p)}return l}var i=n(153),o=n(85),a=n(25),s=n(46),u=Object.prototype,c=u.hasOwnProperty;t.exports=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=r(o),s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(14),c=r(u),f=n(5),h=r(f),l=h["default"].utils,d=l.logger,p=l.request,g=function(){function t(e,n){i(this,t),this.endpoint=e,this.project=n||null,d.debug({description:"Init action called.",Action:this,func:"init",obj:"ApiAction"})}return s(t,[{key:"get",value:function(){return p.get(this.url)}},{key:"add",value:function(t){return p.post(this.url,t)}},{key:"update",value:function(t){return t||(t=this),p.put(this.url,t)}},{key:"remove",value:function(){return p.del(this.url)}},{key:"search",value:function(t){if(!t||""===t)return d.log({description:"Null query, returning empty array.",func:"search",obj:"ApiAction"}),Promise.resolve([]);if(!(0,a["default"])(t))return d.warn({description:"Invalid query type in search (should be string).",func:"search",obj:"ApiAction"}),Promise.reject({message:"Invalid query type. Search query should be string."});var e=-1===t.indexOf("@")?"username":"email";return p.get(this.url+"/search?"+e+"="+t)}},{key:"url",get:function(){return[c["default"].serverUrl,this.endpoint].join("/")}}]),t}();e["default"]=g,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(217),a=r(o),s=n(219),u=r(s),c=n(93),f=r(c),h=n(3),l=r(h),d=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),p=n(5),g=r(p),b=n(52),v=r(b),y=n(33),m=r(y),w=g["default"].utils.logger,_=function(){function t(e,n){if(i(this,t),w.debug({description:"FileSystemEntity constructor called.",project:e,path:n,func:"constructor",obj:"FileSystemEntity"}),!e||!(0,l["default"])(n))throw w.error({description:"FileSystemEntity that includes path and project is needed to create a FileSystemEntity action.",func:"constructor",obj:"FileSystemEntity"}),new Error("FileSystemEntity with path and project is needed to create file action.");this.project=e,this.path=0===n.indexOf("/")?n.slice(1):n,this.name=(0,f["default"])(n.split("/")),w.debug({description:"FileSystemEntity object constructed.",entity:this,func:"constructor",obj:"FileSystemEntity"})}return d(t,[{key:"get",value:function(){var t=this;return new Promise(function(e,n){t.fbRef.once("value",function(t){t.val()||n("no firebase value found"),e(t.val())})})}},{key:"open",value:function(){return this.get()}},{key:"remove",value:function(){return this.removeFromFb()}},{key:"move",value:function(){return null}},{key:"save",value:function(){return this.addToFb()}},{key:"addToFb",value:function(){w.debug({description:"addToFb called.",entity:this,func:"addToFb",obj:"FileSystemEntity"});var t=this.fbRef,e=this.path,n=this.name,r=this.entityType,i=this.fileType,o=this.content,s={meta:{path:e,name:n,entityType:r,fileType:i}};return s.meta=(0,u["default"])(s.meta,a["default"]),o&&(s.original=o),new Promise(function(e,n){t.update(s,function(t){t?(w.error({description:"Error creating file on Firebase.",error:t,func:"addToFb",obj:"FileSystemEntity"}),n(t)):(w.info({description:"FileSystemEntity successfully added to Firebase.",func:"addToFb",obj:"FileSystemEntity"}),e(s))})})}},{key:"removeFromFb",value:function(){var t=this;return w.debug({description:"Remove FileSystemEntity from Firebase called.",func:"removeFromFb",obj:"FileSystemEntity"}),new Promise(function(e,n){t.fbRef.remove(function(r){return r?(w.error({description:"Error removing file from Firebase.",entity:t,error:r,func:"removeFromFb",obj:"FileSystemEntity"}),n(r)):(w.info({description:"FileSystemEntity successfully removed from Firebase.",entity:t,func:"removeFromFb",obj:"FileSystemEntity"}),void e(t))})})}},{key:"fbRef",get:function(){if(!this.project||!this.project.name)throw w.error({description:"App information needed to generate fbUrl for FileSystemEntity.",entity:this,func:"fbUrl",obj:"FileSystemEntity"}),new Error("App information needed to generate fbUrl for FileSystemEntity.");var t=[this.project.fbUrl,m["default"].pathToSafePath(this.path)].join("/");return w.debug({description:"Fb ref generated.",url:t,func:"fbRef",obj:"FileSystemEntity"}),new v["default"](t)}}]),t}();e["default"]=_,t.exports=e["default"]},function(t,e,n){(function(r){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=n(14),u=i(s),c=n(52),f=i(c),h=n(5),l=i(h),d=l["default"].utils.logger,p=function(){function t(){o(this,t)}return a(t,null,[{key:"pathArrayFromFbRef",value:function(t){var e=u["default"].fbUrl.replace("https://","").split("/");e.shift();var n=t.path.o.splice(0,e.length);return d.info({description:"Path array built.",pathArray:n,func:"fbRef",obj:"Directory"}),n}},{key:"pathToSafePath",value:function(t){return d.debug({description:"Safe path array created.",path:t,func:"safePathArray",obj:"FileSystemEntity"}),t.replace(/[.]/g,":").replace(/[#$\[\]]/g,"_-_")}},{key:"ref",value:function(t){return new f["default"](this.url(t))}},{key:"url",value:function(t){return u["default"].fbUrl+"/files/"+t}},{key:"getLib",value:function(){return d.debug({description:"Get firepad lib called",func:"File => getFirepadLib",file:"classes/File"}),"undefined"!=typeof window&&window.Firepad&&window.ace?window.Firepad:"undefined"!=typeof r&&r.Firepad&&r.ace?r.Firepad:(d.debug({description:"Firepad does not currently exist.",func:"fbRef",obj:"File"}),null)}}]),t}();e["default"]=p,t.exports=e["default"]}).call(e,function(){return this}())},function(t,e,n){(function(t,r){/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
"use strict";function i(){function t(){}try{var e=new Uint8Array(1);return e.foo=function(){return 42},e.constructor=t,42===e.foo()&&e.constructor===t&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(n){return!1}}function o(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function t(e){return this instanceof t?(t.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof e?a(this,e):"string"==typeof e?s(this,e,arguments.length>1?arguments[1]:"utf8"):u(this,e)):arguments.length>1?new t(e,arguments[1]):new t(e)}function a(e,n){if(e=g(e,0>n?0:0|b(n)),!t.TYPED_ARRAY_SUPPORT)for(var r=0;n>r;r++)e[r]=0;return e}function s(t,e,n){"string"==typeof n&&""!==n||(n="utf8");var r=0|y(e,n);return t=g(t,r),t.write(e,n),t}function u(e,n){if(t.isBuffer(n))return c(e,n);if(G(n))return f(e,n);if(null==n)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(n.buffer instanceof ArrayBuffer)return h(e,n);if(n instanceof ArrayBuffer)return l(e,n)}return n.length?d(e,n):p(e,n)}function c(t,e){var n=0|b(e.length);return t=g(t,n),e.copy(t,0,0,n),t}function f(t,e){var n=0|b(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function h(t,e){var n=0|b(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function l(e,n){return t.TYPED_ARRAY_SUPPORT?(n.byteLength,e=t._augment(new Uint8Array(n))):e=h(e,new Uint8Array(n)),e}function d(t,e){var n=0|b(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function p(t,e){var n,r=0;"Buffer"===e.type&&G(e.data)&&(n=e.data,r=0|b(n.length)),t=g(t,r);for(var i=0;r>i;i+=1)t[i]=255&n[i];return t}function g(e,n){t.TYPED_ARRAY_SUPPORT?(e=t._augment(new Uint8Array(n)),e.__proto__=t.prototype):(e.length=n,e._isBuffer=!0);var r=0!==n&&n<=t.poolSize>>>1;return r&&(e.parent=V),e}function b(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function v(e,n){if(!(this instanceof v))return new v(e,n);var r=new t(e,n);return delete r.parent,r}function y(t,e){"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(r)return W(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var r=!1;if(e=0|e,n=void 0===n||n===1/0?this.length:0|n,t||(t="utf8"),0>e&&(e=0),n>this.length&&(n=this.length),e>=n)return"";for(;;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return T(this,e,n);case"binary":return F(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function w(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 Error("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;r>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[n+a]=s}return a}function _(t,e,n,r){return K(W(e,t.length-n),t,n,r)}function k(t,e,n,r){return K(X(e),t,n,r)}function E(t,e,n,r){return k(t,e,n,r)}function j(t,e,n,r){return K(Y(e),t,n,r)}function x(t,e,n,r){return K(H(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?Q.fromByteArray(t):Q.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;n>i;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(n>=i+s){var u,c,f,h;switch(s){case 1:128>o&&(a=o);break;case 2:u=t[i+1],128===(192&u)&&(h=(31&o)<<6|63&u,h>127&&(a=h));break;case 3:u=t[i+1],c=t[i+2],128===(192&u)&&128===(192&c)&&(h=(15&o)<<12|(63&u)<<6|63&c,h>2047&&(55296>h||h>57343)&&(a=h));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],128===(192&u)&&128===(192&c)&&128===(192&f)&&(h=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&f,h>65535&&1114112>h&&(a=h))}}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 O(r)}function O(t){var e=t.length;if(J>=e)return String.fromCharCode.apply(String,t);for(var n="",r=0;e>r;)n+=String.fromCharCode.apply(String,t.slice(r,r+=J));return n}function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)r+=String.fromCharCode(127&t[i]);return r}function F(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)r+=String.fromCharCode(t[i]);return r}function P(t,e,n){var r=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=e;n>o;o++)i+=q(t[o]);return i}function I(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 C(t,e,n){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function R(e,n,r,i,o,a){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(n>o||a>n)throw new RangeError("value is out of bounds");if(r+i>e.length)throw new RangeError("index out of range")}function U(t,e,n,r){0>e&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);o>i;i++)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(t,e,n,r){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);o>i;i++)t[n+i]=e>>>8*(r?i:3-i)&255}function D(t,e,n,r,i,o){if(e>i||o>e)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function L(t,e,n,r,i){return i||D(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,n,r,23,4),n+4}function B(t,e,n,r,i){return i||D(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,n,r,52,8),n+8}function N(t){if(t=z(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function z(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return 16>t?"0"+t.toString(16):t.toString(16)}function W(t,e){e=e||1/0;for(var n,r=t.length,i=null,o=[],a=0;r>a;a++){if(n=t.charCodeAt(a),n>55295&&57344>n){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(56320>n){(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,128>n){if((e-=1)<0)break;o.push(n)}else if(2048>n){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(65536>n){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(1114112>n))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 X(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e}function H(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 Y(t){return Q.toByteArray(N(t))}function K(t,e,n,r){for(var i=0;r>i&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}var Q=n(107),Z=n(110),G=n(108);e.Buffer=t,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50,t.poolSize=8192;var V={};t.TYPED_ARRAY_SUPPORT=void 0!==r.TYPED_ARRAY_SUPPORT?r.TYPED_ARRAY_SUPPORT:i(),t.TYPED_ARRAY_SUPPORT?(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array):(t.prototype.length=void 0,t.prototype.parent=void 0),t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var r=e.length,i=n.length,o=0,a=Math.min(r,i);a>o&&e[o]===n[o];)++o;return o!==a&&(r=e[o],i=n[o]),i>r?-1:r>i?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,n){if(!G(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new t(0);var r;if(void 0===n)for(n=0,r=0;r<e.length;r++)n+=e[r].length;var i=new t(n),o=0;for(r=0;r<e.length;r++){var a=e[r];a.copy(i,o),o+=a.length}return i},t.byteLength=y,t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):m.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===t.compare(this,e)},t.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+">"},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.indexOf=function(e,n){function r(t,e,n){for(var r=-1,i=0;n+i<t.length;i++)if(t[n+i]===e[-1===r?0:i-r]){if(-1===r&&(r=i),i-r+1===e.length)return n+r}else r=-1;return-1}if(n>2147483647?n=2147483647:-2147483648>n&&(n=-2147483648),n>>=0,0===this.length)return-1;if(n>=this.length)return-1;if(0>n&&(n=Math.max(this.length+n,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,n);if(t.isBuffer(e))return r(this,e,n);if("number"==typeof e)return t.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,n):r(this,[e],n);throw new TypeError("val must be string, number or Buffer")},t.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},t.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},t.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))e=0|e,isFinite(n)?(n=0|n,void 0===r&&(r="utf8")):(r=n,n=void 0);else{var i=r;r=e,e=0|n,n=i}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(0>n||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return k(this,t,e,n);case"binary":return E(this,t,e,n);case"base64":return j(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;t.prototype.slice=function(e,n){var r=this.length;e=~~e,n=void 0===n?r:~~n,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>n?(n+=r,0>n&&(n=0)):n>r&&(n=r),e>n&&(n=e);var i;if(t.TYPED_ARRAY_SUPPORT)i=t._augment(this.subarray(e,n));else{var o=n-e;i=new t(o,void 0);for(var a=0;o>a;a++)i[a]=this[a+e]}return i.length&&(i.parent=this.parent||this),i},t.prototype.readUIntLE=function(t,e,n){t=0|t,e=0|e,n||C(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},t.prototype.readUIntBE=function(t,e,n){t=0|t,e=0|e,n||C(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},t.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,n){t=0|t,e=0|e,n||C(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},t.prototype.readIntBE=function(t,e,n){t=0|t,e=0|e,n||C(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},t.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),Z.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),Z.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,n,r){t=+t,e=0|e,n=0|n,r||R(this,t,e,n,Math.pow(2,8*n),0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},t.prototype.writeUIntBE=function(t,e,n,r){t=+t,e=0|e,n=0|n,r||R(this,t,e,n,Math.pow(2,8*n),0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},t.prototype.writeUInt8=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[n]=255&e,n+1},t.prototype.writeUInt16LE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):U(this,e,n,!0),n+2},t.prototype.writeUInt16BE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):U(this,e,n,!1),n+2},t.prototype.writeUInt32LE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=255&e):M(this,e,n,!0),n+4},t.prototype.writeUInt32BE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):M(this,e,n,!1),n+4},t.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e=0|e,!r){var i=Math.pow(2,8*n-1);R(this,t,e,n,i-1,-i)}var o=0,a=1,s=0>t?1:0;for(this[e]=255&t;++o<n&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+n},t.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e=0|e,!r){var i=Math.pow(2,8*n-1);R(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0>t?1:0;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+n},t.prototype.writeInt8=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[n]=255&e,n+1},t.prototype.writeInt16LE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8):U(this,e,n,!0),n+2},t.prototype.writeInt16BE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>8,this[n+1]=255&e):U(this,e,n,!1),n+2},t.prototype.writeInt32LE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[n]=255&e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24):M(this,e,n,!0),n+4},t.prototype.writeInt32BE=function(e,n,r){return e=+e,n=0|n,r||R(this,e,n,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e):M(this,e,n,!1),n+4},t.prototype.writeFloatLE=function(t,e,n){return L(this,t,e,!0,n)},t.prototype.writeFloatBE=function(t,e,n){return L(this,t,e,!1,n)},t.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},t.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},t.prototype.copy=function(e,n,r,i){if(r||(r=0),i||0===i||(i=this.length),n>=e.length&&(n=e.length),n||(n=0),i>0&&r>i&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(0>n)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-n<i-r&&(i=e.length-n+r);var o,a=i-r;if(this===e&&n>r&&i>n)for(o=a-1;o>=0;o--)e[o+n]=this[o+r];else if(1e3>a||!t.TYPED_ARRAY_SUPPORT)for(o=0;a>o;o++)e[o+n]=this[o+r];else e._set(this.subarray(r,r+a),n);return a},t.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),e>n)throw new RangeError("end < start");if(n!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var r;if("number"==typeof t)for(r=e;n>r;r++)this[r]=t;else{var i=W(t.toString()),o=i.length;for(r=e;n>r;r++)this[r]=i[r%o]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),n=0,r=e.length;r>n;n+=1)e[n]=this[n];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var $=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._set=e.set,e.get=$.get,e.set=$.set,e.write=$.write,e.toString=$.toString,e.toLocaleString=$.toString,e.toJSON=$.toJSON,e.equals=$.equals,e.compare=$.compare,e.indexOf=$.indexOf,e.copy=$.copy,e.slice=$.slice,e.readUIntLE=$.readUIntLE,e.readUIntBE=$.readUIntBE,e.readUInt8=$.readUInt8,e.readUInt16LE=$.readUInt16LE,e.readUInt16BE=$.readUInt16BE,e.readUInt32LE=$.readUInt32LE,e.readUInt32BE=$.readUInt32BE,e.readIntLE=$.readIntLE,e.readIntBE=$.readIntBE,e.readInt8=$.readInt8,e.readInt16LE=$.readInt16LE,e.readInt16BE=$.readInt16BE,e.readInt32LE=$.readInt32LE,e.readInt32BE=$.readInt32BE,e.readFloatLE=$.readFloatLE,e.readFloatBE=$.readFloatBE,e.readDoubleLE=$.readDoubleLE,e.readDoubleBE=$.readDoubleBE,e.writeUInt8=$.writeUInt8,e.writeUIntLE=$.writeUIntLE,e.writeUIntBE=$.writeUIntBE,e.writeUInt16LE=$.writeUInt16LE,e.writeUInt16BE=$.writeUInt16BE,e.writeUInt32LE=$.writeUInt32LE,e.writeUInt32BE=$.writeUInt32BE,e.writeIntLE=$.writeIntLE,e.writeIntBE=$.writeIntBE,e.writeInt8=$.writeInt8,e.writeInt16LE=$.writeInt16LE,e.writeInt16BE=$.writeInt16BE,e.writeInt32LE=$.writeInt32LE,e.writeInt32BE=$.writeInt32BE,e.writeFloatLE=$.writeFloatLE,e.writeFloatBE=$.writeFloatBE,e.writeDoubleLE=$.writeDoubleLE,e.writeDoubleBE=$.writeDoubleBE,e.fill=$.fill,e.inspect=$.inspect,e.toArrayBuffer=$.toArrayBuffer,e};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,n(34).Buffer,function(){return this}())},function(t,e){"use strict";var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.encode=function(t,e){for(var r,i,o,a,s,u,c,f="",h=0;h<t.length;)r=t.charCodeAt(h++),i=t.charCodeAt(h++),o=t.charCodeAt(h++),a=r>>2,s=(3&r)<<4|i>>4,u=(15&i)<<2|o>>6,c=63&o,isNaN(i)?u=c=64:isNaN(o)&&(c=64),f=f+n.charAt(a)+n.charAt(s)+n.charAt(u)+n.charAt(c);return f},e.decode=function(t,e){var r,i,o,a,s,u,c,f="",h=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<t.length;)a=n.indexOf(t.charAt(h++)),s=n.indexOf(t.charAt(h++)),u=n.indexOf(t.charAt(h++)),c=n.indexOf(t.charAt(h++)),r=a<<2|s>>4,i=(15&s)<<4|u>>2,o=(3&u)<<6|c,f+=String.fromCharCode(r),64!=u&&(f+=String.fromCharCode(i)),64!=c&&(f+=String.fromCharCode(o));return f}},function(t,e,n){"use strict";e.STORE={magic:"\x00\x00",compress:function(t,e){return t},uncompress:function(t){return t},compressInputType:null,uncompressInputType:null},e.DEFLATE=n(113)},function(t,e,n){(function(e){"use strict";t.exports=function(t,n){return new e(t,n)},t.exports.test=function(t){return e.isBuffer(t)}}).call(e,n(34).Buffer)},function(t,e,n){"use strict";var r=n(15),i=n(4),o=n(111),a=n(56),s=n(55),u=n(35),c=n(36),f=n(53),h=n(37),l=n(119),d=n(117),p=n(118),g=function(t){if(t._data instanceof f&&(t._data=t._data.getContent(),t.options.binary=!0,t.options.base64=!1,"uint8array"===i.getTypeOf(t._data))){var e=t._data;t._data=new Uint8Array(e.length),0!==e.length&&t._data.set(e,0)}return t._data},b=function(t){var e=g(t),n=i.getTypeOf(e);return"string"===n?!t.options.binary&&r.nodebuffer?h(e,"utf-8"):t.asBinary():e},v=function(t){var e=g(this);return null===e||"undefined"==typeof e?"":(this.options.base64&&(e=u.decode(e)),e=t&&this.options.binary?F.utf8decode(e):i.transformTo("string",e),t||this.options.binary||(e=i.transformTo("string",F.utf8encode(e))),e)},y=function(t,e,n){this.name=t,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=e,this.options=n,this._initialMetadata={dir:n.dir,date:n.date}};y.prototype={asText:function(){return v.call(this,!0)},asBinary:function(){return v.call(this,!1)},asNodeBuffer:function(){var t=b(this);return i.transformTo("nodebuffer",t)},asUint8Array:function(){var t=b(this);return i.transformTo("uint8array",t)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var m=function(t,e){var n,r="";for(n=0;e>n;n++)r+=String.fromCharCode(255&t),t>>>=8;return r},w=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},_=function(t){return t=t||{},t.base64!==!0||null!==t.binary&&void 0!==t.binary||(t.binary=!0),t=w(t,s),t.date=t.date||new Date,null!==t.compression&&(t.compression=t.compression.toUpperCase()),t},k=function(t,e,n){var r,o=i.getTypeOf(e);if(n=_(n),"string"==typeof n.unixPermissions&&(n.unixPermissions=parseInt(n.unixPermissions,8)),n.unixPermissions&&16384&n.unixPermissions&&(n.dir=!0),n.dosPermissions&&16&n.dosPermissions&&(n.dir=!0),n.dir&&(t=j(t)),n.createFolders&&(r=E(t))&&x.call(this,r,!0),n.dir||null===e||"undefined"==typeof e)n.base64=!1,n.binary=!1,e=null,o=null;else if("string"===o)n.binary&&!n.base64&&n.optimizedBinaryString!==!0&&(e=i.string2binary(e));else{if(n.base64=!1,n.binary=!0,!(o||e instanceof f))throw new Error("The data of '"+t+"' is in an unsupported format !");"arraybuffer"===o&&(e=i.transformTo("uint8array",e))}var a=new y(t,e,n);return this.files[t]=a,a},E=function(t){"/"==t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return e>0?t.substring(0,e):""},j=function(t){return"/"!=t.slice(-1)&&(t+="/"),t},x=function(t,e){return e="undefined"!=typeof e?e:!1,t=j(t),this.files[t]||k.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]},A=function(t,e,n){var r,a=new f;return t._data instanceof f?(a.uncompressedSize=t._data.uncompressedSize,a.crc32=t._data.crc32,0===a.uncompressedSize||t.dir?(e=c.STORE,a.compressedContent="",a.crc32=0):t._data.compressionMethod===e.magic?a.compressedContent=t._data.getCompressedContent():(r=t._data.getContent(),a.compressedContent=e.compress(i.transformTo(e.compressInputType,r),n))):(r=b(t),r&&0!==r.length&&!t.dir||(e=c.STORE,r=""),a.uncompressedSize=r.length,a.crc32=o(r),a.compressedContent=e.compress(i.transformTo(e.compressInputType,r),n)),a.compressedSize=a.compressedContent.length,a.compressionMethod=e.magic,a},S=function(t,e){var n=t;return t||(n=e?16893:33204),(65535&n)<<16},O=function(t,e){return 63&(t||0)},T=function(t,e,n,r,s){var u,c,f,h,d=(n.compressedContent,i.transformTo("string",l.utf8encode(e.name))),p=e.comment||"",g=i.transformTo("string",l.utf8encode(p)),b=d.length!==e.name.length,v=g.length!==p.length,y=e.options,w="",_="",k="";f=e._initialMetadata.dir!==e.dir?e.dir:y.dir,h=e._initialMetadata.date!==e.date?e.date:y.date;var E=0,j=0;f&&(E|=16),"UNIX"===s?(j=798,E|=S(e.unixPermissions,f)):(j=20,E|=O(e.dosPermissions,f)),u=h.getHours(),u<<=6,u|=h.getMinutes(),u<<=5,u|=h.getSeconds()/2,c=h.getFullYear()-1980,c<<=4,c|=h.getMonth()+1,c<<=5,c|=h.getDate(),b&&(_=m(1,1)+m(o(d),4)+d,w+="up"+m(_.length,2)+_),v&&(k=m(1,1)+m(this.crc32(g),4)+g,w+="uc"+m(k.length,2)+k);var x="";x+="\n\x00",x+=b||v?"\x00\b":"\x00\x00",x+=n.compressionMethod,x+=m(u,2),x+=m(c,2),x+=m(n.crc32,4),x+=m(n.compressedSize,4),x+=m(n.uncompressedSize,4),x+=m(d.length,2),x+=m(w.length,2);var A=a.LOCAL_FILE_HEADER+x+d+w,T=a.CENTRAL_FILE_HEADER+m(j,2)+x+m(g.length,2)+"\x00\x00\x00\x00"+m(E,4)+m(r,4)+d+w+g;return{fileRecord:A,dirRecord:T,compressedObject:n}},F={load:function(t,e){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(t){var e,n,r,i,o=[];for(e in this.files)this.files.hasOwnProperty(e)&&(r=this.files[e],i=new y(r.name,r._data,w(r.options)),n=e.slice(this.root.length,e.length),e.slice(0,this.root.length)===this.root&&t(n,i)&&o.push(i));return o},file:function(t,e,n){if(1===arguments.length){if(i.isRegExp(t)){var r=t;return this.filter(function(t,e){return!e.dir&&r.test(t)})}return this.filter(function(e,n){return!n.dir&&e===t})[0]||null}return t=this.root+t,k.call(this,t,e,n),this},folder:function(t){if(!t)return this;if(i.isRegExp(t))return this.filter(function(e,n){return n.dir&&t.test(e)});var e=this.root+t,n=x.call(this,e),r=this.clone();return r.root=n.name,r},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!=t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var n=this.filter(function(e,n){return n.name.slice(0,t.length)===t}),r=0;r<n.length;r++)delete this.files[n[r].name];return this},generate:function(t){t=w(t||{},{base64:!0,compression:"STORE",compressionOptions:null,type:"base64",platform:"DOS",comment:null,mimeType:"application/zip"}),i.checkSupport(t.type),"darwin"!==t.platform&&"freebsd"!==t.platform&&"linux"!==t.platform&&"sunos"!==t.platform||(t.platform="UNIX"),"win32"===t.platform&&(t.platform="DOS");var e,n,r=[],o=0,s=0,f=i.transformTo("string",this.utf8encode(t.comment||this.comment||""));for(var h in this.files)if(this.files.hasOwnProperty(h)){var l=this.files[h],g=l.options.compression||t.compression.toUpperCase(),b=c[g];if(!b)throw new Error(g+" is not a valid compression method !");var v=l.options.compressionOptions||t.compressionOptions||{},y=A.call(this,l,b,v),_=T.call(this,h,l,y,o,t.platform);o+=_.fileRecord.length+y.compressedSize,s+=_.dirRecord.length,r.push(_)}var k="";k=a.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+m(r.length,2)+m(r.length,2)+m(s,4)+m(o,4)+m(f.length,2)+f;var E=t.type.toLowerCase();for(e="uint8array"===E||"arraybuffer"===E||"blob"===E||"nodebuffer"===E?new p(o+s+k.length):new d(o+s+k.length),n=0;n<r.length;n++)e.append(r[n].fileRecord),e.append(r[n].compressedObject.compressedContent);for(n=0;n<r.length;n++)e.append(r[n].dirRecord);e.append(k);var j=e.finalize();switch(t.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return i.transformTo(t.type.toLowerCase(),j);case"blob":return i.arrayBuffer2Blob(i.transformTo("arraybuffer",j),t.mimeType);case"base64":return t.base64?u.encode(j):j;default:return j}},crc32:function(t,e){return o(t,e)},utf8encode:function(t){return i.transformTo("string",l.utf8encode(t))},utf8decode:function(t){return l.utf8decode(t)}};t.exports=F},function(t,e,n){var r=n(8),i=r.Symbol;t.exports=i},functi