"use strict";(self.webpackChunkweb_toolbox=self.webpackChunkweb_toolbox||[]).push([[44],{32376:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(9950),o=n(69935),r=n(10226),c=n(67243),i=n.n(c),l=n(77671);const s=e=>{let{data:t,isDisabled:n,hoverMessage:c,feedbackMessage:s,Icon:d=o.A,...p}=e;const{setToasterState:u}=(0,l.dq)();return a.createElement(r.A,Object.assign({disabled:!t||n,title:null!==c&&void 0!==c?c:"Copy to clipboard",variant:"contained","data-testid":"copy-to-clipboard",color:"primary"},p,{onClick:()=>{if(!t)return;const e=null!==s&&void 0!==s?s:"Content copied into clipboard: ".concat(t.substring(0,25)," \u2026");i()(t,{format:"text/plain"}),u({open:!0,message:e,type:"success",autoHideDuration:2e3})}}),a.createElement(d,null))}},50057:(e,t,n)=>{n.d(t,{n:()=>l});var a=n(9950),o=n(25131),r=n(72772),c=n(73931);const i=(0,o.A)((e=>({root:{margin:e.spacing(1)}}))),l=e=>{let{title:t,iconType:n,children:o}=e;const l=i();return a.createElement(a.Fragment,null,a.createElement(r.m,{titleTemplate:"Web Toolbox - %s",defaultTitle:"Web Toolbox",title:t}),a.createElement("div",{className:l.root},a.createElement(c.A,{iconType:n,title:t}),o))}},73931:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(9950),o=n(82053);const r=(0,n(25131).A)((e=>({title:{wordBreak:"break-word"},titleWithIcon:{display:"flex",justifyContent:"center",alignItems:"center",marginBottom:e.spacing(1)},icon:{height:"40px",width:"40px",marginRight:e.spacing(1)}}))),c=e=>{let{title:t,iconType:n}=e;const c=r();return a.createElement("div",{className:c.titleWithIcon},a.createElement(n,{className:c.icon}),a.createElement(o.A,{variant:"h5",className:c.title},t))}},26044:(e,t,n)=>{n.r(t),n.d(t,{default:()=>T,mapDispatchToProps:()=>A,mapStateToProps:()=>E});var a=n(9950),o=n(76084),r=n(83239),c=n(16491),i=n(10226),l=n(8145),s=n(25131),d=n(10300),p=n(58042),u=n(33602),m=n(32376),g=n(50057),b=n(73649),h=n(1810);class f extends Error{}function v(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(n){return atob(t)}}function w(e,t){if(!e)return"";try{const n=function(e,t){if("string"!==typeof e)throw new f("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,a=e.split(".")[n];if("string"!==typeof a)throw new f("Invalid token specified: missing part #".concat(n+1));let o;try{o=v(a)}catch(r){throw new f("Invalid token specified: invalid base64 for part #".concat(n+1," (").concat(r.message,")"))}try{return JSON.parse(o)}catch(r){throw new f("Invalid token specified: invalid json for part #".concat(n+1," (").concat(r.message,")"))}}(e,{header:t});return JSON.stringify(n,null,4)}catch(n){return JSON.stringify(n)}}f.prototype.name="InvalidTokenError";const y=(0,s.A)((e=>({decoded:{padding:e.spacing(1),borderColor:e.palette.text.disabled,borderStyle:"solid",borderWidth:1,borderRadius:e.shape.borderRadius,width:"100%",overflow:"auto"},toolbar:{margin:0,padding:0}})));function E(e){return{inputText:e.textInputs.lastJWT}}function A(e){return{storeInputText:(t,n)=>e((0,u.s)(t,n))}}const T=(0,d.Ng)(E,A)((e=>{let{inputText:t,storeInputText:n}=e;const s=y(),d=(0,h.Pb)("md"),u=(0,b.c)(),[f,v]=a.useState(w(t,!0)),[E,A]=a.useState(w(t,!1));return a.createElement(g.n,{iconType:o.A,title:"JWT decoder\u2026"},a.createElement("form",{noValidate:!0,autoComplete:"off"},a.createElement(l.A,{autoFocus:d,id:"jwt",label:"JSON web token to decode",placeholder:"Paste or type the content here",multiline:!0,minRows:10,maxRows:d?20:10,variant:"outlined",margin:"normal",fullWidth:!0,value:t,onChange:e=>n("lastJWT",e.target.value)})),a.createElement(r.A,{className:s.toolbar},a.createElement(c.A,{component:"div",flexGrow:1}),a.createElement(m.A,{data:E,sx:{mr:1}}),a.createElement(i.A,{variant:"contained",title:"Decode the JWT Token",color:"primary",endIcon:a.createElement(o.A,null,"Decode"),disabled:!t,onClick:function(){v(w(t,!0)),A(w(t,!1))}},"Decode")),a.createElement("div",{className:s.decoded},a.createElement("div",null,a.createElement(p.A,{language:"json",style:u},f),a.createElement(p.A,{language:"json",style:u},E))))}))},73649:(e,t,n)=>{n.d(t,{c:()=>c});var a=n(32284),o=n(71830),r=n(90038);const c=()=>{const{isDark:e}=(0,r.CX)();return e?a.A:o.A}}}]);