diff --git a/README.md b/README.md index 216d706..00de456 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Client library to simplify communication with Tessellate application building se Grout is isomorphic, so it can be used within a front-end or on a server. Below are options for setups: -### Node or ES6 +### NodeJS 1. Install: `npm install --save kyper-grout` @@ -24,7 +24,13 @@ Grout is isomorphic, so it can be used within a front-end or on a server. Below var Grout = require('kyper-grout'); var grout = new Grout(); ``` - **or** + +### ES6 +1. Install: + `npm install --save kyper-grout` + +2. Include and use `kyper-grout`: + ```javascript import Grout from 'kyper-grout'; let grout = new Grout(); @@ -36,7 +42,7 @@ Grout is isomorphic, so it can be used within a front-end or on a server. Below Add script tag to index.html: ```html - + ``` #### Bower @@ -46,14 +52,15 @@ Grout is isomorphic, so it can be used within a front-end or on a server. Below ``` 2. Begin using grout: - ```javascript - var grout = new Grout(); - if(grout.isLoggedIn){ - console.log('The currently logged in user is', grout.currentUser); - } else { - console.warn('Not logged into grout'); - } - ``` + + ```javascript + var grout = new Grout(); + if(grout.isLoggedIn){ + console.log('The currently logged in user is', grout.currentUser); + } else { + console.warn('Not logged into grout'); + } + ``` ## Documentation diff --git a/dist/grout.js b/dist/grout.js index 6bdd589..2440472 100644 --- a/dist/grout.js +++ b/dist/grout.js @@ -19327,7 +19327,6 @@ return /******/ (function(modules) { // webpackBootstrap function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var logger = _Matter2.default.utils.logger; - /** * @description Initial AWS Config */ @@ -19340,7 +19339,9 @@ return /******/ (function(modules) { // webpackBootstrap }); setConfig(); } - return new _awsSdk2.default.S3(); + if (typeof _awsSdk2.default.S3 === 'function') { + return new _awsSdk2.default.S3(); + } }; /** * @description Set AWS config credentials @@ -19349,8 +19350,7 @@ return /******/ (function(modules) { // webpackBootstrap return _awsSdk2.default.config.update({ credentials: new _awsSdk2.default.CognitoIdentityCredentials({ IdentityPoolId: _config2.default.aws.cognito.poolId - }), - region: _config2.default.aws.region + }), region: _config2.default.aws.region }); }; /** diff --git a/dist/grout.min.js b/dist/grout.min.js index 7fa97a6..15cdf35 100644 --- a/dist/grout.min.js +++ b/dist/grout.min.js @@ -15,10 +15,10 @@ r=C,Ye(this.ta.subtree(n),function(t,e){var n=e.fb(G);n&&(r=r.U(t,n))}));var s=n A("Firebase.setWithPriority",3,n,!0),".length"===this.key()||".keys"===this.key())throw"Firebase.setWithPriority failed: "+this.key()+" is a read-only object.";this.k.Kb(this.path,t,e,n||null)},U.prototype.setWithPriority=U.prototype.Kb,U.prototype.remove=function(t){x("Firebase.remove",0,1,arguments.length),jg("Firebase.remove",this.path),A("Firebase.remove",1,t,!0),this.set(null,t)},U.prototype.remove=U.prototype.remove,U.prototype.transaction=function(t,e,r){if(x("Firebase.transaction",1,3,arguments.length),jg("Firebase.transaction",this.path),A("Firebase.transaction",1,t,!1),A("Firebase.transaction",2,e,!0),n(r)&&"boolean"!=typeof r)throw Error(y("Firebase.transaction",3,!0)+"must be a boolean.");if(".length"===this.key()||".keys"===this.key())throw"Firebase.transaction failed: "+this.key()+" is a read-only object.";"undefined"==typeof r&&(r=!0),ji(this.k,this.path,t,e||null,r)},U.prototype.transaction=U.prototype.transaction,U.prototype.Og=function(t,e){x("Firebase.setPriority",1,2,arguments.length),jg("Firebase.setPriority",this.path),fg("Firebase.setPriority",1,t),A("Firebase.setPriority",2,e,!0),this.k.Kb(this.path.u(".priority"),t,null,e)},U.prototype.setPriority=U.prototype.Og,U.prototype.push=function(t,e){x("Firebase.push",0,2,arguments.length),jg("Firebase.push",this.path),bg("Firebase.push",t,this.path,!0),A("Firebase.push",2,e,!0);var n=$h(this.k),n=Fe(n),n=this.u(n);return"undefined"!=typeof t&&null!==t&&n.set(t,e),n},U.prototype.push=U.prototype.push,U.prototype.hb=function(){return jg("Firebase.onDisconnect",this.path),new X(this.k,this.path)},U.prototype.onDisconnect=U.prototype.hb,U.prototype.M=function(t,e,n){O("FirebaseRef.auth() being deprecated. Please use FirebaseRef.authWithCustomToken() instead."),x("Firebase.auth",1,3,arguments.length),kg("Firebase.auth",t),A("Firebase.auth",2,e,!0),A("Firebase.auth",3,e,!0),Yg(this.k.M,t,{},{remember:"none"},e,n)},U.prototype.auth=U.prototype.M,U.prototype.ge=function(t){x("Firebase.unauth",0,1,arguments.length),A("Firebase.unauth",1,t,!0),Zg(this.k.M,t)},U.prototype.unauth=U.prototype.ge,U.prototype.xe=function(){return x("Firebase.getAuth",0,0,arguments.length),this.k.M.xe()},U.prototype.getAuth=U.prototype.xe,U.prototype.xg=function(t,e){x("Firebase.onAuth",1,2,arguments.length),A("Firebase.onAuth",1,t,!1),mb("Firebase.onAuth",2,e),this.k.M.Eb("auth_status",t,e)},U.prototype.onAuth=U.prototype.xg,U.prototype.wg=function(t,e){x("Firebase.offAuth",1,2,arguments.length),A("Firebase.offAuth",1,t,!1),mb("Firebase.offAuth",2,e),this.k.M.ic("auth_status",t,e)},U.prototype.offAuth=U.prototype.wg,U.prototype.Zf=function(t,e,n){x("Firebase.authWithCustomToken",2,3,arguments.length),kg("Firebase.authWithCustomToken",t),A("Firebase.authWithCustomToken",2,e,!1),ng("Firebase.authWithCustomToken",3,n,!0),Yg(this.k.M,t,{},n||{},e)},U.prototype.authWithCustomToken=U.prototype.Zf,U.prototype.$f=function(t,e,n){x("Firebase.authWithOAuthPopup",2,3,arguments.length),mg("Firebase.authWithOAuthPopup",t),A("Firebase.authWithOAuthPopup",2,e,!1),ng("Firebase.authWithOAuthPopup",3,n,!0),ch(this.k.M,t,n,e)},U.prototype.authWithOAuthPopup=U.prototype.$f,U.prototype.ag=function(t,e,n){x("Firebase.authWithOAuthRedirect",2,3,arguments.length),mg("Firebase.authWithOAuthRedirect",t),A("Firebase.authWithOAuthRedirect",2,e,!1),ng("Firebase.authWithOAuthRedirect",3,n,!0);var r=this.k.M;ah(r);var i=[Kg],o=vg(n);"anonymous"===t||"firebase"===t?P(e,Mg("TRANSPORT_UNAVAILABLE")):(yc.set("redirect_client_options",o.od),bh(r,i,"/auth/"+t,o,e))},U.prototype.authWithOAuthRedirect=U.prototype.ag,U.prototype.bg=function(t,e,n,r){x("Firebase.authWithOAuthToken",3,4,arguments.length),mg("Firebase.authWithOAuthToken",t),A("Firebase.authWithOAuthToken",3,n,!1),ng("Firebase.authWithOAuthToken",4,r,!0),p(e)?(lg("Firebase.authWithOAuthToken",2,e),$g(this.k.M,t+"/token",{access_token:e},r,n)):(ng("Firebase.authWithOAuthToken",2,e,!1),$g(this.k.M,t+"/token",e,r,n))},U.prototype.authWithOAuthToken=U.prototype.bg,U.prototype.Yf=function(t,e){x("Firebase.authAnonymously",1,2,arguments.length),A("Firebase.authAnonymously",1,t,!1),ng("Firebase.authAnonymously",2,e,!0),$g(this.k.M,"anonymous",{},e,t)},U.prototype.authAnonymously=U.prototype.Yf,U.prototype.cg=function(t,e,n){x("Firebase.authWithPassword",2,3,arguments.length),ng("Firebase.authWithPassword",1,t,!1),og("Firebase.authWithPassword",t,"email"),og("Firebase.authWithPassword",t,"password"),A("Firebase.authWithPassword",2,e,!1),ng("Firebase.authWithPassword",3,n,!0),$g(this.k.M,"password",t,n,e)},U.prototype.authWithPassword=U.prototype.cg,U.prototype.se=function(t,e){x("Firebase.createUser",2,2,arguments.length),ng("Firebase.createUser",1,t,!1),og("Firebase.createUser",t,"email"),og("Firebase.createUser",t,"password"),A("Firebase.createUser",2,e,!1),this.k.M.se(t,e)},U.prototype.createUser=U.prototype.se,U.prototype.Te=function(t,e){x("Firebase.removeUser",2,2,arguments.length),ng("Firebase.removeUser",1,t,!1),og("Firebase.removeUser",t,"email"),og("Firebase.removeUser",t,"password"),A("Firebase.removeUser",2,e,!1),this.k.M.Te(t,e)},U.prototype.removeUser=U.prototype.Te,U.prototype.pe=function(t,e){x("Firebase.changePassword",2,2,arguments.length),ng("Firebase.changePassword",1,t,!1),og("Firebase.changePassword",t,"email"),og("Firebase.changePassword",t,"oldPassword"),og("Firebase.changePassword",t,"newPassword"),A("Firebase.changePassword",2,e,!1),this.k.M.pe(t,e)},U.prototype.changePassword=U.prototype.pe,U.prototype.oe=function(t,e){x("Firebase.changeEmail",2,2,arguments.length),ng("Firebase.changeEmail",1,t,!1),og("Firebase.changeEmail",t,"oldEmail"),og("Firebase.changeEmail",t,"newEmail"),og("Firebase.changeEmail",t,"password"),A("Firebase.changeEmail",2,e,!1),this.k.M.oe(t,e)},U.prototype.changeEmail=U.prototype.oe,U.prototype.Ve=function(t,e){x("Firebase.resetPassword",2,2,arguments.length),ng("Firebase.resetPassword",1,t,!1),og("Firebase.resetPassword",t,"email"),A("Firebase.resetPassword",2,e,!1),this.k.M.Ve(t,e)},U.prototype.resetPassword=U.prototype.Ve}(),module.exports=Firebase},function(t,e,n){var r=n(1);r.apiLoader=function(t,e){return r.apiLoader.services[t][e]},r.apiLoader.services={},r.XML.Parser=n(88),n(70),"undefined"!=typeof window&&(window.AWS=r),t.exports=r},function(t,e,n){var r=n(110),i=n(52),o=n(1),a=o.util.base64.encode,s=o.util.inherit,u=function(t){var e={"+":"-","=":"_","/":"~"};return t.replace(/[\+=\/]/g,function(t){return e[t]})},c=function(t,e){var n=r.createSign("RSA-SHA1");return n.write(t),u(n.sign(e,"base64"))},l=function(t,e,n,r){var i=JSON.stringify({Statement:[{Resource:t,Condition:{DateLessThan:{"AWS:EpochTime":e}}}]});return{Expires:e,"Key-Pair-Id":n,Signature:c(i.toString(),r)}},f=function(t,e,n){return t=t.replace(/\s/gm,t),{Policy:u(a(t)),"Key-Pair-Id":e,Signature:c(t,n)}},h=function(t){var e=t.split("://");if(e.length<2)throw new Error("Invalid URL.");return e[0].replace("*","")},d=function(t){var e=i.parse(t);return e.path.replace(/^\//,"")+e.hash},p=function(t){switch(h(t)){case"http":case"https":return t;case"rtmp":return d(t);default:throw new Error("Invalid URI scheme. Scheme must be one of http, https, or rtmp")}},g=function(t,e){if(!e||"function"!=typeof e)throw t;e(t)},v=function(t,e){return e&&"function"==typeof e?void e(null,t):t};o.CloudFront.Signer=s({constructor:function(t,e){if(void 0===t||void 0===e)throw new Error("A key pair ID and private key are required");this.keyPairId=t,this.privateKey=e},getSignedCookie:function(t,e){var n="policy"in t?f(t.policy,this.keyPairId,this.privateKey):l(t.url,t.expires,this.keyPairId,this.privateKey),r={};for(var i in n)n.hasOwnProperty(i)&&(r["CloudFront-"+i]=n[i]);return v(r,e)},getSignedUrl:function(t,e){try{var n=p(t.url)}catch(r){return g(r,e)}var o=i.parse(t.url,!0),a=t.hasOwnProperty("policy")?f(t.policy,this.keyPairId,this.privateKey):l(n,t.expires,this.keyPairId,this.privateKey);o.search=null;for(var s in a)a.hasOwnProperty(s)&&(o.query[s]=a[s]);try{var u="rtmp"===h(t.url)?d(i.format(o)):i.format(o)}catch(r){return g(r,e)}return v(u,e)}}),t.exports=o.CloudFront.Signer},function(t,e,n){var r=n(1);n(24),n(25),r.Config=r.util.inherit({constructor:function(t){void 0===t&&(t={}),t=this.extractCredentials(t),r.util.each.call(this,this.keys,function(e,n){this.set(e,t[e],n)})},getCredentials:function(t){function e(e){t(e,e?null:a.credentials)}function n(t,e){return new r.util.error(e||new Error,{code:"CredentialsError",message:t})}function i(){a.credentials.get(function(t){if(t){var r="Could not load credentials from "+a.credentials.constructor.name;t=n(r,t)}e(t)})}function o(){var t=null;a.credentials.accessKeyId&&a.credentials.secretAccessKey||(t=n("Missing credentials")),e(t)}var a=this;a.credentials?"function"==typeof a.credentials.get?i():o():a.credentialProvider?a.credentialProvider.resolve(function(t,r){t&&(t=n("Could not load credentials from any providers",t)),a.credentials=r,e(t)}):e(n("No credentials to load"))},update:function(t,e){e=e||!1,t=this.extractCredentials(t),r.util.each.call(this,t,function(t,n){(e||this.keys.hasOwnProperty(t)||r.Service.hasService(t))&&this.set(t,n)})},loadFromPath:function(t){this.clear();var e=JSON.parse(r.util.readFileSync(t)),n=new r.FileSystemCredentials(t),i=new r.CredentialProviderChain;return i.providers.unshift(n),i.resolve(function(t,n){if(t)throw t;e.credentials=n}),this.constructor(e),this},clear:function(){r.util.each.call(this,this.keys,function(t){delete this[t]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(t,e,n){void 0===e?(void 0===n&&(n=this.keys[t]),"function"==typeof n?this[t]=n.call(this):this[t]=n):"httpOptions"===t&&this[t]?this[t]=r.util.merge(this[t],e):this[t]=e},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0},extractCredentials:function(t){return t.accessKeyId&&t.secretAccessKey&&(t=r.util.copy(t),t.credentials=new r.Credentials(t)),t}}),r.config=new r.Config},function(t,e,n){var r=n(1);r.CognitoIdentityCredentials=r.util.inherit(r.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(t){r.Credentials.call(this),this.expired=!0,this.params=t,this.data=null,this.identityId=null,this.loadCachedId()},refresh:function(t){var e=this;e.createClients(),e.data=null,e.identityId=null,e.getId(function(n){n?(e.clearCachedId(),t(n)):e.params.RoleArn?e.getCredentialsFromSTS(t):e.getCredentialsForIdentity(t)})},clearCachedId:function(){this.identityId=null,delete this.params.IdentityId;var t=this.params.IdentityPoolId,e=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+t+e],delete this.storage[this.localStorageKey.providers+t+e]},getId:function(t){var e=this;return"string"==typeof e.params.IdentityId?t(null,e.params.IdentityId):void e.cognito.getId(function(n,r){!n&&r.IdentityId?(e.params.IdentityId=r.IdentityId,t(null,r.IdentityId)):t(n)})},loadCredentials:function(t,e){t&&e&&(e.expired=!1,e.accessKeyId=t.Credentials.AccessKeyId,e.secretAccessKey=t.Credentials.SecretKey,e.sessionToken=t.Credentials.SessionToken,e.expireTime=t.Credentials.Expiration)},getCredentialsForIdentity:function(t){var e=this;e.cognito.getCredentialsForIdentity(function(n,r){n?e.clearCachedId():(e.cacheId(r),e.data=r,e.loadCredentials(e.data,e)),t(n)})},getCredentialsFromSTS:function(t){var e=this;e.cognito.getOpenIdToken(function(n,r){n?(e.clearCachedId(),t(n)):(e.cacheId(r),e.params.WebIdentityToken=r.Token,e.webIdentityCredentials.refresh(function(n){n?e.clearCachedId():(e.data=e.webIdentityCredentials.data,e.sts.credentialsFrom(e.data,e)),t(n)}))})},loadCachedId:function(){var t=this;if(r.util.isBrowser()&&!t.params.IdentityId){var e=t.getStorage("id");if(e&&t.params.Logins){var n=Object.keys(t.params.Logins),i=(t.getStorage("providers")||"").split(","),o=i.filter(function(t){return-1!==n.indexOf(t)});0!==o.length&&(t.params.IdentityId=e)}else e&&(t.params.IdentityId=e)}},createClients:function(){this.webIdentityCredentials=this.webIdentityCredentials||new r.WebIdentityCredentials(this.params),this.cognito=this.cognito||new r.CognitoIdentity({params:this.params}),this.sts=this.sts||new r.STS},cacheId:function(t){this.identityId=t.IdentityId,this.params.IdentityId=this.identityId,r.util.isBrowser()&&(this.setStorage("id",t.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(t){return this.storage[this.localStorageKey[t]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(t,e){try{this.storage[this.localStorageKey[t]+this.params.IdentityPoolId+(this.params.LoginId||"")]=e}catch(n){}},storage:function(){try{return r.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{}}catch(t){return{}}}()})},function(t,e,n){var r=n(1);n(71),r.EC2MetadataCredentials=r.util.inherit(r.Credentials,{constructor:function(t){r.Credentials.call(this),t=t?r.util.copy(t):{},t.httpOptions||(t.httpOptions={}),t.httpOptions=r.util.merge({timeout:this.defaultTimeout},t.httpOptions),this.metadataService=new r.MetadataService(t),this.metadata={}},defaultTimeout:1e3,refresh:function(t){var e=this;t||(t=function(t){if(t)throw t}),e.metadataService.loadCredentials(function(n,r){n||(e.expired=!1,e.metadata=r,e.accessKeyId=r.AccessKeyId,e.secretAccessKey=r.SecretAccessKey,e.sessionToken=r.Token,e.expireTime=new Date(r.Expiration)),t(n)})}})},function(t,e,n){(function(t){var e=n(1);e.EnvironmentCredentials=e.util.inherit(e.Credentials,{constructor:function(t){e.Credentials.call(this),this.envPrefix=t,this.get(function(){})},refresh:function(n){if(n||(n=function(t){if(t)throw t}),void 0===t)return void n(new Error("No process info available"));for(var r=["ACCESS_KEY_ID","SECRET_ACCESS_KEY","SESSION_TOKEN"],i=[],o=0;o=600?this.emit("sign",[this],function(t){t?e(t):a()}):a()}),t("HTTP_HEADERS","httpHeaders",function(t,e,n){n.httpResponse.statusCode=t,n.httpResponse.headers=e,n.httpResponse.body=new r.util.Buffer(""),n.httpResponse.buffers=[],n.httpResponse.numBytes=0;var i=e.date||e.Date;if(i){var o=Date.parse(i);n.request.service.config.correctClockSkew&&r.util.isClockSkewed(o)&&r.util.applyClockOffset(o)}}),t("HTTP_DATA","httpData",function(t,e){if(t){if(r.util.isNode()){e.httpResponse.numBytes+=t.length;var n=e.httpResponse.headers["content-length"],i={loaded:e.httpResponse.numBytes,total:n};e.request.emit("httpDownloadProgress",[i,e])}e.httpResponse.buffers.push(new r.util.Buffer(t))}}),t("HTTP_DONE","httpDone",function(t){if(t.httpResponse.buffers&&t.httpResponse.buffers.length>0){var e=r.util.buffer.concat(t.httpResponse.buffers);t.httpResponse.body=e}delete t.httpResponse.numBytes,delete t.httpResponse.buffers}),t("FINALIZE_ERROR","retry",function(t){t.httpResponse.statusCode&&(t.error.statusCode=t.httpResponse.statusCode,void 0===t.error.retryable&&(t.error.retryable=this.service.retryableError(t.error,this)))}),t("INVALIDATE_CREDENTIALS","retry",function(t){if(t.error)switch(t.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":t.error.retryable=!0,t.request.service.config.credentials.expired=!0}}),t("EXPIRED_SIGNATURE","retry",function(t){var e=t.error;e&&"string"==typeof e.code&&"string"==typeof e.message&&e.code.match(/Signature/)&&e.message.match(/expired/)&&(t.error.retryable=!0)}),t("CLOCK_SKEWED","retry",function(t){t.error&&this.service.clockSkewError(t.error)&&this.service.config.correctClockSkew&&r.config.isClockSkewed&&(t.error.retryable=!0)}),t("REDIRECT","retry",function(t){t.error&&t.error.statusCode>=300&&t.error.statusCode<400&&t.httpResponse.headers.location&&(this.httpRequest.endpoint=new r.Endpoint(t.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,t.error.redirect=!0,t.error.retryable=!0)}),t("RETRY_CHECK","retry",function(t){if(t.error)if(t.error.redirect&&t.redirectCount=this.HEADERS_RECEIVED&&!f){try{l.responseType="arraybuffer"}catch(t){}u.statusCode=l.status,u.headers=a.parseHeaders(l.getAllResponseHeaders()),u.emit("headers",u.statusCode,u.headers),f=!0}this.readyState===this.DONE&&a.finishRequest(l,u)},!1),l.upload.addEventListener("progress",function(t){u.emit("sendProgress",t)}),l.addEventListener("progress",function(t){u.emit("receiveProgress",t)},!1),l.addEventListener("timeout",function(){o(r.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),l.addEventListener("error",function(){o(r.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),n(u),l.open(t.method,c,e.xhrAsync!==!1),r.util.each(t.headers,function(t,e){"Content-Length"!==t&&"User-Agent"!==t&&"Host"!==t&&l.setRequestHeader(t,e)}),e.timeout&&e.xhrAsync!==!1&&(l.timeout=e.timeout),e.xhrWithCredentials&&(l.withCredentials=!0);try{l.send(t.body)}catch(h){if(!t.body||"object"!=typeof t.body.buffer)throw h;l.send(t.body.buffer)}return u},parseHeaders:function(t){var e={};return r.util.arrayEach(t.split(/\r?\n/),function(t){var n=t.split(":",1)[0],r=t.substring(n.length+2);n.length>0&&(e[n.toLowerCase()]=r)}),e},finishRequest:function(t,e){var n;if("arraybuffer"===t.responseType&&t.response){var i=t.response;n=new r.util.Buffer(i.byteLength);for(var o=new Uint8Array(i),a=0;a1||n.request(r,function(t,i){t?e(t):(i=i.split("\n")[0],n.request(r+i,function(t,n){if(t)e(t);else try{var r=JSON.parse(n);e(null,r)}catch(i){e(i)}}))})}}),t.exports=r.MetadataService}).call(e,n(5))},function(t,e,n){var r=n(1);r.ParamValidator=r.util.inherit({constructor:function(t){(t===!0||void 0===t)&&(t={min:!0}),this.validation=t},validate:function(t,e,n){if(this.errors=[],this.validateMember(t,e||{},n||"params"),this.errors.length>1){var i=this.errors.join("\n* ");throw i="There were "+this.errors.length+" validation errors:\n* "+i,r.util.error(new Error(i),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(t,e){this.errors.push(r.util.error(new Error(e),{code:t}))},validateStructure:function(t,e,n){this.validateType(e,n,["object"],"structure");for(var r,i=0;t.required&&i= "+t.min+", but found "+e+" for "+n),this.validation.max&&void 0!==t.max&&e>t.max&&this.fail("MaxRangeError","Expected "+r+" <= "+t.max+", but found "+e+" for "+n)},validateEnum:function(t,e,n){this.validation.enum&&void 0!==t.enum&&-1===t.enum.indexOf(e)&&this.fail("EnumError","Found string value of "+e+", but expected "+t.enum.join("|")+" for "+n)},validateType:function(t,e,n,i){if(null===t||void 0===t)return!1;for(var o=!1,a=0;at){n.removeListener("httpData",r.EventListeners.Core.HTTP_DATA),n.removeListener("httpError",r.EventListeners.Core.HTTP_ERROR),n.on("httpError",function(t){o.error=t,o.error.retryable=!1});var a=o.httpResponse.createUnbufferedStream();2===r.HttpClient.streamsApiVersion?a.pipe(i):(a.on("data",function(t){i.emit("data",t)}),a.on("end",function(){i.emit("end")})),a.on("error",function(t){i.emit("error",t)})}}),this.on("error",function(t){i.emit("error",t)}),i},emitEvent:function(t,e,n){"function"==typeof e&&(n=e,e=null),n||(n=function(){}),e||(e=this.eventParameters(t,this.response));var i=r.SequentialExecutor.prototype.emit;i.call(this,t,e,function(t){t&&(this.response.error=t),n.call(this,t)})},eventParameters:function(t){switch(t){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(t,e){return e||"function"!=typeof t||(e=t,t=null),(new r.Signers.Presign).sign(this.toGet(),t,e)},toUnauthenticated:function(){return this.removeListener("validate",r.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",r.EventListeners.Core.SIGN),this},toGet:function(){return("query"===this.service.api.protocol||"ec2"===this.service.api.protocol)&&(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(t){t.httpRequest.method="GET",t.httpRequest.path=t.service.endpoint.path+"?"+t.httpRequest.body,t.httpRequest.body="",delete t.httpRequest.headers["Content-Length"],delete t.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),r.util.mixin(r.Request,r.SequentialExecutor)}).call(e,n(5))},function(t,e,n){var r=n(1),i=r.util.inherit;r.ResourceWaiter=i({constructor:function(t,e){this.service=t,this.state=e,"object"==typeof this.state&&r.util.each.call(this,this.state,function(t,e){this.state=t,this.expectedValue=e}),this.loadWaiterConfig(this.state),this.expectedValue||(this.expectedValue=this.config.successValue)},service:null,state:null,expectedValue:null,config:null,waitDone:!1,Listeners:{retry:(new r.SequentialExecutor).addNamedListeners(function(t){t("RETRY_CHECK","retry",function(t){var e=t.request._waiter;t.error&&"ResourceNotReady"===t.error.code&&(t.error.retryDelay=1e3*e.config.interval)})}),output:(new r.SequentialExecutor).addNamedListeners(function(t){t("CHECK_OUT_ERROR","extractError",function(t){t.error&&t.request._waiter.setError(t,!0)}),t("CHECK_OUTPUT","extractData",function(t){var e=t.request._waiter,n=e.checkSuccess(t);n?t.error=null:e.setError(t,null===n?!1:!0)})}),error:(new r.SequentialExecutor).addNamedListeners(function(t){t("CHECK_ERROR","extractError",function(t){var e=t.request._waiter,n=e.checkError(t);n?(t.error=null,t.data={},t.request.removeAllListeners("extractData")):e.setError(t,null===n?!1:!0)}),t("CHECK_ERR_OUTPUT","extractData",function(t){t.request._waiter.setError(t,!0)})})},wait:function(t,e){"function"==typeof t&&(e=t,t=void 0);var n=this.service.makeRequest(this.config.operation,t),r=this.Listeners[this.config.successType];return n._waiter=this,n.response.maxRetries=this.config.maxAttempts,n.addListeners(this.Listeners.retry),r&&n.addListeners(r),e&&n.send(e),n},setError:function(t,e){t.data=null,t.error=r.util.error(t.error||new Error,{code:"ResourceNotReady",message:"Resource is not in the state "+this.state,retryable:e})},checkSuccess:function(t){if(!this.config.successPath)return t.httpResponse.statusCode<300;var e=r.util.jamespath.find(this.config.successPath,t.data);return this.config.failureValue&&this.config.failureValue.indexOf(e)>=0?null:this.expectedValue?e===this.expectedValue:e?!0:!1},checkError:function(t){var e=this.config.successValue;return"number"==typeof e?t.httpResponse.statusCode===e:t.error&&t.error.code===e},loadWaiterConfig:function(t,e){if(!this.service.api.waiters[t]){if(e)return;throw new r.util.error(new Error,{code:"StateNotFoundError",message:"State "+t+" not found."})}this.config=this.service.api.waiters[t];var n=this.config;!function(){n.successType=n.successType||n.acceptorType,n.successPath=n.successPath||n.acceptorPath,n.successValue=n.successValue||n.acceptorValue,n.failureType=n.failureType||n.acceptorType,n.failurePath=n.failurePath||n.acceptorPath,n.failureValue=n.failureValue||n.acceptorValue}()}})},function(t,e,n){var r=n(1),i=r.util.inherit;r.Response=i({constructor:function(t){this.request=t,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new r.HttpResponse,t&&(this.maxRetries=t.service.numRetries(),this.maxRedirects=t.service.config.maxRedirects)},nextPage:function(t){var e,n=this.request.service,i=this.request.operation;try{e=n.paginationConfig(i,!0)}catch(o){this.error=o}if(!this.hasNextPage()){if(t)t(this.error,null);else if(this.error)throw this.error;return null}var a=r.util.copy(this.request.params);if(this.nextPageTokens){var s=e.inputToken;"string"==typeof s&&(s=[s]);for(var u=0;ut.partSize&&(t.partSize=n)}else t.totalBytes=void 0},isDoneChunking:!1,partPos:0,totalChunkedBytes:0,totalUploadedBytes:0,totalBytes:void 0,numParts:0,totalPartNumbers:0,activeParts:0,doneParts:0,parts:null,completeInfo:null,failed:!1,multipartReq:null,partBuffers:null,partBufferLength:0,fillBuffer:function(){var t=this,e=i(t.body);if(0===e)return t.isDoneChunking=!0,t.numParts=1,void t.nextChunk(t.body);for(;t.activeParts=t.queueSize)){var n=t.body.read(t.partSize-t.partBufferLength)||t.body.read();if(n&&(t.partBuffers.push(n),t.partBufferLength+=n.length,t.totalChunkedBytes+=n.length),t.partBufferLength>=t.partSize){var r=e.concat(t.partBuffers);if(t.partBuffers=[],t.partBufferLength=0,r.length>t.partSize){var i=r.slice(t.partSize);t.partBuffers.push(i),t.partBufferLength+=i.length,r=r.slice(0,t.partSize)}t.nextChunk(r)}t.isDoneChunking&&!t.isDoneSending&&(r=e.concat(t.partBuffers),t.partBuffers=[],t.partBufferLength=0,t.totalBytes=t.totalChunkedBytes,t.isDoneSending=!0,(0===t.numParts||r.length>0)&&(t.numParts++,t.nextChunk(r))),t.body.read(0)}},nextChunk:function(t){var e=this;if(e.failed)return null;var n=++e.totalPartNumbers;if(e.isDoneChunking&&1===n){var i=e.service.putObject({Body:t});return i._managedUpload=e,i.on("httpUploadProgress",e.progress).send(e.finishSinglePart),null}if(e.service.config.params.ContentMD5){var o=r.util.error(new Error("The Content-MD5 you specified is invalid for multi-part uploads."),{code:"InvalidDigest",retryable:!1});return e.cleanup(o),null}return e.completeInfo[n]&&null!==e.completeInfo[n].ETag?null:(e.activeParts++,void(e.service.config.params.UploadId?e.uploadPart(t,n):e.multipartReq?e.queueChunks(t,n):(e.multipartReq=e.service.createMultipartUpload(),e.multipartReq.on("success",function(t){e.service.config.params.UploadId=t.data.UploadId,e.multipartReq=null}),e.queueChunks(t,n),e.multipartReq.on("error",function(t){e.cleanup(t)}),e.multipartReq.send())))},uploadPart:function(t,e){var n=this,i={Body:t,ContentLength:r.util.string.byteLength(t),PartNumber:e},o={ETag:null,PartNumber:e};n.completeInfo[e]=o;var a=n.service.uploadPart(i);n.parts[e]=a,a._lastUploadedBytes=0,a._managedUpload=n,a.on("httpUploadProgress",n.progress),a.send(function(t,e){if(delete n.parts[i.PartNumber],n.activeParts--,!(t||e&&e.ETag)){var a="No access to ETag property on response.";r.util.isBrowser()&&(a+=" Check CORS configuration to expose ETag header."),t=r.util.error(new Error(a),{code:"ETagMissing",retryable:!1})}return t?n.cleanup(t):(o.ETag=e.ETag,n.doneParts++,void(n.isDoneChunking&&n.doneParts===n.numParts?n.finishMultiPart():n.fillQueue.call(n)))})},queueChunks:function(t,e){var n=this;n.multipartReq.on("success",function(){n.uploadPart(t,e)})},cleanup:function(t){var e=this;e.failed||("function"==typeof e.body.removeAllListeners&&"function"==typeof e.body.resume&&(e.body.removeAllListeners("readable"),e.body.removeAllListeners("end"),e.body.resume()),e.service.config.params.UploadId&&!e.leavePartsOnError&&e.service.abortMultipartUpload().send(),r.util.each(e.parts,function(t,e){e.removeAllListeners("complete"),e.abort()}),e.activeParts=0,e.partPos=0,e.numParts=0,e.totalPartNumbers=0,e.parts={},e.failed=!0,e.callback(t))},finishMultiPart:function(){var t=this,e={MultipartUpload:{Parts:t.completeInfo.slice(1)}};t.service.completeMultipartUpload(e,function(e,n){return e?t.cleanup(e):void t.callback(e,n)})},finishSinglePart:function(t,e){var n=this.request._managedUpload,r=this.request.httpRequest,i=r.endpoint;return t?n.callback(t):(e.Location=[i.protocol,"//",i.host,r.path].join(""),e.key=this.request.params.Key,void n.callback(t,e))},progress:function(t){var e=this._managedUpload;"putObject"===this.operation?(t.part=1,t.key=this.params.Key):(e.totalUploadedBytes+=t.loaded-this._lastUploadedBytes,this._lastUploadedBytes=t.loaded,t={loaded:e.totalUploadedBytes,total:e.totalBytes,part:this.params.PartNumber,key:this.params.Key}),e.emit("httpUploadProgress",[t])}}),r.util.mixin(r.S3.ManagedUpload,r.SequentialExecutor),t.exports=r.S3.ManagedUpload}).call(e,n(3).Buffer)},function(t,e,n){var r=n(1),i=n(28),o=n(74),a=r.util.inherit;r.Service=a({constructor:function(t){if(!this.loadServiceClass)throw r.util.error(new Error,"Service must be constructed with `new' operator");var e=this.loadServiceClass(t||{});return e?new e(t):void this.initialize(t)},initialize:function(t){var e=r.config[this.serviceIdentifier];this.config=new r.Config(r.config),e&&this.config.update(e,!0),t&&this.config.update(t,!0),this.validateService(),this.config.endpoint||o(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint)},validateService:function(){},loadServiceClass:function(t){var e=t;if(r.util.isEmpty(this.api)){if(e.apiConfig)return r.Service.defineServiceApi(this.constructor,e.apiConfig);if(this.constructor.services){e=new r.Config(r.config),e.update(t,!0);var n=e.apiVersions[this.constructor.serviceIdentifier];return n=n||e.apiVersion,this.getLatestServiceClass(n)}return null}return null},getLatestServiceClass:function(t){return t=this.getLatestServiceVersion(t),null===this.constructor.services[t]&&r.Service.defineServiceApi(this.constructor,t),this.constructor.services[t]},getLatestServiceVersion:function(t){if(!this.constructor.services||0===this.constructor.services.length)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(t?r.util.isType(t,Date)&&(t=r.util.date.iso8601(t).split("T")[0]):t="latest",Object.hasOwnProperty(this.constructor.services,t))return t;for(var e=Object.keys(this.constructor.services).sort(),n=null,i=e.length-1;i>=0;i--)if("*"!==e[i][e[i].length-1]&&(n=e[i]),e[i].substr(0,10)<=t)return n;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+t+"'")},api:{},defaultRetryCount:3,makeRequest:function(t,e,n){if("function"==typeof e&&(n=e,e=null),e=e||{},this.config.params){var i=this.api.operations[t];i&&(e=r.util.copy(e),r.util.each(this.config.params,function(t,n){i.input.members[t]&&(void 0===e[t]||null===e[t])&&(e[t]=n)}))}var o=new r.Request(this,t,e);return this.addAllRequestListeners(o),n&&o.send(n),o},makeUnauthenticatedRequest:function(t,e,n){"function"==typeof e&&(n=e,e={});var r=this.makeRequest(t,e).toUnauthenticated();return n?r.send(n):r},waitFor:function(t,e,n){var i=new r.ResourceWaiter(this,t);return i.wait(e,n)},addAllRequestListeners:function(t){for(var e=[r.events,r.EventListeners.Core,this.serviceInterface(),r.EventListeners.CorePost],n=0;nn;++n)e[n]=30*Math.pow(2,n);return e},retryableError:function(t){return this.networkingError(t)?!0:this.expiredCredentialsError(t)?!0:this.throttledError(t)?!0:t.statusCode>=500?!0:!1},networkingError:function(t){return"NetworkingError"===t.code},expiredCredentialsError:function(t){return"ExpiredTokenException"===t.code},clockSkewError:function(t){switch(t.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},throttledError:function(t){switch(t.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":return!0;default:return!1}},endpointFromTemplate:function(t){if("string"!=typeof t)return t;var e=t;return e=e.replace(/\{service\}/g,this.api.endpointPrefix),e=e.replace(/\{region\}/g,this.config.region),e=e.replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(t){this.endpoint=new r.Endpoint(t,this.config)},paginationConfig:function(t,e){var n=this.api.operations[t].paginator;if(!n){if(e){var i=new Error;throw r.util.error(i,"No pagination configuration for "+t)}return null}return n}}),r.util.update(r.Service,{defineMethods:function(t){r.util.each(t.prototype.api.operations,function(e){t.prototype[e]||(t.prototype[e]=function(t,n){return this.makeRequest(e,t,n)})})},defineService:function(t,e,n){r.Service._serviceMap[t]=!0,Array.isArray(e)||(n=e,e=[]);var i=a(r.Service,n||{});if("string"==typeof t){r.Service.addVersions(i,e);var o=i.serviceIdentifier||t;i.serviceIdentifier=o}else i.prototype.api=t,r.Service.defineMethods(i);return i},addVersions:function(t,e){Array.isArray(e)||(e=[e]),t.services=t.services||{};for(var n=0;n604800){var n="Presigning does not support expiry time greater than a week with SigV4 signing.";throw o.util.error(new Error,{code:"InvalidExpiryTime",message:n,retryable:!1})}t.httpRequest.headers[s]=e}else{if(t.service.getSignerClass()!==o.Signers.S3)throw o.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});t.httpRequest.headers[s]=parseInt(o.util.date.unixTimestamp()+e,10).toString()}}function i(t){var e=t.httpRequest.endpoint,n=o.util.urlParse(t.httpRequest.path),r={};n.search&&(r=o.util.queryStringParse(n.search.substr(1))),o.util.each(t.httpRequest.headers,function(t,e){ t===s&&(t="Expires"),0===t.indexOf("x-amz-")&&(t=t.toLowerCase()),r[t]=e}),delete t.httpRequest.headers[s];var i=r.Authorization.split(" ");if("AWS"===i[0])i=i[1].split(":"),r.AWSAccessKeyId=i[0],r.Signature=i[1];else if("AWS4-HMAC-SHA256"===i[0]){i.shift();var a=i.join(" "),u=a.match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];r["X-Amz-Signature"]=u,delete r.Expires}delete r.Authorization,delete r.Host,e.pathname=n.pathname,e.search=o.util.queryParamsToString(r)}var o=n(1),a=o.util.inherit,s="presigned-expires";o.Signers.Presign=a({sign:function(t,e,n){if(t.httpRequest.headers[s]=e||3600,t.on("build",r),t.on("sign",i),t.removeListener("afterBuild",o.EventListeners.Core.SET_CONTENT_LENGTH),t.removeListener("afterBuild",o.EventListeners.Core.COMPUTE_SHA256),t.emit("beforePresign",[t]),!n){if(t.build(),t.response.error)throw t.response.error;return o.util.urlFormat(t.httpRequest.endpoint)}t.build(function(){this.response.error?n(this.response.error):n(null,o.util.urlFormat(t.httpRequest.endpoint))})}}),t.exports=o.Signers.Presign},function(t,e,n){var r=n(1),i=r.util.inherit;r.Signers.RequestSigner=i({constructor:function(t){this.request=t}}),r.Signers.RequestSigner.getVersion=function(t){switch(t){case"v2":return r.Signers.V2;case"v3":return r.Signers.V3;case"v4":return r.Signers.V4;case"s3":return r.Signers.S3;case"v3https":return r.Signers.V3Https}throw new Error("Unknown signing version "+t)},n(84),n(51),n(85),n(86),n(83),n(81)},function(t,e,n){var r=n(1),i=r.util.inherit;r.Signers.S3=i(r.Signers.RequestSigner,{subResources:{acl:1,cors:1,lifecycle:1,"delete":1,location:1,logging:1,notification:1,partNumber:1,policy:1,requestPayment:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(t,e){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=r.util.date.rfc822(e)),t.sessionToken&&(this.request.headers["x-amz-security-token"]=t.sessionToken);var n=this.sign(t.secretAccessKey,this.stringToSign()),i="AWS "+t.accessKeyId+":"+n;this.request.headers.Authorization=i},stringToSign:function(){var t=this.request,e=[];e.push(t.method),e.push(t.headers["Content-MD5"]||""),e.push(t.headers["Content-Type"]||""),e.push(t.headers["presigned-expires"]||"");var n=this.canonicalizedAmzHeaders();return n&&e.push(n),e.push(this.canonicalizedResource()),e.join("\n")},canonicalizedAmzHeaders:function(){var t=[];r.util.each(this.request.headers,function(e){e.match(/^x-amz-/i)&&t.push(e)}),t.sort(function(t,e){return t.toLowerCase()=0?"&":"?";this.request.path+=o+r.util.queryParamsToString(i)},authorization:function(t,e){var n=[],r=this.credentialString(e);return n.push(this.algorithm+" Credential="+t.accessKeyId+"/"+r),n.push("SignedHeaders="+this.signedHeaders()),n.push("Signature="+this.signature(t,e)),n.join(", ")},signature:function(t,e){var n=null;if(this.signatureCache)var n=o[this.serviceName];var i=e.substr(0,8);if(!n||n.akid!==t.accessKeyId||n.region!==this.request.region||n.date!==i){var a=t.secretAccessKey,s=r.util.crypto.hmac("AWS4"+a,i,"buffer"),u=r.util.crypto.hmac(s,this.request.region,"buffer"),c=r.util.crypto.hmac(u,this.serviceName,"buffer"),l=r.util.crypto.hmac(c,"aws4_request","buffer");if(!this.signatureCache)return r.util.crypto.hmac(l,this.stringToSign(e),"hex");o[this.serviceName]={region:this.request.region,date:i,key:l,akid:t.accessKeyId}}var f=o[this.serviceName].key;return r.util.crypto.hmac(f,this.stringToSign(e),"hex")},stringToSign:function(t){var e=[];return e.push("AWS4-HMAC-SHA256"),e.push(t),e.push(this.credentialString(t)),e.push(this.hexEncodedHash(this.canonicalString())),e.join("\n")},canonicalString:function(){var t=[],e=this.request.pathname();return"s3"!==this.serviceName&&(e=r.util.uriEscapePath(e)),t.push(this.request.method),t.push(e),t.push(this.request.search()),t.push(this.canonicalHeaders()+"\n"),t.push(this.signedHeaders()),t.push(this.hexEncodedBodyHash()),t.join("\n")},canonicalHeaders:function(){var t=[];r.util.each.call(this,this.request.headers,function(e,n){t.push([e,n])}),t.sort(function(t,e){return t[0].toLowerCase()0||r?o.root().toString():""},t.exports=r},function(t,e,n){function r(){}function i(t,e){switch(e.type){case"structure":return o(t,e);case"map":return a(t,e);case"list":return s(t,e);case void 0:case null:return c(t);default:return u(t,e)}}function o(t,e){var n={};return null===t?n:(l.each(e.members,function(e,r){var o=r.name;if(t.hasOwnProperty(o)&&Array.isArray(t[o])){var a=t[o];r.flattened||(a=a[0]),n[e]=i(a,r)}else r.isXmlAttribute&&t.$&&t.$.hasOwnProperty(o)?n[e]=u(t.$[o],r):"list"===r.type&&(n[e]=r.defaultValue)}),n)}function a(t,e){var n={};if(null===t)return n;var r=e.key.name||"key",o=e.value.name||"value",a=e.flattened?t:t.entry;return Array.isArray(a)&&l.arrayEach(a,function(t){n[t[r][0]]=i(t[o][0],e.value)}),n}function s(t,e){var n=[],r=e.member.name||"member";return e.flattened?l.arrayEach(t,function(t){n.push(i(t,e.member))}):t&&Array.isArray(t[r])&&l.arrayEach(t[r],function(t){n.push(i(t,e.member))}),n}function u(t,e){return t&&t.$&&"base64"===t.$.encoding&&(e=new f.create({type:t.$.encoding})),t&&t._&&(t=t._),"function"==typeof e.toType?e.toType(t):t}function c(t){if(void 0===t||null===t)return"";if("string"==typeof t)return t;if(Array.isArray(t)){var e=[];for(n=0;n1?o[a]=s(u,{member:{}}):o[a]=i(u[0],{}))}return o}var l=n(2),f=n(6),h=n(128),d={explicitCharkey:!1,trim:!1,normalize:!1,explicitRoot:!1,emptyTag:null,explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,validator:null};r.prototype.parse=function(t,e){e=e||{};var n=null,r=null,o=new h.Parser(d);if(o.parseString(t,function(t,e){r=t,n=e}),n){var a=i(n,e);return n.ResponseMetadata&&(a.ResponseMetadata=i(n.ResponseMetadata[0],{})),a}if(r)throw l.error(r,{code:"XMLParserError"});return i({},e)},t.exports=r},function(t,e,n){(function(t){function n(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,i="/"===a.charAt(0))}return e=n(r(e.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+e||"."},e.normalize=function(t){var i=e.isAbsolute(t),o="/"===a(t,-1);return t=n(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var i=r(t.split("/")),o=r(n.split("/")),a=Math.min(i.length,o.length),s=a,u=0;a>u;u++)if(i[u]!==o[u]){s=u;break}for(var c=[],u=s;ue&&(e=t.length+e),t.substr(e,n)}}).call(e,n(5))},function(t,e,n){function r(t,e){this.afterTransform=function(t,n){return i(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function i(t,e,n){var r=t._transformState;r.transforming=!1;var i=r.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,u.isNullOrUndefined(n)||t.push(n),i&&i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length1){for(var n=[],r=0;r getFirepadLib",file:"classes/File"}),"undefined"!=typeof window&&window.Firepad&&window.ace?window.Firepad:"undefined"!=typeof r&&r.Firepad&&r.ace?r.Firepad:(b.debug({description:"Firepad does not currently exist.",func:"fbRef",obj:"File"}),null)}var u=function(){function t(t,e){for(var n=0;n1)return f.default.info({description:"String list of groups.",list:r,func:"isInGroup",obj:"Matter"}),{v:e.isInGroups(r)};var i=e.token.data.groups||[];return f.default.log({description:"Checking if user is in group.",group:n,userGroups:e.token.data.groups,func:"isInGroup",obj:"Matter"}),{v:(0,E.some)(i,function(t){return n==t.name})}}();return"object"===("undefined"==typeof n?"undefined":a(n))?n.v:void 0}},{key:"isInGroups",value:function(t){var e=this;if(!this.isLoggedIn)return f.default.log({description:"No logged in user to check.",func:"isInGroups",obj:"Matter"}),!1;if(!t)return f.default.log({description:"Invalid group(s).",func:"isInGroup",obj:"Matter"}),!1;if((0,E.isArray)(t))return(0,E.every)(t.map(function(t){return(0,E.isString)(t)?e.isInGroup(t):(0,E.has)(t,"name")?e.isInGroup(t.name):(f.default.error({description:"Invalid group object.",group:t,func:"isInGroups",obj:"Matter"}),!1)}),!0);if((0,E.isString)(t)){var n=t.split(",");return n.length>1?this.isInGroups(n):this.isInGroup(n[0])}return f.default.error({description:"Invalid groups list.",func:"isInGroups",obj:"Matter"}),!1}},{key:"isLoggedIn",get:function(){return this.token.string?!0:!1}},{key:"endpoint",get:function(){(0,E.has)(this,"options")&&(this.options.localServer&&(c.default.envName="local",f.default.log({description:"LocalServer option was set to true. Now server url is local server.",url:c.default.serverUrl,func:"endpoint",obj:"Matter"})),this.options.env&&(c.default.envName=this.options.env,f.default.log({description:"Environment set based on provided environment.",config:c.default,func:"endpoint",obj:"Matter"})));var t=c.default.serverUrl+"/apps/"+this.name;return"tessellate"==this.name&&("undefined"!=typeof window&&(0,E.has)(window,"location")&&-1!==window.location.host.indexOf("tessellate")?(t="",f.default.info({description:"Host is Tessellate Server, serverUrl simplified!",url:t,func:"endpoint",obj:"Matter"})):(t=c.default.serverUrl,f.default.info({description:"App is tessellate, serverUrl set as main tessellate server.",url:t,func:"endpoint",obj:"Matter"}))),f.default.log({description:"Endpoint created.",url:t,func:"endpoint",obj:"Matter"}),t}},{key:"urls",get:function(){return this.token&&this.token.data&&this.token.data.username?{update:this.endpoint+"/account/"+this.token.data.username,upload:this.endpoint+"/account/"+this.token.data.username+"/upload",recover:this.endpoint+"/recover"}:{recover:this.endpoint+"/recover"}}},{key:"currentUser",set:function(t){f.default.debug({description:"Current User set.",user:t,func:"currentUser",obj:"Matter"}),this.storage.setItem(c.default.tokenUserDataName,t)},get:function(){return this.storage.getItem(c.default.tokenUserDataName)?this.storage.getItem(c.default.tokenUserDataName):null}},{key:"storage",get:function(){return b.default}},{key:"token",get:function(){return m.default}},{key:"utils",get:function(){return{logger:f.default,request:g.default,storage:b.default,dom:d}}}]),t}();e.default=j,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("undefined"==typeof document)throw c.default.error({description:"Document does not exsist to load assets into.",func:"loadCss",obj:"dom"}),new Error("Document object is required to load assets.");var e=document.createElement("link");return e.rel="stylesheet",e.type="text/css",e.href=t,document.getElementsByTagName("head")[0].insertBefore(e,document.getElementsByTagName("head")[0].firstChild),c.default.log({description:"CSS was loaded into document.",element:e,func:"loadCss",obj:"dom"}),e}function o(t){if("undefined"!=typeof window&&(0,l.has)(window,"document")){var e=window.document.createElement("script");return e.src=t,e.type="text/javascript",window.document.getElementsByTagName("head")[0].appendChild(e),c.default.log({description:"JS was loaded into document.",element:e,func:"loadJs",obj:"dom"}),e}throw c.default.error({description:"Document does not exsist to load assets into.",func:"loadJs",obj:"dom"}),new Error("Document object is required to load assets.")}function a(t){if("undefined"!=typeof window&&(0,l.has)(window,"document")){var e=window.document.createElement("script");return e.src=t,e.type="text/javascript",window.document.getElementsByTagName("head")[0].appendChild(e),c.default.log({description:"JS was loaded into document.",element:e,func:"asyncLoadJs",obj:"dom"}),new Promise(function(t){window.setTimeout(t,200)})}throw c.default.error({description:"Document does not exsist to load assets into.",func:"asyncLoadJs",obj:"dom"}),new Error("Document object is required to load assets.")}function s(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)"),n=e.exec(location.search);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}Object.defineProperty(e,"__esModule",{value:!0}),e.loadCss=i,e.loadJs=o,e.asyncLoadJs=a,e.getQueryParam=s;var u=n(9),c=r(u),l=n(4)},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(9),o=r(i),a=n(4),s=r(a),u={},c={get localExists(){var t="test";if("undefined"==typeof window||"undefined"==typeof window.sessionStorage)return!1;try{return window.sessionStorage.setItem(t,"1"),window.sessionStorage.removeItem(t),!0}catch(e){return o.default.error({description:"Error saving to session storage",error:e,obj:"storage",func:"localExists"}),!1}},item:function(t,e){return this.setItem(t,e)},setItem:function(t,e){u[t]=e,this.localExists&&(s.default.isObject(e)&&(e=JSON.stringify(e)),window.sessionStorage.setItem(t,e))},getItem:function(t){if(u[t])return u[t];if(this.localExists){var e=window.sessionStorage.getItem(t);if(e){var n=!1,r=null;try{r=JSON.parse(e),n=!0}catch(i){n=!1}if(n)return r}return e}return null},removeItem:function(t){if(u[t]&&(u[t]=null),this.localExists)try{window.sessionStorage.removeItem(t)}catch(e){o.default.error({description:"Error removing item from session storage",error:e,obj:"storage",func:"removeItem"})}},clear:function(){if(u={},this.localExists)try{window.sessionStorage.clear()}catch(t){o.default.warn({description:"Session storage could not be cleared.",error:t})}}};e.default=c,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return new Promise(function(e,n){return"function"!=typeof t.end?(s.default.warn({description:"req.end is not a function",func:"handleResponse"}),n("req.end is not a function")):void t.end(function(t,r){if(t){var i=t.response.body.error?t.response.body.error:t.response.body;return s.default.warn({description:"Error in request.",error:i,errorRes:t,func:"handleResponse"}),401==t.status&&s.default.warn({description:"Unauthorized. You must be signed into make this request.",func:"handleResponse"}),n(i.message||i)}try{var o=JSON.parse(r.body);e(o)}catch(a){e(r.body)}})})}function o(t){return c.default.string&&(t=t.set("Authorization","Bearer "+c.default.string)),t}Object.defineProperty(e,"__esModule",{value:!0});var a=n(9),s=r(a),u=n(105),c=r(u),l=n(124),f=r(l),h={get:function(t,e){var n=f.default.get(t);return e&&n.query(e),n=o(n),i(n)},post:function(t,e){var n=f.default.post(t).send(e);return n=o(n),i(n)},put:function(t,e){var n=f.default.put(t,e);return n=o(n),i(n)},del:function(t,e){var n=f.default.put(t,e);return n=o(n),i(n)}};e.default=h,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e=void 0;if(t&&""!=t)try{e=(0,h.default)(t)}catch(n){throw u.default.error({description:"Error decoding token.",data:e,error:n,func:"decodeToken",file:"token"}),new Error("Invalid token string.")}return e}Object.defineProperty(e,"__esModule",{value:!0});var o=n(22),a=r(o),s=n(9),u=r(s),c=n(103),l=r(c),f=n(120),h=r(f),d=n(4),p=r(d),g={get string(){return l.default.getItem(a.default.tokenName)},get data(){return l.default.getItem(a.default.tokenDataName)?l.default.getItem(a.default.tokenDataName):i(this.string)},set data(t){if(p.default.isString(t)){var e=t;t=i(e),u.default.info({description:"Token data was set as string. Decoding token.",token:e,tokenData:t,func:"data",obj:"token"})}else u.default.log({description:"Token data was set.",data:t,func:"data",obj:"token"}),l.default.setItem(a.default.tokenDataName,t)},set string(t){var e=void 0;if(p.default.isString(t))e=t;else{if(u.default.log({description:"Token data is not string.",token:t,func:"string",obj:"token"}),!p.default.isObject(t)||!p.default.has(t,"token"))return void u.default.error({description:"Invalid value set to token.",token:t,func:"string",obj:"token"});e=t.token}u.default.log({description:"Token was set.",token:t,tokenStr:e,func:"string",obj:"token"}),l.default.setItem(a.default.tokenName,e),this.data=(0,h.default)(e)},save:function(t){this.string=t},"delete":function(){l.default.removeItem(a.default.tokenName),l.default.removeItem(a.default.tokenDataName),u.default.log({description:"Token was removed.",func:"delete",obj:"token"})}};e.default=g,t.exports=e.default},function(t,e,n){(function(e){var r=n(1);t.exports=r,r.apiLoader=n(23).load,r.XML.Parser=n(90),n(69),n(80),n(58),n(59),n(60),n(62),r.CredentialProviderChain.defaultProviders=[function(){return new r.EnvironmentCredentials("AWS")},function(){return new r.EnvironmentCredentials("AMAZON")},function(){return new r.SharedIniFileCredentials},function(){return new r.EC2MetadataCredentials}],r.util.update(r.Config.prototype.keys,{credentials:function(){var t=null;return new r.CredentialProviderChain([function(){return new r.EnvironmentCredentials("AWS")},function(){return new r.EnvironmentCredentials("AMAZON")},function(){return new r.SharedIniFileCredentials}]).resolve(function(e,n){e||(t=n)}),t},credentialProvider:function(){return new r.CredentialProviderChain},region:function(){return e.env.AWS_REGION||e.env.AMAZON_REGION}}),r.config=new r.Config}).call(e,n(5))},function(t,e){t.exports={rules:{"*/*":{endpoint:"{service}.{region}.amazonaws.com"},"cn-*/*":{endpoint:"{service}.{region}.amazonaws.com.cn"},"*/cloudfront":"globalSSL","*/iam":"globalSSL","*/sts":"globalSSL","*/importexport":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2",globalEndpoint:!0},"*/route53":{endpoint:"https://{service}.amazonaws.com",signatureVersion:"v3https",globalEndpoint:!0},"*/waf":"globalSSL","us-gov-*/iam":"globalGovCloud","us-gov-*/sts":{endpoint:"{service}.{region}.amazonaws.com"},"us-gov-west-1/s3":"s3dash","us-west-1/s3":"s3dash","us-west-2/s3":"s3dash","eu-west-1/s3":"s3dash","ap-southeast-1/s3":"s3dash","ap-southeast-2/s3":"s3dash","ap-northeast-1/s3":"s3dash","sa-east-1/s3":"s3dash","us-east-1/s3":{endpoint:"{service}.amazonaws.com",signatureVersion:"s3"},"us-east-1/sdb":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2"},"*/sdb":{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"v2"}},patterns:{globalSSL:{endpoint:"https://{service}.amazonaws.com",globalEndpoint:!0},globalGovCloud:{endpoint:"{service}.us-gov.amazonaws.com"},s3dash:{endpoint:"{service}-{region}.amazonaws.com",signatureVersion:"s3"}}}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){(function(e){function r(t){return function(){var n=[],r={update:function(t,r){return e.isBuffer(t)||(t=new e(t,r)),n.push(t),this},digest:function(r){var i=e.concat(n),o=t(i);return n=null,r?o.toString(r):o}};return r}}var i=n(141),o=r(n(137)),a=r(n(139));t.exports=function(t){return"md5"===t?new o:"rmd160"===t?new a:i(t)}}).call(e,n(3).Buffer)},function(t,e,n){(function(t){function r(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function i(t,e){for(var n in t)e(t[n],n)}var o=n(146);e.createHash=n(109),e.createHmac=n(135),e.randomBytes=function(e,n){if(!n||!n.call)return new t(o(e));try{n.call(this,void 0,new t(o(e)))}catch(r){n(r)}},e.getHashes=function(){return["sha1","sha256","sha512","md5","rmd160"]};var a=n(145)(e);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync,i(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman"],function(t){e[t]=function(){r("sorry,",t,"is not implemented yet")}})}).call(e,n(3).Buffer)},function(t,e,n){var r=t.exports,i=(n(18).EventEmitter,n(147)),o=n(52);r.request=function(t,e){"string"==typeof t&&(t=o.parse(t)),t||(t={}),t.host||t.port||(t.port=parseInt(window.location.port,10)),!t.host&&t.hostname&&(t.host=t.hostname),t.protocol||(t.scheme?t.protocol=t.scheme+":":t.protocol=window.location.protocol),t.host||(t.host=window.location.hostname||window.location.host),/:/.test(t.host)&&(t.port||(t.port=t.host.split(":")[1]),t.host=t.host.split(":")[0]),t.port||(t.port="https:"==t.protocol?443:80);var n=new i(new a,t);return e&&n.on("response",e),n},r.get=function(t,e){t.method="GET";var n=r.request(t,e);return n.end(),n},r.Agent=function(){},r.Agent.defaultMaxSockets=4;var a=function(){if("undefined"==typeof window)throw new Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject){for(var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],e=0;e0)if(e.ended&&!i){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&i){var s=new Error("stream.unshift() after end event");t.emit("error",s)}else!e.decoder||i||r||(n=e.decoder.write(n)),i||(e.reading=!1),e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,i?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&f(t)),d(t,e);else i||(e.reading=!1);return a(e)}function a(t){return!t.ended&&(t.needReadable||t.length=R)t=R;else{t--;for(var e=1;32>e;e<<=1)t|=t>>e;t++}return t}function u(t,e){return 0===e.length&&e.ended?0:e.objectMode?0===t?0:1:isNaN(t)||x.isNull(t)?e.flowing&&e.buffer.length?e.buffer[0].length:e.length:0>=t?0:(t>e.highWaterMark&&(e.highWaterMark=s(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function c(t,e){var n=null;return x.isBuffer(e)||x.isString(e)||x.isNullOrUndefined(e)||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(t,e){if(e.decoder&&!e.ended){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,f(t)}function f(t){var n=t._readableState;n.needReadable=!1,n.emittedReadable||(k("emitReadable",n.flowing),n.emittedReadable=!0,n.sync?e.nextTick(function(){h(t)}):h(t))}function h(t){k("emit readable"),t.emit("readable"),y(t)}function d(t,n){n.readingMore||(n.readingMore=!0,e.nextTick(function(){p(t,n)}))}function p(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(tc&&t>u;c++){var s=r[0],f=Math.min(t-u,s.length);o?n+=s.slice(0,f):s.copy(n,u,0,f),f0)throw new Error("endReadable called on non-empty stream");n.endEmitted||(n.ended=!0,e.nextTick(function(){n.endEmitted||0!==n.length||(n.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function _(t,e){for(var n=0,r=t.length;r>n;n++)e(t[n],n)}function E(t,e){for(var n=0,r=t.length;r>n;n++)if(t[n]===e)return n;return-1}t.exports=i;var j=n(155),S=n(3).Buffer;i.ReadableState=r;var A=n(18).EventEmitter;A.listenerCount||(A.listenerCount=function(t,e){return t.listeners(e).length});var T=n(14),x=n(19);x.inherits=n(20);var C,k=n(168);k=k&&k.debuglog?k.debuglog("stream"):function(){},x.inherits(i,T),i.prototype.push=function(t,e){var n=this._readableState;return x.isString(t)&&!n.objectMode&&(e=e||n.defaultEncoding,e!==n.encoding&&(t=new S(t,e),e="")),o(this,n,t,e,!1)},i.prototype.unshift=function(t){var e=this._readableState;return o(this,e,t,"",!0)},i.prototype.setEncoding=function(t){return C||(C=n(115).StringDecoder),this._readableState.decoder=new C(t),this._readableState.encoding=t,this};var R=8388608;i.prototype.read=function(t){k("read",t);var e=this._readableState,n=t;if((!x.isNumber(t)||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return k("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?w(this):f(this),null;if(t=u(t,e),0===t&&e.ended)return 0===e.length&&w(this),null;var r=e.needReadable;k("need readable",r),(0===e.length||e.length-t0?b(t,e):null,x.isNull(i)&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),n!==t&&e.ended&&0===e.length&&w(this),x.isNull(i)||this.emit("data",i),i},i.prototype._read=function(t){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(t,n){function r(t){k("onunpipe"),t===f&&o()}function i(){k("onend"),t.end()}function o(){k("cleanup"),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("drain",v),t.removeListener("error",s),t.removeListener("unpipe",r),f.removeListener("end",i),f.removeListener("end",o),f.removeListener("data",a),!h.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){k("ondata");var n=t.write(e);!1===n&&(k("false write response, pause",f._readableState.awaitDrain),f._readableState.awaitDrain++,f.pause())}function s(e){k("onerror",e),l(),t.removeListener("error",s),0===A.listenerCount(t,"error")&&t.emit("error",e)}function u(){t.removeListener("finish",c),l()}function c(){k("onfinish"),t.removeListener("close",u),l()}function l(){k("unpipe"),f.unpipe(t)}var f=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=t;break;case 1:h.pipes=[h.pipes,t];break;default:h.pipes.push(t)}h.pipesCount+=1,k("pipe count=%d opts=%j",h.pipesCount,n);var d=(!n||n.end!==!1)&&t!==e.stdout&&t!==e.stderr,p=d?i:o;h.endEmitted?e.nextTick(p):f.once("end",p),t.on("unpipe",r);var v=g(f);return t.on("drain",v),f.on("data",a),t._events&&t._events.error?j(t._events.error)?t._events.error.unshift(s):t._events.error=[s,t._events.error]:t.on("error",s),t.once("close",u),t.once("finish",c),t.emit("pipe",f),h.flowing||(k("pipe resume"),f.resume()),t},i.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=E(e.pipes,t);return-1===i?this:(e.pipes.splice(i,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},i.prototype.on=function(t,n){var r=T.prototype.on.call(this,t,n);if("data"===t&&!1!==this._readableState.flowing&&this.resume(),"readable"===t&&this.readable){var i=this._readableState;if(!i.readableListening)if(i.readableListening=!0,i.emittedReadable=!1,i.needReadable=!0,i.reading)i.length&&f(this,i);else{var o=this;e.nextTick(function(){k("readable nexttick read 0"),o.read(0)})}}return r},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var t=this._readableState;return t.flowing||(k("resume"),t.flowing=!0,t.reading||(k("resume read 0"),this.read(0)),v(this,t)),this},i.prototype.pause=function(){return k("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(k("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(t){var e=this._readableState,n=!1,r=this;t.on("end",function(){if(k("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)}),t.on("data",function(i){if(k("wrapped data"),e.decoder&&(i=e.decoder.write(i)),i&&(e.objectMode||i.length)){var o=r.push(i);o||(n=!0,t.pause())}});for(var i in t)x.isFunction(t[i])&&x.isUndefined(this[i])&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return _(o,function(e){t.on(e,r.emit.bind(r,e))}),r._read=function(e){k("wrapped _read",e),n&&(n=!1,t.resume())},r},i._fromList=b}).call(e,n(5))},function(t,e,n){function r(t){if(t&&!u(t))throw new Error("Unknown encoding: "+t)}function i(t){return t.toString(this.encoding)}function o(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function a(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}var s=n(3).Buffer,u=s.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=e.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),r(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&56319>=r)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),e+=t.toString(this.encoding,0,i);var i=e.length-1,r=e.charCodeAt(i);if(r>=55296&&56319>=r){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,i)}return e},c.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(2>=e&&n>>4==14){this.charLength=3;break}if(3>=e&&n>>3==30){this.charLength=4;break}}this.charReceived=e},c.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},function(t,e,n){function r(t){return n(i(t))}function i(t){return o[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var o={"./apigateway":37,"./apigateway.js":37, -"./cloudfront":38,"./cloudfront.js":38,"./cloudsearchdomain":39,"./cloudsearchdomain.js":39,"./cognitoidentity":40,"./cognitoidentity.js":40,"./dynamodb":41,"./dynamodb.js":41,"./ec2":42,"./ec2.js":42,"./glacier":43,"./glacier.js":43,"./iotdata":44,"./iotdata.js":44,"./machinelearning":45,"./machinelearning.js":45,"./route53":46,"./route53.js":46,"./s3":47,"./s3.js":47,"./sqs":48,"./sqs.js":48,"./sts":49,"./sts.js":49,"./swf":50,"./swf.js":50};r.keys=function(){return Object.keys(o)},r.resolve=i,t.exports=r,r.id=116},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.logger=void 0;var i=n(9),o=r(i);e.logger=o.default},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}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")}var a=function(){function t(t,e){for(var n=0;n>8-o%1*8)){if(i=t.charCodeAt(o+=.75),i>255)throw r;e=e<<8|i}return s}),t.atob||(t.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw r;for(var e,i,o=0,a=0,s="";i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?s+=String.fromCharCode(255&e>>(-2*o&6)):0)i=n.indexOf(i);return s})}()},function(t,e,n){var r;(function(t,i){(function(){function o(t,e){return t.set(e[0],e[1]),t}function a(t,e){return t.add(e),t}function s(t,e,n){var r=n?n.length:0;switch(r){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function u(t,e){for(var n=-1,r=t.length,i=-1,o=e.length,a=Array(r+o);++n-1}function p(t,e,n){for(var r=-1,i=t.length;++r-1;);return n}function I(t,e){for(var n=t.length;n--&&j(e,t[n],0)>-1;);return n}function O(t){return t&&t.Object===Object?t:null}function L(t,e){if(t!==e){var n=null===t,r=t===Y,i=t===t,o=null===e,a=e===Y,s=e===e;if(t>e&&!o||!i||n&&!a&&s||r&&s)return 1;if(e>t&&!n||!s||o&&!r&&i||a&&i)return-1}return 0}function F(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r=s)return u;var c=n[r];return u*("desc"==c?-1:1)}}return t.index-e.index}function q(t){return yn[t]}function U(t){return bn[t]}function M(t){return"\\"+En[t]}function N(t,e,n){for(var r=t.length,i=e+(n?0:-1);n?i--:++i-1&&t%1==0&&e>t}function H(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function W(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function z(t,e){for(var n=-1,r=t.length,i=-1,o=[];++ne,i=n?t.length:0,o=ni(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,f=l.length,h=0,d=Qu(u,this.__takeCount__);if(!n||pt>i||i==u&&d==u)return vr(t,this.__actions__);var p=[];t:for(;u--&&d>h;){c+=e;for(var g=-1,v=t[c];++gn)return!1;var r=t.length-1;return n==r?t.pop():Bu.call(t,n,1),!0}function Ye(t,e){var n=Je(t,e);return 0>n?Y:t[n][1]}function $e(t,e){return Je(t,e)>-1}function Je(t,e){for(var n=t.length;n--;)if(oa(t[n][0],e))return n;return-1}function Ze(t,e,n){var r=Je(t,e);0>r?t.push([e,n]):t[r][1]=n}function tn(t,e,n,r){return t===Y||oa(t,ju[n])&&!Au.call(r,n)?e:t}function en(t,e,n){(n!==Y&&!oa(t[e],n)||"number"==typeof e&&n===Y&&!(e in t))&&(t[e]=n)}function nn(t,e,n){var r=t[e];(!oa(r,n)||oa(r,ju[e])&&!Au.call(t,e)||n===Y&&!(e in t))&&(t[e]=n)}function rn(t,e){return t&&xr(e,as(e),t)}function on(t,e){for(var n=-1,r=null==t,i=e.length,o=Array(i);++n=t?t:n),e!==Y&&(t=t>=e?t:e)),t}function sn(t,e,n,r,i,o){var a;if(n&&(a=i?n(t,r,i,o):n(t)),a!==Y)return a;if(!Ea(t))return t;var s=tl(t);if(s){if(a=ii(t),!e)return Tr(t,a)}else{var u=ei(t),l=u==Ot||u==Lt;if(u!=Ut&&u!=Ct&&(!l||i))return mn[u]?ai(t,u,e):i?t:{};if(D(t))return i?t:{};if(a=oi(l?{}:t),!e)return kr(t,rn(a,t))}o||(o=new We);var f=o.get(t);return f?f:(o.set(t,a),(s?c:xn)(t,function(r,i){nn(a,i,sn(r,e,n,i,t,o))}),s?a:kr(t,a))}function cn(t){var e=as(t),n=e.length;return function(r){if(null==r)return!n;for(var i=n;i--;){var o=e[i],a=t[o],s=r[o];if(s===Y&&!(o in Object(r))||!a(s))return!1}return!0}}function yn(t,e,n){if("function"!=typeof t)throw new _u(yt);return Du(function(){t.apply(Y,n)},e)}function bn(t,e,n,r){var i=-1,o=d,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=g(e,k(n))),r?(o=p,a=!1):e.length>=pt&&(o=Be,a=!1,e=new De(e));t:for(;++in&&(n=-n>i?0:i+n),r=r===Y||r>i?i:Ba(r),0>r&&(r+=i),r=n>r?0:Ha(r);r>n;)t[n++]=e;return t}function En(t,e){var n=[];return lc(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function An(t,e,n,r){r||(r=[]);for(var i=-1,o=t.length;++in;)t=t[e[n++]];return n&&n==r?t:Y}function On(t,e){return Au.call(t,e)||"object"==typeof t&&e in t&&null===qu(t)}function Ln(t,e){return e in Object(t)}function Fn(t,e,n){return t>=Qu(e,n)&&t=120)?new De(o&&u):Y}u=t[0];var c=-1,l=u.length,f=a[0];t:for(;++c-1;)o!==t&&Bu.call(o,a,1),Bu.call(t,a,1);return t}function nr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(r==n||i!=o){var o=i;if(B(i))Bu.call(t,i,1);else if(ci(i,t))delete t[i];else{var a=hr(i),s=vi(t,a);null!=s&&delete s[Ni(a)]}}}return t}function rr(t,e){return t+Wu(Yu()*(e-t+1))}function ir(t,e,n,r){for(var i=-1,o=Gu(Hu((e-t)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=t,t+=n;return a}function or(t,e,n,r){e=ci(e,t)?[e+""]:hr(e);for(var i=-1,o=e.length,a=o-1,s=t;null!=s&&++ie&&(e=-e>i?0:i+e),n=n>i?i:n,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=i){for(;i>r;){var o=r+i>>>1,a=t[o];(n?e>=a:e>a)&&null!==a?r=o+1:i=o}return i}return cr(t,e,Xs,n)}function cr(t,e,n,r){e=n(e);for(var i=0,o=t?t.length:0,a=e!==e,s=null===e,u=e===Y;o>i;){var c=Wu((i+o)/2),l=n(t[c]),f=l!==Y,h=l===l;if(a)var d=h||r;else d=s?h&&f&&(r||null!=l):u?h&&(r||f):null==l?!1:r?e>=l:e>l;d?i=c+1:o=c}return Qu(o,At)}function lr(t){return fr(t)}function fr(t,e){for(var n=0,r=t.length,i=t[0],o=e?e(i):i,a=o,s=0,u=[i];++n=pt){var c=e?null:gc(t);if(c)return K(c);a=!1,i=Be,u=new De}else u=e?[]:s;t:for(;++r1?n[i-1]:Y,a=i>2?n[2]:Y;for(o="function"==typeof o?(i--,o):Y,a&&ui(n[0],n[1],a)&&(o=3>i?Y:o,i=1),e=Object(e);++ro&&u[0]!==l&&u[o-1]!==l?[]:z(u,l);return o-=f.length,n>o?Kr(t,e,Dr,l,Y,u,f,Y,Y,n-o):s(c,this,u)}var i=Ur(t);return r}function Nr(t){return Yo(function(e){e=An(e);var n=e.length,i=n,o=r.prototype.thru;for(t&&e.reverse();i--;){var a=e[i];if("function"!=typeof a)throw new _u(yt);if(o&&!s&&"wrapper"==$r(a))var s=new r([],!0)}for(i=s?i:n;++i=pt)return s.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++iy)return Kr(t,e,Dr,_,n,w,E,s,u,c-y)}var j=h?n:this,S=d?j[t]:t;return s?w=mi(w,s):v&&w.length>1&&w.reverse(),f&&u=e)return"";var i=e-r;n=n===Y?" ":n+"";var o=Os(n,Hu(i/V(n)));return ln.test(n)?G(o).slice(0,i).join(""):o.slice(0,i)}function Wr(t,e,n,r){function i(){for(var e=-1,u=arguments.length,c=-1,l=r.length,f=Array(l+u),h=this&&this!==Pn&&this instanceof i?a:t;++ce?1:-1:Wa(r)||0,ir(e,n,r,t)}}function Kr(t,e,n,r,i,o,a,s,u,c){var l=e&et,f=s?Tr(s):Y,h=l?a:Y,d=l?Y:a,p=l?o:Y,g=l?Y:o;e|=l?rt:it,e&=~(l?it:rt),e&tt||(e&=~(J|Z));var v=[t,e,i,p,h,g,d,f,u,c],m=n.apply(Y,v);return fi(t)&&bc(m,v),m.placeholder=r,m}function Vr(t){var e=bu[t];return function(t,n){if(t=Wa(t),n=Ba(n)){var r=(Va(t)+"e").split("e"),i=e(r[0]+"e"+(+r[1]+n));return r=(Va(i)+"e").split("e"),+(r[0]+"e"+(+r[1]-n))}return e(t)}}function Gr(t,e,n,r,i,o,a,s){var u=e&Z;if(!u&&"function"!=typeof t)throw new _u(yt);var c=r?r.length:0;if(c||(e&=~(rt|it),r=i=Y),a=a===Y?a:Gu(Ba(a),0),s=s===Y?s:Ba(s),c-=i?i.length:0,e&it){var l=r,f=i;r=i=Y}var h=u?Y:vc(t),d=[t,e,n,r,i,l,f,o,a,s];if(h&&pi(d,h),t=d[0],e=d[1],n=d[2],r=d[3],i=d[4],s=d[9]=null==d[9]?u?0:t.length:Gu(d[9]-c,0),!s&&e&(et|nt)&&(e&=~(et|nt)),e&&e!=J)p=e==et||e==nt?Mr(t,e,s):e!=rt&&e!=(J|rt)||i.length?Dr.apply(Y,d):Wr(t,e,n,r);else var p=Lr(t,e,n);var g=h?pc:bc;return g(p,d)}function Qr(t,e,n,r,i,o){var a=-1,s=i&ct,u=i&ut,c=t.length,l=e.length;if(c!=l&&!(s&&l>c))return!1;var f=o.get(t);if(f)return f==e;var h=!0;for(o.set(t,e);++ai,a=r==ot&&n==et||r==ot&&n==at&&t[7].length<=e[8]||r==(ot|at)&&e[7].length<=e[8]&&n==et;if(!o&&!a)return t;r&J&&(t[2]=e[2],i|=n&J?0:tt);var s=e[3];if(s){var u=t[3];t[3]=u?Sr(u,s,e[4]):Tr(s),t[4]=u?z(t[3],xt):Tr(e[4])}return s=e[5],s&&(u=t[5],t[5]=u?Ar(u,s,e[6]):Tr(s),t[6]=u?z(t[5],xt):Tr(e[6])),s=e[7],s&&(t[7]=Tr(s)),r&ot&&(t[8]=null==t[8]?e[8]:Qu(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i,t}function gi(t,e,n,r,i,o){return Ea(t)&&Ea(e)&&(o.set(e,t),Gn(t,e,gi,o)),t===Y?sn(e):t}function vi(t,e){return 1==e.length?t:ns(t,ar(e,0,-1))}function mi(t,e){for(var n=t.length,r=Qu(e.length,n),i=Tr(t);r--;){var o=e[r];t[r]=B(o,n)?i[o]:Y}return t}function yi(t){var e=[];return Va(t).replace(fe,function(t,n,r,i){e.push(r?i.replace(me,"$1"):n||t)}),e}function bi(t){return la(t)?t:[]}function wi(t){return"function"==typeof t?t:Xs}function _i(t){if(t instanceof i)return t.clone();var e=new r(t.__wrapped__,t.__chain__);return e.__actions__=Tr(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}function Ei(t,e){e=Gu(Ba(e),0);var n=t?t.length:0;if(!n||1>e)return[];for(var r=0,i=-1,o=Array(Hu(n/e));n>r;)o[++i]=ar(t,r,r+=e);return o}function ji(t){for(var e=-1,n=t?t.length:0,r=-1,i=[];++ee?0:e,r)):[]}function Ai(t,e,n){var r=t?t.length:0;return r?(e=n||e===Y?1:Ba(e),e=r-e,ar(t,0,0>e?0:e)):[]}function Ti(t,e){return t&&t.length?gr(t,Jr(e,3),!0,!0):[]}function xi(t,e){return t&&t.length?gr(t,Jr(e,3),!0):[]}function Ci(t,e,n,r){var i=t?t.length:0;return i?(n&&"number"!=typeof n&&ui(t,e,n)&&(n=0,r=i),_n(t,e,n,r)):[]}function ki(t,e){return t&&t.length?E(t,Jr(e,3)):-1}function Ri(t,e){return t&&t.length?E(t,Jr(e,3),!0):-1}function Pi(t,e){var n=t?t.length:0;return n?An(g(t,Jr(e,3))):[]}function Ii(t){var e=t?t.length:0;return e?An(t):[]}function Oi(t){var e=t?t.length:0;return e?An(t,!0):[]}function Li(t){for(var e=-1,n=t?t.length:0,r={};++en&&(n=Gu(r+n,0)),j(t,e,n)):-1}function Ui(t){return Ai(t,1)}function Mi(t,e){return t?Ku.call(t,e):""}function Ni(t){var e=t?t.length:0;return e?t[e-1]:Y}function Di(t,e,n){var r=t?t.length:0;if(!r)return-1;var i=r;if(n!==Y&&(i=Ba(n),i=(0>i?Gu(r+i,0):Qu(i,r-1))+1),e!==e)return N(t,i,!0);for(;i--;)if(t[i]===e)return i;return-1}function Bi(t,e){return t&&t.length&&e&&e.length?tr(t,e):t}function Hi(t,e,n){return t&&t.length&&e&&e.length?er(t,e,Jr(n)):t}function Wi(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=Jr(e,3);++rr&&oa(t[r],e))return r}return-1}function Xi(t,e){return ur(t,e,!0)}function Yi(t,e,n){return cr(t,e,Jr(n),!0)}function $i(t,e){var n=t?t.length:0;if(n){var r=ur(t,e,!0)-1;if(oa(t[r],e))return r}return-1}function Ji(t){return t&&t.length?lr(t):[]}function Zi(t,e){return t&&t.length?fr(t,Jr(e)):[]}function to(t){return Si(t,1)}function eo(t,e,n){return t&&t.length?(e=n||e===Y?1:Ba(e),ar(t,0,0>e?0:e)):[]}function no(t,e,n){var r=t?t.length:0;return r?(e=n||e===Y?1:Ba(e),e=r-e,ar(t,0>e?0:e,r)):[]}function ro(t,e){return t&&t.length?gr(t,Jr(e,3),!1,!0):[]}function io(t,e){return t&&t.length?gr(t,Jr(e,3)):[]}function oo(t){return t&&t.length?dr(t):[]}function ao(t,e){return t&&t.length?dr(t,Jr(e)):[]}function so(t,e){return t&&t.length?dr(t,Y,e):[]}function uo(t){if(!t||!t.length)return[];var e=0;return t=h(t,function(t){return la(t)?(e=Gu(t.length,e),!0):void 0}),x(e,function(e){return g(t,Jn(e))})}function co(t,e){if(!t||!t.length)return[];var n=uo(t);return null==e?n:g(n,function(t){return s(e,Y,t)})}function lo(t,e){for(var n=-1,r=t?t.length:0,i=e?e.length:0,o={};++nn?e[n]:Y);return o}function fo(t){var n=e(t);return n.__chain__=!0,n}function ho(t,e){return e(t),t}function po(t,e){return e(t)}function go(){return fo(this)}function vo(){return new r(this.value(),this.__chain__)}function mo(t){return this.map(t).flatten()}function yo(){this.__values__===Y&&(this.__values__=Da(this.value()));var t=this.__index__>=this.__values__.length,e=t?Y:this.__values__[this.__index__++];return{done:t,value:e}}function bo(){return this}function wo(t){for(var e,r=this;r instanceof n;){var i=_i(r);i.__index__=0,i.__values__=Y,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=t,e}function _o(){var t=this.__wrapped__;if(t instanceof i){var e=t;return this.__actions__.length&&(e=new i(this)),e=e.reverse(),e.__actions__.push({func:po,args:[zi],thisArg:Y}),new r(e,this.__chain__)}return this.thru(zi)}function Eo(){return vr(this.__wrapped__,this.__actions__)}function jo(t,e,n){var r=tl(t)?f:wn;return n&&ui(t,e,n)&&(e=Y),r(t,Jr(e,3))}function So(t,e){var n=tl(t)?h:En;return n(t,Jr(e,3))}function Ao(t,e){if(e=Jr(e,3),tl(t)){var n=E(t,e);return n>-1?t[n]:Y}return _(t,e,lc)}function To(t,e){if(e=Jr(e,3),tl(t)){var n=E(t,e,!0);return n>-1?t[n]:Y}return _(t,e,fc)}function xo(t,e){return"function"==typeof e&&tl(t)?c(t,e):lc(t,wi(e))}function Co(t,e){return"function"==typeof e&&tl(t)?l(t,e):fc(t,wi(e))}function ko(t,e,n,r){t=ca(t)?t:bs(t),n=n&&!r?Ba(n):0;var i=t.length;return 0>n&&(n=Gu(i+n,0)),La(t)?i>=n&&t.indexOf(e,n)>-1:!!i&&j(t,e,n)>-1}function Ro(t,e){var n=tl(t)?g:zn;return n(t,Jr(e,3))}function Po(t,e,n,r){return null==t?[]:(tl(e)||(e=null==e?[]:[e]),n=r?Y:n,tl(n)||(n=null==n?[]:[n]),Xn(t,e,n))}function Io(t,e,n){var r=tl(t)?m:S,i=arguments.length<3;return r(t,Jr(e,4),n,i,lc)}function Oo(t,e,n){var r=tl(t)?y:S,i=arguments.length<3;return r(t,Jr(e,4),n,i,fc)}function Lo(t,e){var n=tl(t)?h:En;return e=Jr(e,3),n(t,function(t,n,r){return!e(t,n,r)})}function Fo(t){var e=ca(t)?t:bs(t),n=e.length;return n>0?e[rr(0,n-1)]:Y}function qo(t,e){var n=-1,r=Da(t),i=r.length,o=i-1;for(e=an(Ba(e),0,i);++n0&&(n=e.apply(this,arguments)),1>=t&&(e=Y),n}}function Wo(t,e,n){e=n?Y:e;var r=Gr(t,et,Y,Y,Y,Y,Y,e);return r.placeholder=Wo.placeholder,r}function zo(t,e,n){e=n?Y:e;var r=Gr(t,nt,Y,Y,Y,Y,Y,e);return r.placeholder=zo.placeholder,r}function Ko(t,e,n){function r(){p&&Lu(p),l&&Lu(l),v=0,c=l=d=p=g=Y}function i(e,n){n&&Lu(n),l=p=g=Y,e&&(v=Kc(),f=t.apply(d,c),p||l||(c=d=Y))}function o(){var t=e-(Kc()-h);0>=t||t>e?i(g,l):p=Du(o,t)}function a(){return(p&&g||l&&b)&&(f=t.apply(d,c)),r(),f}function s(){i(b,p)}function u(){if(c=arguments,h=Kc(),d=this,g=b&&(p||!m),y===!1)var n=m&&!p;else{l||m||(v=h);var r=y-(h-v),i=0>=r||r>y;i?(l&&(l=Lu(l)),v=h,f=t.apply(d,c)):l||(l=Du(s,r))}return i&&p?p=Lu(p):p||e===y||(p=Du(o,e)),n&&(i=!0,f=t.apply(d,c)),!i||p||l||(c=d=Y),f}var c,l,f,h,d,p,g,v=0,m=!1,y=!1,b=!0;if("function"!=typeof t)throw new _u(yt);return e=Wa(e)||0,Ea(n)&&(m=!!n.leading,y="maxWait"in n&&Gu(Wa(n.maxWait)||0,e),b="trailing"in n?!!n.trailing:b),u.cancel=r,u.flush=a,u}function Vo(t){return Gr(t,st)}function Go(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new _u(yt);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new Go.Cache,n}function Qo(t){if("function"!=typeof t)throw new _u(yt);return function(){return!t.apply(this,arguments)}}function Xo(t){return Ho(2,t)}function Yo(t,e){if("function"!=typeof t)throw new _u(yt);return e=Gu(e===Y?t.length-1:Ba(e),0),function(){for(var n=arguments,r=-1,i=Gu(n.length-e,0),o=Array(i);++re}function sa(t,e){return t>=e}function ua(t){return la(t)&&Au.call(t,"callee")&&(!Nu.call(t,"callee")||Cu.call(t)==Ct)}function ca(t){return null!=t&&!("function"==typeof t&&ba(t))&&_a(mc(t))}function la(t){return ja(t)&&ca(t)}function fa(t){return t===!0||t===!1||ja(t)&&Cu.call(t)==Rt}function ha(t){return ja(t)&&Cu.call(t)==Pt}function da(t){return!!t&&1===t.nodeType&&ja(t)&&!Pa(t)}function pa(t){return!ja(t)||ba(t.splice)?!Mo(t):!as(t).length}function ga(t,e){return Mn(t,e)}function va(t,e,n){n="function"==typeof n?n:Y;var r=n?n(t,e):Y;return r===Y?Mn(t,e,n):!!r}function ma(t){return ja(t)&&"string"==typeof t.message&&Cu.call(t)==It}function ya(t){return"number"==typeof t&&zu(t)}function ba(t){var e=Ea(t)?Cu.call(t):"";return e==Ot||e==Lt}function wa(t){return"number"==typeof t&&t==Ba(t)}function _a(t){return"number"==typeof t&&t>-1&&t%1==0&&_t>=t}function Ea(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ja(t){return!!t&&"object"==typeof t}function Sa(t,e){return t===e||Dn(t,e,Zr(e))}function Aa(t,e,n){return n="function"==typeof n?n:Y,Dn(t,e,Zr(e),n)}function Ta(t){return Ra(t)&&t!=+t}function xa(t){return null==t?!1:ba(t)?Ru.test(Su.call(t)):ja(t)&&(D(t)?Ru:je).test(t)}function Ca(t){return null===t}function ka(t){return null==t}function Ra(t){return"number"==typeof t||ja(t)&&Cu.call(t)==qt}function Pa(t){if(!ja(t)||Cu.call(t)!=Ut||D(t))return!1;var e=ju;if("function"==typeof t.constructor&&(e=qu(t)),null===e)return!0;var n=e.constructor;return"function"==typeof n&&n instanceof n&&Su.call(n)==xu}function Ia(t){return Ea(t)&&Cu.call(t)==Mt}function Oa(t){return wa(t)&&t>=-_t&&_t>=t}function La(t){return"string"==typeof t||!tl(t)&&ja(t)&&Cu.call(t)==Dt}function Fa(t){return"symbol"==typeof t||ja(t)&&Cu.call(t)==Bt}function qa(t){return ja(t)&&_a(t.length)&&!!vn[Cu.call(t)]}function Ua(t){return t===Y}function Ma(t,e){return e>t}function Na(t,e){return e>=t}function Da(t){if(!t)return[];if(ca(t))return La(t)?G(t):Tr(t);if(Mu&&t[Mu])return H(t[Mu]());var e=ei(t),n=e==Ft?W:e==Nt?K:bs;return n(t)}function Ba(t){if(!t)return 0===t?t:0;if(t=Wa(t),t===wt||t===-wt){var e=0>t?-1:1;return e*Et}var n=t%1;return t===t?n?t-n:t:0}function Ha(t){return t?an(Ba(t),0,St):0}function Wa(t){if(Ea(t)){var e=ba(t.valueOf)?t.valueOf():t;t=Ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(pe,"");var n=Ee.test(t);return n||Se.test(t)?Sn(t.slice(2),n?2:8):_e.test(t)?jt:+t}function za(t){return xr(t,ss(t))}function Ka(t){return an(Ba(t),-_t,_t)}function Va(t){if("string"==typeof t)return t;if(null==t)return"";if(Fa(t))return Pu?sc.call(t):"";var e=t+"";return"0"==e&&1/t==-wt?"-0":e}function Ga(t,e){var n=cc(t);return e?rn(n,e):n}function Qa(t,e){return _(t,Jr(e,3),xn,!0)}function Xa(t,e){return _(t,Jr(e,3),Cn,!0)}function Ya(t,e){return null==t?t:hc(t,wi(e),ss)}function $a(t,e){return null==t?t:dc(t,wi(e),ss)}function Ja(t,e){return t&&xn(t,wi(e))}function Za(t,e){return t&&Cn(t,wi(e))}function ts(t){return null==t?[]:kn(t,as(t))}function es(t){return null==t?[]:kn(t,ss(t))}function ns(t,e,n){var r=null==t?Y:Rn(t,e);return r===Y?n:r}function rs(t,e){return ri(t,e,On)}function is(t,e){return ri(t,e,Ln)}function os(t,e,n){return m(as(t),function(r,i){var o=t[i];return e&&!n?Au.call(r,o)?r[o].push(i):r[o]=[i]:r[o]=i,r},{})}function as(t){var e=hi(t);if(!e&&!ca(t))return Hn(t);var n=si(t),r=!!n,i=n||[],o=i.length;for(var a in t)!On(t,a)||r&&("length"==a||B(a,o))||e&&"constructor"==a||i.push(a);return i}function ss(t){for(var e=-1,n=hi(t),r=Wn(t),i=r.length,o=si(t),a=!!o,s=o||[],u=s.length;++ee){var r=t;t=e,e=r}if(n||t%1||e%1){var i=Yu();return Qu(t+i*(e-t+jn("1e-"+((i+"").length-1))),e)}return rr(t,e)}function Ss(t){return ml(Va(t).toLowerCase())}function As(t){return t=Va(t),t&&t.replace(Te,q).replace(un,"")}function Ts(t,e,n){t=Va(t),e="string"==typeof e?e:e+"";var r=t.length;return n=n===Y?r:an(Ba(n),0,r),n-=e.length,n>=0&&t.indexOf(e,n)==n}function xs(t){return t=Va(t),t&&oe.test(t)?t.replace(re,U):t}function Cs(t){return t=Va(t),t&&de.test(t)?t.replace(he,"\\$&"):t}function ks(t,e,n){t=Va(t),e=Ba(e);var r=V(t);if(!e||r>=e)return t;var i=(e-r)/2,o=Wu(i),a=Hu(i);return Hr("",o,n)+t+Hr("",a,n)}function Rs(t,e,n){return t=Va(t),t+Hr(t,e,n)}function Ps(t,e,n){return t=Va(t),Hr(t,e,n)+t}function Is(t,e,n){return n||null==e?e=0:e&&(e=+e),t=Va(t).replace(pe,""),Xu(t,e||(we.test(t)?16:10))}function Os(t,e){t=Va(t),e=Ba(e);var n="";if(!t||1>e||e>_t)return n;do e%2&&(n+=t),e=Wu(e/2),t+=t;while(e);return n}function Ls(){var t=arguments,e=Va(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function Fs(t,e,n){return Va(t).split(e,n)}function qs(t,e,n){return t=Va(t),n=an(Ba(n),0,t.length),t.lastIndexOf(e,n)==n}function Us(t,n,r){var i=e.templateSettings;r&&ui(t,n,r)&&(n=Y),t=Va(t),n=rl({},n,i,tn);var o,a,s=rl({},n.imports,i.imports,tn),u=as(s),c=R(s,u),l=0,f=n.interpolate||xe,h="__p += '",d=wu((n.escape||xe).source+"|"+f.source+"|"+(f===ue?ye:xe).source+"|"+(n.evaluate||xe).source+"|$","g"),p="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++gn+"]")+"\n";t.replace(d,function(e,n,r,i,s,u){return r||(r=i),h+=t.slice(l,u).replace(Ce,M),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),h+="';\n";var g=n.variable;g||(h="with (obj) {\n"+h+"\n}\n"),h=(a?h.replace(Zt,""):h).replace(te,"$1").replace(ee,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var v=_l(function(){return Function(u,p+"return "+h).apply(Y,c)});if(v.source=h,ma(v))throw v;return v}function Ms(t){return Va(t).toLowerCase()}function Ns(t){return Va(t).toUpperCase()}function Ds(t,e,n){if(t=Va(t),!t)return t;if(n||e===Y)return t.replace(pe,"");if(e+="",!e)return t;var r=G(t),i=G(e);return r.slice(P(r,i),I(r,i)+1).join("")}function Bs(t,e,n){if(t=Va(t),!t)return t;if(n||e===Y)return t.replace(ve,"");if(e+="",!e)return t;var r=G(t);return r.slice(0,I(r,G(e))+1).join("")}function Hs(t,e,n){if(t=Va(t),!t)return t;if(n||e===Y)return t.replace(ge,"");if(e+="",!e)return t;var r=G(t);return r.slice(P(r,G(e))).join("")}function Ws(t,e){var n=lt,r=ft;if(Ea(e)){var i="separator"in e?e.separator:i;n="length"in e?Ba(e.length):n,r="omission"in e?Va(e.omission):r}t=Va(t);var o=t.length;if(ln.test(t)){var a=G(t);o=a.length}if(n>=o)return t;var s=n-V(r);if(1>s)return r;var u=a?a.slice(0,s).join(""):t.slice(0,s);if(i===Y)return u+r;if(a&&(s+=u.length-s),Ia(i)){if(t.slice(s).search(i)){var c,l=u;for(i.global||(i=wu(i.source,Va(be.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var f=c.index;u=u.slice(0,f===Y?s:f)}}else if(t.indexOf(i,s)!=s){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r}function zs(t){return t=Va(t),t&&ie.test(t)?t.replace(ne,Q):t}function Ks(t,e,n){return t=Va(t),e=n?Y:e,e===Y&&(e=dn.test(t)?hn:fn),t.match(e)||[]}function Vs(t){var e=t?t.length:0,n=Jr();return t=e?g(t,function(t){if("function"!=typeof t[1])throw new _u(yt);return[n(t[0]),t[1]]}):[],Yo(function(n){for(var r=-1;++rt||t>_t)return[];var n=St,r=Qu(t,St);e=wi(e),t-=St;for(var i=x(r,e);++n0){if(++t>=ht)return n}else t=0;return pc(n,r)}}(),wc=Yo(function(t,e){return e=An(e),u(tl(t)?t:[Object(t)],e)}),_c=Yo(function(t,e){return la(t)?bn(t,An(e,!1,!0)):[]}),Ec=Yo(function(t,e){var n=Ni(e);return la(n)&&(n=Y),la(t)?bn(t,An(e,!1,!0),Jr(n)):[]}),jc=Yo(function(t,e){var n=Ni(e);return la(n)&&(n=Y),la(t)?bn(t,An(e,!1,!0),Y,n):[]}),Sc=Yo(function(t){var e=g(t,bi);return e.length&&e[0]===t[0]?qn(e):[]}),Ac=Yo(function(t){var e=Ni(t),n=g(t,bi);return e===Ni(n)?e=Y:n.pop(),n.length&&n[0]===t[0]?qn(n,Jr(e)):[]}),Tc=Yo(function(t){var e=Ni(t),n=g(t,bi);return e===Ni(n)?e=Y:n.pop(),n.length&&n[0]===t[0]?qn(n,Y,e):[]}),xc=Yo(Bi),Cc=Yo(function(t,e){e=g(An(e),String);var n=on(t,e);return nr(t,e.sort(L)),n}),kc=Yo(function(t){return dr(An(t,!1,!0))}),Rc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),dr(An(t,!1,!0),Jr(e))}),Pc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),dr(An(t,!1,!0),Y,e)}),Ic=Yo(function(t,e){return la(t)?bn(t,e):[]}),Oc=Yo(function(t){return mr(h(t,la))}),Lc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),mr(h(t,la),Jr(e))}),Fc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),mr(h(t,la),Y,e)}),qc=Yo(uo),Uc=Yo(function(t){var e=t.length,n=e>1?t[e-1]:Y;return n="function"==typeof n?(t.pop(),n):Y,co(t,n)}),Mc=Yo(function(t){t=An(t);var e=t.length,n=e?t[0]:0,o=this.__wrapped__,a=function(e){return on(e,t)};return!(e>1||this.__actions__.length)&&o instanceof i&&B(n)?(o=o.slice(n,+n+(e?1:0)),o.__actions__.push({func:po,args:[a],thisArg:Y}),new r(o,this.__chain__).thru(function(t){return e&&!t.length&&t.push(Y),t})):this.thru(a)}),Nc=Rr(function(t,e,n){Au.call(t,n)?++t[n]:t[n]=1}),Dc=Rr(function(t,e,n){Au.call(t,n)?t[n].push(e):t[n]=[e]}),Bc=Yo(function(t,e,n){var r=-1,i="function"==typeof e,o=ci(e),a=ca(t)?Array(t.length):[];return lc(t,function(t){var u=i?e:o&&null!=t?t[e]:Y;a[++r]=u?s(u,t,n):Un(t,e,n)}),a}),Hc=Rr(function(t,e,n){t[n]=e}),Wc=Rr(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),zc=Yo(function(t,e){if(null==t)return[];var n=e.length;return n>1&&ui(t,e[0],e[1])?e=[]:n>2&&ui(e[0],e[1],e[2])&&(e.length=1),Xn(t,An(e),[])}),Kc=mu.now,Vc=Yo(function(t,e,n){var r=J;if(n.length){var i=z(n,Vc.placeholder);r|=rt}return Gr(t,r,e,n,i)}),Gc=Yo(function(t,e,n){var r=J|Z;if(n.length){var i=z(n,Gc.placeholder);r|=rt}return Gr(e,r,t,n,i)}),Qc=Yo(function(t,e){return yn(t,1,e)}),Xc=Yo(function(t,e,n){return yn(t,Wa(e)||0,n)}),Yc=Yo(function(t,e){e=g(An(e),Jr());var n=e.length;return Yo(function(r){for(var i=-1,o=Qu(r.length,n);++i0||0>e)?new i(n):(0>t?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==Y&&(e=Ba(e),n=0>e?n.dropRight(-e):n.take(e-t)),n)},i.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},i.prototype.toArray=function(){return this.take(St)},xn(i.prototype,function(t,n){var o=/^(?:filter|find|map|reject)|While$/.test(n),a=/^(?:head|last)$/.test(n),s=e[a?"take"+("last"==n?"Right":""):n],u=a||/^find/.test(n);s&&(e.prototype[n]=function(){var n=this.__wrapped__,c=a?[1]:arguments,l=n instanceof i,f=c[0],h=l||tl(n),d=function(t){var n=s.apply(e,v([t],c));return a&&p?n[0]:n};h&&o&&"function"==typeof f&&1!=f.length&&(l=h=!1);var p=this.__chain__,g=!!this.__actions__.length,m=u&&!p,y=l&&!g;if(!u&&h){n=y?n:new i(this);var b=t.apply(n,c);return b.__actions__.push({func:po,args:[d],thisArg:Y}),new r(b,p)}return m&&y?t.apply(this,c):(b=this.thru(d),m?a?b.value()[0]:b.value():b)})}),c(["pop","push","shift","sort","splice","unshift"],function(t){var n=Eu[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);e.prototype[t]=function(){var t=arguments;return i&&!this.__chain__?n.apply(this.value(),t):this[r](function(e){return n.apply(e,t)})}}),xn(i.prototype,function(t,n){var r=e[n];if(r){var i=r.name+"",o=uc[i]||(uc[i]=[]);o.push({name:n,func:r})}}),uc[Dr(Y,Z).name]=[{name:"wrapper",func:Y}],i.prototype.clone=O,i.prototype.reverse=Ht,i.prototype.value=Ae,e.prototype.at=Mc,e.prototype.chain=go,e.prototype.commit=vo,e.prototype.flatMap=mo,e.prototype.next=yo,e.prototype.plant=wo,e.prototype.reverse=_o,e.prototype.toJSON=e.prototype.valueOf=e.prototype.value=Eo,Mu&&(e.prototype[Mu]=bo),e}var Y,$="4.0.0",J=1,Z=2,tt=4,et=8,nt=16,rt=32,it=64,ot=128,at=256,st=512,ut=1,ct=2,lt=30,ft="...",ht=150,dt=16,pt=200,gt=1,vt=2,mt=3,yt="Expected a function",bt="__lodash_hash_undefined__",wt=1/0,_t=9007199254740991,Et=1.7976931348623157e308,jt=NaN,St=4294967295,At=St-1,Tt=St>>>1,xt="__lodash_placeholder__",Ct="[object Arguments]",kt="[object Array]",Rt="[object Boolean]",Pt="[object Date]",It="[object Error]",Ot="[object Function]",Lt="[object GeneratorFunction]",Ft="[object Map]",qt="[object Number]",Ut="[object Object]",Mt="[object RegExp]",Nt="[object Set]",Dt="[object String]",Bt="[object Symbol]",Ht="[object WeakMap]",Wt="[object ArrayBuffer]",zt="[object Float32Array]",Kt="[object Float64Array]",Vt="[object Int8Array]",Gt="[object Int16Array]",Qt="[object Int32Array]",Xt="[object Uint8Array]",Yt="[object Uint8ClampedArray]",$t="[object Uint16Array]",Jt="[object Uint32Array]",Zt=/\b__p \+= '';/g,te=/\b(__p \+=) '' \+/g,ee=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ne=/&(?:amp|lt|gt|quot|#39|#96);/g,re=/[&<>"'`]/g,ie=RegExp(ne.source),oe=RegExp(re.source),ae=/<%-([\s\S]+?)%>/g,se=/<%([\s\S]+?)%>/g,ue=/<%=([\s\S]+?)%>/g,ce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,le=/^\w*$/,fe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,he=/[\\^$.*+?()[\]{}|]/g,de=RegExp(he.source),pe=/^\s+|\s+$/g,ge=/^\s+/,ve=/\s+$/,me=/\\(\\)?/g,ye=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,be=/\w*$/,we=/^0x/i,_e=/^[-+]0x[0-9a-f]+$/i,Ee=/^0b[01]+$/i,je=/^\[object .+?Constructor\]$/,Se=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,Te=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,xe=/($^)/,Ce=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",Re="\\u0300-\\u036f\\ufe20-\\ufe23",Pe="\\u2700-\\u27bf",Ie="a-z\\xdf-\\xf6\\xf8-\\xff",Oe="\\xac\\xb1\\xd7\\xf7",Le="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fe="\\u2018\\u2019\\u201c\\u201d",qe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ue="A-Z\\xc0-\\xd6\\xd8-\\xde",Me="\\ufe0e\\ufe0f",Ne=Oe+Le+Fe+qe,De="["+ke+"]",Be="["+Ne+"]",He="["+Re+"]",We="\\d+",ze="["+Pe+"]",Ke="["+Ie+"]",Ve="[^"+ke+Ne+We+Pe+Ie+Ue+"]",Ge="(?:\\ud83c[\\udffb-\\udfff])",Qe="[^"+ke+"]",Xe="(?:\\ud83c[\\udde6-\\uddff]){2}",Ye="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Ue+"]",Je="\\u200d",Ze="(?:"+Ke+"|"+Ve+")",tn="(?:"+$e+"|"+Ve+")",en=Ge+"?",nn="["+Me+"]?",rn="(?:"+Je+"(?:"+[Qe,Xe,Ye].join("|")+")"+nn+en+")*",on=nn+en+rn,an="(?:"+[ze,Xe,Ye].join("|")+")"+on,sn="(?:"+[Qe+He+"?",He,Xe,Ye,De].join("|")+")",un=RegExp(He,"g"),cn=RegExp(sn+on,"g"),ln=RegExp("["+Je+ke+Re+Me+"]"),fn=/[a-zA-Z0-9]+/g,hn=RegExp([$e+"?"+Ke+"+(?="+[Be,$e,"$"].join("|")+")",tn+"+(?="+[Be,$e+Ze,"$"].join("|")+")",$e+"?"+Ze+"+",We+"(?:"+Ze+"+)?",an].join("|"),"g"),dn=/[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,pn=["Array","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Reflect","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],gn=-1,vn={}; +t.set(o,function(t){t?(b.error({description:"Error creating file on Firebase.",error:t,func:"addToFb",obj:"File"}),n(t)):(b.info({description:"File successfully added to Firebase.",func:"addToFb",obj:"File"}),e(o))})})}},{key:"removeFromFb",value:function(){var t=this;return b.debug({description:"Remove File from Firebase called.",func:"removeFromFb",obj:"File"}),new Promise(function(e,n){t.fbRef.remove(function(r){return r?(b.error({description:"Error creating file on Firebase.",error:r,func:"removeFromFb",obj:"File"}),n(r)):(b.info({description:"File successfully removed from Firebase.",file:t,func:"removeFromFb",obj:"File"}),void e(t))})})}},{key:"openInFirepad",value:function(t){return this.get().then(function(e){b.info({description:"File contents loaded. Opening firepad.",editor:t,file:e,func:"openInFirepad",obj:"File"});var n=e.firepadFromAce(t);n.on("ready",function(){resolve(e)})},function(e){b.error({description:"Valid ace editor instance required to create firepad.",editor:t,error:e,func:"openInFirepad",obj:"File"}),reject(e)})}},{key:"firepadFromAce",value:function(t){if(!t||"function"!=typeof t.setTheme)return void b.error({description:"Valid ace editor instance required to create firepad.",func:"fbRef",obj:"File"});var e=s();if("function"!=typeof e.fromACE)return void b.error({description:"Firepad does not have fromACE method.",firepad:e,func:"fbRef",obj:"File"});var n={};return f.default.isLoggedIn&&f.default.currentUser&&(n.userId=f.default.currentUser.username||f.default.currentUser.name),b.debug({description:"Creating firepad from ace.",settings:n,editor:t,func:"fbRef",obj:"File"}),e.fromACE(this.fbRef,t,n)}},{key:"getConnectedUsers",value:function(){var t=this;return new Promise(function(e,n){t.fbRef.child("users").on("value",function(t){null===t.val()?e([]):!function(){var n=[];t.forEach(function(t){var e=t.val();e.username=t.key(),n.push(e)}),b.log({description:"Connected users array built.",usersArray:n,func:"connectedUsers",obj:"File"}),e(n)}()},function(t){b.error({description:"Error loading connected users.",error:t,func:"connectedUsers",obj:"File"}),n(t)})})}},{key:"getFromS3",value:function(t){var e=this;return this.getProject().then(function(n){var r={bucket:n.frontend.bucketName,path:e.path};return b.debug({description:"File get params built.",getData:t,file:e,func:"getFromS3",obj:"File"}),w.getObject(r).then(function(t){return(0,h.extend)(e,t),b.info({description:"File loaded from s3.",s3File:t,file:e,func:"getFromS3",obj:"File"}),e},function(t){return b.error({description:"Error getting file from s3.",file:e,func:"getFromS3",obj:"File"}),Promise.reject(t)})},function(t){return Promise.reject(t)})}},{key:"saveToS3",value:function(t){var e=this;return this.getProject().then(function(t){var n=i.content,r=i.contentType,i={bucket:t.frontend.bucketName,path:e.path,content:n};return r&&(i.contentType=r),w.saveObject(i)},function(t){return Promise.reject(t)})}},{key:"removeFromS3",value:function(){var t=this;return this.getProject().then(function(e){var n={Bucket:t.project.frontend.bucketName,Key:t.path};return b.debug({description:"File get params built.",saveParams:n,file:t,func:"get",obj:"File"}),w.deleteObject(n).then(function(t){b.info({description:"File loaded successfully.",deletedFile:t,func:"get",obj:"File"}),resolve(t)},function(t){return Promise.reject(t)})},function(t){return Promise.reject(t)})}},{key:"getProject",value:function(){var t=this;return this.project&&this.project.frontend?Promise.resolve(this.project):(b.log({description:"Application Frontend data not available. Calling applicaiton get.",func:"get",obj:"File"}),this.project.get().then(function(e){return t.project=e,b.log({description:"Application get successful. Getting file.",app:e,func:"get",obj:"File"}),t.get()},function(t){return b.error({description:"Application Frontend data not available.",error:t,func:"get",obj:"File"}),Promise.reject({message:"Front end data is required to get file."})}))}},{key:"pathArrayFromRef",get:function(){return this.fbRef||b.error({description:"File fbRef is required to get path array.",file:this,func:"pathArrayFromRef",obj:"File"}),this.fbRef.path.o}},{key:"fileType",get:function(){return"js"==this.ext?"javascript":this.ext}},{key:"ext",get:function(){var t=/(?:\.([^.]+))?$/;return t.exec(this.name)[1]}},{key:"safePathArray",get:function(){var t=this.pathArray.map(function(t){return t.replace(/[.]/g,":").replace(/[#$\[\]]/g,"--")});return b.debug({description:"Safe path array created.",safeArray:t,func:"safePathArray",obj:"File"}),t}},{key:"safePath",get:function(){var t=this.safePathArray;return 1===t.length?t[0]:t.join("/")}},{key:"fbUrl",get:function(){if(!this.project||!this.project.name)throw b.error({description:"App information needed to generate fbUrl for File.",file:this,func:"fbUrl",obj:"File"}),new Error("App information needed to generate fbUrl for File.");var t=new p.default({project:this.project}),e=[t.fbUrl,this.safePath].join("/");return b.debug({description:"FbUrl created for file.",url:e,file:this,func:"fbUrl",obj:"File"}),e}},{key:"fbRef",get:function(){return this.ref?(b.debug({description:"File already has reference.",ref:this.ref,func:"fbRef",obj:"File"}),this.ref):(b.debug({description:"Fb ref generated.",url:this.fbUrl,func:"fbRef",obj:"File"}),new v.default(this.fbUrl))}},{key:"headless",get:function(){var t=s();if("undefined"==typeof t||"function"!=typeof t.Headless)throw b.error({description:"Firepad is required to get file content.",func:"get",obj:"File"}),Error("Firepad is required to get file content");return t.Headless(this.fbRef)}}]),t}();e.default=_,t.exports=e.default}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}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")}function a(t){return A.debug({description:"getContentFromFile called",fileData:t,func:"getContentFromFile",obj:"Files"}),new Promise(function(e){try{var n=new FileReader;A.debug({description:"reader created",reader:n,func:"getContentFromFile",obj:"Files"}),n.onload=function(t){var n=t.target.result;A.debug({description:"Contents loaded",contents:n,func:"getContentFromFile",obj:"Files"}),e(n)},n.readAsText(t)}catch(r){A.error({description:"Error getting file contents.",error:r,func:"getContentFromFile",obj:"Files"}),reject(r)}})}function s(t){var e=t.map(function(t){return u(t)});return c(e)}function u(t){var e=void 0;(0,p.has)(t,"path")?e=t.path.split("/"):(0,p.has)(t,"Key")?(e=t.Key.split("/"),t=(0,p.pick)(t,"Key"),t.path=t.Key,t.name=t.Key):A.error({description:"Invalid file.",file:t,func:"buildStructureObject",obj:"Files"});var n=t;if(1==e.length)return n.name=e[0],(0,p.has)(n,"type")||(n.type="file"),n.path=e[0],n;var r={};return(0,p.each)(e,function(i,o,a){o!=a.length-1?(n.name=i,n.path=(0,p.take)(a,o+1).join("/"),n.type="folder",n.children=[{}],0===o&&(r=n),n=n.children[0]):(n.type="file",n.name=i,n.path=e.join("/"),t.$id&&(n.$id=t.$id))}),r}function c(t){var e=[],n=[];return(0,p.each)(t,function(r){if(-1==e.indexOf(r.name))e.push(r.name),n.push(r);else{var i=(0,p.findWhere)(t,{name:r.name});i.children=(0,p.union)(r.children,i.children),i.children=c(i.children)}}),n}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},f=function(){function t(t,e){for(var n=0;n1)return f.default.info({description:"String list of groups.",list:r,func:"isInGroup",obj:"Matter"}),{v:e.isInGroups(r)};var i=e.token.data.groups||[];return f.default.log({description:"Checking if user is in group.",group:n,userGroups:e.token.data.groups,func:"isInGroup",obj:"Matter"}),{v:(0,E.some)(i,function(t){return n==t.name})}}();return"object"===("undefined"==typeof n?"undefined":a(n))?n.v:void 0}},{key:"isInGroups",value:function(t){var e=this;if(!this.isLoggedIn)return f.default.log({description:"No logged in user to check.",func:"isInGroups",obj:"Matter"}),!1;if(!t)return f.default.log({description:"Invalid group(s).",func:"isInGroup",obj:"Matter"}),!1;if((0,E.isArray)(t))return(0,E.every)(t.map(function(t){return(0,E.isString)(t)?e.isInGroup(t):(0,E.has)(t,"name")?e.isInGroup(t.name):(f.default.error({description:"Invalid group object.",group:t,func:"isInGroups",obj:"Matter"}),!1)}),!0);if((0,E.isString)(t)){var n=t.split(",");return n.length>1?this.isInGroups(n):this.isInGroup(n[0])}return f.default.error({description:"Invalid groups list.",func:"isInGroups",obj:"Matter"}),!1}},{key:"isLoggedIn",get:function(){return this.token.string?!0:!1}},{key:"endpoint",get:function(){(0,E.has)(this,"options")&&(this.options.localServer&&(c.default.envName="local",f.default.log({description:"LocalServer option was set to true. Now server url is local server.",url:c.default.serverUrl,func:"endpoint",obj:"Matter"})),this.options.env&&(c.default.envName=this.options.env,f.default.log({description:"Environment set based on provided environment.",config:c.default,func:"endpoint",obj:"Matter"})));var t=c.default.serverUrl+"/apps/"+this.name;return"tessellate"==this.name&&("undefined"!=typeof window&&(0,E.has)(window,"location")&&-1!==window.location.host.indexOf("tessellate")?(t="",f.default.info({description:"Host is Tessellate Server, serverUrl simplified!",url:t,func:"endpoint",obj:"Matter"})):(t=c.default.serverUrl,f.default.info({description:"App is tessellate, serverUrl set as main tessellate server.",url:t,func:"endpoint",obj:"Matter"}))),f.default.log({description:"Endpoint created.",url:t,func:"endpoint",obj:"Matter"}),t}},{key:"urls",get:function(){return this.token&&this.token.data&&this.token.data.username?{update:this.endpoint+"/account/"+this.token.data.username,upload:this.endpoint+"/account/"+this.token.data.username+"/upload",recover:this.endpoint+"/recover"}:{recover:this.endpoint+"/recover"}}},{key:"currentUser",set:function(t){f.default.debug({description:"Current User set.",user:t,func:"currentUser",obj:"Matter"}),this.storage.setItem(c.default.tokenUserDataName,t)},get:function(){return this.storage.getItem(c.default.tokenUserDataName)?this.storage.getItem(c.default.tokenUserDataName):null}},{key:"storage",get:function(){return b.default}},{key:"token",get:function(){return m.default}},{key:"utils",get:function(){return{logger:f.default,request:g.default,storage:b.default,dom:d}}}]),t}();e.default=j,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if("undefined"==typeof document)throw c.default.error({description:"Document does not exsist to load assets into.",func:"loadCss",obj:"dom"}),new Error("Document object is required to load assets.");var e=document.createElement("link");return e.rel="stylesheet",e.type="text/css",e.href=t,document.getElementsByTagName("head")[0].insertBefore(e,document.getElementsByTagName("head")[0].firstChild),c.default.log({description:"CSS was loaded into document.",element:e,func:"loadCss",obj:"dom"}),e}function o(t){if("undefined"!=typeof window&&(0,l.has)(window,"document")){var e=window.document.createElement("script");return e.src=t,e.type="text/javascript",window.document.getElementsByTagName("head")[0].appendChild(e),c.default.log({description:"JS was loaded into document.",element:e,func:"loadJs",obj:"dom"}),e}throw c.default.error({description:"Document does not exsist to load assets into.",func:"loadJs",obj:"dom"}),new Error("Document object is required to load assets.")}function a(t){if("undefined"!=typeof window&&(0,l.has)(window,"document")){var e=window.document.createElement("script");return e.src=t,e.type="text/javascript",window.document.getElementsByTagName("head")[0].appendChild(e),c.default.log({description:"JS was loaded into document.",element:e,func:"asyncLoadJs",obj:"dom"}),new Promise(function(t){window.setTimeout(t,200)})}throw c.default.error({description:"Document does not exsist to load assets into.",func:"asyncLoadJs",obj:"dom"}),new Error("Document object is required to load assets.")}function s(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)"),n=e.exec(location.search);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}Object.defineProperty(e,"__esModule",{value:!0}),e.loadCss=i,e.loadJs=o,e.asyncLoadJs=a,e.getQueryParam=s;var u=n(9),c=r(u),l=n(4)},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(9),o=r(i),a=n(4),s=r(a),u={},c={get localExists(){var t="test";if("undefined"==typeof window||"undefined"==typeof window.sessionStorage)return!1;try{return window.sessionStorage.setItem(t,"1"),window.sessionStorage.removeItem(t),!0}catch(e){return o.default.error({description:"Error saving to session storage",error:e,obj:"storage",func:"localExists"}),!1}},item:function(t,e){return this.setItem(t,e)},setItem:function(t,e){u[t]=e,this.localExists&&(s.default.isObject(e)&&(e=JSON.stringify(e)),window.sessionStorage.setItem(t,e))},getItem:function(t){if(u[t])return u[t];if(this.localExists){var e=window.sessionStorage.getItem(t);if(e){var n=!1,r=null;try{r=JSON.parse(e),n=!0}catch(i){n=!1}if(n)return r}return e}return null},removeItem:function(t){if(u[t]&&(u[t]=null),this.localExists)try{window.sessionStorage.removeItem(t)}catch(e){o.default.error({description:"Error removing item from session storage",error:e,obj:"storage",func:"removeItem"})}},clear:function(){if(u={},this.localExists)try{window.sessionStorage.clear()}catch(t){o.default.warn({description:"Session storage could not be cleared.",error:t})}}};e.default=c,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){return new Promise(function(e,n){return"function"!=typeof t.end?(s.default.warn({description:"req.end is not a function",func:"handleResponse"}),n("req.end is not a function")):void t.end(function(t,r){if(t){var i=t.response.body.error?t.response.body.error:t.response.body;return s.default.warn({description:"Error in request.",error:i,errorRes:t,func:"handleResponse"}),401==t.status&&s.default.warn({description:"Unauthorized. You must be signed into make this request.",func:"handleResponse"}),n(i.message||i)}try{var o=JSON.parse(r.body);e(o)}catch(a){e(r.body)}})})}function o(t){return c.default.string&&(t=t.set("Authorization","Bearer "+c.default.string)),t}Object.defineProperty(e,"__esModule",{value:!0});var a=n(9),s=r(a),u=n(105),c=r(u),l=n(124),f=r(l),h={get:function(t,e){var n=f.default.get(t);return e&&n.query(e),n=o(n),i(n)},post:function(t,e){var n=f.default.post(t).send(e);return n=o(n),i(n)},put:function(t,e){var n=f.default.put(t,e);return n=o(n),i(n)},del:function(t,e){var n=f.default.put(t,e);return n=o(n),i(n)}};e.default=h,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){var e=void 0;if(t&&""!=t)try{e=(0,h.default)(t)}catch(n){throw u.default.error({description:"Error decoding token.",data:e,error:n,func:"decodeToken",file:"token"}),new Error("Invalid token string.")}return e}Object.defineProperty(e,"__esModule",{value:!0});var o=n(22),a=r(o),s=n(9),u=r(s),c=n(103),l=r(c),f=n(120),h=r(f),d=n(4),p=r(d),g={get string(){return l.default.getItem(a.default.tokenName)},get data(){return l.default.getItem(a.default.tokenDataName)?l.default.getItem(a.default.tokenDataName):i(this.string)},set data(t){if(p.default.isString(t)){var e=t;t=i(e),u.default.info({description:"Token data was set as string. Decoding token.",token:e,tokenData:t,func:"data",obj:"token"})}else u.default.log({description:"Token data was set.",data:t,func:"data",obj:"token"}),l.default.setItem(a.default.tokenDataName,t)},set string(t){var e=void 0;if(p.default.isString(t))e=t;else{if(u.default.log({description:"Token data is not string.",token:t,func:"string",obj:"token"}),!p.default.isObject(t)||!p.default.has(t,"token"))return void u.default.error({description:"Invalid value set to token.",token:t,func:"string",obj:"token"});e=t.token}u.default.log({description:"Token was set.",token:t,tokenStr:e,func:"string",obj:"token"}),l.default.setItem(a.default.tokenName,e),this.data=(0,h.default)(e)},save:function(t){this.string=t},"delete":function(){l.default.removeItem(a.default.tokenName),l.default.removeItem(a.default.tokenDataName),u.default.log({description:"Token was removed.",func:"delete",obj:"token"})}};e.default=g,t.exports=e.default},function(t,e,n){(function(e){var r=n(1);t.exports=r,r.apiLoader=n(23).load,r.XML.Parser=n(90),n(69),n(80),n(58),n(59),n(60),n(62),r.CredentialProviderChain.defaultProviders=[function(){return new r.EnvironmentCredentials("AWS")},function(){return new r.EnvironmentCredentials("AMAZON")},function(){return new r.SharedIniFileCredentials},function(){return new r.EC2MetadataCredentials}],r.util.update(r.Config.prototype.keys,{credentials:function(){var t=null;return new r.CredentialProviderChain([function(){return new r.EnvironmentCredentials("AWS")},function(){return new r.EnvironmentCredentials("AMAZON")},function(){return new r.SharedIniFileCredentials}]).resolve(function(e,n){e||(t=n)}),t},credentialProvider:function(){return new r.CredentialProviderChain},region:function(){return e.env.AWS_REGION||e.env.AMAZON_REGION}}),r.config=new r.Config}).call(e,n(5))},function(t,e){t.exports={rules:{"*/*":{endpoint:"{service}.{region}.amazonaws.com"},"cn-*/*":{endpoint:"{service}.{region}.amazonaws.com.cn"},"*/cloudfront":"globalSSL","*/iam":"globalSSL","*/sts":"globalSSL","*/importexport":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2",globalEndpoint:!0},"*/route53":{endpoint:"https://{service}.amazonaws.com",signatureVersion:"v3https",globalEndpoint:!0},"*/waf":"globalSSL","us-gov-*/iam":"globalGovCloud","us-gov-*/sts":{endpoint:"{service}.{region}.amazonaws.com"},"us-gov-west-1/s3":"s3dash","us-west-1/s3":"s3dash","us-west-2/s3":"s3dash","eu-west-1/s3":"s3dash","ap-southeast-1/s3":"s3dash","ap-southeast-2/s3":"s3dash","ap-northeast-1/s3":"s3dash","sa-east-1/s3":"s3dash","us-east-1/s3":{endpoint:"{service}.amazonaws.com",signatureVersion:"s3"},"us-east-1/sdb":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2"},"*/sdb":{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"v2"}},patterns:{globalSSL:{endpoint:"https://{service}.amazonaws.com",globalEndpoint:!0},globalGovCloud:{endpoint:"{service}.us-gov.amazonaws.com"},s3dash:{endpoint:"{service}-{region}.amazonaws.com",signatureVersion:"s3"}}}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){(function(e){function r(t){return function(){var n=[],r={update:function(t,r){return e.isBuffer(t)||(t=new e(t,r)),n.push(t),this},digest:function(r){var i=e.concat(n),o=t(i);return n=null,r?o.toString(r):o}};return r}}var i=n(141),o=r(n(137)),a=r(n(139));t.exports=function(t){return"md5"===t?new o:"rmd160"===t?new a:i(t)}}).call(e,n(3).Buffer)},function(t,e,n){(function(t){function r(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function i(t,e){for(var n in t)e(t[n],n)}var o=n(146);e.createHash=n(109),e.createHmac=n(135),e.randomBytes=function(e,n){if(!n||!n.call)return new t(o(e));try{n.call(this,void 0,new t(o(e)))}catch(r){n(r)}},e.getHashes=function(){return["sha1","sha256","sha512","md5","rmd160"]};var a=n(145)(e);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync,i(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman"],function(t){e[t]=function(){r("sorry,",t,"is not implemented yet")}})}).call(e,n(3).Buffer)},function(t,e,n){var r=t.exports,i=(n(18).EventEmitter,n(147)),o=n(52);r.request=function(t,e){"string"==typeof t&&(t=o.parse(t)),t||(t={}),t.host||t.port||(t.port=parseInt(window.location.port,10)),!t.host&&t.hostname&&(t.host=t.hostname),t.protocol||(t.scheme?t.protocol=t.scheme+":":t.protocol=window.location.protocol),t.host||(t.host=window.location.hostname||window.location.host),/:/.test(t.host)&&(t.port||(t.port=t.host.split(":")[1]),t.host=t.host.split(":")[0]),t.port||(t.port="https:"==t.protocol?443:80);var n=new i(new a,t);return e&&n.on("response",e),n},r.get=function(t,e){t.method="GET";var n=r.request(t,e);return n.end(),n},r.Agent=function(){},r.Agent.defaultMaxSockets=4;var a=function(){if("undefined"==typeof window)throw new Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject){for(var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],e=0;e0)if(e.ended&&!i){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&i){var s=new Error("stream.unshift() after end event");t.emit("error",s)}else!e.decoder||i||r||(n=e.decoder.write(n)),i||(e.reading=!1),e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,i?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&f(t)),d(t,e);else i||(e.reading=!1);return a(e)}function a(t){return!t.ended&&(t.needReadable||t.length=R)t=R;else{t--;for(var e=1;32>e;e<<=1)t|=t>>e;t++}return t}function u(t,e){return 0===e.length&&e.ended?0:e.objectMode?0===t?0:1:isNaN(t)||x.isNull(t)?e.flowing&&e.buffer.length?e.buffer[0].length:e.length:0>=t?0:(t>e.highWaterMark&&(e.highWaterMark=s(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function c(t,e){var n=null;return x.isBuffer(e)||x.isString(e)||x.isNullOrUndefined(e)||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(t,e){if(e.decoder&&!e.ended){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,f(t)}function f(t){var n=t._readableState;n.needReadable=!1,n.emittedReadable||(k("emitReadable",n.flowing),n.emittedReadable=!0,n.sync?e.nextTick(function(){h(t)}):h(t))}function h(t){k("emit readable"),t.emit("readable"),y(t)}function d(t,n){n.readingMore||(n.readingMore=!0,e.nextTick(function(){p(t,n)}))}function p(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=i)n=o?r.join(""):S.concat(r,i),r.length=0;else if(tc&&t>u;c++){var s=r[0],f=Math.min(t-u,s.length);o?n+=s.slice(0,f):s.copy(n,u,0,f),f0)throw new Error("endReadable called on non-empty stream");n.endEmitted||(n.ended=!0,e.nextTick(function(){n.endEmitted||0!==n.length||(n.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function _(t,e){for(var n=0,r=t.length;r>n;n++)e(t[n],n)}function E(t,e){for(var n=0,r=t.length;r>n;n++)if(t[n]===e)return n;return-1}t.exports=i;var j=n(155),S=n(3).Buffer;i.ReadableState=r;var A=n(18).EventEmitter;A.listenerCount||(A.listenerCount=function(t,e){return t.listeners(e).length});var T=n(14),x=n(19);x.inherits=n(20);var C,k=n(168);k=k&&k.debuglog?k.debuglog("stream"):function(){},x.inherits(i,T),i.prototype.push=function(t,e){var n=this._readableState;return x.isString(t)&&!n.objectMode&&(e=e||n.defaultEncoding,e!==n.encoding&&(t=new S(t,e),e="")),o(this,n,t,e,!1)},i.prototype.unshift=function(t){var e=this._readableState;return o(this,e,t,"",!0)},i.prototype.setEncoding=function(t){return C||(C=n(115).StringDecoder),this._readableState.decoder=new C(t),this._readableState.encoding=t,this};var R=8388608;i.prototype.read=function(t){k("read",t);var e=this._readableState,n=t;if((!x.isNumber(t)||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return k("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?w(this):f(this),null;if(t=u(t,e),0===t&&e.ended)return 0===e.length&&w(this),null;var r=e.needReadable;k("need readable",r),(0===e.length||e.length-t0?b(t,e):null,x.isNull(i)&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),n!==t&&e.ended&&0===e.length&&w(this),x.isNull(i)||this.emit("data",i),i},i.prototype._read=function(t){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(t,n){function r(t){k("onunpipe"),t===f&&o()}function i(){k("onend"),t.end()}function o(){k("cleanup"),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("drain",v),t.removeListener("error",s),t.removeListener("unpipe",r),f.removeListener("end",i),f.removeListener("end",o),f.removeListener("data",a),!h.awaitDrain||t._writableState&&!t._writableState.needDrain||v()}function a(e){k("ondata");var n=t.write(e);!1===n&&(k("false write response, pause",f._readableState.awaitDrain),f._readableState.awaitDrain++,f.pause())}function s(e){k("onerror",e),l(),t.removeListener("error",s),0===A.listenerCount(t,"error")&&t.emit("error",e)}function u(){t.removeListener("finish",c),l()}function c(){k("onfinish"),t.removeListener("close",u),l()}function l(){k("unpipe"),f.unpipe(t)}var f=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=t;break;case 1:h.pipes=[h.pipes,t];break;default:h.pipes.push(t)}h.pipesCount+=1,k("pipe count=%d opts=%j",h.pipesCount,n);var d=(!n||n.end!==!1)&&t!==e.stdout&&t!==e.stderr,p=d?i:o;h.endEmitted?e.nextTick(p):f.once("end",p),t.on("unpipe",r);var v=g(f);return t.on("drain",v),f.on("data",a),t._events&&t._events.error?j(t._events.error)?t._events.error.unshift(s):t._events.error=[s,t._events.error]:t.on("error",s),t.once("close",u),t.once("finish",c),t.emit("pipe",f),h.flowing||(k("pipe resume"),f.resume()),t},i.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=E(e.pipes,t);return-1===i?this:(e.pipes.splice(i,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},i.prototype.on=function(t,n){var r=T.prototype.on.call(this,t,n);if("data"===t&&!1!==this._readableState.flowing&&this.resume(),"readable"===t&&this.readable){var i=this._readableState;if(!i.readableListening)if(i.readableListening=!0,i.emittedReadable=!1,i.needReadable=!0,i.reading)i.length&&f(this,i);else{var o=this;e.nextTick(function(){k("readable nexttick read 0"),o.read(0)})}}return r},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var t=this._readableState;return t.flowing||(k("resume"),t.flowing=!0,t.reading||(k("resume read 0"),this.read(0)),v(this,t)),this},i.prototype.pause=function(){return k("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(k("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(t){var e=this._readableState,n=!1,r=this;t.on("end",function(){if(k("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)}),t.on("data",function(i){if(k("wrapped data"),e.decoder&&(i=e.decoder.write(i)),i&&(e.objectMode||i.length)){var o=r.push(i);o||(n=!0,t.pause())}});for(var i in t)x.isFunction(t[i])&&x.isUndefined(this[i])&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return _(o,function(e){t.on(e,r.emit.bind(r,e))}),r._read=function(e){k("wrapped _read",e),n&&(n=!1,t.resume())},r},i._fromList=b}).call(e,n(5))},function(t,e,n){function r(t){if(t&&!u(t))throw new Error("Unknown encoding: "+t)}function i(t){return t.toString(this.encoding)}function o(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function a(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}var s=n(3).Buffer,u=s.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},c=e.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),r(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};c.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&56319>=r)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),e+=t.toString(this.encoding,0,i);var i=e.length-1,r=e.charCodeAt(i);if(r>=55296&&56319>=r){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,i)}return e},c.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(2>=e&&n>>4==14){this.charLength=3;break}if(3>=e&&n>>3==30){this.charLength=4;break}}this.charReceived=e},c.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},function(t,e,n){function r(t){return n(i(t))}function i(t){return o[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var o={"./apigateway":37, +"./apigateway.js":37,"./cloudfront":38,"./cloudfront.js":38,"./cloudsearchdomain":39,"./cloudsearchdomain.js":39,"./cognitoidentity":40,"./cognitoidentity.js":40,"./dynamodb":41,"./dynamodb.js":41,"./ec2":42,"./ec2.js":42,"./glacier":43,"./glacier.js":43,"./iotdata":44,"./iotdata.js":44,"./machinelearning":45,"./machinelearning.js":45,"./route53":46,"./route53.js":46,"./s3":47,"./s3.js":47,"./sqs":48,"./sqs.js":48,"./sts":49,"./sts.js":49,"./swf":50,"./swf.js":50};r.keys=function(){return Object.keys(o)},r.resolve=i,t.exports=r,r.id=116},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.logger=void 0;var i=n(9),o=r(i);e.logger=o.default},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}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")}var a=function(){function t(t,e){for(var n=0;n>8-o%1*8)){if(i=t.charCodeAt(o+=.75),i>255)throw r;e=e<<8|i}return s}),t.atob||(t.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw r;for(var e,i,o=0,a=0,s="";i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?s+=String.fromCharCode(255&e>>(-2*o&6)):0)i=n.indexOf(i);return s})}()},function(t,e,n){var r;(function(t,i){(function(){function o(t,e){return t.set(e[0],e[1]),t}function a(t,e){return t.add(e),t}function s(t,e,n){var r=n?n.length:0;switch(r){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function u(t,e){for(var n=-1,r=t.length,i=-1,o=e.length,a=Array(r+o);++n-1}function p(t,e,n){for(var r=-1,i=t.length;++r-1;);return n}function I(t,e){for(var n=t.length;n--&&j(e,t[n],0)>-1;);return n}function O(t){return t&&t.Object===Object?t:null}function L(t,e){if(t!==e){var n=null===t,r=t===Y,i=t===t,o=null===e,a=e===Y,s=e===e;if(t>e&&!o||!i||n&&!a&&s||r&&s)return 1;if(e>t&&!n||!s||o&&!r&&i||a&&i)return-1}return 0}function F(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r=s)return u;var c=n[r];return u*("desc"==c?-1:1)}}return t.index-e.index}function q(t){return yn[t]}function U(t){return bn[t]}function M(t){return"\\"+En[t]}function N(t,e,n){for(var r=t.length,i=e+(n?0:-1);n?i--:++i-1&&t%1==0&&e>t}function H(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}function W(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function z(t,e){for(var n=-1,r=t.length,i=-1,o=[];++ne,i=n?t.length:0,o=ni(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,f=l.length,h=0,d=Qu(u,this.__takeCount__);if(!n||pt>i||i==u&&d==u)return vr(t,this.__actions__);var p=[];t:for(;u--&&d>h;){c+=e;for(var g=-1,v=t[c];++gn)return!1;var r=t.length-1;return n==r?t.pop():Bu.call(t,n,1),!0}function Ye(t,e){var n=Je(t,e);return 0>n?Y:t[n][1]}function $e(t,e){return Je(t,e)>-1}function Je(t,e){for(var n=t.length;n--;)if(oa(t[n][0],e))return n;return-1}function Ze(t,e,n){var r=Je(t,e);0>r?t.push([e,n]):t[r][1]=n}function tn(t,e,n,r){return t===Y||oa(t,ju[n])&&!Au.call(r,n)?e:t}function en(t,e,n){(n!==Y&&!oa(t[e],n)||"number"==typeof e&&n===Y&&!(e in t))&&(t[e]=n)}function nn(t,e,n){var r=t[e];(!oa(r,n)||oa(r,ju[e])&&!Au.call(t,e)||n===Y&&!(e in t))&&(t[e]=n)}function rn(t,e){return t&&xr(e,as(e),t)}function on(t,e){for(var n=-1,r=null==t,i=e.length,o=Array(i);++n=t?t:n),e!==Y&&(t=t>=e?t:e)),t}function sn(t,e,n,r,i,o){var a;if(n&&(a=i?n(t,r,i,o):n(t)),a!==Y)return a;if(!Ea(t))return t;var s=tl(t);if(s){if(a=ii(t),!e)return Tr(t,a)}else{var u=ei(t),l=u==Ot||u==Lt;if(u!=Ut&&u!=Ct&&(!l||i))return mn[u]?ai(t,u,e):i?t:{};if(D(t))return i?t:{};if(a=oi(l?{}:t),!e)return kr(t,rn(a,t))}o||(o=new We);var f=o.get(t);return f?f:(o.set(t,a),(s?c:xn)(t,function(r,i){nn(a,i,sn(r,e,n,i,t,o))}),s?a:kr(t,a))}function cn(t){var e=as(t),n=e.length;return function(r){if(null==r)return!n;for(var i=n;i--;){var o=e[i],a=t[o],s=r[o];if(s===Y&&!(o in Object(r))||!a(s))return!1}return!0}}function yn(t,e,n){if("function"!=typeof t)throw new _u(yt);return Du(function(){t.apply(Y,n)},e)}function bn(t,e,n,r){var i=-1,o=d,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=g(e,k(n))),r?(o=p,a=!1):e.length>=pt&&(o=Be,a=!1,e=new De(e));t:for(;++in&&(n=-n>i?0:i+n),r=r===Y||r>i?i:Ba(r),0>r&&(r+=i),r=n>r?0:Ha(r);r>n;)t[n++]=e;return t}function En(t,e){var n=[];return lc(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function An(t,e,n,r){r||(r=[]);for(var i=-1,o=t.length;++in;)t=t[e[n++]];return n&&n==r?t:Y}function On(t,e){return Au.call(t,e)||"object"==typeof t&&e in t&&null===qu(t)}function Ln(t,e){return e in Object(t)}function Fn(t,e,n){return t>=Qu(e,n)&&t=120)?new De(o&&u):Y}u=t[0];var c=-1,l=u.length,f=a[0];t:for(;++c-1;)o!==t&&Bu.call(o,a,1),Bu.call(t,a,1);return t}function nr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(r==n||i!=o){var o=i;if(B(i))Bu.call(t,i,1);else if(ci(i,t))delete t[i];else{var a=hr(i),s=vi(t,a);null!=s&&delete s[Ni(a)]}}}return t}function rr(t,e){return t+Wu(Yu()*(e-t+1))}function ir(t,e,n,r){for(var i=-1,o=Gu(Hu((e-t)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=t,t+=n;return a}function or(t,e,n,r){e=ci(e,t)?[e+""]:hr(e);for(var i=-1,o=e.length,a=o-1,s=t;null!=s&&++ie&&(e=-e>i?0:i+e),n=n>i?i:n,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=i){for(;i>r;){var o=r+i>>>1,a=t[o];(n?e>=a:e>a)&&null!==a?r=o+1:i=o}return i}return cr(t,e,Xs,n)}function cr(t,e,n,r){e=n(e);for(var i=0,o=t?t.length:0,a=e!==e,s=null===e,u=e===Y;o>i;){var c=Wu((i+o)/2),l=n(t[c]),f=l!==Y,h=l===l;if(a)var d=h||r;else d=s?h&&f&&(r||null!=l):u?h&&(r||f):null==l?!1:r?e>=l:e>l;d?i=c+1:o=c}return Qu(o,At)}function lr(t){return fr(t)}function fr(t,e){for(var n=0,r=t.length,i=t[0],o=e?e(i):i,a=o,s=0,u=[i];++n=pt){var c=e?null:gc(t);if(c)return K(c);a=!1,i=Be,u=new De}else u=e?[]:s;t:for(;++r1?n[i-1]:Y,a=i>2?n[2]:Y;for(o="function"==typeof o?(i--,o):Y,a&&ui(n[0],n[1],a)&&(o=3>i?Y:o,i=1),e=Object(e);++ro&&u[0]!==l&&u[o-1]!==l?[]:z(u,l);return o-=f.length,n>o?Kr(t,e,Dr,l,Y,u,f,Y,Y,n-o):s(c,this,u)}var i=Ur(t);return r}function Nr(t){return Yo(function(e){e=An(e);var n=e.length,i=n,o=r.prototype.thru;for(t&&e.reverse();i--;){var a=e[i];if("function"!=typeof a)throw new _u(yt);if(o&&!s&&"wrapper"==$r(a))var s=new r([],!0)}for(i=s?i:n;++i=pt)return s.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++iy)return Kr(t,e,Dr,_,n,w,E,s,u,c-y)}var j=h?n:this,S=d?j[t]:t;return s?w=mi(w,s):v&&w.length>1&&w.reverse(),f&&u=e)return"";var i=e-r;n=n===Y?" ":n+"";var o=Os(n,Hu(i/V(n)));return ln.test(n)?G(o).slice(0,i).join(""):o.slice(0,i)}function Wr(t,e,n,r){function i(){for(var e=-1,u=arguments.length,c=-1,l=r.length,f=Array(l+u),h=this&&this!==Pn&&this instanceof i?a:t;++ce?1:-1:Wa(r)||0,ir(e,n,r,t)}}function Kr(t,e,n,r,i,o,a,s,u,c){var l=e&et,f=s?Tr(s):Y,h=l?a:Y,d=l?Y:a,p=l?o:Y,g=l?Y:o;e|=l?rt:it,e&=~(l?it:rt),e&tt||(e&=~(J|Z));var v=[t,e,i,p,h,g,d,f,u,c],m=n.apply(Y,v);return fi(t)&&bc(m,v),m.placeholder=r,m}function Vr(t){var e=bu[t];return function(t,n){if(t=Wa(t),n=Ba(n)){var r=(Va(t)+"e").split("e"),i=e(r[0]+"e"+(+r[1]+n));return r=(Va(i)+"e").split("e"),+(r[0]+"e"+(+r[1]-n))}return e(t)}}function Gr(t,e,n,r,i,o,a,s){var u=e&Z;if(!u&&"function"!=typeof t)throw new _u(yt);var c=r?r.length:0;if(c||(e&=~(rt|it),r=i=Y),a=a===Y?a:Gu(Ba(a),0),s=s===Y?s:Ba(s),c-=i?i.length:0,e&it){var l=r,f=i;r=i=Y}var h=u?Y:vc(t),d=[t,e,n,r,i,l,f,o,a,s];if(h&&pi(d,h),t=d[0],e=d[1],n=d[2],r=d[3],i=d[4],s=d[9]=null==d[9]?u?0:t.length:Gu(d[9]-c,0),!s&&e&(et|nt)&&(e&=~(et|nt)),e&&e!=J)p=e==et||e==nt?Mr(t,e,s):e!=rt&&e!=(J|rt)||i.length?Dr.apply(Y,d):Wr(t,e,n,r);else var p=Lr(t,e,n);var g=h?pc:bc;return g(p,d)}function Qr(t,e,n,r,i,o){var a=-1,s=i&ct,u=i&ut,c=t.length,l=e.length;if(c!=l&&!(s&&l>c))return!1;var f=o.get(t);if(f)return f==e;var h=!0;for(o.set(t,e);++ai,a=r==ot&&n==et||r==ot&&n==at&&t[7].length<=e[8]||r==(ot|at)&&e[7].length<=e[8]&&n==et;if(!o&&!a)return t;r&J&&(t[2]=e[2],i|=n&J?0:tt);var s=e[3];if(s){var u=t[3];t[3]=u?Sr(u,s,e[4]):Tr(s),t[4]=u?z(t[3],xt):Tr(e[4])}return s=e[5],s&&(u=t[5],t[5]=u?Ar(u,s,e[6]):Tr(s),t[6]=u?z(t[5],xt):Tr(e[6])),s=e[7],s&&(t[7]=Tr(s)),r&ot&&(t[8]=null==t[8]?e[8]:Qu(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i,t}function gi(t,e,n,r,i,o){return Ea(t)&&Ea(e)&&(o.set(e,t),Gn(t,e,gi,o)),t===Y?sn(e):t}function vi(t,e){return 1==e.length?t:ns(t,ar(e,0,-1))}function mi(t,e){for(var n=t.length,r=Qu(e.length,n),i=Tr(t);r--;){var o=e[r];t[r]=B(o,n)?i[o]:Y}return t}function yi(t){var e=[];return Va(t).replace(fe,function(t,n,r,i){e.push(r?i.replace(me,"$1"):n||t)}),e}function bi(t){return la(t)?t:[]}function wi(t){return"function"==typeof t?t:Xs}function _i(t){if(t instanceof i)return t.clone();var e=new r(t.__wrapped__,t.__chain__);return e.__actions__=Tr(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}function Ei(t,e){e=Gu(Ba(e),0);var n=t?t.length:0;if(!n||1>e)return[];for(var r=0,i=-1,o=Array(Hu(n/e));n>r;)o[++i]=ar(t,r,r+=e);return o}function ji(t){for(var e=-1,n=t?t.length:0,r=-1,i=[];++ee?0:e,r)):[]}function Ai(t,e,n){var r=t?t.length:0;return r?(e=n||e===Y?1:Ba(e),e=r-e,ar(t,0,0>e?0:e)):[]}function Ti(t,e){return t&&t.length?gr(t,Jr(e,3),!0,!0):[]}function xi(t,e){return t&&t.length?gr(t,Jr(e,3),!0):[]}function Ci(t,e,n,r){var i=t?t.length:0;return i?(n&&"number"!=typeof n&&ui(t,e,n)&&(n=0,r=i),_n(t,e,n,r)):[]}function ki(t,e){return t&&t.length?E(t,Jr(e,3)):-1}function Ri(t,e){return t&&t.length?E(t,Jr(e,3),!0):-1}function Pi(t,e){var n=t?t.length:0;return n?An(g(t,Jr(e,3))):[]}function Ii(t){var e=t?t.length:0;return e?An(t):[]}function Oi(t){var e=t?t.length:0;return e?An(t,!0):[]}function Li(t){for(var e=-1,n=t?t.length:0,r={};++en&&(n=Gu(r+n,0)),j(t,e,n)):-1}function Ui(t){return Ai(t,1)}function Mi(t,e){return t?Ku.call(t,e):""}function Ni(t){var e=t?t.length:0;return e?t[e-1]:Y}function Di(t,e,n){var r=t?t.length:0;if(!r)return-1;var i=r;if(n!==Y&&(i=Ba(n),i=(0>i?Gu(r+i,0):Qu(i,r-1))+1),e!==e)return N(t,i,!0);for(;i--;)if(t[i]===e)return i;return-1}function Bi(t,e){return t&&t.length&&e&&e.length?tr(t,e):t}function Hi(t,e,n){return t&&t.length&&e&&e.length?er(t,e,Jr(n)):t}function Wi(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=Jr(e,3);++rr&&oa(t[r],e))return r}return-1}function Xi(t,e){return ur(t,e,!0)}function Yi(t,e,n){return cr(t,e,Jr(n),!0)}function $i(t,e){var n=t?t.length:0;if(n){var r=ur(t,e,!0)-1;if(oa(t[r],e))return r}return-1}function Ji(t){return t&&t.length?lr(t):[]}function Zi(t,e){return t&&t.length?fr(t,Jr(e)):[]}function to(t){return Si(t,1)}function eo(t,e,n){return t&&t.length?(e=n||e===Y?1:Ba(e),ar(t,0,0>e?0:e)):[]}function no(t,e,n){var r=t?t.length:0;return r?(e=n||e===Y?1:Ba(e),e=r-e,ar(t,0>e?0:e,r)):[]}function ro(t,e){return t&&t.length?gr(t,Jr(e,3),!1,!0):[]}function io(t,e){return t&&t.length?gr(t,Jr(e,3)):[]}function oo(t){return t&&t.length?dr(t):[]}function ao(t,e){return t&&t.length?dr(t,Jr(e)):[]}function so(t,e){return t&&t.length?dr(t,Y,e):[]}function uo(t){if(!t||!t.length)return[];var e=0;return t=h(t,function(t){return la(t)?(e=Gu(t.length,e),!0):void 0}),x(e,function(e){return g(t,Jn(e))})}function co(t,e){if(!t||!t.length)return[];var n=uo(t);return null==e?n:g(n,function(t){return s(e,Y,t)})}function lo(t,e){for(var n=-1,r=t?t.length:0,i=e?e.length:0,o={};++nn?e[n]:Y);return o}function fo(t){var n=e(t);return n.__chain__=!0,n}function ho(t,e){return e(t),t}function po(t,e){return e(t)}function go(){return fo(this)}function vo(){return new r(this.value(),this.__chain__)}function mo(t){return this.map(t).flatten()}function yo(){this.__values__===Y&&(this.__values__=Da(this.value()));var t=this.__index__>=this.__values__.length,e=t?Y:this.__values__[this.__index__++];return{done:t,value:e}}function bo(){return this}function wo(t){for(var e,r=this;r instanceof n;){var i=_i(r);i.__index__=0,i.__values__=Y,e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=t,e}function _o(){var t=this.__wrapped__;if(t instanceof i){var e=t;return this.__actions__.length&&(e=new i(this)),e=e.reverse(),e.__actions__.push({func:po,args:[zi],thisArg:Y}),new r(e,this.__chain__)}return this.thru(zi)}function Eo(){return vr(this.__wrapped__,this.__actions__)}function jo(t,e,n){var r=tl(t)?f:wn;return n&&ui(t,e,n)&&(e=Y),r(t,Jr(e,3))}function So(t,e){var n=tl(t)?h:En;return n(t,Jr(e,3))}function Ao(t,e){if(e=Jr(e,3),tl(t)){var n=E(t,e);return n>-1?t[n]:Y}return _(t,e,lc)}function To(t,e){if(e=Jr(e,3),tl(t)){var n=E(t,e,!0);return n>-1?t[n]:Y}return _(t,e,fc)}function xo(t,e){return"function"==typeof e&&tl(t)?c(t,e):lc(t,wi(e))}function Co(t,e){return"function"==typeof e&&tl(t)?l(t,e):fc(t,wi(e))}function ko(t,e,n,r){t=ca(t)?t:bs(t),n=n&&!r?Ba(n):0;var i=t.length;return 0>n&&(n=Gu(i+n,0)),La(t)?i>=n&&t.indexOf(e,n)>-1:!!i&&j(t,e,n)>-1}function Ro(t,e){var n=tl(t)?g:zn;return n(t,Jr(e,3))}function Po(t,e,n,r){return null==t?[]:(tl(e)||(e=null==e?[]:[e]),n=r?Y:n,tl(n)||(n=null==n?[]:[n]),Xn(t,e,n))}function Io(t,e,n){var r=tl(t)?m:S,i=arguments.length<3;return r(t,Jr(e,4),n,i,lc)}function Oo(t,e,n){var r=tl(t)?y:S,i=arguments.length<3;return r(t,Jr(e,4),n,i,fc)}function Lo(t,e){var n=tl(t)?h:En;return e=Jr(e,3),n(t,function(t,n,r){return!e(t,n,r)})}function Fo(t){var e=ca(t)?t:bs(t),n=e.length;return n>0?e[rr(0,n-1)]:Y}function qo(t,e){var n=-1,r=Da(t),i=r.length,o=i-1;for(e=an(Ba(e),0,i);++n0&&(n=e.apply(this,arguments)),1>=t&&(e=Y),n}}function Wo(t,e,n){e=n?Y:e;var r=Gr(t,et,Y,Y,Y,Y,Y,e);return r.placeholder=Wo.placeholder,r}function zo(t,e,n){e=n?Y:e;var r=Gr(t,nt,Y,Y,Y,Y,Y,e);return r.placeholder=zo.placeholder,r}function Ko(t,e,n){function r(){p&&Lu(p),l&&Lu(l),v=0,c=l=d=p=g=Y}function i(e,n){n&&Lu(n),l=p=g=Y,e&&(v=Kc(),f=t.apply(d,c),p||l||(c=d=Y))}function o(){var t=e-(Kc()-h);0>=t||t>e?i(g,l):p=Du(o,t)}function a(){return(p&&g||l&&b)&&(f=t.apply(d,c)),r(),f}function s(){i(b,p)}function u(){if(c=arguments,h=Kc(),d=this,g=b&&(p||!m),y===!1)var n=m&&!p;else{l||m||(v=h);var r=y-(h-v),i=0>=r||r>y;i?(l&&(l=Lu(l)),v=h,f=t.apply(d,c)):l||(l=Du(s,r))}return i&&p?p=Lu(p):p||e===y||(p=Du(o,e)),n&&(i=!0,f=t.apply(d,c)),!i||p||l||(c=d=Y),f}var c,l,f,h,d,p,g,v=0,m=!1,y=!1,b=!0;if("function"!=typeof t)throw new _u(yt);return e=Wa(e)||0,Ea(n)&&(m=!!n.leading,y="maxWait"in n&&Gu(Wa(n.maxWait)||0,e),b="trailing"in n?!!n.trailing:b),u.cancel=r,u.flush=a,u}function Vo(t){return Gr(t,st)}function Go(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new _u(yt);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new Go.Cache,n}function Qo(t){if("function"!=typeof t)throw new _u(yt);return function(){return!t.apply(this,arguments)}}function Xo(t){return Ho(2,t)}function Yo(t,e){if("function"!=typeof t)throw new _u(yt);return e=Gu(e===Y?t.length-1:Ba(e),0),function(){for(var n=arguments,r=-1,i=Gu(n.length-e,0),o=Array(i);++re}function sa(t,e){return t>=e}function ua(t){return la(t)&&Au.call(t,"callee")&&(!Nu.call(t,"callee")||Cu.call(t)==Ct)}function ca(t){return null!=t&&!("function"==typeof t&&ba(t))&&_a(mc(t))}function la(t){return ja(t)&&ca(t)}function fa(t){return t===!0||t===!1||ja(t)&&Cu.call(t)==Rt}function ha(t){return ja(t)&&Cu.call(t)==Pt}function da(t){return!!t&&1===t.nodeType&&ja(t)&&!Pa(t)}function pa(t){return!ja(t)||ba(t.splice)?!Mo(t):!as(t).length}function ga(t,e){return Mn(t,e)}function va(t,e,n){n="function"==typeof n?n:Y;var r=n?n(t,e):Y;return r===Y?Mn(t,e,n):!!r}function ma(t){return ja(t)&&"string"==typeof t.message&&Cu.call(t)==It}function ya(t){return"number"==typeof t&&zu(t)}function ba(t){var e=Ea(t)?Cu.call(t):"";return e==Ot||e==Lt}function wa(t){return"number"==typeof t&&t==Ba(t)}function _a(t){return"number"==typeof t&&t>-1&&t%1==0&&_t>=t}function Ea(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ja(t){return!!t&&"object"==typeof t}function Sa(t,e){return t===e||Dn(t,e,Zr(e))}function Aa(t,e,n){return n="function"==typeof n?n:Y,Dn(t,e,Zr(e),n)}function Ta(t){return Ra(t)&&t!=+t}function xa(t){return null==t?!1:ba(t)?Ru.test(Su.call(t)):ja(t)&&(D(t)?Ru:je).test(t)}function Ca(t){return null===t}function ka(t){return null==t}function Ra(t){return"number"==typeof t||ja(t)&&Cu.call(t)==qt}function Pa(t){if(!ja(t)||Cu.call(t)!=Ut||D(t))return!1;var e=ju;if("function"==typeof t.constructor&&(e=qu(t)),null===e)return!0;var n=e.constructor;return"function"==typeof n&&n instanceof n&&Su.call(n)==xu}function Ia(t){return Ea(t)&&Cu.call(t)==Mt}function Oa(t){return wa(t)&&t>=-_t&&_t>=t}function La(t){return"string"==typeof t||!tl(t)&&ja(t)&&Cu.call(t)==Dt}function Fa(t){return"symbol"==typeof t||ja(t)&&Cu.call(t)==Bt}function qa(t){return ja(t)&&_a(t.length)&&!!vn[Cu.call(t)]}function Ua(t){return t===Y}function Ma(t,e){return e>t}function Na(t,e){return e>=t}function Da(t){if(!t)return[];if(ca(t))return La(t)?G(t):Tr(t);if(Mu&&t[Mu])return H(t[Mu]());var e=ei(t),n=e==Ft?W:e==Nt?K:bs;return n(t)}function Ba(t){if(!t)return 0===t?t:0;if(t=Wa(t),t===wt||t===-wt){var e=0>t?-1:1;return e*Et}var n=t%1;return t===t?n?t-n:t:0}function Ha(t){return t?an(Ba(t),0,St):0}function Wa(t){if(Ea(t)){var e=ba(t.valueOf)?t.valueOf():t;t=Ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(pe,"");var n=Ee.test(t);return n||Se.test(t)?Sn(t.slice(2),n?2:8):_e.test(t)?jt:+t}function za(t){return xr(t,ss(t))}function Ka(t){return an(Ba(t),-_t,_t)}function Va(t){if("string"==typeof t)return t;if(null==t)return"";if(Fa(t))return Pu?sc.call(t):"";var e=t+"";return"0"==e&&1/t==-wt?"-0":e}function Ga(t,e){var n=cc(t);return e?rn(n,e):n}function Qa(t,e){return _(t,Jr(e,3),xn,!0)}function Xa(t,e){return _(t,Jr(e,3),Cn,!0)}function Ya(t,e){return null==t?t:hc(t,wi(e),ss)}function $a(t,e){return null==t?t:dc(t,wi(e),ss)}function Ja(t,e){return t&&xn(t,wi(e))}function Za(t,e){return t&&Cn(t,wi(e))}function ts(t){return null==t?[]:kn(t,as(t))}function es(t){return null==t?[]:kn(t,ss(t))}function ns(t,e,n){var r=null==t?Y:Rn(t,e);return r===Y?n:r}function rs(t,e){return ri(t,e,On)}function is(t,e){return ri(t,e,Ln)}function os(t,e,n){return m(as(t),function(r,i){var o=t[i];return e&&!n?Au.call(r,o)?r[o].push(i):r[o]=[i]:r[o]=i,r},{})}function as(t){var e=hi(t);if(!e&&!ca(t))return Hn(t);var n=si(t),r=!!n,i=n||[],o=i.length;for(var a in t)!On(t,a)||r&&("length"==a||B(a,o))||e&&"constructor"==a||i.push(a);return i}function ss(t){for(var e=-1,n=hi(t),r=Wn(t),i=r.length,o=si(t),a=!!o,s=o||[],u=s.length;++ee){var r=t;t=e,e=r}if(n||t%1||e%1){var i=Yu();return Qu(t+i*(e-t+jn("1e-"+((i+"").length-1))),e)}return rr(t,e)}function Ss(t){return ml(Va(t).toLowerCase())}function As(t){return t=Va(t),t&&t.replace(Te,q).replace(un,"")}function Ts(t,e,n){t=Va(t),e="string"==typeof e?e:e+"";var r=t.length;return n=n===Y?r:an(Ba(n),0,r),n-=e.length,n>=0&&t.indexOf(e,n)==n}function xs(t){return t=Va(t),t&&oe.test(t)?t.replace(re,U):t}function Cs(t){return t=Va(t),t&&de.test(t)?t.replace(he,"\\$&"):t}function ks(t,e,n){t=Va(t),e=Ba(e);var r=V(t);if(!e||r>=e)return t;var i=(e-r)/2,o=Wu(i),a=Hu(i);return Hr("",o,n)+t+Hr("",a,n)}function Rs(t,e,n){return t=Va(t),t+Hr(t,e,n)}function Ps(t,e,n){return t=Va(t),Hr(t,e,n)+t}function Is(t,e,n){return n||null==e?e=0:e&&(e=+e),t=Va(t).replace(pe,""),Xu(t,e||(we.test(t)?16:10))}function Os(t,e){t=Va(t),e=Ba(e);var n="";if(!t||1>e||e>_t)return n;do e%2&&(n+=t),e=Wu(e/2),t+=t;while(e);return n}function Ls(){var t=arguments,e=Va(t[0]);return t.length<3?e:e.replace(t[1],t[2])}function Fs(t,e,n){return Va(t).split(e,n)}function qs(t,e,n){return t=Va(t),n=an(Ba(n),0,t.length),t.lastIndexOf(e,n)==n}function Us(t,n,r){var i=e.templateSettings;r&&ui(t,n,r)&&(n=Y),t=Va(t),n=rl({},n,i,tn);var o,a,s=rl({},n.imports,i.imports,tn),u=as(s),c=R(s,u),l=0,f=n.interpolate||xe,h="__p += '",d=wu((n.escape||xe).source+"|"+f.source+"|"+(f===ue?ye:xe).source+"|"+(n.evaluate||xe).source+"|$","g"),p="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++gn+"]")+"\n";t.replace(d,function(e,n,r,i,s,u){return r||(r=i),h+=t.slice(l,u).replace(Ce,M),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),h+="';\n";var g=n.variable;g||(h="with (obj) {\n"+h+"\n}\n"),h=(a?h.replace(Zt,""):h).replace(te,"$1").replace(ee,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var v=_l(function(){return Function(u,p+"return "+h).apply(Y,c)});if(v.source=h,ma(v))throw v;return v}function Ms(t){return Va(t).toLowerCase()}function Ns(t){return Va(t).toUpperCase()}function Ds(t,e,n){if(t=Va(t),!t)return t;if(n||e===Y)return t.replace(pe,"");if(e+="",!e)return t;var r=G(t),i=G(e);return r.slice(P(r,i),I(r,i)+1).join("")}function Bs(t,e,n){if(t=Va(t),!t)return t;if(n||e===Y)return t.replace(ve,"");if(e+="",!e)return t;var r=G(t);return r.slice(0,I(r,G(e))+1).join("")}function Hs(t,e,n){if(t=Va(t),!t)return t;if(n||e===Y)return t.replace(ge,"");if(e+="",!e)return t;var r=G(t);return r.slice(P(r,G(e))).join("")}function Ws(t,e){var n=lt,r=ft;if(Ea(e)){var i="separator"in e?e.separator:i;n="length"in e?Ba(e.length):n,r="omission"in e?Va(e.omission):r}t=Va(t);var o=t.length;if(ln.test(t)){var a=G(t);o=a.length}if(n>=o)return t;var s=n-V(r);if(1>s)return r;var u=a?a.slice(0,s).join(""):t.slice(0,s);if(i===Y)return u+r;if(a&&(s+=u.length-s),Ia(i)){if(t.slice(s).search(i)){var c,l=u;for(i.global||(i=wu(i.source,Va(be.exec(i))+"g")),i.lastIndex=0;c=i.exec(l);)var f=c.index;u=u.slice(0,f===Y?s:f)}}else if(t.indexOf(i,s)!=s){var h=u.lastIndexOf(i);h>-1&&(u=u.slice(0,h))}return u+r}function zs(t){return t=Va(t),t&&ie.test(t)?t.replace(ne,Q):t}function Ks(t,e,n){return t=Va(t),e=n?Y:e,e===Y&&(e=dn.test(t)?hn:fn),t.match(e)||[]}function Vs(t){var e=t?t.length:0,n=Jr();return t=e?g(t,function(t){if("function"!=typeof t[1])throw new _u(yt);return[n(t[0]),t[1]]}):[],Yo(function(n){for(var r=-1;++rt||t>_t)return[];var n=St,r=Qu(t,St);e=wi(e),t-=St;for(var i=x(r,e);++n0){if(++t>=ht)return n}else t=0;return pc(n,r)}}(),wc=Yo(function(t,e){return e=An(e),u(tl(t)?t:[Object(t)],e)}),_c=Yo(function(t,e){return la(t)?bn(t,An(e,!1,!0)):[]}),Ec=Yo(function(t,e){var n=Ni(e);return la(n)&&(n=Y),la(t)?bn(t,An(e,!1,!0),Jr(n)):[]}),jc=Yo(function(t,e){var n=Ni(e);return la(n)&&(n=Y),la(t)?bn(t,An(e,!1,!0),Y,n):[]}),Sc=Yo(function(t){var e=g(t,bi);return e.length&&e[0]===t[0]?qn(e):[]}),Ac=Yo(function(t){var e=Ni(t),n=g(t,bi);return e===Ni(n)?e=Y:n.pop(),n.length&&n[0]===t[0]?qn(n,Jr(e)):[]}),Tc=Yo(function(t){var e=Ni(t),n=g(t,bi);return e===Ni(n)?e=Y:n.pop(),n.length&&n[0]===t[0]?qn(n,Y,e):[]}),xc=Yo(Bi),Cc=Yo(function(t,e){e=g(An(e),String);var n=on(t,e);return nr(t,e.sort(L)),n}),kc=Yo(function(t){return dr(An(t,!1,!0))}),Rc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),dr(An(t,!1,!0),Jr(e))}),Pc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),dr(An(t,!1,!0),Y,e)}),Ic=Yo(function(t,e){return la(t)?bn(t,e):[]}),Oc=Yo(function(t){return mr(h(t,la))}),Lc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),mr(h(t,la),Jr(e))}),Fc=Yo(function(t){var e=Ni(t);return la(e)&&(e=Y),mr(h(t,la),Y,e)}),qc=Yo(uo),Uc=Yo(function(t){var e=t.length,n=e>1?t[e-1]:Y;return n="function"==typeof n?(t.pop(),n):Y,co(t,n)}),Mc=Yo(function(t){t=An(t);var e=t.length,n=e?t[0]:0,o=this.__wrapped__,a=function(e){return on(e,t)};return!(e>1||this.__actions__.length)&&o instanceof i&&B(n)?(o=o.slice(n,+n+(e?1:0)),o.__actions__.push({func:po,args:[a],thisArg:Y}),new r(o,this.__chain__).thru(function(t){return e&&!t.length&&t.push(Y),t})):this.thru(a)}),Nc=Rr(function(t,e,n){Au.call(t,n)?++t[n]:t[n]=1}),Dc=Rr(function(t,e,n){Au.call(t,n)?t[n].push(e):t[n]=[e]}),Bc=Yo(function(t,e,n){var r=-1,i="function"==typeof e,o=ci(e),a=ca(t)?Array(t.length):[];return lc(t,function(t){var u=i?e:o&&null!=t?t[e]:Y;a[++r]=u?s(u,t,n):Un(t,e,n)}),a}),Hc=Rr(function(t,e,n){t[n]=e}),Wc=Rr(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),zc=Yo(function(t,e){if(null==t)return[];var n=e.length;return n>1&&ui(t,e[0],e[1])?e=[]:n>2&&ui(e[0],e[1],e[2])&&(e.length=1),Xn(t,An(e),[])}),Kc=mu.now,Vc=Yo(function(t,e,n){var r=J;if(n.length){var i=z(n,Vc.placeholder);r|=rt}return Gr(t,r,e,n,i)}),Gc=Yo(function(t,e,n){var r=J|Z;if(n.length){var i=z(n,Gc.placeholder);r|=rt}return Gr(e,r,t,n,i)}),Qc=Yo(function(t,e){return yn(t,1,e)}),Xc=Yo(function(t,e,n){return yn(t,Wa(e)||0,n)}),Yc=Yo(function(t,e){e=g(An(e),Jr());var n=e.length;return Yo(function(r){for(var i=-1,o=Qu(r.length,n);++i0||0>e)?new i(n):(0>t?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==Y&&(e=Ba(e),n=0>e?n.dropRight(-e):n.take(e-t)),n)},i.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},i.prototype.toArray=function(){return this.take(St)},xn(i.prototype,function(t,n){var o=/^(?:filter|find|map|reject)|While$/.test(n),a=/^(?:head|last)$/.test(n),s=e[a?"take"+("last"==n?"Right":""):n],u=a||/^find/.test(n);s&&(e.prototype[n]=function(){var n=this.__wrapped__,c=a?[1]:arguments,l=n instanceof i,f=c[0],h=l||tl(n),d=function(t){var n=s.apply(e,v([t],c));return a&&p?n[0]:n};h&&o&&"function"==typeof f&&1!=f.length&&(l=h=!1);var p=this.__chain__,g=!!this.__actions__.length,m=u&&!p,y=l&&!g;if(!u&&h){n=y?n:new i(this);var b=t.apply(n,c);return b.__actions__.push({func:po,args:[d],thisArg:Y}),new r(b,p)}return m&&y?t.apply(this,c):(b=this.thru(d),m?a?b.value()[0]:b.value():b)})}),c(["pop","push","shift","sort","splice","unshift"],function(t){var n=Eu[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);e.prototype[t]=function(){var t=arguments;return i&&!this.__chain__?n.apply(this.value(),t):this[r](function(e){return n.apply(e,t)})}}),xn(i.prototype,function(t,n){var r=e[n];if(r){var i=r.name+"",o=uc[i]||(uc[i]=[]);o.push({name:n,func:r})}}),uc[Dr(Y,Z).name]=[{name:"wrapper",func:Y}],i.prototype.clone=O,i.prototype.reverse=Ht,i.prototype.value=Ae,e.prototype.at=Mc,e.prototype.chain=go,e.prototype.commit=vo,e.prototype.flatMap=mo,e.prototype.next=yo,e.prototype.plant=wo,e.prototype.reverse=_o,e.prototype.toJSON=e.prototype.valueOf=e.prototype.value=Eo,Mu&&(e.prototype[Mu]=bo),e}var Y,$="4.0.0",J=1,Z=2,tt=4,et=8,nt=16,rt=32,it=64,ot=128,at=256,st=512,ut=1,ct=2,lt=30,ft="...",ht=150,dt=16,pt=200,gt=1,vt=2,mt=3,yt="Expected a function",bt="__lodash_hash_undefined__",wt=1/0,_t=9007199254740991,Et=1.7976931348623157e308,jt=NaN,St=4294967295,At=St-1,Tt=St>>>1,xt="__lodash_placeholder__",Ct="[object Arguments]",kt="[object Array]",Rt="[object Boolean]",Pt="[object Date]",It="[object Error]",Ot="[object Function]",Lt="[object GeneratorFunction]",Ft="[object Map]",qt="[object Number]",Ut="[object Object]",Mt="[object RegExp]",Nt="[object Set]",Dt="[object String]",Bt="[object Symbol]",Ht="[object WeakMap]",Wt="[object ArrayBuffer]",zt="[object Float32Array]",Kt="[object Float64Array]",Vt="[object Int8Array]",Gt="[object Int16Array]",Qt="[object Int32Array]",Xt="[object Uint8Array]",Yt="[object Uint8ClampedArray]",$t="[object Uint16Array]",Jt="[object Uint32Array]",Zt=/\b__p \+= '';/g,te=/\b(__p \+=) '' \+/g,ee=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ne=/&(?:amp|lt|gt|quot|#39|#96);/g,re=/[&<>"'`]/g,ie=RegExp(ne.source),oe=RegExp(re.source),ae=/<%-([\s\S]+?)%>/g,se=/<%([\s\S]+?)%>/g,ue=/<%=([\s\S]+?)%>/g,ce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,le=/^\w*$/,fe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,he=/[\\^$.*+?()[\]{}|]/g,de=RegExp(he.source),pe=/^\s+|\s+$/g,ge=/^\s+/,ve=/\s+$/,me=/\\(\\)?/g,ye=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,be=/\w*$/,we=/^0x/i,_e=/^[-+]0x[0-9a-f]+$/i,Ee=/^0b[01]+$/i,je=/^\[object .+?Constructor\]$/,Se=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,Te=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,xe=/($^)/,Ce=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",Re="\\u0300-\\u036f\\ufe20-\\ufe23",Pe="\\u2700-\\u27bf",Ie="a-z\\xdf-\\xf6\\xf8-\\xff",Oe="\\xac\\xb1\\xd7\\xf7",Le="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fe="\\u2018\\u2019\\u201c\\u201d",qe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ue="A-Z\\xc0-\\xd6\\xd8-\\xde",Me="\\ufe0e\\ufe0f",Ne=Oe+Le+Fe+qe,De="["+ke+"]",Be="["+Ne+"]",He="["+Re+"]",We="\\d+",ze="["+Pe+"]",Ke="["+Ie+"]",Ve="[^"+ke+Ne+We+Pe+Ie+Ue+"]",Ge="(?:\\ud83c[\\udffb-\\udfff])",Qe="[^"+ke+"]",Xe="(?:\\ud83c[\\udde6-\\uddff]){2}",Ye="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Ue+"]",Je="\\u200d",Ze="(?:"+Ke+"|"+Ve+")",tn="(?:"+$e+"|"+Ve+")",en=Ge+"?",nn="["+Me+"]?",rn="(?:"+Je+"(?:"+[Qe,Xe,Ye].join("|")+")"+nn+en+")*",on=nn+en+rn,an="(?:"+[ze,Xe,Ye].join("|")+")"+on,sn="(?:"+[Qe+He+"?",He,Xe,Ye,De].join("|")+")",un=RegExp(He,"g"),cn=RegExp(sn+on,"g"),ln=RegExp("["+Je+ke+Re+Me+"]"),fn=/[a-zA-Z0-9]+/g,hn=RegExp([$e+"?"+Ke+"+(?="+[Be,$e,"$"].join("|")+")",tn+"+(?="+[Be,$e+Ze,"$"].join("|")+")",$e+"?"+Ze+"+",We+"(?:"+Ze+"+)?",an].join("|"),"g"),dn=/[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,pn=["Array","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Reflect","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],gn=-1,vn={}; vn[zt]=vn[Kt]=vn[Vt]=vn[Gt]=vn[Qt]=vn[Xt]=vn[Yt]=vn[$t]=vn[Jt]=!0,vn[Ct]=vn[kt]=vn[Wt]=vn[Rt]=vn[Pt]=vn[It]=vn[Ot]=vn[Ft]=vn[qt]=vn[Ut]=vn[Mt]=vn[Nt]=vn[Dt]=vn[Ht]=!1;var mn={};mn[Ct]=mn[kt]=mn[Wt]=mn[Rt]=mn[Pt]=mn[zt]=mn[Kt]=mn[Vt]=mn[Gt]=mn[Qt]=mn[Ft]=mn[qt]=mn[Ut]=mn[Mt]=mn[Nt]=mn[Dt]=mn[Bt]=mn[Xt]=mn[Yt]=mn[$t]=mn[Jt]=!0,mn[It]=mn[Ot]=mn[Ht]=!1;var yn={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},bn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},wn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},_n={"function":!0,object:!0},En={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jn=parseFloat,Sn=parseInt,An=_n[typeof e]&&e&&!e.nodeType?e:null,Tn=_n[typeof t]&&t&&!t.nodeType?t:null,xn=O(An&&Tn&&"object"==typeof i&&i),Cn=O(_n[typeof self]&&self),kn=O(_n[typeof window]&&window),Rn=(Tn&&Tn.exports===An?An:null,O(_n[typeof this]&&this)),Pn=xn||kn!==(Rn&&Rn.window)&&kn||Cn||Rn||Function("return this")(),In=X();(kn||Cn||{})._=In,r=function(){return In}.call(e,n,e,t),!(r!==Y&&(t.exports=r))}).call(this)}).call(e,n(108)(t),function(){return this}())},function(t,e,n){function r(){}function i(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function o(t){return t===Object(t)}function a(t){if(!o(t))return t;var e=[];for(var n in t)null!=t[n]&&s(e,n,t[n]);return e.join("&")}function s(t,e,n){return Array.isArray(n)?n.forEach(function(n){s(t,e,n)}):void t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))}function u(t){for(var e,n,r={},i=t.split("&"),o=0,a=i.length;a>o;++o)n=i[o],e=n.split("="),r[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return r}function c(t){var e,n,r,i,o=t.split(/\r?\n/),a={};o.pop();for(var s=0,u=o.length;u>s;++s)n=o[s],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),i=w(n.slice(e+1)),a[r]=i;return a}function l(t){return/[\/+]json\b/.test(t)}function f(t){return t.split(/ *; */).shift()}function h(t){return b(t.split(/ *; */),function(t,e){var n=e.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(t[r]=i),t},{})}function d(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=c(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text?this.text:this.xhr.response):null}function p(t,e){var n=this;y.call(this),this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new d(n)}catch(r){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=r,t.rawResponse=n.xhr&&n.xhr.responseText?n.xhr.responseText:null,n.callback(t)}if(n.emit("response",e),t)return n.callback(t,e);if(e.status>=200&&e.status<300)return n.callback(t,e);var i=new Error(e.statusText||"Unsuccessful HTTP response");i.original=t,i.response=e,i.status=e.status,n.callback(i,e)})}function g(t,e){return"function"==typeof e?new p("GET",t).end(e):1==arguments.length?new p("GET",t):new p(t,e)}function v(t,e){var n=g("DELETE",t);return e&&n.end(e),n}var m,y=n(125),b=n(126);m="undefined"!=typeof window?window:"undefined"!=typeof self?self:this,g.getXHR=function(){if(!(!m.XMLHttpRequest||m.location&&"file:"==m.location.protocol&&m.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1};var w="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};g.serializeObject=a,g.parseString=u,g.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},g.serialize={"application/x-www-form-urlencoded":a,"application/json":JSON.stringify},g.parse={"application/x-www-form-urlencoded":u,"application/json":JSON.parse},d.prototype.get=function(t){return this.header[t.toLowerCase()]},d.prototype.setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=f(e);var n=h(e);for(var r in n)this[r]=n[r]},d.prototype.parseBody=function(t){var e=g.parse[this.type];return e&&t&&(t.length||t instanceof Object)?e(t):null},d.prototype.setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},d.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",i=new Error(r);return i.status=this.status,i.method=e,i.url=n,i},g.Response=d,y(p.prototype),p.prototype.use=function(t){return t(this),this},p.prototype.timeout=function(t){return this._timeout=t,this},p.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},p.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},p.prototype.set=function(t,e){if(o(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},p.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},p.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},p.prototype.type=function(t){return this.set("Content-Type",g.types[t]||t),this},p.prototype.parse=function(t){return this._parser=t,this},p.prototype.accept=function(t){return this.set("Accept",g.types[t]||t),this},p.prototype.auth=function(t,e){var n=btoa(t+":"+e);return this.set("Authorization","Basic "+n),this},p.prototype.query=function(t){return"string"!=typeof t&&(t=a(t)),t&&this._query.push(t),this},p.prototype.field=function(t,e){return this._formData||(this._formData=new m.FormData),this._formData.append(t,e),this},p.prototype.attach=function(t,e,n){return this._formData||(this._formData=new m.FormData),this._formData.append(t,e,n),this},p.prototype.send=function(t){var e=o(t),n=this.getHeader("Content-Type");if(e&&o(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this.getHeader("Content-Type"),"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||i(t)?this:(n||this.type("json"),this)},p.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},p.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},p.prototype.withCredentials=function(){return this._withCredentials=!0,this},p.prototype.end=function(t){var e=this,n=this.xhr=g.getXHR(),o=this._query.join("&"),a=this._timeout,s=this._formData||this._data;this._callback=t||r,n.onreadystatechange=function(){if(4==n.readyState){var t;try{t=n.status}catch(r){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};var u=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),e.emit("progress",t)};this.hasListeners("progress")&&(n.onprogress=u);try{n.upload&&this.hasListeners("progress")&&(n.upload.onprogress=u)}catch(c){}if(a&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},a)),o&&(o=g.serializeObject(o),this.url+=~this.url.indexOf("?")?"&"+o:"?"+o),n.open(this.method,this.url,!0),this._withCredentials&&(n.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!i(s)){var f=this.getHeader("Content-Type"),h=this._parser||g.serialize[f?f.split(";")[0]:""];!h&&l(f)&&(h=g.serialize["application/json"]),h&&(s=h(s))}for(var d in this.header)null!=this.header[d]&&n.setRequestHeader(d,this.header[d]);return this.emit("request",this),n.send("undefined"!=typeof s?s:null),this},p.prototype.then=function(t,e){return this.end(function(n,r){n?e(n):t(r)})},g.Request=p,g.get=function(t,e,n){var r=g("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},g.head=function(t,e,n){var r=g("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},g.del=v,g.delete=v,g.patch=function(t,e,n){var r=g("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},g.post=function(t,e,n){var r=g("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},g.put=function(t,e,n){var r=g("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},t.exports=g},function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,i=0;ir;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){t.exports=function(t,e,n){for(var r=0,i=t.length,o=3==arguments.length?n:t[r++];i>r;)o=e.call(null,o,t[r],++r,t);return o}},function(t,e,n){!function(t){function e(n,r){if(!(this instanceof e))return new e(n,r);var o=this;i(o),o.q=o.c="",o.bufferCheckPosition=t.MAX_BUFFER_LENGTH,o.opt=r||{},o.opt.lowercase=o.opt.lowercase||o.opt.lowercasetags,o.looseCase=o.opt.lowercase?"toLowerCase":"toUpperCase",o.tags=[],o.closed=o.closedRoot=o.sawRoot=!1,o.tag=o.error=null,o.strict=!!n,o.noscript=!(!n&&!o.opt.noscript),o.state=H.BEGIN,o.ENTITIES=Object.create(t.ENTITIES),o.attribList=[],o.opt.xmlns&&(o.ns=Object.create(N)),o.trackPosition=o.opt.position!==!1,o.trackPosition&&(o.position=o.line=o.column=0),f(o,"onready")}function r(e){for(var n=Math.max(t.MAX_BUFFER_LENGTH,10),r=0,i=0,o=A.length;o>i;i++){var a=e[A[i]].length;if(a>n)switch(A[i]){case"textNode":d(e);break;case"cdata":h(e,"oncdata",e.cdata),e.cdata="";break;case"script":h(e,"onscript",e.script),e.script="";break;default:g(e,"Max buffer length exceeded: "+A[i])}r=Math.max(r,a)}e.bufferCheckPosition=t.MAX_BUFFER_LENGTH-r+e.position}function i(t){for(var e=0,n=A.length;n>e;e++)t[A[e]]=""}function o(t,e){return new a(t,e)}function a(t,n){if(!(this instanceof a))return new a(t,n);T.apply(this),this._parser=new e(t,n),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},C.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){return e?void r.on(t,e):(r.removeAllListeners(t),r._parser["on"+t]=e)},enumerable:!0,configurable:!1})})}function s(t){return t.split("").reduce(function(t,e){return t[e]=!0,t},{})}function u(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function c(t,e){return u(t)?!!e.match(t):t[e]}function l(t,e){return!c(t,e)}function f(t,e,n){t[e]&&t[e](n)}function h(t,e,n){t.textNode&&d(t),f(t,e,n)}function d(t){t.textNode=p(t.opt,t.textNode),t.textNode&&f(t,"ontext",t.textNode),t.textNode=""}function p(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function g(t,e){return d(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,f(t,"onerror",e),t}function v(t){return t.closedRoot||m(t,"Unclosed root tag"),t.state!==H.TEXT&&g(t,"Unexpected end"),d(t),t.c="",t.closed=!0,f(t,"onend"),e.call(t,t.strict,t.opt),t}function m(t,n){if("object"!=typeof t||!(t instanceof e))throw new Error("bad call to strictFail");t.strict&&g(t,n)}function y(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,n=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(n.ns=e.ns),t.attribList.length=0}function b(t){var e=t.indexOf(":"),n=0>e?["",t]:t.split(":"),r=n[0],i=n[1];return"xmlns"===t&&(r="xmlns",i=""),{prefix:r,local:i}}function w(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))return t.attribName=t.attribValue="";if(t.opt.xmlns){var e=b(t.attribName),n=e.prefix,r=e.local;if("xmlns"===n)if("xml"===r&&t.attribValue!==U)m(t,"xml: prefix must be bound to "+U+"\nActual: "+t.attribValue);else if("xmlns"===r&&t.attribValue!==M)m(t,"xmlns: prefix must be bound to "+M+"\nActual: "+t.attribValue);else{var i=t.tag,o=t.tags[t.tags.length-1]||t;i.ns===o.ns&&(i.ns=Object.create(o.ns)),i.ns[r]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,h(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}function _(t,e){if(t.opt.xmlns){var n=t.tag,r=b(t.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||r.prefix,n.prefix&&!n.uri&&m(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName));var i=t.tags[t.tags.length-1]||t;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach(function(e){h(t,"onopennamespace",{prefix:e,uri:n.ns[e]})});for(var o=0,a=t.attribList.length;a>o;o++){var s=t.attribList[o],u=s[0],c=s[1],l=b(u),f=l.prefix,d=l.local,p=""==f?"":n.ns[f]||"",g={name:u,value:c,prefix:f,local:d,uri:p};f&&"xmlns"!=f&&!p&&(m(t,"Unbound namespace prefix: "+JSON.stringify(f)),g.uri=f),t.tag.attributes[u]=g,h(t,"onattribute",g)}t.attribList.length=0}t.tag.isSelfClosing=!!e,t.sawRoot=!0,t.tags.push(t.tag),h(t,"onopentag",t.tag),e||(t.noscript||"script"!==t.tagName.toLowerCase()?t.state=H.TEXT:t.state=H.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function E(t){if(!t.tagName)return m(t,"Weird empty close tag."),t.textNode+="",void(t.state=H.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="",t.tagName="",void(t.state=H.SCRIPT);h(t,"onscript",t.script),t.script=""}var e=t.tags.length,n=t.tagName;t.strict||(n=n[t.looseCase]());for(var r=n;e--;){var i=t.tags[e];if(i.name===r)break;m(t,"Unexpected close tag")}if(0>e)return m(t,"Unmatched closing tag: "+t.tagName),t.textNode+="",void(t.state=H.TEXT);t.tagName=n;for(var o=t.tags.length;o-- >e;){var a=t.tag=t.tags.pop();t.tagName=t.tag.name,h(t,"onclosetag",t.tagName);var s={};for(var u in a.ns)s[u]=a.ns[u];var c=t.tags[t.tags.length-1]||t;t.opt.xmlns&&a.ns!==c.ns&&Object.keys(a.ns).forEach(function(e){var n=a.ns[e];h(t,"onclosenamespace",{prefix:e,uri:n})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=H.TEXT}function j(t){var e,n=t.entity,r=n.toLowerCase(),i="";return t.ENTITIES[n]?t.ENTITIES[n]:t.ENTITIES[r]?t.ENTITIES[r]:(n=r,"#"===n.charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),e=parseInt(n,16),i=e.toString(16)):(n=n.slice(1),e=parseInt(n,10),i=e.toString(10))),n=n.replace(/^0+/,""),i.toLowerCase()!==n?(m(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCharCode(e))}function S(t){var e=this;if(this.error)throw this.error;if(e.closed)return g(e,"Cannot write after close. Assign an onready handler.");if(null===t)return v(e);for(var n=0,i="";e.c=i=t.charAt(n++);)switch(e.trackPosition&&(e.position++,"\n"===i?(e.line++,e.column=0):e.column++),e.state){case H.BEGIN:"<"===i?(e.state=H.OPEN_WAKA,e.startTagPosition=e.position):l(k,i)&&(m(e,"Non-whitespace before first tag."),e.textNode=i,e.state=H.TEXT);continue;case H.TEXT:if(e.sawRoot&&!e.closedRoot){for(var o=n-1;i&&"<"!==i&&"&"!==i;)i=t.charAt(n++),i&&e.trackPosition&&(e.position++,"\n"===i?(e.line++,e.column=0):e.column++);e.textNode+=t.substring(o,n-1)}"<"===i?(e.state=H.OPEN_WAKA,e.startTagPosition=e.position):(!l(k,i)||e.sawRoot&&!e.closedRoot||m(e,"Text data outside of root node."),"&"===i?e.state=H.TEXT_ENTITY:e.textNode+=i);continue;case H.SCRIPT:"<"===i?e.state=H.SCRIPT_ENDING:e.script+=i;continue;case H.SCRIPT_ENDING:"/"===i?e.state=H.CLOSE_TAG:(e.script+="<"+i,e.state=H.SCRIPT);continue;case H.OPEN_WAKA:if("!"===i)e.state=H.SGML_DECL,e.sgmlDecl="";else if(c(k,i));else if(c(D,i))e.state=H.OPEN_TAG,e.tagName=i;else if("/"===i)e.state=H.CLOSE_TAG,e.tagName="";else if("?"===i)e.state=H.PROC_INST,e.procInstName=e.procInstBody="";else{if(m(e,"Unencoded <"),e.startTagPosition+1"===i?(h(e,"onsgmldeclaration",e.sgmlDecl),e.sgmlDecl="",e.state=H.TEXT):c(I,i)?(e.state=H.SGML_DECL_QUOTED,e.sgmlDecl+=i):e.sgmlDecl+=i;continue;case H.SGML_DECL_QUOTED:i===e.q&&(e.state=H.SGML_DECL,e.q=""),e.sgmlDecl+=i;continue;case H.DOCTYPE:">"===i?(e.state=H.TEXT,h(e,"ondoctype",e.doctype),e.doctype=!0):(e.doctype+=i,"["===i?e.state=H.DOCTYPE_DTD:c(I,i)&&(e.state=H.DOCTYPE_QUOTED,e.q=i));continue;case H.DOCTYPE_QUOTED:e.doctype+=i,i===e.q&&(e.q="",e.state=H.DOCTYPE);continue;case H.DOCTYPE_DTD:e.doctype+=i,"]"===i?e.state=H.DOCTYPE:c(I,i)&&(e.state=H.DOCTYPE_DTD_QUOTED,e.q=i);continue;case H.DOCTYPE_DTD_QUOTED:e.doctype+=i,i===e.q&&(e.state=H.DOCTYPE_DTD,e.q="");continue;case H.COMMENT:"-"===i?e.state=H.COMMENT_ENDING:e.comment+=i;continue;case H.COMMENT_ENDING:"-"===i?(e.state=H.COMMENT_ENDED,e.comment=p(e.opt,e.comment),e.comment&&h(e,"oncomment",e.comment),e.comment=""):(e.comment+="-"+i,e.state=H.COMMENT);continue;case H.COMMENT_ENDED:">"!==i?(m(e,"Malformed comment"),e.comment+="--"+i,e.state=H.COMMENT):e.state=H.TEXT;continue;case H.CDATA:"]"===i?e.state=H.CDATA_ENDING:e.cdata+=i;continue;case H.CDATA_ENDING:"]"===i?e.state=H.CDATA_ENDING_2:(e.cdata+="]"+i,e.state=H.CDATA);continue;case H.CDATA_ENDING_2:">"===i?(e.cdata&&h(e,"oncdata",e.cdata),h(e,"onclosecdata"),e.cdata="",e.state=H.TEXT):"]"===i?e.cdata+="]":(e.cdata+="]]"+i,e.state=H.CDATA);continue;case H.PROC_INST:"?"===i?e.state=H.PROC_INST_ENDING:c(k,i)?e.state=H.PROC_INST_BODY:e.procInstName+=i;continue;case H.PROC_INST_BODY:if(!e.procInstBody&&c(k,i))continue;"?"===i?e.state=H.PROC_INST_ENDING:e.procInstBody+=i;continue;case H.PROC_INST_ENDING:">"===i?(h(e,"onprocessinginstruction",{name:e.procInstName,body:e.procInstBody}),e.procInstName=e.procInstBody="",e.state=H.TEXT):(e.procInstBody+="?"+i,e.state=H.PROC_INST_BODY);continue;case H.OPEN_TAG:c(B,i)?e.tagName+=i:(y(e),">"===i?_(e):"/"===i?e.state=H.OPEN_TAG_SLASH:(l(k,i)&&m(e,"Invalid character in tag name"),e.state=H.ATTRIB));continue;case H.OPEN_TAG_SLASH:">"===i?(_(e,!0),E(e)):(m(e,"Forward-slash in opening tag not followed by >"),e.state=H.ATTRIB);continue;case H.ATTRIB:if(c(k,i))continue;">"===i?_(e):"/"===i?e.state=H.OPEN_TAG_SLASH:c(D,i)?(e.attribName=i,e.attribValue="",e.state=H.ATTRIB_NAME):m(e,"Invalid attribute name");continue;case H.ATTRIB_NAME:"="===i?e.state=H.ATTRIB_VALUE:">"===i?(m(e,"Attribute without value"),e.attribValue=e.attribName,w(e),_(e)):c(k,i)?e.state=H.ATTRIB_NAME_SAW_WHITE:c(B,i)?e.attribName+=i:m(e,"Invalid attribute name");continue;case H.ATTRIB_NAME_SAW_WHITE:if("="===i)e.state=H.ATTRIB_VALUE;else{if(c(k,i))continue;m(e,"Attribute without value"),e.tag.attributes[e.attribName]="",e.attribValue="",h(e,"onattribute",{name:e.attribName,value:""}),e.attribName="",">"===i?_(e):c(D,i)?(e.attribName=i,e.state=H.ATTRIB_NAME):(m(e,"Invalid attribute name"),e.state=H.ATTRIB)}continue;case H.ATTRIB_VALUE:if(c(k,i))continue;c(I,i)?(e.q=i,e.state=H.ATTRIB_VALUE_QUOTED):(m(e,"Unquoted attribute value"),e.state=H.ATTRIB_VALUE_UNQUOTED,e.attribValue=i);continue;case H.ATTRIB_VALUE_QUOTED:if(i!==e.q){"&"===i?e.state=H.ATTRIB_VALUE_ENTITY_Q:e.attribValue+=i;continue}w(e),e.q="",e.state=H.ATTRIB;continue;case H.ATTRIB_VALUE_UNQUOTED:if(l(L,i)){"&"===i?e.state=H.ATTRIB_VALUE_ENTITY_U:e.attribValue+=i;continue}w(e),">"===i?_(e):e.state=H.ATTRIB;continue;case H.CLOSE_TAG:if(e.tagName)">"===i?E(e):c(B,i)?e.tagName+=i:e.script?(e.script+=""===i?E(e):m(e,"Invalid characters in closing tag");continue;case H.TEXT_ENTITY:case H.ATTRIB_VALUE_ENTITY_Q:case H.ATTRIB_VALUE_ENTITY_U:switch(e.state){case H.TEXT_ENTITY:var s=H.TEXT,u="textNode";break;case H.ATTRIB_VALUE_ENTITY_Q:var s=H.ATTRIB_VALUE_QUOTED,u="attribValue";break;case H.ATTRIB_VALUE_ENTITY_U:var s=H.ATTRIB_VALUE_UNQUOTED,u="attribValue"}";"===i?(e[u]+=j(e),e.entity="",e.state=s):c(O,i)?e.entity+=i:(m(e,"Invalid character entity"),e[u]+="&"+e.entity+i,e.entity="",e.state=s);continue;default:throw new Error(e,"Unknown state: "+e.state)}return e.position>=e.bufferCheckPosition&&r(e),e}t.parser=function(t,n){return new e(t,n)},t.SAXParser=e,t.SAXStream=a,t.createStream=o,t.MAX_BUFFER_LENGTH=65536;var A=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(t){function e(){this.__proto__=t}return e.prototype=t,new e}),Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__}),Object.keys||(Object.keys=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}),e.prototype={end:function(){v(this)},write:S,resume:function(){return this.error=null,this},close:function(){return this.write(null)}};try{var T=n(14).Stream}catch(x){var T=function(){}}var C=t.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});a.prototype=Object.create(T.prototype,{constructor:{value:a}}),a.prototype.write=function(t){return this._parser.write(t.toString()),this.emit("data",t),!0},a.prototype.end=function(t){return t&&t.length&&this._parser.write(t.toString()),this._parser.end(),!0},a.prototype.on=function(t,e){var n=this;return n._parser["on"+t]||-1===C.indexOf(t)||(n._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),n.emit.apply(n,e)}),T.prototype.on.call(n,t,e)};var k="\r\n ",R="0124356789",P="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",I="'\"",O=R+P+"#",L=k+">",F="[CDATA[",q="DOCTYPE",U="http://www.w3.org/XML/1998/namespace",M="http://www.w3.org/2000/xmlns/",N={xml:U,xmlns:M};k=s(k),R=s(R),P=s(P);var D=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,B=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;I=s(I),O=s(O),L=s(L);var H=0;t.STATE={BEGIN:H++,TEXT:H++,TEXT_ENTITY:H++,OPEN_WAKA:H++,SGML_DECL:H++,SGML_DECL_QUOTED:H++,DOCTYPE:H++,DOCTYPE_QUOTED:H++,DOCTYPE_DTD:H++,DOCTYPE_DTD_QUOTED:H++,COMMENT_STARTING:H++,COMMENT:H++,COMMENT_ENDING:H++,COMMENT_ENDED:H++,CDATA:H++,CDATA_ENDING:H++,CDATA_ENDING_2:H++,PROC_INST:H++,PROC_INST_BODY:H++,PROC_INST_ENDING:H++,OPEN_TAG:H++,OPEN_TAG_SLASH:H++,ATTRIB:H++,ATTRIB_NAME:H++,ATTRIB_NAME_SAW_WHITE:H++,ATTRIB_VALUE:H++,ATTRIB_VALUE_QUOTED:H++,ATTRIB_VALUE_UNQUOTED:H++,ATTRIB_VALUE_ENTITY_Q:H++,ATTRIB_VALUE_ENTITY_U:H++,CLOSE_TAG:H++,CLOSE_TAG_SAW_WHITE:H++,SCRIPT:H++,SCRIPT_ENDING:H++},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(e){var n=t.ENTITIES[e],r="number"==typeof n?String.fromCharCode(n):n;t.ENTITIES[e]=r});for(var H in t.STATE)t.STATE[t.STATE[H]]=H;H=t.STATE}(e)},function(t,e,n){(function(t){(function(){var r,i,o,a={}.hasOwnProperty,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u=function(t,e){return function(){return t.apply(e,arguments)}};o=n(127),r=n(18),i=function(t){return"object"==typeof t&&null!=t&&0===Object.keys(t).length},e.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,async:!1,strict:!0},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,childkey:"$$",charsAsChildren:!1,async:!1,strict:!0}},e.ValidationError=function(t){function e(t){this.message=t}return s(e,t),e}(Error),e.Parser=function(n){function r(t){this.parseString=u(this.parseString,this),this.reset=u(this.reset,this);var n,r,i;if(!(this instanceof e.Parser))return new e.Parser(t);this.options={},i=e.defaults[.2];for(n in i)a.call(i,n)&&(r=i[n],this.options[n]=r);for(n in t)a.call(t,n)&&(r=t[n],this.options[n]=r);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.reset()}return s(r,n),r.prototype.reset=function(){var t,e,n,r,s,u=this;return this.removeAllListeners(),this.saxParser=o.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),n=!1,this.saxParser.onerror=function(t){return n?void 0:(n=!0,u.emit("error",t))},this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,s=[],t=this.options.attrkey,e=this.options.charkey,this.saxParser.onopentag=function(n){var r,i,o;if(i={},i[e]="",!u.options.ignoreAttrs){o=n.attributes;for(r in o)a.call(o,r)&&(t in i||u.options.mergeAttrs||(i[t]={}),u.options.mergeAttrs?i[r]=n.attributes[r]:i[t][r]=n.attributes[r])}return i["#name"]=u.options.normalizeTags?n.name.toLowerCase():n.name,u.options.xmlns&&(i[u.options.xmlnskey]={uri:n.uri,local:n.local}),s.push(i)},this.saxParser.onclosetag=function(){var t,r,o,a,c,l,f,h;if(c=s.pop(),a=c["#name"],delete c["#name"],t=c.cdata,delete c.cdata,f=s[s.length-1],c[e].match(/^\s*$/)&&!t?(r=c[e],delete c[e]):(u.options.trim&&(c[e]=c[e].trim()),u.options.normalize&&(c[e]=c[e].replace(/\s{2,}/g," ").trim()),1===Object.keys(c).length&&e in c&&!u.EXPLICIT_CHARKEY&&(c=c[e])),i(c)&&(c=void 0!==u.options.emptyTag?u.options.emptyTag:r),null!=u.options.validator){h="/"+function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)o=s[t],n.push(o["#name"]);return n}().concat(a).join("/");try{c=u.options.validator(h,f&&f[a],c)}catch(d){n=d,u.emit("error",n)}}return u.options.explicitChildren&&!u.options.mergeAttrs&&"object"==typeof c&&(o={},u.options.attrkey in c&&(o[u.options.attrkey]=c[u.options.attrkey],delete c[u.options.attrkey]),!u.options.charsAsChildren&&u.options.charkey in c&&(o[u.options.charkey]=c[u.options.charkey],delete c[u.options.charkey]),Object.getOwnPropertyNames(c).length>0&&(o[u.options.childkey]=c),c=o),s.length>0?u.options.explicitArray?(f[a]instanceof Array||(f[a]=[]),f[a].push(c)):a in f?f[a]instanceof Array?f[a].push(c):(l=f[a],f[a]=[l],f[a].push(c)):f[a]=c:(u.options.explicitRoot&&(l=c,c={},c[a]=l),u.resultObject=c,u.emit("end",u.resultObject))},r=function(t){var n;return n=s[s.length-1],n?(n[e]+=t,n):void 0; },this.saxParser.ontext=r,this.saxParser.oncdata=function(t){var e;return e=r(t),e?e.cdata=!0:void 0}},r.prototype.parseString=function(e,n){return null!=n&&"function"==typeof n&&(this.on("end",function(e){return this.reset(),this.options.async?t.nextTick(function(){return n(null,e)}):n(null,e)}),this.on("error",function(e){return this.reset(),this.options.async?t.nextTick(function(){return n(e)}):n(e)})),""===e.toString().trim()?(this.emit("end",null),!0):this.saxParser.write(e.toString())},r}(r.EventEmitter),e.parseString=function(t,n,r){var i,o,a;return null!=r?("function"==typeof r&&(i=r),"object"==typeof n&&(o=n)):("function"==typeof n&&(i=n),o={}),a=new e.Parser(o),a.parseString(t,i)}}).call(this)}).call(e,n(5))},function(t,e,n){(function(){var e,r;r=n(130),e=function(){function t(t,e,n){var i,o,a;if(this.children=[],this.rootObject=null,this.is(t,"Object")&&(a=[t,e],e=a[0],n=a[1],t=null),null!=t&&(t=""+t||"",null==e&&(e={version:"1.0"})),null!=e&&null==e.version)throw new Error("Version number is required");if(null!=e){if(e.version=""+e.version||"",!e.version.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+e.version);if(i={version:e.version},null!=e.encoding){if(e.encoding=""+e.encoding||"",!e.encoding.match(/[A-Za-z](?:[A-Za-z0-9._-]|-)*/))throw new Error("Invalid encoding: "+e.encoding);i.encoding=e.encoding}null!=e.standalone&&(i.standalone=e.standalone?"yes":"no"),o=new r(this,"?xml",i),this.children.push(o)}null!=n&&(i={},null!=t&&(i.name=t),null!=n.ext&&(n.ext=""+n.ext||"",i.ext=n.ext),o=new r(this,"!DOCTYPE",i),this.children.push(o)),null!=t&&this.begin(t)}return t.prototype.begin=function(e,n,i){var o,a;if(null==e)throw new Error("Root element needs a name");return this.rootObject&&(this.children=[],this.rootObject=null),null!=n?(o=new t(e,n,i),o.root()):(e=""+e||"",a=new r(this,e,{}),a.isRoot=!0,a.documentObject=this,this.children.push(a),this.rootObject=a,a)},t.prototype.root=function(){return this.rootObject},t.prototype.end=function(t){return toString(t)},t.prototype.toString=function(t){var e,n,r,i,o;for(n="",o=this.children,r=0,i=o.length;i>r;r++)e=o[r],n+=e.toString(t);return n},t.prototype.is=function(t,e){var n;return n=Object.prototype.toString.call(t).slice(8,-1),null!=t&&n===e},t}(),t.exports=e}).call(this)},function(t,e){(function(){var e,n={}.hasOwnProperty;e=function(){function t(t,e,n,r){this.isRoot=!1,this.documentObject=null,this.parent=t,this.name=e,this.attributes=n,this.value=r,this.children=[]}return t.prototype.element=function(e,r,i){var o,a,s,u,c;if(null==e)throw new Error("Missing element name");e=""+e||"",this.assertLegalChar(e),null==r&&(r={}),this.is(r,"String")&&this.is(i,"Object")?(u=[i,r],r=u[0],i=u[1]):this.is(r,"String")&&(c=[{},r],r=c[0],i=c[1]);for(a in r)n.call(r,a)&&(s=r[a],s=""+s||"",r[a]=this.escape(s));return o=new t(this,e,r),null!=i&&(i=""+i||"",i=this.escape(i),this.assertLegalChar(i),o.raw(i)),this.children.push(o),o},t.prototype.insertBefore=function(e,r,i){var o,a,s,u,c,l;if(this.isRoot)throw new Error("Cannot insert elements at root level");if(null==e)throw new Error("Missing element name");e=""+e||"",this.assertLegalChar(e),null==r&&(r={}),this.is(r,"String")&&this.is(i,"Object")?(c=[i,r],r=c[0],i=c[1]):this.is(r,"String")&&(l=[{},r],r=l[0],i=l[1]);for(s in r)n.call(r,s)&&(u=r[s],u=""+u||"",r[s]=this.escape(u));return o=new t(this.parent,e,r),null!=i&&(i=""+i||"",i=this.escape(i),this.assertLegalChar(i),o.raw(i)),a=this.parent.children.indexOf(this),this.parent.children.splice(a,0,o),o},t.prototype.insertAfter=function(e,r,i){var o,a,s,u,c,l;if(this.isRoot)throw new Error("Cannot insert elements at root level");if(null==e)throw new Error("Missing element name");e=""+e||"",this.assertLegalChar(e),null==r&&(r={}),this.is(r,"String")&&this.is(i,"Object")?(c=[i,r],r=c[0],i=c[1]):this.is(r,"String")&&(l=[{},r],r=l[0],i=l[1]);for(s in r)n.call(r,s)&&(u=r[s],u=""+u||"",r[s]=this.escape(u));return o=new t(this.parent,e,r),null!=i&&(i=""+i||"",i=this.escape(i),this.assertLegalChar(i),o.raw(i)),a=this.parent.children.indexOf(this),this.parent.children.splice(a+1,0,o),o},t.prototype.remove=function(){var t,e;if(this.isRoot)throw new Error("Cannot remove the root element");return t=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[t,t-t+1].concat(e=[])),e,this.parent},t.prototype.text=function(e){var n;if(null==e)throw new Error("Missing element text");return e=""+e||"",e=this.escape(e),this.assertLegalChar(e),n=new t(this,"",{},e),this.children.push(n),this},t.prototype.cdata=function(e){var n;if(null==e)throw new Error("Missing CDATA text");if(e=""+e||"",this.assertLegalChar(e),e.match(/]]>/))throw new Error("Invalid CDATA text: "+e);return n=new t(this,"",{},""),this.children.push(n),this},t.prototype.comment=function(e){var n;if(null==e)throw new Error("Missing comment text");if(e=""+e||"",e=this.escape(e),this.assertLegalChar(e),e.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+e);return n=new t(this,"",{},""),this.children.push(n),this},t.prototype.raw=function(e){var n;if(null==e)throw new Error("Missing raw text");return e=""+e||"",n=new t(this,"",{},e),this.children.push(n),this},t.prototype.up=function(){if(this.isRoot)throw new Error("This node has no parent. Use doc() if you need to get the document object.");return this.parent},t.prototype.root=function(){var t;if(this.isRoot)return this;for(t=this.parent;!t.isRoot;)t=t.parent;return t},t.prototype.document=function(){return this.root().documentObject},t.prototype.end=function(t){return this.document().toString(t)},t.prototype.prev=function(){var t;if(this.isRoot)throw new Error("Root node has no siblings");if(t=this.parent.children.indexOf(this),1>t)throw new Error("Already at the first node");return this.parent.children[t-1]},t.prototype.next=function(){var t;if(this.isRoot)throw new Error("Root node has no siblings");if(t=this.parent.children.indexOf(this),-1===t||t===this.parent.children.length-1)throw new Error("Already at the last node");return this.parent.children[t+1]},t.prototype.clone=function(e){var n;return n=new t(this.parent,this.name,this.attributes,this.value),e&&this.children.forEach(function(t){var r;return r=t.clone(e),r.parent=n,n.children.push(r)}),n},t.prototype.importXMLBuilder=function(t){var e;return e=t.root().clone(!0),e.parent=this,this.children.push(e),e.isRoot=!1,this},t.prototype.attribute=function(t,e){var n;if(null==t)throw new Error("Missing attribute name");if(null==e)throw new Error("Missing attribute value");return t=""+t||"",e=""+e||"",null==(n=this.attributes)&&(this.attributes={}),this.attributes[t]=this.escape(e),this},t.prototype.removeAttribute=function(t){if(null==t)throw new Error("Missing attribute name");return t=""+t||"",delete this.attributes[t],this},t.prototype.toString=function(t,e){var n,r,i,o,a,s,u,c,l,f,h,d;s=null!=t&&t.pretty||!1,o=null!=t&&t.indent||" ",a=null!=t&&t.newline||"\n",e||(e=0),c=new Array(e+1).join(o),u="",s&&(u+=c),u+=null==this.value?"<"+this.name:""+this.value,h=this.attributes;for(n in h)r=h[n],u+="!DOCTYPE"===this.name?" "+r:" "+n+'="'+r+'"';if(0===this.children.length)null==this.value&&(u+="?xml"===this.name?"?>":"!DOCTYPE"===this.name?">":"/>"),s&&(u+=a);else if(s&&1===this.children.length&&this.children[0].value)u+=">",u+=this.children[0].value,u+="",u+=a;else{for(u+=">",s&&(u+=a),d=this.children,l=0,f=d.length;f>l;l++)i=d[l],u+=i.toString(t,e+1);s&&(u+=c),u+="",s&&(u+=a)}return u},t.prototype.escape=function(t){return t.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},t.prototype.assertLegalChar=function(t){var e,n;if(e=/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/,n=t.match(e))throw new Error("Invalid character ("+n+") in string: "+t)},t.prototype.is=function(t,e){var n;return n=Object.prototype.toString.call(t).slice(8,-1),null!=t&&n===e},t.prototype.ele=function(t,e,n){return this.element(t,e,n)},t.prototype.txt=function(t){return this.text(t)},t.prototype.dat=function(t){return this.cdata(t)},t.prototype.att=function(t,e){return this.attribute(t,e)},t.prototype.com=function(t){return this.comment(t)},t.prototype.doc=function(){return this.document()},t.prototype.e=function(t,e,n){return this.element(t,e,n)},t.prototype.t=function(t){return this.text(t)},t.prototype.d=function(t){return this.cdata(t)},t.prototype.a=function(t,e){return this.attribute(t,e)},t.prototype.c=function(t){return this.comment(t)},t.prototype.r=function(t){return this.raw(t)},t.prototype.u=function(){return this.up()},t}(),t.exports=e}).call(this)},function(t,e,n){(function(){var e;e=n(129),t.exports.create=function(t,n,r){return null!=t?new e(t,n,r).root():new e}}).call(this)},function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===a||e===f?62:e===s||e===h?63:u>e?-1:u+10>e?e-u+26+26:l+26>e?e-l:c+26>e?e-c+26:void 0}function n(t){function n(t){c[f++]=t}var r,i,a,s,u,c;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=t.length;u="="===t.charAt(l-2)?2:"="===t.charAt(l-1)?1:0,c=new o(3*t.length/4-u),a=u>0?t.length-4:t.length;var f=0;for(r=0,i=0;a>r;r+=4,i+=3)s=e(t.charAt(r))<<18|e(t.charAt(r+1))<<12|e(t.charAt(r+2))<<6|e(t.charAt(r+3)),n((16711680&s)>>16),n((65280&s)>>8),n(255&s);return 2===u?(s=e(t.charAt(r))<<2|e(t.charAt(r+1))>>4,n(255&s)):1===u&&(s=e(t.charAt(r))<<10|e(t.charAt(r+1))<<4|e(t.charAt(r+2))>>2,n(s>>8&255),n(255&s)),c}function i(t){function e(t){return r.charAt(t)}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var i,o,a,s=t.length%3,u="";for(i=0,a=t.length-s;a>i;i+=3)o=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=n(o);switch(s){case 1:o=t[t.length-1],u+=e(o>>2),u+=e(o<<4&63),u+="==";break;case 2:o=(t[t.length-2]<<8)+t[t.length-1],u+=e(o>>10),u+=e(o>>4&63),u+=e(o<<2&63),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),s="/".charCodeAt(0),u="0".charCodeAt(0),c="a".charCodeAt(0),l="A".charCodeAt(0),f="-".charCodeAt(0),h="_".charCodeAt(0);t.toByteArray=n,t.fromByteArray=i}(e)},function(t,e){e.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=s;l>0;o=256*o+t[e+f],f+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+f>=1?h/u:h*Math.pow(2,1-f),e*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[n+d]=255&a,d+=p,a/=256,c-=8);t[n+d-p]|=128*g}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){(function(e){function r(t,n){if(!(this instanceof r))return new r(t,n);this._opad=u,this._alg=t;var a="sha512"===t?128:64;n=this._key=e.isBuffer(n)?n:new e(n),n.length>a?n=i(t).update(n).digest():n.lengthc;c++)s[c]=54^n[c],u[c]=92^n[c];this._hash=i(t).update(s)}var i=n(109),o=new e(128);o.fill(0),t.exports=r,r.prototype.update=function(t,e){return this._hash.update(t,e),this},r.prototype.digest=function(t){var e=this._hash.digest();return i(this._alg).update(this._opad).update(e).digest(t)}}).call(e,n(3).Buffer)},function(t,e,n){(function(e){function n(t,n){if(t.length%o!==0){var r=t.length+(o-t.length%o);t=e.concat([t,a],r)}for(var i=[],s=n?t.readInt32BE:t.readInt32LE,u=0;u>5]|=128<>>9<<4)+14]=e;for(var n=1732584193,r=-271733879,i=-1732584194,l=271733878,f=0;f>16)+(e>>16)+(n>>16);return r<<16|65535&n}function l(t,e){return t<>>32-e}var f=n(136);t.exports=function(t){return f.hash(t,r,16)}},function(t,e,n){(function(e){t.exports=function(t){function n(t,e,n,i,o,a){if("function"==typeof o&&(a=o,o=void 0),"function"!=typeof a)throw new Error("No callback provided to pbkdf2");setTimeout(function(){var s;try{s=r(t,e,n,i,o)}catch(u){return a(u)}a(void 0,s)})}function r(n,r,i,o,a){if("number"!=typeof i)throw new TypeError("Iterations not a number");if(0>i)throw new TypeError("Bad iterations");if("number"!=typeof o)throw new TypeError("Key length not a number");if(0>o)throw new TypeError("Bad key length");a=a||"sha1",e.isBuffer(n)||(n=new e(n)),e.isBuffer(r)||(r=new e(r));var s,u,c,l=1,f=new e(o),h=new e(r.length+4);r.copy(h,0,0,r.length);for(var d=1;l>=d;d++){h.writeUInt32BE(d,r.length);var p=t.createHmac(a,n).update(h).digest();if(!s&&(s=p.length,c=new e(s),l=Math.ceil(o/s),u=o-(l-1)*s,o>(Math.pow(2,32)-1)*s))throw new TypeError("keylen exceeds maximum length");p.copy(c,0,0,s);for(var g=1;i>g;g++){p=t.createHmac(a,n).update(p).digest();for(var v=0;s>v;v++)c[v]^=p[v]}var m=(d-1)*s,y=d==l?u:s;c.copy(f,m,0,y)}return f}return{pbkdf2:n,pbkdf2Sync:r}}}).call(e,n(3).Buffer)},function(t,e,n){(function(e){function n(t,e,n){return t^e^n}function r(t,e,n){return t&e|~t&n}function i(t,e,n){return(t|~e)^n}function o(t,e,n){return t&n|e&~n}function a(t,e,n){return t^(e|~n)}function s(t,e){return t<>>32-e}function u(t){var n=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof t&&(t=new e(t,"utf8"));var r=g(t),i=8*t.length,o=8*t.length;r[i>>>5]|=128<<24-i%32,r[(i+64>>>9<<4)+14]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8);for(var a=0;aa;a++){var s=n[a];n[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var u=v(n);return new e(u)}t.exports=u;/** @preserve (c) 2012 by Cédric Mesnil. All rights reserved. diff --git a/lib/utils/s3.js b/lib/utils/s3.js index 7b1f985..36f47c0 100644 --- a/lib/utils/s3.js +++ b/lib/utils/s3.js @@ -27,7 +27,6 @@ var _lodash = require('lodash'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var logger = _Matter2.default.utils.logger; - /** * @description Initial AWS Config */ @@ -40,7 +39,9 @@ function init() { }); setConfig(); } - return new _awsSdk2.default.S3(); + if (typeof _awsSdk2.default.S3 === 'function') { + return new _awsSdk2.default.S3(); + } }; /** * @description Set AWS config credentials @@ -49,8 +50,7 @@ function setConfig() { return _awsSdk2.default.config.update({ credentials: new _awsSdk2.default.CognitoIdentityCredentials({ IdentityPoolId: _config2.default.aws.cognito.poolId - }), - region: _config2.default.aws.region + }), region: _config2.default.aws.region }); }; /** diff --git a/package.json b/package.json index e7e07f7..b67a9fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kyper-grout", - "version": "0.1.7", + "version": "0.1.8", "description": "Library to communicate with tessellate application building/managing service.", "main": "lib/index.js", "scripts": { diff --git a/src/utils/s3.js b/src/utils/s3.js index 785da57..b3e5863 100644 --- a/src/utils/s3.js +++ b/src/utils/s3.js @@ -3,7 +3,6 @@ import matter from '../classes/Matter'; import AWS from 'aws-sdk'; import { has } from 'lodash'; const { logger } = matter.utils; - /** * @description Initial AWS Config */ @@ -15,7 +14,9 @@ export function init() { }); setConfig(); } - return new AWS.S3(); + if(typeof AWS.S3 === 'function'){ + return new AWS.S3(); + } }; /** * @description Set AWS config credentials @@ -24,8 +25,7 @@ export function setConfig() { return AWS.config.update({ credentials: new AWS.CognitoIdentityCredentials({ IdentityPoolId: config.aws.cognito.poolId - }), - region: config.aws.region + }), region: config.aws.region }); }; /** diff --git a/webpack.config.base.js b/webpack.config.base.js index 19cf28c..ba10307 100644 --- a/webpack.config.base.js +++ b/webpack.config.base.js @@ -8,7 +8,7 @@ module.exports = { loaders: [ { test: /\.js$/, loaders: ['babel-loader'], exclude: [/node_modules/] }, { test: /aws-sdk/, loaders: ["transform?brfs"], exclude:[]}, - { test: /\.json$/, loaders: ['json'], exclude:[]}, + { test: /\.json$/, loaders: ['json'], exclude:[]} ] }, output: {