(this["webpackJsonpportkey-react"]=this["webpackJsonpportkey-react"]||[]).push([[0],{102:function(e,n,t){},104:function(e,n,t){},142:function(e,n,t){"use strict";t.r(n);var a=t(1),l=t.n(a),o=t(12),r=t.n(o),c=(t(102),t(19)),i=t.n(c),s=t(13),u=t(36),d=(t.p,t(104),t(105),t(192)),j=t(196),h=t(197),p=t(91),b=t(198),g=t(87),O=t.n(g),f=t(199),m=t(89),x=t(208),C=t(207),S=t(200),v=t(201),k=t(202),w=t(203),y=t(205),P=t(204),E=t(188),T=t(189),_=t(190),A=t(191),D=t(88),R=t.n(D),W=t(6),U=t(107).default,F=null,I=null,N=null,L=null,B=null,M="https://gco7tzamu1.execute-api.us-east-1.amazonaws.com/prod";function H(){return(H=Object(u.a)(i.a.mark((function e(){var n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,U.get(M+"/hello");case 2:return n=e.sent,console.log(n),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=Object(u.a)(i.a.mark((function e(n,t,a,l){var o;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l(null),e.prev=1,console.log("Preparing to add portkey."),e.next=5,U.put(M+"/destination/"+n,{mark:n,destination:t},{headers:{Authorization:a}});case 5:return o=e.sent,console.log(o),e.abrupt("return",o);case 10:return e.prev=10,e.t0=e.catch(1),console.log(e.t0),l(e.t0.response.data.message),e.abrupt("return",null);case 15:case"end":return e.stop()}}),e,null,[[1,10]])})))).apply(this,arguments)}var z=function(){var e="rco0a3i0e78skgvltllm0757m",n={region:"us-east-1"},t=(Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}).AWS_COGNITO_USER_POOL_ID,Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}).AWS_COGNITO_APP_ID,l.a.useState(null)),a=Object(s.a)(t,2),o=a[0],r=a[1],c=l.a.useState(null),g=Object(s.a)(c,2),D=g[0],U=g[1],M=l.a.useState(null),z=Object(s.a)(M,2),V=z[0],Y=z[1],$=l.a.useState(null),G=Object(s.a)($,2),J=G[0],Q=G[1],q=l.a.useState(null),X=Object(s.a)(q,2),Z=X[0],ee=X[1],ne=l.a.useState(null),te=Object(s.a)(ne,2),ae=te[0],le=te[1],oe=l.a.useState(null),re=Object(s.a)(oe,2),ce=re[0],ie=re[1],se=l.a.useState(null),ue=Object(s.a)(se,2),de=ue[0],je=ue[1],he=l.a.useState(null),pe=Object(s.a)(he,2),be=pe[0],ge=pe[1],Oe=l.a.useState(null),fe=Object(s.a)(Oe,2),me=fe[0],xe=(fe[1],l.a.useState(null)),Ce=Object(s.a)(xe,2),Se=Ce[0],ve=Ce[1],ke=l.a.useState(null),we=Object(s.a)(ke,2),ye=we[0],Pe=we[1],Ee=l.a.useState(null),Te=Object(s.a)(Ee,2),_e=Te[0],Ae=Te[1],De=l.a.useState(null),Re=Object(s.a)(De,2),We=Re[0],Ue=Re[1],Fe=l.a.useState(null),Ie=Object(s.a)(Fe,2),Ne=Ie[0],Le=Ie[1],Be=l.a.useState(null),Me=Object(s.a)(Be,2),He=Me[0],Ke=Me[1],ze=l.a.useState(null),Ve=Object(s.a)(ze,2),Ye=Ve[0],$e=Ve[1],Ge=l.a.useState(null),Je=Object(s.a)(Ge,2),Qe=Je[0],qe=Je[1],Xe=l.a.useState(null),Ze=Object(s.a)(Xe,2),en=Ze[0],nn=Ze[1],tn=l.a.useState(null),an=Object(s.a)(tn,2),ln=an[0],on=an[1],rn=function(e){r(null),U(e.currentTarget)},cn=function(e){U(null)},sn=function(e){r(null),Y(e.currentTarget)};function un(){return(un=Object(u.a)(i.a.mark((function t(a){var l,o,r,c,s,u,d,j;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=new P.a(n),(o={}).Password=ae,o.Username=Z,(r=[]).push({Name:"email",Value:Z}),o.UserAttributes=r,o.ClientId=e,c=new E.a(o),t.prev=10,t.next=13,l.send(c);case 13:s=t.sent,console.log("Signup attempt complete"),console.log(s),s.$metadata.httpStatusCode,u=s.UserConfirmed,d="",u?d="User signup complete. Please login.":(d="User signup complete, but your account is not verified. ","EMAIL"==(j=s.CodeDeliveryDetails.DeliveryMedium)?d+="Please check your email for verification instructions.":"SMS"==j&&(d+="Please check your text messages for verification instructions.")),Q(null),ie(d),t.next=32;break;case 24:if(t.prev=24,t.t0=t.catch(10),console.log("Error while executing signup."),console.log(t.t0),"UsernameExistsException"!=t.t0.name){t.next=32;break}return Q(null),ie(t.t0.message),t.abrupt("return");case 32:return t.prev=32,t.finish(32);case 34:B=Z,He,Q(null),$e(!0);case 38:case"end":return t.stop()}}),t,null,[[10,24,32,34]])})))).apply(this,arguments)}function dn(){return(dn=Object(u.a)(i.a.mark((function t(a){var l,o,r,c;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=new P.a(n),o={AuthFlow:"USER_PASSWORD_AUTH",AuthParameters:{USERNAME:de,PASSWORD:be},ClientId:e},t.prev=4,r=new T.a(o),t.next=8,l.send(r);case 8:if(c=t.sent,console.log("Login attempt complete"),console.log(c),200==c.$metadata.httpStatusCode){t.next=16;break}return ie("Unexpected response during authentication."),Y(null),t.abrupt("return");case 16:if(!("ChallengeName"in c)||"NEW_PASSWORD_REQUIRED"!=c.ChallengeName){t.next=22;break}return console.log("Password Change Required"),F=c.Session,console.log("Session ID: "+F),hn(),t.abrupt("return");case 22:I=c.AuthenticationResult.AccessToken,ve(c.AuthenticationResult.IdToken),N=c.AuthenticationResult.RefreshToken,L=c.AuthenticationResult.ExpiresIn+(new Date).getTime()/1e3,t.next=33;break;case 28:t.prev=28,t.t0=t.catch(4),console.log("Error handling login attempt"),console.log(t.t0),"UserNotConfirmedException"==t.t0.name?ie("Your user has not been verified."):(t.t0.name,ie(t.t0.message));case 33:return t.prev=33,t.finish(33);case 35:case"end":return t.stop()}}),t,null,[[4,28,33,35]])})))).apply(this,arguments)}var jn=function(e){ie(null)},hn=function(){Pe(!0)},pn=function(e){Pe(null)},bn=function(){$e(null)};function gn(){return(gn=Object(u.a)(i.a.mark((function t(){var a,l,o,r;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=new P.a(n),l={ClientId:e,ConfirmationCode:He,Username:B},console.log("Confirmation input: "+l),o=new _.a(l),t.next=6,a.send(o);case 6:r=t.sent,console.log("Confirm response: "),console.log(r),200==r.$metadata.httpStatusCode&&(bn(),ie("Account "+B+" verified. Please Login."));case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function On(){return(On=Object(u.a)(i.a.mark((function t(){var a,l,o,r,c,s,u;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=_e,l=We,o=F,console.log("Session for password change: "+o),r=new P.a(n),c={ChallengeName:"NEW_PASSWORD_REQUIRED",Session:o,ChallengeResponses:{USERNAME:a,NEW_PASSWORD:l},ClientId:e},s=new A.a(c),t.next=9,r.send(s);case 9:u=t.sent,console.log(u);case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return Object(W.jsxs)(d.a,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[Object(W.jsx)(j.a,{position:"static",children:Object(W.jsxs)(h.a,{children:[Object(W.jsx)(b.a,{edge:"start",color:"inherit","aria-label":"menu",children:Object(W.jsx)(O.a,{"aria-controls":"simple-menu","aria-haspopup":"true",onClick:function(e){r(e.currentTarget)}})}),Object(W.jsx)(p.a,{variant:"h6",children:"portkey.to"}),Object(W.jsxs)("div",{children:[Object(W.jsx)(b.a,{"aria-label":"account of current user","aria-controls":"profile-menu","aria-haspopup":"true",onClick:function(e){},color:"inherit",children:Se&&Object(W.jsx)(R.a,{onClick:function(e){console.log("Pool"),console.log("us-east-1_blKdYdznc"),console.log("Access"),console.log(I),console.log("Refresh"),console.log(N),console.log("Expire Time"),console.log(L),console.log("Now"),console.log((new Date).getTime()/1e3);var n=function(){return H.apply(this,arguments)}();console.log(n)}})}),Object(W.jsxs)(m.a,{id:"profile-menu",anchorEl:o,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:me,onClose:function(e){},children:[Object(W.jsx)(x.a,{onClick:function(e){},children:"Profile"}),Object(W.jsx)(x.a,{onClick:function(e){},children:"My account"})]})]})]})}),Object(W.jsxs)(m.a,{id:"main-menu",anchorEl:o,keepMounted:!0,open:Boolean(o),onClose:function(){r(null)},children:[Se&&Object(W.jsx)(x.a,{onClick:rn,children:"Add Portkey"}),!Se&&Object(W.jsx)(x.a,{onClick:sn,children:"Login"}),!Se&&Object(W.jsx)(x.a,{onClick:function(e){le(null),ee(null),r(null),Q(e.currentTarget)},children:"Sign Up"}),Se&&Object(W.jsx)(x.a,{onClick:function(e){ve(null),I=null,N=null,L=null},children:"Sign Out"})]}),!Se&&Object(W.jsx)(p.a,{variant:"h3",children:"Shorter, memorable links. Login to create a portkey."}),!Se&&Object(W.jsx)(f.a,{variant:"contained",onClick:sn,children:"Login"}),Se&&Object(W.jsx)(p.a,{variant:"h3",children:"Shorter, memorable links. Create a portkey now!"}),Se&&Object(W.jsx)(f.a,{variant:"contained",onClick:rn,children:"Create a Portkey"}),Object(W.jsxs)(C.a,{onClose:cn,open:Boolean(D),children:[Object(W.jsx)(S.a,{id:"addMarkDialogTitle",children:"Add a portkey"}),Object(W.jsxs)(v.a,{children:[Object(W.jsx)(k.a,{children:"To add a portkey and a destination, fill this out."}),Object(W.jsx)(y.a,{error:null!==ln,helperText:ln,autoFocus:!0,onChange:function(e){return qe(e.target.value)},margin:"dense",id:"markField",label:"Mark",fullWidth:!0}),Object(W.jsx)(y.a,{onChange:function(e){return nn(e.target.value)},margin:"dense",id:"destinationField",label:"Destination",fullWidth:!0})]}),Object(W.jsxs)(w.a,{children:[Object(W.jsx)(f.a,{onClick:cn,color:"primary",children:"Cancel"}),Object(W.jsx)(f.a,{onClick:function(e){!function(e,n,t,a){K.apply(this,arguments)}(Qe,en,Se,on)},color:"primary",children:"Add"})]})]}),Object(W.jsxs)(C.a,{onClose:function(e){Q(null)},open:Boolean(J),children:[Object(W.jsx)(S.a,{id:"messageDialogTitle",children:"Signup for portkey.to"}),Object(W.jsxs)(v.a,{children:[Object(W.jsx)(k.a,{children:"Please provide your email address and a password."}),Object(W.jsx)(y.a,{autoFocus:!0,value:Z,onChange:function(e){return ee(e.target.value)},margin:"dense",id:"signupEmailField",label:"Email Address",type:"email",fullWidth:!0}),Object(W.jsx)(y.a,{value:ae,onChange:function(e){return le(e.target.value)},margin:"dense",id:"signupPasswordField",label:"Password",type:"password",fullWidth:!0})]}),Object(W.jsxs)(w.a,{children:[Object(W.jsx)(f.a,{onClick:function(e){!function(e){un.apply(this,arguments)}(e)},color:"primary",children:"Signup"}),Object(W.jsx)(f.a,{onClick:function(e){le(null),ee(null),r(null),Q(null)},color:"primary",children:"Cancel"})]})]}),Object(W.jsxs)(C.a,{onClose:jn,open:Boolean(ce),children:[Object(W.jsx)(v.a,{children:Object(W.jsx)(k.a,{children:ce})}),Object(W.jsx)(w.a,{children:Object(W.jsx)(f.a,{onClick:jn,color:"primary",children:"Ok"})})]}),Object(W.jsxs)(C.a,{onClose:function(e){ge(null),je(null),r(null),Y(null)},open:Boolean(V),children:[Object(W.jsx)(S.a,{id:"loginDialogTitle",children:"Login"}),Object(W.jsxs)(v.a,{children:[Object(W.jsx)(y.a,{value:de,onChange:function(e){return je(e.target.value)},margin:"dense",id:"loginUsernameField",label:"Username",fullWidth:!0}),Object(W.jsx)(y.a,{value:be,onChange:function(e){return ge(e.target.value)},margin:"dense",id:"loginPasswordField",label:"Password",type:"password",fullWidth:!0})]}),Object(W.jsxs)(w.a,{children:[Object(W.jsx)(f.a,{onClick:function(e){(function(e){return dn.apply(this,arguments)})(e)&&(je(null),ge(null),r(null),Y(null))},color:"primary",children:"Login"}),Object(W.jsx)(f.a,{onClick:function(e){je(null),ge(null),r(null),Y(null)},color:"primary",children:"Cancel"})]})]}),Object(W.jsxs)(C.a,{onClose:pn,open:Boolean(ye),children:[Object(W.jsx)(S.a,{id:"messageDialogTitle",children:"Reset Password"}),Object(W.jsxs)(v.a,{children:[Object(W.jsx)(k.a,{children:"Please provide your email address and a new password."}),Object(W.jsx)(y.a,{autoFocus:!0,value:_e,onChange:function(e){return Ae(e.target.value)},margin:"dense",id:"changePasswordUsernameField",label:"Email",fullWidth:!0}),Object(W.jsx)(y.a,{value:We,onChange:function(e){return Ue(e.target.value)},margin:"dense",id:"changePassword",label:"New Password",type:"password",fullWidth:!0}),Object(W.jsx)(y.a,{value:Ne,onChange:function(e){return Le(e.target.value)},margin:"dense",id:"changePasswordVerification",label:"Verify New Password",type:"password",fullWidth:!0})]}),Object(W.jsxs)(w.a,{children:[Object(W.jsx)(f.a,{onClick:function(e){!function(){On.apply(this,arguments)}()},color:"primary",children:"Ok"}),Object(W.jsx)(f.a,{onClick:function(e){pn(e)},color:"primary",children:"Cancel"})]})]}),Object(W.jsxs)(C.a,{onClose:bn,open:Boolean(Ye),children:[Object(W.jsx)(S.a,{id:"messageDialogTitle",children:"Confirm Your Account"}),Object(W.jsxs)(v.a,{children:[Object(W.jsx)(k.a,{children:"Please provide the code sent to your email address."}),Object(W.jsx)(y.a,{autoFocus:!0,value:He,onChange:function(e){return Ke(e.target.value)},margin:"dense",id:"changePasswordUsernameField",label:"Verification Code",fullWidth:!0})]}),Object(W.jsxs)(w.a,{children:[Object(W.jsx)(f.a,{onClick:function(){return gn.apply(this,arguments)},color:"primary",children:"Ok"}),Object(W.jsx)(f.a,{onClick:function(){},color:"primary",children:"Cancel"})]})]})]})},V=function(e){e&&e instanceof Function&&t.e(3).then(t.bind(null,210)).then((function(n){var t=n.getCLS,a=n.getFID,l=n.getFCP,o=n.getLCP,r=n.getTTFB;t(e),a(e),l(e),o(e),r(e)}))};r.a.render(Object(W.jsx)(l.a.StrictMode,{children:Object(W.jsx)(z,{})}),document.getElementById("root")),V()}},[[142,1,2]]]); //# sourceMappingURL=main.a85fc3b6.chunk.js.map