text: module.exports=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=76)}([function(e,t){e.exports=require("auth0-extension-tools@1.3.1")},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(91),o=n(19);e.exports=function(e){return r(o(e))}},function(e,t,n){"use strict";e.exports=n(0).config()},function(e,t,n){e.exports=!n(14)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(7),o=n(17);e.exports=n(5)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(12),o=n(43),i=n(28),s=Object.defineProperty;t.f=n(5)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(26)("wks"),o=n(18),i=n(1).Symbol,s="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=s&&i[e]||(s?i:o)("Symbol."+e))}).store=r},function(e,t,n){const r=n(66),o=n(34),i=n(59),s=n(65);e.exports.createServer=r.createServer,e.exports.urlHelpers=o,e.exports.middlewares=i,e.exports.routes=s},function(e,t){e.exports=require("express@4.12.4")},function(e,t,n){"use strict";var r=n(132);r.emitErrs=!0;var o=new r.Logger({transports:[new r.transports.Console({timestamp:!0,level:"debug",handleExceptions:!0,json:!1,colorize:!0})],exitOnError:!1});e.exports=o,e.exports.stream={write:function(e){o.info(e.replace(/\n$/,""))}}},function(e,t,n){var r=n(15);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(48),o=n(20);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on  "+e);return e}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){e.exports={}},function(e,t){e.exports=!0},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(7).f,o=n(2),i=n(8)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(26)("keys"),o=n(18);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(1),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(15);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(1),o=n(13),i=n(22),s=n(30),a=n(7).f;e.exports=function(e){var t=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:s.f(e)})}},function(e,t,n){t.f=n(8)},function(e,t){e.exports=require("bluebird@3.4.6")},function(e,t){e.exports=require("lodash@3.10.1")},function(e,t){e.exports=require("url")},function(e,t,n){function r(e){if(!e.container)return null;const t=e.container.replace(u,"\\$&"),n=e.jtn?e.jtn.replace(u,"\\$&"):"";if(e.url_format===c)return new RegExp("^/api/run/"+t+"/(?:"+n+"/?)?");if(e.url_format===a)return new RegExp("^/"+t+"/(?:"+n+"/?)?");if(e.url_format===s)return new RegExp("^/(?:"+n+"/?)?");throw new Error("Unsupported webtask URL format.")}function o(e,t){if(!e)return null;const n=e.indexOf("sandbox8")>=0?"8":"";return"https://"+t+"."+(e.split(".it.auth0.com")[0].split("-")[1]||"us")+n+".webtask.io/"}const i=n(33),s=3,a=2,c=1,u=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,l=function(e,t){var n=i.parse(e).pathname||"";return n=n.replace(t,"").replace(/^\/|\/$/g,""),n.startsWith("/")||(n="/"+n),n.endsWith("/")||(n+="/"),n};e.exports.getBasePath=function(e){return l(e.originalUrl||"",e.path)},e.exports.getBaseUrl=function(e,t){var n=t;const r=i.parse(e.originalUrl||"").pathname||"";return i.format({protocol:n||"https",host:e.headers.host,pathname:r.replace(e.path,"").replace(/\/$/g,"")})},e.exports.getWebtaskUrl=function(e){const t=r(e.x_wt),n=e.url,s=e.url.replace(t,"/"),a=i.parse(s||"").pathname,c=e.x_wt&&e.x_wt.ectx&&e.x_wt.ectx.ISOLATED_DOMAIN||!1,u=i.parse(n||"").pathname||"";var l;if(c){l=i.format({protocol:"https",host:e.headers.host,pathname:u.replace(a,"").replace(/\/$/g,"")});const f=".it.auth0.com/api/run/"+e.x_wt.container+"/",p=o(l,e.x_wt.container);l.indexOf(f)>=0&&(l=l.replace("https://"+e.headers.host+"/api/run/"+e.x_wt.container+"/",p))}else l=u;return l}},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new a.ArgumentError("Must provide an options object");if(null===e.domain||void 0===e.domain)throw new a.ArgumentError("Must provide a valid domain");if("string"!=typeof e.domain||0===e.domain.length)throw new a.ArgumentError("The provided domain is invalid: "+e.domain);if(null===e.clientId||void 0===e.clientId)throw new a.ArgumentError("Must provide a valid clientId");if("string"!=typeof e.clientId||0===e.clientId.length)throw new a.ArgumentError("The provided clientId is invalid: "+e.clientId);if(null===e.clientSecret||void 0===e.clientSecret)throw new a.ArgumentError("Must provide a valid clientSecret");if("string"!=typeof e.clientSecret||0===e.clientSecret.length)throw new a.ArgumentError("The provided clientSecret is invalid: "+e.clientSecret);this.options=e,this.tokenCache=e.tokenCache||{getToken:function(){return o.resolve()},setToken:function(){return o.resolve()}}}var o=n(31),i=n(54),s=n(127),a=n(0);r.prototype.getAccessToken=function(){var e=this;return new o(function(t,n){i.post("https://"+e.options.domain+"/oauth/token").send({audience:"https://"+e.options.domain+"/api/v2/",client_id:e.options.clientId,client_secret:e.options.clientSecret,grant_type:"client_credentials"}).set("Accept","application/json").end(function(r,o){if(r&&401===r.status)return n(new a.ManagementApiError("unauthorized","Invalid credentials for "+e.options.clientId,r.status));if(r&&o&&o.body&&o.body.error)return n(new a.ManagementApiError(o.body.error,o.body.error_description||o.body.error,r.status));if(r)return n(r);if(!o.ok||!o.body.access_token)return n(new a.ManagementApiError("unknown_error","Unknown error from Management API or no access_token was provided: "+(o.text||o.status)));var i=new Date;return t({token:o.body.access_token,expiresAt:i.setSeconds(i.getSeconds()+o.body.expires_in)})})})},r.prototype.getAccessTokenCached=function(){var e=this;return e.tokenCache.getToken().then(function(t){if(t&&t.token){var n=(new Date).valueOf();if(t.expiresAt-n>1e4)return t}return e.getAccessToken(e.options).then(function(t){return e.tokenCache.setToken(t).then(function(){return t})})})},r.prototype.getLogs=function(e){var t=this;return new o(function(n,r){t.getAccessTokenCached(t.options,t.storage).then(function(o){var c=s.stringify(e);i.get("https://"+t.options.domain+"/api/v2/logs?"+c).set("Authorization","Bearer "+o.token).set("Content-Type","application/json").end(function(e,o){if(e&&403===e.status){var i=function(){return r(new a.ManagementApiError(o.body.error,o.body.error_description||o.body.error,e.status))};t.tokenCache.setToken(null).then(i).catch(i)}return e&&o&&o.body&&o.body.error?r(new a.ManagementApiError(o.body.error,o.body.error_description||o.body.error,e.status)):e?r(e):o.ok?n({logs:o.body,limits:{limit:o.headers["x-ratelimit-limit"],remaining:o.headers["x-ratelimit-remaining"],reset:o.headers["x-ratelimit-reset"]}}):r(new a.ManagementApiError("unknown_error","Unknown error from Management API: "+(o.text||o.status)))})})})},e.exports=r},function(e,t,n){"use strict";var r={success:"success",error:"error",warning:"warning"},o={s:{name:"Success Login",icon:"icon-budicon-448",severity:r.success,level:1},ssa:{name:"Success Silent Auth",icon:"icon-budicon-448",severity:r.success,level:1},fsa:{name:"Failed Silent Auth",icon:"icon-budicon-448",severity:r.error,level:3},seacft:{name:"Success Exchange",description:"Authorization Code for Access Token",icon:"icon-budicon-456",severity:r.success,level:1},feacft:{name:"Failed Exchange",description:"Authorization Code for Access Token",icon:"icon-budicon-456",severity:r.error,level:3},seccft:{name:"Success Exchange",description:"Client Credentials for Access Token",icon:"icon-budicon-456",severity:r.success,level:1},feccft:{name:"Failed Exchange",description:"Client Credentials for Access Token",icon:"icon-budicon-456",severity:r.error,level:3},sepft:{name:"Success Exchange",description:"Password for Access Token",icon:"icon-budicon-456",severity:r.success,level:1},fepft:{name:"Failed Exchange",description:"Password for Access Token",icon:"icon-budicon-456",severity:r.error,level:3},sertft:{name:"Success Exchange",description:"Refresh Token for Access Token",icon:"icon-budicon-456",severity:r.success,level:1},fertft:{name:"Failed Exchange",description:"Refresh Token for Access Token",icon:"icon-budicon-456",severity:r.error,level:3},seoobft:{name:"Success Exchange",description:"Password and OOB Challenge for Access Token",icon:"icon-budicon-456",severity:r.success,level:1},feoobft:{name:"Failed Exchange",description:"Password and OOB Challenge for Access Token",icon:"icon-budicon-456",severity:r.error,level:3},seotpft:{name:"Success Exchange",description:"Password and OTP Challenge for Access Token",icon:"icon-budicon-456",severity:r.success,level:1},feotpft:{name:"Failed Exchange",description:"Password and OTP Challenge for Access Token",icon:"icon-budicon-456",severity:r.error,level:3},sercft:{name:"Success Exchange",description:"Password and MFA Recovery code for Access Token",icon:"icon-budicon-456",severity:r.success,level:1},fercft:{name:"Failed Exchange",description:"Password and MFA Recovery code for Access Token",icon:"icon-budicon-456",severity:r.error,level:3},f:{name:"Failed Login",icon:"icon-budicon-448",severity:r.error,level:3},w:{name:"Warning",icon:"icon-budicon-354",severity:r.warning,level:2},depnote:{name:"Deprecation Notice",icon:"icon-budicon-354",severity:r.warning,level:2},du:{name:"Deleted User",icon:"icon-budicon-311",severity:r.error,level:3},fu:{name:"Failed Login (invalid email/username)",icon:"icon-budicon-311",severity:r.error,level:3},fp:{name:"Failed Login (wrong password)",icon:"icon-budicon-311",severity:r.error,level:3},fc:{name:"Failed by Connector",icon:"icon-budicon-313",severity:r.error,level:3},fco:{name:"Failed by CORS",icon:"icon-budicon-313",severity:r.error,level:3},con:{name:"Connector Online",icon:"icon-budicon-143",severity:r.success,level:1},coff:{name:"Connector Offline",icon:"icon-budicon-143",severity:r.error,level:3},fcpro:{name:"Failed Connector Provisioning",icon:"icon-budicon-143",severity:r.error,level:4},ss:{name:"Success Signup",icon:"icon-budicon-314",severity:r.success,level:1},fs:{name:"Failed Signup",icon:"icon-budicon-311",severity:r.error,level:3},cs:{name:"Code Sent",icon:"icon-budicon-243",severity:r.success,level:1},cls:{name:"Code/Link Sent",icon:"icon-budicon-781",severity:r.success,level:1},sv:{name:"Success Verification Email",icon:"icon-budicon-781",severity:r.success,level:1},fv:{name:"Failed Verification Email",icon:"icon-budicon-311",severity:r.error,level:3},scp:{name:"Success Change Password",icon:"icon-budicon-280",severity:r.success,level:1},fcp:{name:"Failed Change Password",icon:"icon-budicon-266",severity:r.error,level:3},scph:{name:"Success Post Change Password Hook",icon:"icon-budicon-280",severity:r.success,level:1},fcph:{name:"Failed Post Change Password Hook",icon:"icon-budicon-266",severity:r.error,level:3},sce:{name:"Success Change Email",icon:"icon-budicon-266",severity:r.success,level:1},fce:{name:"Failed Change Email",icon:"icon-budicon-266",severity:r.error,level:3},scu:{name:"Success Change Username",icon:"icon-budicon-266",severity:r.success,level:1},fcu:{name:"Failed Change Username",icon:"icon-budicon-266",severity:r.error,level:3},scpn:{name:"Success Change Phone Number",icon:"icon-budicon-266",severity:r.success,level:1},fcpn:{name:"Failed Change Phone Number",icon:"icon-budicon-266",severity:r.error,level:3},svr:{name:"Success Verification Email Request",icon:"icon-budicon-781",severity:r.success,level:1},fvr:{name:"Failed Verification Email Request",icon:"icon-budicon-311",severity:r.error,level:3},scpr:{name:"Success Change Password Request",icon:"icon-budicon-280",severity:r.success,level:1},fcpr:{name:"Failed Change Password Request",icon:"icon-budicon-311",severity:r.error,level:3},fn:{name:"Failed Sending Notification",icon:"icon-budicon-782",severity:r.error,level:3},sapi:{name:"API Operation",icon:"icon-budicon-546",severity:r.success,level:1,category:"api"},fapi:{name:"Failed API Operation",icon:"icon-budicon-546",severity:r.error,level:3,category:"api"},limit_wc:{name:"Blocked Account",icon:"icon-budicon-313",severity:r.error,level:4},limit_mu:{name:"Blocked IP Address",icon:"icon-budicon-313",severity:r.error,level:4},limit_ui:{name:"Too Many Calls to /userinfo",icon:"icon-budicon-313",severity:r.error,level:4},api_limit:{name:"Rate Limit On API",icon:"icon-budicon-313",severity:r.error,level:4},limit_delegation:{name:"Too Many Calls to /delegation",icon:"icon-budicon-313",severity:r.error,level:4},sdu:{name:"Successful User Deletion",icon:"icon-budicon-312",severity:r.success,level:1},fdu:{name:"Failed User Deletion",icon:"icon-budicon-311",severity:r.error,level:3},admin_update_launch:{name:"Auth0 Update Launched",icon:"icon-budicon-774",severity:r.success,level:1},sys_os_update_start:{name:"Auth0 OS Update Started",icon:"icon-budicon-661",severity:r.success,level:1},sys_os_update_end:{name:"Auth0 OS Update Ended",icon:"icon-budicon-661",severity:r.success,level:1},sys_update_start:{name:"Auth0 Update Started",icon:"icon-budicon-661",severity:r.success,level:1},sys_update_end:{name:"Auth0 Update Ended",icon:"icon-budicon-661",severity:r.success,level:1},slo:{name:"Success Logout",icon:"icon-budicon-449",severity:r.success,level:1},flo:{name:"Failed Logout",icon:"icon-budicon-449",severity:r.error,level:3},sd:{name:"Success Delegation",icon:"icon-budicon-456",severity:r.success,level:1},fd:{name:"Failed Delegation",icon:"icon-budicon-456",severity:r.error,level:3},gd_unenroll:{name:"Unenroll device account",icon:"icon-budicon-298",severity:r.success,level:1},gd_update_device_account:{name:"Update device account",icon:"icon-budicon-257",severity:r.success,level:1},gd_module_switch:{name:"Module switch",icon:"icon-budicon-329",severity:r.success,level:1},gd_tenant_update:{name:"Guardian tenant update",icon:"icon-budicon-170",severity:r.success,level:1},gd_start_auth:{name:"Second factor started",icon:"icon-budicon-285",severity:r.success,level:1},gd_start_enroll:{name:"Enroll started",icon:"icon-budicon-299",severity:r.success,level:1},gd_start_enroll_failed:{name:"MFA Enrollment start failed",icon:"icon-budicon-299",severity:r.error,level:3},gd_user_delete:{name:"User delete",icon:"icon-budicon-298",severity:r.success,level:1},gd_auth_succeed:{name:"OTP Auth suceed",icon:"icon-budicon-mfa-login-succeed",severity:r.success,level:1},gd_auth_failed:{name:"OTP Auth failed",icon:"icon-budicon-mfa-login-failed",severity:r.error,level:3},gd_send_pn:{name:"Push notification sent",icon:"icon-budicon-mfa-send-pn",severity:r.success,level:1},gd_send_pn_failure:{name:"Error sending MFA Push Notification",icon:"icon-budicon-mfa-send-pn",severity:r.error,level:3},gd_auth_rejected:{name:"OTP Auth rejected",icon:"icon-budicon-mfa-login-failed",severity:r.error,level:3},gd_recovery_succeed:{name:"Recovery succeed",icon:"icon-budicon-mfa-recovery-succeed",severity:r.success,level:1},gd_recovery_failed:{name:"Recovery failed",icon:"icon-budicon-mfa-recovery-failed",severity:r.error,level:3},gd_send_sms:{name:"SMS Sent",icon:"icon-budicon-799",severity:r.success,level:1},gd_send_sms_failure:{name:"Error sending MFA SMS",icon:"icon-budicon-799",severity:r.error,level:3},gd_otp_rate_limit_exceed:{name:"Too many failures",icon:"icon-budicon-435",severity:r.warning,level:2},gd_recovery_rate_limit_exceed:{name:"Too many failures",icon:"icon-budicon-435",severity:r.warning,level:2},gd_enrollment_complete:{name:"Guardian enrollment complete",icon:"icon-budicon-299",severity:r.success,level:1},fui:{name:"Users import",icon:"icon-budicon-299",severity:r.warning,level:2},sui:{name:"Users import",icon:"icon-budicon-299",severity:r.success,level:1},pwd_leak:{name:"Breached password",icon:"icon-budicon-313",severity:r.error,level:3},fcoa:{name:"Failed cross origin authentication",icon:"icon-budicon-448",severity:r.error,level:3},scoa:{name:"Success cross origin authentication",icon:"icon-budicon-448",severity:r.success,level:1},ublkdu:{name:"Account unblocked",icon:"icon-budicon-313",severity:r.success,level:1}};e.exports=o,e.exports.get=function(e){return o[e]&&o[e].name||"Unknown Log Type: "+e}},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new s.ArgumentError("Must provide an options object");i.call(this,{objectMode:!0}),this.client=new a(e),this.options=e,this.remaining=50,this.lastBatch=0,this.retries=0,this.previousCheckpoint=e.checkpointId||null,this.lastCheckpoint=e.checkpointId||null,this.status={start:new Date,end:null,logsProcessed:0}}var o=n(130),i=n(129).Readable,s=n(0),a=n(35);o.inherits(r,i),r.prototype.getQuery=function(e){return e&&e.length?"type:"+e.join(" OR type:"):""},r.prototype.done=function(){this.status.end=new Date,this.push(null)},r.prototype.next=function(e){var t=this,n=t.options.types&&t.options.types.length?100:e;if(t.remaining<1)t.status.warning="Auth0 Management API rate limit reached.",t.done();else{var r=t.lastCheckpoint?{take:n,from:t.lastCheckpoint}:{per_page:n,page:0};r.q=t.getQuery(t.options.types),r.sort="date:1";!function n(){t.client.getLogs(r).then(function(n){var r=n.logs;if(t.remaining=n.limits.remaining,r&&r.length){var o=r;t.options.types&&t.options.types.length&&(o=r.filter(function(e){return t.options.types.indexOf(e.type)>=0}).slice(0,e||100)),o.length?(t.lastCheckpoint=o[o.length-1]._id,t.lastBatch+=o.length,t.push({logs:o,limits:n.limits})):(t.lastCheckpoint=r[r.length-1]._id,t.lastBatch+=0,t.push({logs:[],limits:n.limits}))}else t.status.end=new Date,t.push(null);return r}).catch(function(e){var r=t.options.start,o=t.options.maxRunTimeSeconds,i=(new Date).getTime(),s=r+1e3*o>=i;return t.options.maxRetries>t.retries&&s?(t.retries++,n()):t.emit("error",e)})}()}},r.prototype.batchSaved=function(){this.status.logsProcessed+=this.lastBatch,this.previousCheckpoint=this.lastCheckpoint,this.lastBatch=0},r.prototype._read=function(){},e.exports=r},function(e,t,n){"use strict";var r=n(115);e.exports=function(e,t,n){return function(o,i,s){var a=r(s);return!0===e||"function"==typeof e&&e(o,i,a)?t(o,i,a):n?n(o,i,a):a()}}},function(e,t,n){e.exports={default:n(82),__esModule:!0}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(15),o=n(1).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(1),o=n(13),i=n(88),s=n(6),a=function(e,t,n){var c,u,l,f=e&a.F,p=e&a.G,d=e&a.S,h=e&a.P,v=e&a.B,g=e&a.W,m=p?o:o[t]||(o[t]={}),y=m.prototype,x=p?r:d?r[t]:(r[t]||{}).prototype;p&&(n=t);for(c in n)(u=!f&&x&&void 0!==x[c])&&c in m||(l=u?x[c]:n[c],m[c]=p&&"function"!=typeof x[c]?n[c]:v&&u?i(l,r):g&&x[c]==l?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(l):h&&"function"==typeof l?i(Function.call,l):l,h&&((m.virtual||(m.virtual={}))[c]=l,e&a.R&&y&&!y[c]&&s(y,c,l)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,e.exports=a},function(e,t,n){e.exports=!n(5)&&!n(14)(function(){return 7!=Object.defineProperty(n(41)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r=n(22),o=n(42),i=n(49),s=n(6),a=n(2),c=n(21),u=n(93),l=n(24),f=n(100),p=n(8)("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(e,t,n,v,g,m,y){u(n,t,v);var x,w,b,_=function(e){if(!d&&e in T)return T[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",k="values"==g,E=!1,T=e.prototype,C=T[p]||T["@@iterator"]||g&&T[g],A=C||_(g),O=g?k?_("entries"):A:void 0,P="Array"==t?T.entries||C:C;if(P&&(b=f(P.call(new e)))!==Object.prototype&&(l(b,S,!0),r||a(b,p)||s(b,p,h)),k&&C&&"values"!==C.name&&(E=!0,A=function(){return C.call(this)}),r&&!y||!d&&!E&&T[p]||s(T,p,A),c[t]=A,c[S]=h,g)if(x={values:k?A:_("values"),keys:m?A:_("keys"),entries:O},y)for(w in x)w in T||i(T,w,x[w]);else o(o.P+o.F*(d||E),t,x);return x}},function(e,t,n){var r=n(12),o=n(97),i=n(20),s=n(25)("IE_PROTO"),a=function(){},c=function(){var e,t=n(41)("iframe"),r=i.length;for(t.style.display="none",n(90).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;r--;)delete c.prototype[i[r]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(a.prototype=r(e),n=new a,a.prototype=null,n[s]=e):n=c(),void 0===t?n:o(n,t)}},function(e,t,n){var r=n(48),o=n(20).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(2),o=n(3),i=n(87)(!1),s=n(25)("IE_PROTO");e.exports=function(e,t){var n,a=o(e),c=0,u=[];for(n in a)n!=s&&r(a,n)&&u.push(n);for(;t.length>c;)r(a,n=t[c++])&&(~i(u,n)||u.push(n));return u}},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";function r(e){this.message=e}var o=n(114);r.prototype=new Error,r.prototype.name="InvalidTokenError",e.exports=function(e,t){if("string"!=typeof e)throw new r("Invalid token specified");t=t||{};var n=!0===t.header?0:1;try{return JSON.parse(o(e.split(".")[n]))}catch(e){throw new r("Invalid token specified: "+e.message)}},e.exports.InvalidTokenError=r},function(e,t){var n={};n.formatTime=function(e){var t;return e instanceof Date&&(e=e.valueOf()),e&&null!==e?(-1!==e.toString().indexOf(".")?(t=parseFloat(e).toFixed(3),t.toString().indexOf(".")>=10&&(t=parseFloat(t.toString().substring(0,14)).toFixed(3))):t=13===e.toString().length?(parseFloat(e)/1e3).toFixed(3):e.toString().length<=12?parseFloat(e).toFixed(3):parseFloat(e.toString().substring(0,13)/1e3).toFixed(3),t):null},n.toArray=function(e){return Array.prototype.slice.call(e)},n.chain=function(e,t){if(arguments.length>1&&"function"==typeof arguments[0]){var r=n.toArray(arguments);e=r.slice(0,r.length-1),t=r[r.length-1]}if(e=e||[],t=t||function(){},0===e.length)t();else{var o=function(e,r,i){var s=function(e){if(e)t(e);else{var i=n.toArray(arguments);i.shift(),o(r[0],r.slice(1),i)}},a=i;0===r.length?a.push(t):a.push(s),e.apply(null,a)};o(e[0],e.slice(1),[])}},n.whilst=function(e,t,r){e=e||function(){return!1},t=t||function(e){e()},r=r||function(){};var o=function(o){o?r(o):n.whilst(e,t,r)};e()?t(o):r(null)},n.expBackoff=function(e,t){if(t=t||function(){},e&&"object"==typeof e)if(e&&!e.hasOwnProperty("attempt"))t(new Error("Must set opts.attempt."));else{var n=Math.random();e.hasOwnProperty("rand")&&(n=e.rand),n++;var r=Math.round(10*n*Math.pow(2,e.attempt));r=Math.min(r,12e4),setTimeout(function(){t(null,r)},r)}else t(new Error("Must send opts as an object."))},n.bind=function(e,t){return function(){return t.apply(e,arguments)}},n.copyObject=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},n.copyArray=function(e){for(var t=[],n=0;e&&n<e.length;n++)t[n]=e[n];return t},n.orByProp=function(e){for(var t=!1,n=1;!t&&n<arguments.length;n++)arguments[n]&&(t=t||arguments[n][e]);return t},n.orByFalseyProp=function(e){for(var t=null,n=arguments.length-1;n>0;n--)arguments[n]&&arguments[n].hasOwnProperty(e)&&(t=arguments[n][e]);return t},n.validateNonNegativeInt=function(e,t){if(e=parseInt(e,10),isNaN(e))throw new Error(t+" must be a number, found: "+e);if(e<0)throw new Error(t+" must be a positive number, found: "+e);return e},e.exports=n},function(e,t){e.exports=require("express-jwt@3.1.0")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("superagent@1.2.0")},function(e,t,n){"use strict";(function(t){var r=(n(33),n(53)),o=n(126),i=n(10),s=n(118),a=n(0),c=n(9),u=n(74),l=n(75),f=n(72),p=n(11),d=n(4),h=n(71);e.exports=function(e,n){d.setProvider(e);var v=n?new a.WebtaskStorageContext(n,{force:1}):new a.FileStorageContext(r.join(t,"./data.json"),{mergeWrites:!0}),g=new i;g.use(o(":method :url :status :response-time ms - :res[content-length]",{stream:p.stream}));var m=function(e){return function(t,n,r){return t.webtaskContext&&t.webtaskContext.body?(t.body=t.webtaskContext.body,r()):e(t,n,r)}};return g.use(m(s.json())),g.use(m(s.urlencoded({extended:!1}))),g.use(c.routes.dashboardAdmins({secret:d("EXTENSION_SECRET"),audience:"urn:logs-to-splunk",rta:d("AUTH0_RTA").replace("https://",""),domain:d("AUTH0_DOMAIN"),baseUrl:d("PUBLIC_WT_URL")||d("WT_URL"),clientName:"Logs to Splunk",urlPrefix:"",sessionStorageKey:"logs-to-splunk:apiToken"})),g.use("/meta",l()),g.use("/.extensions",f()),g.use("/app",i.static(r.join(t,"../dist"))),g.use(h(v)),g.use("/",u(v)),g.use(c.middlewares.errorHandler(p.error.bind(p))),g}}).call(t,"/")},function(e,t,n){const r=n(50),o=n(52),i=n(0),s=n(38);e.exports=function(e){if(!e||"object"!=typeof e)throw new i.ArgumentError("Must provide the options");if(null===e.secret||void 0===e.secret)throw new i.ArgumentError("Must provide a valid secret");if("string"!=typeof e.secret||0===e.secret.length)throw new i.ArgumentError("The provided secret is invalid: "+e.secret);if(null===e.audience||void 0===e.audience)throw new i.ArgumentError("Must provide a valid secret");if("string"!=typeof e.audience||0===e.audience.length)throw new i.ArgumentError("The provided audience is invalid: "+e.audience);if(null===e.baseUrl||void 0===e.baseUrl)throw new i.ArgumentError("Must provide a valid base URL");if("string"!=typeof e.baseUrl||0===e.baseUrl.length)throw new i.ArgumentError("The provided base URL is invalid: "+e.baseUrl);const t=o({audience:e.audience,issuer:e.baseUrl,secret:e.secret,algorithms:["HS256"],credentialsRequired:e.credentialsRequired||!0});return function(n,r,o){t(n,r,function(t){return t?o(t):e.onLoginSuccess?e.onLoginSuccess(n,r,o):o()})}},e.exports.optional=function(t){const n=e.exports(t);return s(function(e){if(e&&e.headers&&e.headers.authorization&&0===e.headers.authorization.indexOf("Bearer "))try{const n=r(e.headers.authorization.split(" ")[1]);return n&&n.iss===t.baseUrl}catch(e){return!1}return!1},n)}},function(e,t,n){const r=n(50),o=n(52),i=n(124),s=n(0),a=n(38),c=n(0).UnauthorizedError;e.exports=function(e){if(!e||"object"!=typeof e)throw new s.ArgumentError("Must provide the options");if(null===e.domain||void 0===e.domain)throw new s.ArgumentError("Must provide a valid domain");if("string"!=typeof e.domain||0===e.domain.length)throw new s.ArgumentError("The provided domain is invalid: "+e.domain);if(null===e.audience||void 0===e.audience)throw new s.ArgumentError("Must provide a valid audience");if("string"!=typeof e.audience||0===e.audience.length)throw new s.ArgumentError("The provided audience is invalid: "+e.audience);const t=o({secret:i.expressJwtSecret({cache:!0,rateLimit:!0,jwksRequestsPerMinute:5,jwksUri:"https://"+e.domain+"/.well-known/jwks.json",handleSigningKeyError:function(e,t){return t(e instanceof i.SigningKeyNotFoundError?new c("A token was provided with an invalid kid"):e)}}),audience:e.audience,issuer:"https://"+e.domain+"/",algorithms:["RS256"],credentialsRequired:e&&e.credentialsRequired||!0});return function(n,r,o){t(n,r,function(t){return t?o(t):e.onLoginSuccess?e.onLoginSuccess(n,r,o):o()})}},e.exports.optional=function(t){const n=e.exports(t);return a(function(e){if(e&&e.headers&&e.headers.authorization&&0===e.headers.authorization.indexOf("Bearer "))try{const n=r(e.headers.authorization.split(" ")[1]);return n&&n.iss==="https://"+t.domain+"/"}catch(e){return!1}return!1},n)}},function(e,t,n){e.exports=function(e){return function(t,n,r,o){return e&&e(t),t&&t.status?(r.status(t.status),r.json({error:t.code||t.name,message:t.message||t.name})):(r.status(t.status||500),r.json({error:"InternalServerError",message:t.message||t.name}))}}},function(e,t,n){e.exports.authenticateAdmins=n(56),e.exports.authenticateUsers=n(57),e.exports.requireAuthentication=n(61),e.exports.errorHandler=n(58),e.exports.managementApiClient=n(60),e.exports.validateHookToken=n(62),e.exports.webtaskConfig=n(63)},function(e,t,n){const r=n(0);e.exports=function(e){return function(t,n,o){const i=t,s=t.user&&t.user.access_token&&t.user.access_token.length,a=s?{domain:e.domain,accessToken:t.user.access_token}:e;r.managementApi.getClient(a).then(function(e){return i.auth0=e,o(),null}).catch(function(e){o(e)})}}},function(e,t,n){const r=n(0).UnauthorizedError;e.exports=function(e,t,n){return e.user?n():n(new r("Authentication required for this endpoint."))}},function(e,t,n){const r=n(0);e.exports=function(e,t,n){if(null===e||void 0===e)throw new r.ArgumentError("Must provide the domain");if("string"!=typeof e||0===e.length)throw new r.ArgumentError("The provided domain is invalid: "+e);if(null===t||void 0===t)throw new r.ArgumentError("Must provide the webtaskUrl");if("string"!=typeof t||0===t.length)throw new r.ArgumentError("The provided webtaskUrl is invalid: "+t);if(null===n||void 0===n)throw new r.ArgumentError("Must provide the extensionSecret");if("string"!=typeof n||0===n.length)throw new r.ArgumentError("The provided extensionSecret is invalid: "+n);return function(o){if(null===o||void 0===o)throw new r.ArgumentError("Must provide the hookPath");if("string"!=typeof o||0===o.length)throw new r.ArgumentError("The provided hookPath is invalid: "+o);return function(i,s,a){if(i.headers.authorization&&"Bearer"===i.headers.authorization.split(" ")[0]){const c=i.headers.authorization.split(" ")[1];try{if(r.validateHookToken(e,t,o,n,c))return a()}catch(e){return a(e)}}return a(new r.HookTokenError("Hook token missing for the call to: "+o))}}}},function(e,t,n){const r=n(0);e.exports=function(e){return function(t,n,o){return t.webtaskContext&&e.setProvider(r.configProvider.fromWebtaskContext(t.webtaskContext)),o()}}},function(e,t,n){const r=n(10),o=n(120),i=n(80),s=n(123),a=n(0),c=n(34);e.exports=function(e){if(!e||"object"!=typeof e)throw new a.ArgumentError("Must provide the options");if(null===e.secret||void 0===e.secret)throw new a.ArgumentError("Must provide a valid secret");if("string"!=typeof e.secret||0===e.secret.length)throw new a.ArgumentError("The provided secret is invalid: "+e.secret);if(null===e.audience||void 0===e.audience)throw new a.ArgumentError("Must provide a valid audience");if("string"!=typeof e.audience||0===e.audience.length)throw new a.ArgumentError("The provided audience is invalid: "+e.audience);if(null===e.rta||void 0===e.rta)throw new a.ArgumentError("Must provide a valid rta");if("string"!=typeof e.rta||0===e.rta.length)throw new a.ArgumentError("The provided rta is invalid: "+e.rta);if(null===e.domain||void 0===e.domain)throw new a.ArgumentError("Must provide a valid domain");if("string"!=typeof e.domain||0===e.domain.length)throw new a.ArgumentError("The provided domain is invalid: "+e.domain);if(null===e.baseUrl||void 0===e.baseUrl)throw new a.ArgumentError("Must provide a valid base URL");if("string"!=typeof e.baseUrl||0===e.baseUrl.length)throw new a.ArgumentError("The provided base URL is invalid: "+e.baseUrl);if(null===e.clientName||void 0===e.clientName)throw new a.ArgumentError("Must provide a valid client name");if("string"!=typeof e.clientName||0===e.clientName.length)throw new a.ArgumentError("The provided client name is invalid: "+e.clientName);const t=e.stateKey||"state",n=e.nonceKey||"nonce",u=e.urlPrefix||"",l=e.sessionStorageKey||"apiToken",f=r.Router();return f.get(u+"/login",function(r,i){const s=o.randomBytes(16).toString("hex"),l=o.randomBytes(16).toString("hex");i.cookie(t,s),i.cookie(n,l);const f=new a.SessionManager(e.rta,e.domain,e.baseUrl),p=f.createAuthorizeUrl({redirectUri:c.getBaseUrl(r)+u+"/login/callback",scopes:e.scopes,expiration:e.expiration,nonce:l,state:s});i.redirect(p)}),f.post(u+"/login/callback",i(),function(r,o,i){var u;try{u=s.decode(r.body.id_token)}catch(e){u=null}return u&&r.cookies&&r.cookies[n]===u.nonce?r.cookies&&r.cookies[t]===r.body.state?new a.SessionManager(e.rta,e.domain,e.baseUrl).create(r.body.id_token,r.body.access_token,{secret:e.secret,issuer:e.baseUrl,audience:e.audience}).then(function(e){o.header("Content-Type","text/html"),o.status(200).send('<html><head><script type="text/javascript">sessionStorage.setItem("'+l+'", "'+e+'");window.location.href = "'+c.getBaseUrl(r)+'";<\/script></head></html>')}).catch(function(e){i(e)}):i(new a.ValidationError("Login failed. State mismatch.")):i(new a.ValidationError("Login failed. Nonce mismatch."))}),f.get(u+"/logout",function(t,n){const r=encodeURIComponent(c.getBaseUrl(t));n.header("Content-Type","text/html"),n.status(200).send('<html><head><script type="text/javascript">sessionStorage.removeItem("'+l+'");window.location.href = "https://'+e.rta+"/v2/logout/?returnTo="+r+"&client_id="+r+'";<\/script></head></html>')}),f.get("/.well-known/oauth2-client-configuration",function(t,n){n.header("Content-Type","application/json"),n.status(200).send({redirect_uris:[c.getBaseUrl(t)+u+"/login/callback"],client_name:e.clientName,post_logout_redirect_uris:[c.getBaseUrl(t)]})}),f}},function(e,t,n){e.exports.dashboardAdmins=n(64)},function(e,t,n){const r=n(0),o=n(131);e.exports.createServer=function(e){const t=r.createServer(e);var n=null;return o.fromExpress(function(e,r){return n||(n=t(e.webtaskContext)),n(e,r)})}},function(e,t,n){"use strict";var r=n(69);e.exports.LogsProcessor=n(68),e.exports.LogsApiClient=n(35),e.exports.LogsApiStream=n(37),e.exports.logTypes=n(36),e.exports.reporters={SlackReporter:r}},function(e,t,n){"use strict";function r(e,t){if(null===t||void 0===t)throw new s.ArgumentError("Must provide an options object");this.start=(new Date).getTime(),this.storage=new u(e),this.options=o.assign({},{batchSize:100,maxRetries:5,maxRunTimeSeconds:20,timeoutSeconds:28},t)}var o=n(32),i=n(31),s=n(0),a=n(36),c=n(37),u=n(70);r.prototype.hasTimeLeft=function(e){var t=(new Date).getTime();return e+1e3*this.options.maxRunTimeSeconds>=t},r.prototype.getLogFilter=function(e){var t=e.logTypes||[];if(e.logLevel){var n=o.map(a,function(e,t){var n=e;return n.type=t,n});t=t.concat(o.map(o.filter(n,function(t){return t.level>=e.logLevel}),"type"))}return o.uniq(t)},r.prototype.getReport=function(e,t){var n=new Date(e).getTime(),r=t?new Date(t).getTime():(new Date).getTime();return this.storage.read().then(function(e){return o.filter(e.logs,function(e){var t=new Date(e.start).getTime(),o=new Date(e.end).getTime();return t>=n&&o<=r})}).then(function(e){var t={type:"report",processed:0,warnings:0,errors:0,checkpoint:""};return o.each(e,function(e){t.processed+=e.logsProcessed,t.checkpoint=e.checkpoint,e.error&&(t.errors+=1),e.warning&&(t.warnings+=1)}),t})},r.prototype.createStream=function(e){var t=this;return this.storage.getCheckpoint(e.startFrom).then(function(n){return e.logger&&e.logger.debug("Starting logs processor from checkpoint:",n),new c({checkpointId:n,types:t.getLogFilter(e),start:t.start,maxRetries:e.maxRetries,maxRunTimeSeconds:e.maxRunTimeSeconds,domain:e.domain,clientId:e.clientId,clientSecret:e.clientSecret,tokenCache:t.storage})})},r.prototype.run=function(e){var t=this,n=i.promisify(e);return new i(function(e,r){var o=t.start,s=0,a=0,c=[],u=t.storage,l=t.options,f=l.batchSize,p=l.maxRetries,d=function(t,n,o){l.logger&&l.logger.debug("Processor failed:",t),n.error=t,u.done(n,o).then(function(){return e({status:n,checkpoint:o})}).catch(r)},h=function(t,n){if(l.logger&&l.logger.debug("Processor run complete. Logs processed:",t.logsProcessed),t.logsProcessed>0){return(new Date).getTime()-a>=6048e5&&(t.warning="Logs are outdated more than for week. Last processed log has date is "+new Date(a)),u.done(t,n).then(function(){return e({status:t,checkpoint:n})}).catch(r)}return e({status:t,checkpoint:n})},v=function(){var e=f;return e-=c.length,e>100&&(e=100),e},g=function(e,r){if(!t.hasTimeLeft(o))return i.reject({err:e,status:r.status,checkpoint:r.previousCheckpoint,unrecoverable:!0});if(s<p)return s+=1,n(c);var a=[e,"Skipping logs from "+r.previousCheckpoint+" to "+r.lastCheckpoint+" after "+p+" retries."];return l.logger&&l.logger.error(a[0],a[1]),i.reject({err:a,status:r.status,checkpoint:r.lastCheckpoint,unrecoverable:!0})};t.createStream(l).then(function(e){return new i(function(r,s){var u=v(),p=!1;l.logger&&l.logger.debug("Loading next batch of logs. Next limit:",u),e.next(u),e.on("data",function(r){if(p)return void(l.logger&&l.logger.info('LogApiClient "data" handler called after timeout'));var i=r.logs;if(c=c.concat(i),i&&i.length&&(a=new Date(i[i.length-1].date).getTime()),c.length<f&&t.hasTimeLeft(o))return e.next(v());var u=function n(r){return r?r.unrecoverable?s(r):g(r.err||r,e).then(function(){return n()}).catch(function(e){return n(e)}):(c=[],t.hasTimeLeft(o)?(e.batchSaved(),e.next(v())):e.done())};return n(c).then(function(){return u()}).catch(function(e){return u(e)})});var d=function(){if(p)return void(l.logger&&l.logger.info('LogApiClient "end" handler called after timeout'));var t=function t(n){return n?n.unrecoverable?s(n):g(n.err||n,e).then(function(){return t()}).catch(function(e){return t(e)}):(e.batchSaved(),r({status:e.status,checkpoint:e.lastCheckpoint}))};return n(c).then(function(){return t()}).catch(function(e){return t(e)})};new i(function(t){e.on("end",t)}).timeout(1e3*l.timeoutSeconds).then(d).catch(i.TimeoutError,function(){l.logger&&l.logger.info("Hit timeoutSeconds ("+l.timeoutSeconds+" seconds)"),e.done(),d(),p=!0}),e.on("error",function(t){return s({err:t,status:e.status,checkpoint:e.previousCheckpoint})})})}).then(function(e){return h(e.status,e.checkpoint)}).catch(function(e){return d(e.err,e.status,e.checkpoint)})})},e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){this.options=e||{}}var i=n(39),s=r(i),a=n(79),c=r(a),u=n(31),l=n(54);o.prototype.send=function(e,t){if(!e||"object"!==(void 0===e?"undefined":(0,c.default)(e)))throw new Error("object status is required");var n=this.options,r=this.createMessage(this.options,e,t);return new u(function(e,t){return n.hook?l.post(n.hook).send(r).set("Accept","application/json").end(function(n){return n?t(n):e()}):e()})},o.prototype.createMessage=function(e,t,n){var r={username:e.username||"auth0-logger",icon_emoji:e.icon||":rocket:",attachments:[]},o=e.title||"Auth0 Logger",i="report"===t.type?o+" Daily Report":t.error?o+" Error":o+" Success",a=t.error||null,c={fallback:e.fallback||i,text:e.text||i,error_field:{title:"Error",value:(0,s.default)(a),short:!1}};"report"===t.type?c.fields=[{title:"Logs processed",value:t.processed,short:!0},{title:"Warnings",value:t.warnings,short:!0},{title:"Errors",value:t.errors,short:!0},{title:"Next checkpoint",value:t.checkpoint,short:!0}]:c.fields=[{title:"Start time",value:t.start,short:!0},{title:"End time",value:t.end,short:!0},{title:"Logs processed",value:t.logsProcessed,short:!0},{title:"Next checkpoint",value:n,short:!0}];var u=e.url?" (<"+e.url+"|Details>)":null,l=c.fields;return t.error&&l.push(c.error_field),r.attachments.push({color:t.error?"#d13f42":"#7cd197",fallback:c.fallback,text:c.fallback+(u||""),fields:l}),r},e.exports=o},function(e,t,n){"use strict";function r(e,t){if(!e)throw new a("The storageContext is required");this.storageContext=e,this.options=s({},{limit:400},t)}var o=n(39),i=function(e){return e&&e.__esModule?e:{default:e}}(o),s=n(32).assign,a=n(0).ArgumentError;r.prototype.read=function(){return this.storageContext.read().then(function(e){var t=e||{};return t.logs=t.logs||[],t})},r.prototype.write=function(e){return this.storageContext.write(e)},r.prototype.getCheckpoint=function(e){var t=this;return t.read().then(function(n){return e&&e!==n.startFrom?(n.startFrom=e,n.checkpointId=e,t.write(n).then(function(){return n.checkpointId||e||null})):n.checkpointId})},r.prototype.getToken=function(){return this.read().then(function(e){return e.logs_access_token||null})},r.prototype.setToken=function(e){var t=this;return t.read().then(function(n){return n.logs_access_token=e,t.write(n)})},r.prototype.done=function(e,t){var n=this;return n.read().then(function(r){return Buffer.byteLength((0,i.default)(r),"utf8")>=1024*n.options.limit&&r.logs&&r.logs.length&&r.logs.splice(0,5),e.checkpoint=t,r.logs.push(e),r.checkpointId=t,n.write(r)})},e.exports=r},function(e,t,n){"use strict";var r=n(125),o=n(116).Logger,i=n(67),s=n(4),a=n(11);e.exports=function(e){return function(t,n,c){var u=t.webtaskContext&&t.webtaskContext.body||t.body||{},l=t.webtaskContext&&t.webtaskContext.headers||{};if(!(u.schedule&&"active"===u.state||"https://manage.auth0.com/"===l.referer&&l["if-none-match"]))return c();var f=new o({token:s("SPLUNK_TOKEN"),url:s("SPLUNK_URL"),port:s("SPLUNK_COLLECTOR_PORT")||8088,path:s("SPLUNK_COLLECTOR_PATH")||"/services/collector/event/1.0",maxBatchCount:0});f.requestOptions={timeout:5e3},f.error=function(e,t){a.error("error",e,"context",t)};var p=function(e,t){if(!e||!e.length)return t();e.forEach(function(e){f.send({message:e})}),a.info("Sending "+e.length+" logs to Splunk..."),f.flush(function(e,n,r){return a.info("Splunk response",r),e?t({error:e,message:"Error sending logs to Splunk"}):(a.info("Upload complete."),t())})},d=new i.reporters.SlackReporter({hook:s("SLACK_INCOMING_WEBHOOK_URL"),username:"auth0-logs-to-splunk",title:"Logs To Splunk"}),h={domain:s("AUTH0_DOMAIN"),clientId:s("AUTH0_CLIENT_ID"),clientSecret:s("AUTH0_CLIENT_SECRET"),batchSize:parseInt(s("BATCH_SIZE")),startFrom:s("START_FROM"),logTypes:s("LOG_TYPES"),logLevel:s("LOG_LEVEL")};(!h.batchSize||h.batchSize>100)&&(h.batchSize=100),h.logTypes&&!Array.isArray(h.logTypes)&&(h.logTypes=h.logTypes.replace(/\s/g,"").split(","));var v=new i.LogsProcessor(e,h),g=function(t){var n=new Date,r=n.getTime(),o=r-864e5;v.getReport(o,r).then(function(e){return d.send(e,e.checkpoint)}).then(function(){return e.read()}).then(function(n){return n.lastReportDate=t,e.write(n)})},m=function(){e.read().then(function(e){var t=r().format("DD-MM-YYYY"),n=s("DAILY_REPORT_TIME")||16;e.lastReportDate!==t&&(new Date).getHours()>=n&&g(t)})};return v.run(p).then(function(e){e&&e.status&&e.status.error?d.send(e.status,e.checkpoint):!0!==s("SLACK_SEND_SUCCESS")&&"true"!==s("SLACK_SEND_SUCCESS")||d.send(e.status,e.checkpoint),m(),n.json(e)}).catch(function(e){d.send({error:e,logsProcessed:0},null),m(),c(e)})}}},function(e,t,n){"use strict";var r=n(10).Router,o=n(9).middlewares,i=n(4),s=n(11);e.exports=function(){var e=r(),t=o.validateHookToken(i("AUTH0_DOMAIN"),i("WT_URL"),i("EXTENSION_SECRET"));return e.use("/on-uninstall",t("/.extensions/on-uninstall")),e.use(o.managementApiClient({domain:i("AUTH0_DOMAIN"),clientId:i("AUTH0_CLIENT_ID"),clientSecret:i("AUTH0_CLIENT_SECRET")})),e.delete("/on-uninstall",function(e,t){var n=i("AUTH0_CLIENT_ID");e.auth0.clients.delete({client_id:n}).then(function(){s.debug("Deleted client "+n),t.sendStatus(204)}).catch(function(e){s.debug("Error deleting client: "+i("AUTH0_CLIENT_ID")),s.error(e),t.sendStatus(204)})}),e}},function(e,t,n){"use strict";(function(t){var r=(n(122),n(121)),o=(n(53),n(9).urlHelpers),i=n(4);e.exports=function(){var e='\n  <!DOCTYPE html>\n  <html lang="en">\n  <head>\n    <title><%= config.TITLE %></title>\n    <meta charset="UTF-8" />\n    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />\n    <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n    <link rel="shortcut icon" href="https://cdn.auth0.com/styleguide/4.6.13/lib/logos/img/favicon.png">\n    <meta name="viewport" content="width=device-width, initial-scale=1">\n    <link rel="stylesheet" type="text/css" href="https://cdn.auth0.com/styles/zocial.min.css" />\n    <link rel="stylesheet" type="text/css" href="https://cdn.auth0.com/manage/v0.3.1672/css/index.min.css" />\n    <link rel="stylesheet" type="text/css" href="https://cdn.auth0.com/styleguide/4.6.13/index.min.css" />\n    <% if (assets.style) { %><link rel="stylesheet" type="text/css" href="/app/<%= assets.style %>" /><% } %>\n    <% if (assets.version) { %><link rel="stylesheet" type="text/css" href="//cdn.auth0.com/extensions/auth0-logs-to-splunk/assets/auth0-logs-to-splunk.ui.<%= assets.version %>.css" /><% } %>\n    <% if (assets.customCss) { %><link rel="stylesheet" type="text/css" href="<%= assets.customCss %>" /><% } %>\n  </head>\n  <body>\n    <div id="app"></div>\n    <script type="text/javascript" src="//cdn.auth0.com/w2/auth0-7.0.4.min.js"><\/script>\n    <script type="text/javascript" src="//cdn.auth0.com/manage/v0.3.1672/js/bundle.js"><\/script>\n    <script type="text/javascript">window.config = <%- JSON.stringify(config) %>;<\/script>\n    <% if (assets.vendors) { %><script type="text/javascript" src="/app/<%= assets.vendors %>"><\/script><% } %>\n    <% if (assets.app) { %><script type="text/javascript" src="/app/<%= assets.app %>"><\/script><% } %>\n    <% if (assets.version) { %>\n    <script type="text/javascript" src="//cdn.auth0.com/extensions/auth0-logs-to-splunk/assets/auth0-logs-to-splunk.ui.vendors.<%= assets.version %>.js"><\/script>\n    <script type="text/javascript" src="//cdn.auth0.com/extensions/auth0-logs-to-splunk/assets/auth0-logs-to-splunk.ui.<%= assets.version %>.js"><\/script>\n    <% } %>\n  </body>\n  </html>\n  ';return function(t,n,s){if(0===t.url.indexOf("/api"))return s();var a={AUTH0_DOMAIN:i("AUTH0_DOMAIN"),AUTH0_CLIENT_ID:i("EXTENSION_CLIENT_ID"),AUTH0_MANAGE_URL:i("AUTH0_MANAGE_URL")||"https://manage.auth0.com",BASE_URL:o.getBaseUrl(t),BASE_PATH:o.getBasePath(t),TITLE:i("TITLE")};return n.send(r.render(e,{config:a,assets:{customCss:i("CUSTOM_CSS"),version:"2.1.1"}}))}}}).call(t,"/")},function(e,t,n){"use strict";var r=n(32),o=n(10).Router,i=n(9).middlewares,s=n(4),a=n(73);e.exports=function(e){var t=o(),n=i.authenticateAdmins({credentialsRequired:!0,secret:s("EXTENSION_SECRET"),audience:"urn:logs-to-splunk",baseUrl:s("PUBLIC_WT_URL")||s("WT_URL"),onLoginSuccess:function(e,t,n){return n()}});return t.get("/",a()),t.get("/api/report",n,function(t,n,o){return e.read().then(function(e){var o=e&&e.logs?r.sortByOrder(e.logs,"start","desc"):[],i=t.query.filter&&"errors"===t.query.filter?r.filter(o,function(e){return!!e.error}):o,s=t.query.page&&parseInt(t.query.page)?parseInt(t.query.page)-1:0,a=t.query.per_page&&parseInt(t.query.per_page)||10,c=a*s;return n.json({logs:i.slice(c,c+a),total:i.length})}).catch(o)}),t}},function(e,t,n){"use strict";var r=n(10),o=n(112);e.exports=function(){var e=r.Router();return e.get("/",function(e,t){t.status(200).send(o)}),e}},function(e,t,n){"use strict";var r=n(9),o=n(55),i=n(4),s=n(11),a=r.createServer(function(e,t){return s.info("Starting Logs to Splunk extension - Version:","2.1.1"),o(e,t)});e.exports=function(e,t,n){i.setValue("PUBLIC_WT_URL",r.urlHelpers.getWebtaskUrl(t)),a(e,t,n)}},function(e,t,n){e.exports={default:n(83),__esModule:!0}},function(e,t,n){e.exports={default:n(84),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(78),i=r(o),s=n(77),a=r(s),c="function"==typeof a.default&&"symbol"==typeof i.default?function(e){return typeof e}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":typeof e};t.default="function"==typeof a.default&&"symbol"===c(i.default)?function(e){return void 0===e?"undefined":c(e)}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":void 0===e?"undefined":c(e)}},function(e,t,n){"use strict";function r(e,t){return function(n,r,o){if(n.cookies)return o();var s=n.headers.cookie,u=!e||Array.isArray(e)?e||[]:[e];if(n.secret=u[0],n.cookies=Object.create(null),n.signedCookies=Object.create(null),!s)return o();n.cookies=c.parse(s,t),0!==u.length&&(n.signedCookies=a(n.cookies,u),n.signedCookies=i(n.signedCookies)),n.cookies=i(n.cookies),o()}}function o(e){if("string"==typeof e&&"j:"===e.substr(0,2))try{return JSON.parse(e.slice(2))}catch(e){return}}function i(e){for(var t,n,r=Object.keys(e),i=0;i<r.length;i++)t=r[i],(n=o(e[t]))&&(e[t]=n);return e}function s(e,t){if("string"==typeof e){if("s:"!==e.substr(0,2))return e;for(var n=!t||Array.isArray(t)?t||[]:[t],r=0;r<n.length;r++){var o=u.unsign(e.slice(2),n[r]);if(!1!==o)return o}return!1}}function a(e,t){for(var n,r,o,i=Object.keys(e),a=Object.create(null),c=0;c<i.length;c++)r=i[c],o=e[r],n=s(o,t),o!==n&&(a[r]=n,delete e[r]);return a}var c=n(81),u=n(119);e.exports=r,e.exports.JSONCookie=o,e.exports.JSONCookies=i,e.exports.signedCookie=s,e.exports.signedCookies=a},function(e,t,n){"use strict";function r(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},r=t||{},o=e.split(c),a=r.decode||s,u=0;u<o.length;u++){var l=o[u],f=l.indexOf("=");if(!(f<0)){var p=l.substr(0,f).trim(),d=l.substr(++f,l.length).trim();'"'==d[0]&&(d=d.slice(1,-1)),void 0==n[p]&&(n[p]=i(d,a))}}return n}function o(e,t,n){var r=n||{},o=r.encode||a;if("function"!=typeof o)throw new TypeError("option encode is invalid");if(!u.test(e))throw new TypeError("argument name is invalid");var i=o(t);if(i&&!u.test(i))throw new TypeError("argument val is invalid");var s=e+"="+i;if(null!=r.maxAge){var c=r.maxAge-0;if(isNaN(c))throw new Error("maxAge should be a Number");s+="; Max-Age="+Math.floor(c)}if(r.domain){if(!u.test(r.domain))throw new TypeError("option domain is invalid");s+="; Domain="+r.domain}if(r.path){if(!u.test(r.path))throw new TypeError("option path is invalid");s+="; Path="+r.path}if(r.expires){if("function"!=typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");s+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.sameSite){switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;default:throw new TypeError("option sameSite is invalid")}}return s}function i(e,t){try{return t(e)}catch(t){return e}}t.parse=r,t.serialize=o;var s=decodeURIComponent,a=encodeURIComponent,c=/; */,u=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/},function(e,t,n){var r=n(13),o=r.JSON||(r.JSON={stringify:JSON.stringify});e.exports=function(e){return o.stringify.apply(o,arguments)}},function(e,t,n){n(108),n(106),n(109),n(110),e.exports=n(13).Symbol},function(e,t,n){n(107),n(111),e.exports=n(30).f("iterator")},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(){}},function(e,t,n){var r=n(3),o=n(103),i=n(102);e.exports=function(e){return function(t,n,s){var a,c=r(t),u=o(c.length),l=i(s,u);if(e&&n!=n){for(;u>l;)if((a=c[l++])!=a)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){var r=n(85);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(16),o=n(47),i=n(23);e.exports=function(e){var t=r(e),n=o.f;if(n)for(var s,a=n(e),c=i.f,u=0;a.length>u;)c.call(e,s=a[u++])&&t.push(s);return t}},function(e,t,n){e.exports=n(1).document&&document.documentElement},function(e,t,n){var r=n(40);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(40);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(45),o=n(17),i=n(24),s={};n(6)(s,n(8)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(s,{next:o(1,n)}),i(e,t+" Iterator")}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(16),o=n(3);e.exports=function(e,t){for(var n,i=o(e),s=r(i),a=s.length,c=0;a>c;)if(i[n=s[c++]]===t)return n}},function(e,t,n){var r=n(18)("meta"),o=n(15),i=n(2),s=n(7).f,a=0,c=Object.isExtensible||function(){return!0},u=!n(14)(function(){return c(Object.preventExtensions({}))}),l=function(e){s(e,r,{value:{i:"O"+ ++a,w:{}}})},f=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!c(e))return"F";if(!t)return"E";l(e)}return e[r].i},p=function(e,t){if(!i(e,r)){if(!c(e))return!0;if(!t)return!1;l(e)}return e[r].w},d=function(e){return u&&h.NEED&&c(e)&&!i(e,r)&&l(e),e},h=e.exports={KEY:r,NEED:!1,fastKey:f,getWeak:p,onFreeze:d}},function(e,t,n){var r=n(7),o=n(12),i=n(16);e.exports=n(5)?Object.defineProperties:function(e,t){o(e);for(var n,s=i(t),a=s.length,c=0;a>c;)r.f(e,n=s[c++],t[n]);return e}},function(e,t,n){var r=n(23),o=n(17),i=n(3),s=n(28),a=n(2),c=n(43),u=Object.getOwnPropertyDescriptor;t.f=n(5)?u:function(e,t){if(e=i(e),t=s(t,!0),c)try{return u(e,t)}catch(e){}if(a(e,t))return o(!r.f.call(e,t),e[t])}},function(e,t,n){var r=n(3),o=n(46).f,i={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(e){try{return o(e)}catch(e){return s.slice()}};e.exports.f=function(e){return s&&"[object Window]"==i.call(e)?a(e):o(r(e))}},function(e,t,n){var r=n(2),o=n(104),i=n(25)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},function(e,t,n){var r=n(27),o=n(19);e.exports=function(e){return function(t,n){var i,s,a=String(o(t)),c=r(n),u=a.length;return c<0||c>=u?e?"":void 0:(i=a.charCodeAt(c),i<55296||i>56319||c+1===u||(s=a.charCodeAt(c+1))<56320||s>57343?e?a.charAt(c):i:e?a.slice(c,c+2):s-56320+(i-55296<<10)+65536)}}},function(e,t,n){var r=n(27),o=Math.max,i=Math.min;e.exports=function(e,t){return e=r(e),e<0?o(e+t,0):i(e,t)}},function(e,t,n){var r=n(27),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(19);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";var r=n(86),o=n(94),i=n(21),s=n(3);e.exports=n(44)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,o(1)):"keys"==t?o(0,n):"values"==t?o(0,e[n]):o(0,[n,e[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(e,t){},function(e,t,n){"use strict";var r=n(101)(!0);n(44)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";var r=n(1),o=n(2),i=n(5),s=n(42),a=n(49),c=n(96).KEY,u=n(14),l=n(26),f=n(24),p=n(18),d=n(8),h=n(30),v=n(29),g=n(95),m=n(89),y=n(92),x=n(12),w=n(3),b=n(28),_=n(17),S=n(45),k=n(99),E=n(98),T=n(7),C=n(16),A=E.f,O=T.f,P=k.f,I=r.Symbol,L=r.JSON,U=L&&L.stringify,R=d("_hidden"),j=d("toPrimitive"),M={}.propertyIsEnumerable,N=l("symbol-registry"),F=l("symbols"),B=l("op-symbols"),D=Object.prototype,q="function"==typeof I,z=r.QObject,H=!z||!z.prototype||!z.prototype.findChild,W=i&&u(function(){return 7!=S(O({},"a",{get:function(){return O(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=A(D,t);r&&delete D[t],O(e,t,n),r&&e!==D&&O(D,t,r)}:O,K=function(e){var t=F[e]=S(I.prototype);return t._k=e,t},J=q&&"symbol"==typeof I.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof I},G=function(e,t,n){return e===D&&G(B,t,n),x(e),t=b(t,!0),x(n),o(F,t)?(n.enumerable?(o(e,R)&&e[R][t]&&(e[R][t]=!1),n=S(n,{enumerable:_(0,!1)})):(o(e,R)||O(e,R,_(1,{})),e[R][t]=!0),W(e,t,n)):O(e,t,n)},V=function(e,t){x(e);for(var n,r=m(t=w(t)),o=0,i=r.length;i>o;)G(e,n=r[o++],t[n]);return e},Y=function(e,t){return void 0===t?S(e):V(S(e),t)},Q=function(e){var t=M.call(this,e=b(e,!0));return!(this===D&&o(F,e)&&!o(B,e))&&(!(t||!o(this,e)||!o(F,e)||o(this,R)&&this[R][e])||t)},$=function(e,t){if(e=w(e),t=b(t,!0),e!==D||!o(F,t)||o(B,t)){var n=A(e,t);return!n||!o(F,t)||o(e,R)&&e[R][t]||(n.enumerable=!0),n}},X=function(e){for(var t,n=P(w(e)),r=[],i=0;n.length>i;)o(F,t=n[i++])||t==R||t==c||r.push(t);return r},Z=function(e){for(var t,n=e===D,r=P(n?B:w(e)),i=[],s=0;r.length>s;)!o(F,t=r[s++])||n&&!o(D,t)||i.push(F[t]);return i};q||(I=function(){if(this instanceof I)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(n){this===D&&t.call(B,n),o(this,R)&&o(this[R],e)&&(this[R][e]=!1),W(this,e,_(1,n))};return i&&H&&W(D,e,{configurable:!0,set:t}),K(e)},a(I.prototype,"toString",function(){return this._k}),E.f=$,T.f=G,n(46).f=k.f=X,n(23).f=Q,n(47).f=Z,i&&!n(22)&&a(D,"propertyIsEnumerable",Q,!0),h.f=function(e){return K(d(e))}),s(s.G+s.W+s.F*!q,{Symbol:I});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),te=0;ee.length>te;)d(ee[te++]);for(var ee=C(d.store),te=0;ee.length>te;)v(ee[te++]);s(s.S+s.F*!q,"Symbol",{for:function(e){return o(N,e+="")?N[e]:N[e]=I(e)},keyFor:function(e){if(J(e))return g(N,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){H=!0},useSimple:function(){H=!1}}),s(s.S+s.F*!q,"Object",{create:Y,defineProperty:G,defineProperties:V,getOwnPropertyDescriptor:$,getOwnPropertyNames:X,getOwnPropertySymbols:Z}),L&&s(s.S+s.F*(!q||u(function(){var e=I();return"[null]"!=U([e])||"{}"!=U({a:e})||"{}"!=U(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!J(e)){for(var t,n,r=[e],o=1;arguments.length>o;)r.push(arguments[o++]);return t=r[1],"function"==typeof t&&(n=t),!n&&y(t)||(t=function(e,t){if(n&&(t=n.call(this,e,t)),!J(t))return t}),r[1]=t,U.apply(L,r)}}}),I.prototype[j]||n(6)(I.prototype,j,I.prototype.valueOf),f(I,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(e,t,n){n(29)("asyncIterator")},function(e,t,n){n(29)("observable")},function(e,t,n){n(105);for(var r=n(1),o=n(6),i=n(21),s=n(8)("toStringTag"),a=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],c=0;c<5;c++){var u=a[c],l=r[u],f=l&&l.prototype;f&&!f[s]&&o(f,s,u),i[u]=i.Array}},function(e,t){e.exports={title:"Auth0 Logs to Splunk",name:"auth0-logs-to-splunk",version:"2.1.1",author:"auth0",description:"This extension will take all of your Auth0 logs and export them to Splunk",type:"cron",initialUrlPath:"/login",category:"log_export",repository:"https://github.com/auth0-extensions/auth0-logs-to-splunk",docsUrl:"https://auth0.com/docs/extensions/splunk",logoUrl:"https://cdn.auth0.com/extensions/auth0-logs-to-splunk/assets/logo.png",keywords:["auth0","extension"],schedule:"0 */5 * * * *",auth0:{createClient:!0,onUninstallPath:"/.extensions/on-uninstall",scopes:"read:logs delete:clients"},secrets:{SPLUNK_URL:{description:"Splunk URL - this is your Splunk HTTP Collector Endpoint",required:!0},SPLUNK_TOKEN:{description:"Splunk Token - this is your Splunk Token",required:!0,type:"password"},SPLUNK_COLLECTOR_PORT:{description:"HTTP Collector Port",required:!0,default:8088},SPLUNK_COLLECTOR_PATH:{description:"HTTP Collector Path (Endpoint)",required:!1,default:"/services/collector/event/1.0"},BATCH_SIZE:{description:"The amount of logs to batch before sending to Splunk. A single cron execution will send multiple batches.",default:100},START_FROM:{description:"Checkpoint ID of log to start from."},SLACK_INCOMING_WEBHOOK_URL:{description:"Slack Incoming Webhook URL used to report statistics and possible failures"},SLACK_SEND_SUCCESS:{description:"This setting will enable verbose notifications to Slack which are useful for troubleshooting",type:"select",allowMultiple:!1,default:"false",options:[{value:"false",text:"No"},{value:"true",text:"Yes"}]},LOG_LEVEL:{description:"This allows you to specify the log level of events that need to be sent",type:"select",allowMultiple:!0,options:[{value:"-",text:""},{value:"0",text:"Debug"},{value:"1",text:"Info"},{value:"2",text:"Warning"},{value:"3",text:"Error"},{value:"4",text:"Critical"}]},LOG_TYPES:{description:"If you only want to send events with a specific type (eg: failed logins)",type:"select",allowMultiple:!0,options:[{text:"",value:"-"},{text:"Success Login",value:"s"},{text:"Success Exchange",value:"seacft"},{text:"Success Exchange (Client Credentials)",value:"seccft"},{text:"Failed Exchange",value:"feacft"},{text:"Failed Exchange (Client Credentials)",value:"feccft"},{text:"Failed Login",value:"f"},{text:"Warnings During Login",value:"w"},{text:"Deleted User",value:"du"},{text:"Failed Login (invalid email/username)",value:"fu"},{text:"Failed Login (wrong password)",value:"fp"},{text:"Failed by Connector",value:"fc"},{text:"Failed by CORS",value:"fco"},{text:"Connector Online",value:"con"},{text:"Connector Offline",value:"coff"},{text:"Failed Connector Provisioning",value:"fcpro"},{text:"Success Signup",value:"ss"},{text:"Failed Signup",value:"fs"},{text:"Code Sent",value:"cs"},{text:"Code/Link Sent",value:"cls"},{text:"Success Verification Email",value:"sv"},{text:"Failed Verification Email",value:"fv"},{text:"Success Change Password",value:"scp"},{text:"Failed Change Password",value:"fcp"},{text:"Success Change Email",value:"sce"},{text:"Failed Change Email",value:"fce"},{text:"Success Change Username",value:"scu"},{text:"Failed Change Username",value:"fcu"},{text:"Success Change Phone Number",value:"scpn"},{text:"Failed Change Phone Number",value:"fcpn"},{text:"Success Verification Email Request",value:"svr"},{text:"Failed Verification Email Request",value:"fvr"},{text:"Success Change Password Request",value:"scpr"},{text:"Failed Change Password Request",value:"fcpr"},{text:"Failed Sending Notification",value:"fn"},{text:"API Operation",value:"sapi"},{text:"Failed API Operation",value:"fapi"},{text:"Blocked Account",value:"limit_wc"},{text:"Too Many Calls to /userinfo",value:"limit_ui"},{text:"Rate Limit On API",value:"api_limit"},{text:"Successful User Deletion",value:"sdu"},{text:"Failed User Deletion",value:"fdu"},{text:"Blocked Account",value:"limit_wc"},{text:"Blocked IP Address",value:"limit_mu"},{text:"Success Logout",value:"slo"},{text:"Failed Logout",value:"flo"},{text:"Success Delegation",value:"sd"},{text:"Failed Delegation",value:"fd"}]}}}},function(e,t){function n(e){this.message=e}function r(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,s=0,a=0,c="";i=t.charAt(a++);~i&&(r=s%4?64*r+i:i,s++%4)?c+=String.fromCharCode(255&r>>(-2*s&6)):0)i=o.indexOf(i);return c}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.name="InvalidCharacterError",e.exports="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||r},function(e,t,n){function r(e){return decodeURIComponent(o(e).replace(/(.)/g,function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}var o=n(113);e.exports=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return r(t)}catch(e){return o(t)}}},function(e,t,n){function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}var i=n(133);e.exports=i(r),e.exports.strict=i(o),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})})},function(e,t,n){var r=n(117),o=n(51);e.exports={Logger:r,utils:o}},function(e,t,n){function r(e,t){console.log("ERROR:",e," CONTEXT",t)}function o(e,t){return{message:e,severity:t}}var i=n(128),s=n(33),a=n(51),c=function(e){this._timerID=null,this._timerDuration=0,this.config=this._initializeConfig(e),this.requestOptions=this._initializeRequestOptions(),this.serializedContextQueue=[],this.eventsBatchSize=0,this.eventFormatter=o,this.error=r,this._enableTimer=a.bind(this,this._enableTimer),this._disableTimer=a.bind(this,this._disableTimer),this._initializeConfig=a.bind(this,this._initializeConfig),this._initializeRequestOptions=a.bind(this,this._initializeRequestOptions),this._validateMessage=a.bind(this,this._validateMessage),this._initializeMetadata=a.bind(this,this._initializeMetadata),this._initializeContext=a.bind(this,this._initializeContext),this._makeBody=a.bind(this,this._makeBody),this._post=a.bind(this,this._post),this._sendEvents=a.bind(this,this._sendEvents),this.send=a.bind(this,this.send),this.flush=a.bind(this,this.flush)};c.prototype.levels={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"};var u={name:"splunk-javascript-logging/0.9.3",host:"localhost",path:"/services/collector/event/1.0",protocol:"https",port:8088,level:c.prototype.levels.INFO,maxRetries:0,batchInterval:0,maxBatchSize:0,maxBatchCount:1},l={json:!1,strictSSL:!1};c.prototype._disableTimer=function(){this._timerID&&(clearInterval(this._timerID),this._timerDuration=0,this._timerID=null)},c.prototype._enableTimer=function(e){e=a.validateNonNegativeInt(e,"Batch interval"),this._timerID&&this._disableTimer(),this.config&&(this.config.batchInterval=e),this._timerDuration=e;var t=this;this._timerID=setInterval(function(){t.serializedContextQueue.length>0&&t.flush()},e)},c.prototype._initializeConfig=function(e){var t=a.copyObject(this.config);if(!e)throw new Error("Config is required.");if("object"!=typeof e)throw new Error("Config must be an object.");if(!t.hasOwnProperty("token")&&!e.hasOwnProperty("token"))throw new Error("Config object must have a token.");if("string"!=typeof t.token&&"string"!=typeof e.token)throw new Error("Config token must be a string.");if(e.url){var n=s.parse(e.url),r=n.path&&"/"!==n.path;n.protocol&&(e.protocol=n.protocol.replace(":","")),n.port&&(e.port=n.port),n.hostname&&n.path?(e.host=n.hostname,r&&(e.path=n.path)):r&&(e.host=n.path)}if(t.token=a.orByProp("token",e,t),t.name=a.orByProp("name",e,t,u),t.level=a.orByProp("level",e,t,u),t.host=a.orByProp("host",e,t,u),t.path=a.orByProp("path",e,t,u),t.protocol=a.orByProp("protocol",e,t,u),t.port=a.orByFalseyProp("port",e,t,u),t.port=a.validateNonNegativeInt(t.port,"Port"),t.port<1||t.port>65535)throw new Error("Port must be an integer between 1 and 65535, found: "+t.port);t.maxRetries=a.orByProp("maxRetries",e,t,u),t.maxRetries=a.validateNonNegativeInt(t.maxRetries,"Max retries"),t.maxBatchCount=a.orByFalseyProp("maxBatchCount",e,t,u),t.maxBatchCount=a.validateNonNegativeInt(t.maxBatchCount,"Max batch count"),t.maxBatchSize=a.orByFalseyProp("maxBatchSize",e,t,u),t.maxBatchSize=a.validateNonNegativeInt(t.maxBatchSize,"Max batch size"),t.batchInterval=a.orByFalseyProp("batchInterval",e,t,u),t.batchInterval=a.validateNonNegativeInt(t.batchInterval,"Batch interval");var o=!this._timerID&&t.batchInterval>0,i=this._timerID&&this._timerDuration!==t.batchInterval&&t.batchInterval>0;return o||i?this._enableTimer(t.batchInterval):this._timerID&&(t.batchInterval<=0||this._timerDuration<0)&&this._disableTimer(),t},c.prototype._initializeRequestOptions=function(e){var t=a.copyObject(e||l);return e&&(t.json=e.hasOwnProperty("json")?e.json:l.json,t.strictSSL=e.strictSSL||l.strictSSL),t.headers=t.headers||{},t},c.prototype._validateMessage=function(e){if(void 0===e||null===e)throw new Error("Message argument is required.");return e},c.prototype._initializeMetadata=function(e){var t={};return e&&e.hasOwnProperty("metadata")&&(e.metadata.hasOwnProperty("time")&&(t.time=e.metadata.time),e.metadata.hasOwnProperty("host")&&(t.host=e.metadata.host),e.metadata.hasOwnProperty("source")&&(t.source=e.metadata.source),e.metadata.hasOwnProperty("sourcetype")&&(t.sourcetype=e.metadata.sourcetype),e.metadata.hasOwnProperty("index")&&(t.index=e.metadata.index)),t},c.prototype._initializeContext=function(e){if(!e)throw new Error("Context argument is required.");if("object"!=typeof e)throw new Error("Context argument must be an object.");if(!e.hasOwnProperty("message"))throw new Error("Context argument must have the message property set.");return e.message=this._validateMessage(e.message),e.severity=e.severity||u.level,e.metadata=e.metadata||this._initializeMetadata(e),e},c.prototype._makeBody=function(e){if(!e)throw new Error("Context parameter is required.");var t=this._initializeMetadata(e),n=a.formatTime(t.time||Date.now());return t.time=n.toString(),t.event=this.eventFormatter(e.message,e.severity||u.level),t},c.prototype._post=function(e,t){i.post(e,t)},c.prototype._sendEvents=function(e,t){t=t||function(){},this.config=this._initializeConfig(this.config);var n=this._initializeRequestOptions(this.requestOptions);n.body=this._validateMessage(e.message),n.headers.Authorization="Splunk "+this.config.token,n.headers["Content-Type"]="application/x-www-form-urlencoded",n.url=this.config.protocol+"://"+this.config.host+":"+this.config.port+this.config.path,e=this._initializeContext(e);var r=this,o=null,i=null,s=null,c=null,u=0;a.whilst(function(){return u++<=r.config.maxRetries},function(e){r._post(n,function(t,n,l){if(o=null,i=t,s=n,i&&u<=r.config.maxRetries)return a.expBackoff({attempt:u},e);if(i)return e(t);try{c=JSON.parse(l)}catch(t){c=l,o=new Error("Unexpected response from Splunk. Request body was: "+c),o.code=-1}!o&&c&&c.code&&"0"!==c.code.toString()&&(o=new Error(c.text),o.code=c.code),e(!0)})},function(){(i||o)&&r.error(i||o,e),t(i,s,c)})},c.prototype.send=function(e,t){e=this._initializeContext(e);var n=JSON.stringify(this._makeBody(e));this.serializedContextQueue.push(n),this.eventsBatchSize+=Buffer.byteLength(n,"utf8");var r=this.eventsBatchSize>this.config.maxBatchSize&&this.config.maxBatchSize>0,o=this.serializedContextQueue.length>=this.config.maxBatchCount&&this.config.maxBatchCount>0;(r||o)&&this.flush(t||function(){})},c.prototype.flush=function(e){e=e||function(){};var t=this.serializedContextQueue;this.serializedContextQueue=[],this.eventsBatchSize=0;var n=t.join(""),r={message:n};this._sendEvents(r,e)},e.exports=c},function(e,t){e.exports=require("body-parser@1.12.4")},function(e,t){e.exports=require("cookie-signature@1.0.6")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("ejs@2.3.1")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("jsonwebtoken@7.1.9")},function(e,t){e.exports=require("jwks-rsa@1.1.1")},function(e,t){e.exports=require("moment@2.10.3")},function(e,t){e.exports=require("morgan@1.5.3")},function(e,t){e.exports=require("querystring")},function(e,t){e.exports=require("request@2.56.0")},function(e,t){e.exports=require("stream")},function(e,t){e.exports=require("util")},function(e,t){e.exports=require("webtask-tools")},function(e,t){e.exports=require("winston@1.0.0")},function(e,t){e.exports=require("wrappy@1.0.1")}]);