(self.webpackChunkweb_toolbox=self.webpackChunkweb_toolbox||[]).push([[144],{32376:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var a=n(9950),r=n(69935),o=n(10226),l=n(67243),s=n.n(l),c=n(77671);const i=e=>{let{data:t,isDisabled:n,hoverMessage:l,feedbackMessage:i,Icon:u=r.A,...m}=e;const{setToasterState:p}=(0,c.dq)();return a.createElement(o.A,Object.assign({disabled:!t||n,title:null!==l&&void 0!==l?l:"Copy to clipboard",variant:"contained","data-testid":"copy-to-clipboard",color:"primary"},m,{onClick:()=>{if(!t)return;const e=null!==i&&void 0!==i?i:"Content copied into clipboard: ".concat(t.substring(0,25)," \u2026");s()(t,{format:"text/plain"}),p({open:!0,message:e,type:"success",autoHideDuration:2e3})}}),a.createElement(u,null))}},50057:(e,t,n)=>{"use strict";n.d(t,{n:()=>c});var a=n(9950),r=n(25131),o=n(72772),l=n(73931);const s=(0,r.A)((e=>({root:{margin:e.spacing(1)}}))),c=e=>{let{title:t,iconType:n,children:r}=e;const c=s();return a.createElement(a.Fragment,null,a.createElement(o.m,{titleTemplate:"Web Toolbox - %s",defaultTitle:"Web Toolbox",title:t}),a.createElement("div",{className:c.root},a.createElement(l.A,{iconType:n,title:t}),r))}},73931:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var a=n(9950),r=n(82053);const o=(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)}}))),l=e=>{let{title:t,iconType:n}=e;const l=o();return a.createElement("div",{className:l.titleWithIcon},a.createElement(n,{className:l.icon}),a.createElement(r.A,{variant:"h5",className:l.title},t))}},36313:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>R,mapDispatchToProps:()=>J,mapStateToProps:()=>I});var a=n(9950),r=n(94774),o=n(58531),l=n(60899),s=n(25979),c=n(23266),i=n(24516),u=n(83239),m=n(16491),p=n(10226),d=n(8145),g=n(25131),v=n(9449),f=n(10300),y=n(58042),h=n(33602),C=n(32376),E=n(50057),b=n(73649),A=n(1810),N=n(25060),S=n.n(N),T=n(70991),O=n(98927);const x=[...new Map([["csharp","C#"],["cpp","C++"],["dart","Dart"],["elm","Elm"],["flow","Flow"],["go","Go"],["haskell","Haskell"],["java","Java"],["javascript","Javascript object"],["json-schema","JSON Schema"],["kotlin","Kotlin"],["objectivec","Objective C"],["pike","Pike"],["python","Python"],["rust","Rust"],["swift","Swift"],["typescript","TypeScript"],["json","JSON"]]).entries()];async function w(e){if(!function(e){return!O.z3(e.source)&&!O.z3(e.sourceType)&&!O.z3(e.rootClassName)&&!O.z3(e.targetLanguage)}(e))return"";if(e.sourceType===e.targetLanguage)return e.source;switch(e.sourceType){case"json":return async function(e){if("javascript"===e.targetLanguage){const t=k(JSON.parse(e.source));return S()(t,{indent_size:2,space_in_empty_paren:!0})}try{const{lines:t}=await async function(e,t,n){const a=(0,T.jsonInputForTargetLanguage)(e);await a.addSource({name:t,samples:[n]});const r=new T.InputData;return r.addInput(a),await(0,T.quicktype)({inputData:r,lang:e,rendererOptions:{"just-types":"true","acronym-style":"original",lombok:"false"}})}(e.targetLanguage,e.rootClassName,e.source);return t.join("\n")}catch(t){return JSON.stringify(t)}}(e);case"jsObject":return async function(e){try{const t=new Function("return ".concat(e.source))(),n=JSON.stringify(t,null,4);return w({...e,sourceType:"json",source:n})}catch(t){return JSON.stringify(t)}}(e);default:return e.source}}function k(e){if(!e)return"null";let t="";const n="undefined"==typeof e.length?1:0;let a="";for(const r in e)n&&(t=-1===r.indexOf(" ")?r+": ":"'"+r+"': "),"string"==typeof e[r]?a+=t+"'"+e[r]+"',":"object"==typeof e[r]?a+=t+k(e[r])+",":a+=t+e[r]+",";return n?"{"+a.slice(0,-1)+"}":"["+a.slice(0,-1)+"]"}const j=(0,g.A)((e=>({form:{marginTop:e.spacing(2)},formControl:{margin:e.spacing(0)},converterOptions:{width:"100%"},encodedResult:{padding:e.spacing(1),borderColor:e.palette.text.disabled,borderStyle:"solid",borderWidth:1,borderRadius:e.shape.borderRadius,whiteSpace:"normal",wordBreak:"break-word"},toolbar:{margin:0,padding:0}})));function I(e){return{inputText:e.textInputs.lastJSON2Convert,optionSource:e.textInputs.lastJSON2ConvertOptionSource,optionTarget:e.textInputs.lastJSON2ConvertOptionTarget,optionRootClassname:e.textInputs.lastJSON2ConvertOptionRootClassname}}function J(e){return{storeInputText:(t,n)=>e((0,h.s)(t,n))}}const R=(0,f.Ng)(I,J)((e=>{let{inputText:t,optionSource:n,optionTarget:g,optionRootClassname:f,storeInputText:h}=e;const N=j(),S=(0,A.Pb)("md"),T=(0,b.c)(),[O,k]=a.useState(""),I={source:null!==t&&void 0!==t?t:"",sourceType:null!==n&&void 0!==n?n:"",targetLanguage:null!==g&&void 0!==g?g:"",rootClassName:null!==f&&void 0!==f?f:""},{handleSubmit:J,control:R,getValues:L}=(0,v.mN)({defaultValues:I});return a.useEffect((()=>{var e,t,n,a;const r=L();h("lastJSON2ConvertOptionSource",null!==(e=r.sourceType)&&void 0!==e?e:""),h("lastJSON2ConvertOptionTarget",null!==(t=r.targetLanguage)&&void 0!==t?t:""),h("lastJSON2ConvertOptionRootClassname",null!==(n=r.rootClassName)&&void 0!==n?n:""),h("lastJSON2Convert",null!==(a=r.source)&&void 0!==a?a:"")}),[h,L,O]),a.createElement(E.n,{iconType:r.A,title:"JSON Converter"},a.createElement("div",{className:N.form},a.createElement(l.Ay,{container:!0,spacing:3,className:N.converterOptions},a.createElement(l.Ay,{item:!0},a.createElement(s.A,{className:N.formControl},a.createElement(v.xI,{control:R,name:"sourceType",render:e=>{let{field:{value:t,name:n,onChange:r}}=e;return a.createElement(d.A,{select:!0,name:n,label:"Source type",value:t,onChange:e=>r(e.target.value)},a.createElement(c.A,{value:"json"},"JSON"),a.createElement(c.A,{value:"jsObject"},"Javascript"))}}),a.createElement(i.A,null,"Input format or language"))),a.createElement(l.Ay,{item:!0},a.createElement(s.A,{className:N.formControl},a.createElement(v.xI,{control:R,name:"targetLanguage",render:e=>{let{field:{value:t,name:n,onChange:r}}=e;return a.createElement(d.A,{select:!0,name:n,label:"Target language",value:t,onChange:e=>r(e.target.value)},x.map((e=>{let[t,n]=e;return a.createElement(c.A,{key:t,value:t},n)})))}}),a.createElement(i.A,null,"The target language of the convertion"))),a.createElement(l.Ay,{item:!0},a.createElement(s.A,{className:N.formControl},a.createElement(v.xI,{name:"rootClassName",render:e=>{let{field:{name:t,value:n,onChange:r},fieldState:{invalid:o}}=e;return a.createElement(d.A,{name:t,value:n,onChange:e=>r(e.target.value),label:"Root class name",error:o,type:"text",helperText:o?"field is required":null,inputProps:{spellCheck:!1}})},control:R,rules:{required:!0}}),a.createElement(i.A,null,"Name of the parent class")))),a.createElement(s.A,{className:N.formControl,fullWidth:!0},a.createElement(v.xI,{name:"source",control:R,render:e=>{let{field:{value:t,name:n,onChange:r},fieldState:{invalid:o}}=e;return a.createElement(d.A,{name:n,onChange:e=>r(e.target.value),value:t,autoFocus:S,label:"Source data",placeholder:"Paste or type the source data here",multiline:!0,minRows:4,maxRows:S?20:4,variant:"outlined",margin:"normal",error:o,helperText:o?"field is required":null,inputProps:{spellCheck:!1}})},rules:{required:!0}}),a.createElement(i.A,null,"Data to convert into the target language"))),a.createElement(u.A,{className:N.toolbar},a.createElement(m.A,{component:"div",flexGrow:1}),a.createElement(C.A,{data:O,sx:{mr:1}}),a.createElement(p.A,{variant:"contained",color:"primary",endIcon:a.createElement(o.A,null,"Encode"),onClick:J((async e=>{const t=await w(e);k(t)}))},"Enc.")),a.createElement(y.A,{style:T,language:L().targetLanguage,className:N.encodedResult},O))}))},73649:(e,t,n)=>{"use strict";n.d(t,{c:()=>l});var a=n(32284),r=n(71830),o=n(90038);const l=()=>{const{isDark:e}=(0,o.CX)();return e?a.A:r.A}},95276:()=>{},6017:()=>{}}]);