1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[174],{9174:(e,t,r)=>{r.d(t,{default:()=>g});var l=r(5155),s=r(2115),a=r(4274),i=r(2663);function c(e){let t=e.trim();if(t.match(/^<\?xml/i))return"xml";if(t.match(/<!DOCTYPE\s+html/i)||t.match(/<html[\s>]/i)||t.match(/<head[\s>]/i)||t.match(/<body[\s>]/i)||t.match(/<script[\s>]/i)||t.match(/<style[\s>]/i)||t.match(/<div[\s>]/i)||t.match(/<span[\s>]/i)||t.match(/<p[\s>]/i)||t.match(/<a\s+href/i)||t.match(/<img\s+src/i)||t.match(/<meta[\s>]/i)||t.match(/<link[\s>]/i)||t.match(/<title[\s>]/i))return"html";if(t.match(/<svg[\s>]/i)||t.match(/^<[^?!][^>]+>/)&&t.match(/<\/[^>]+>$/))return"xml";if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t),"json"}catch(e){}return t.match(/\b(const|let|var|function|return|if|else|for|while|class|import|export|async|await|=>)\b/)||t.match(/\bfunction\s*\(/)||t.match(/\bconsole\.\w+/)||t.match(/\bdocument\./)||t.match(/\bwindow\./)||t.match(/=>/)||t.match(/\$\(/)||t.match(/\.\w+\(/)||t.match(/\bnew\s+\w+/)||t.match(/\btry\s*{/)||t.match(/\bcatch\s*\(/)?"javascript":(t.match(/^\s*[.#@]/)||t.match(/^[a-zA-Z-]+\s*{/)||t.match(/{\s*[\w-]+\s*:\s*[^;{}]+;/m)||t.includes("@media")||t.includes("@import")||t.includes("@keyframes"))&&!t.match(/\b(const|let|var|function|return|if|else|for|while)\b/)?"css":"javascript"}var n=r(8054),o=r(9778),d=r(4208),u=r(6533),m=r(6699);async function h(e,t){let r={printWidth:80,tabWidth:2,useTabs:!1,semi:!0,singleQuote:!0,trailingComma:"es5",bracketSpacing:!0,arrowParens:"avoid"};try{switch(t){case"javascript":default:return await n.GP(e,{...r,parser:"babel",plugins:[o,d]});case"css":return await n.GP(e,{...r,parser:"css",plugins:[u]});case"html":return await n.GP(e,{...r,parser:"html",plugins:[m,o,d],htmlWhitespaceSensitivity:"css",embeddedLanguageFormatting:"auto"});case"xml":var l;let s,a;return l=e,s="",a=0,(l=l.replace(/>\s*</g,"><").trim()).split(/>\s*</).forEach(e=>{e.match(/^\/\w/)&&(a-=1);let t=" ".repeat(a);s+=t+"<"+e+">\r\n",e.match(/^<?\w[^>]*[^\/]$/)&&!e.startsWith("?")&&(a+=1)}),s.substring(1,s.length-3);case"json":return await n.GP(e,{...r,parser:"json",plugins:[o,d]})}}catch(e){throw Error("Failed to unminify ".concat(t," code: ").concat(e.message))}}var f=r(8122),b=r(97),x=r(6814),p=r(7704);function g(){let{t:e}=(0,a.Bd)("common"),[t,r]=(0,s.useState)(""),[n,o]=(0,s.useState)(""),[d,u]=(0,s.useState)(""),[m,g]=(0,s.useState)(!1),[v,j]=(0,s.useState)(!1),[w,y]=(0,s.useState)(null),[N,k]=(0,s.useState)(!1),C=(0,s.useRef)(null),S=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=localStorage.getItem("showLineNumbers");null!==e&&j("true"===e)},[]),(0,s.useEffect)(()=>{if(!t.trim()){o(""),u(""),y(null);return}let e=setTimeout(async()=>{g(!0),y(null);try{let e=c(t);u(e);let r=await h(t,e);o(r)}catch(e){console.error("Unminification error:",e),o(""),y(e instanceof Error?e.message:"An error occurred")}finally{g(!1)}},500);return()=>clearTimeout(e)},[t]);let L=async()=>{if(n)try{await navigator.clipboard.writeText(n),i.Ay.success(e("editor.copied")),S.current&&clearTimeout(S.current),k(!0),S.current=setTimeout(()=>{k(!1),S.current=null},2e3)}catch(t){i.Ay.error(e("editor.error"))}};return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)("input",{ref:C,type:"file",onChange:t=>{var l;let s=null==(l=t.target.files)?void 0:l[0];if(!s)return;let a=new FileReader;a.onload=t=>{var l;let s=null==(l=t.target)?void 0:l.result;r(s);let a=c(s);u(a),i.Ay.success(e("editor.formatDetected",{format:a}))},a.onerror=()=>{i.Ay.error(e("editor.fileError"))},a.readAsText(s)},accept:".js,.css,.html,.xml,.json,.txt",className:"hidden"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-sm font-medium mb-2",children:e("editor.inputLabel",{defaultValue:"Input (Minified Code)"})}),(0,l.jsx)("textarea",{value:t,onChange:e=>{r(e.target.value)},placeholder:e("editor.placeholder"),className:"w-full h-[500px] p-4 font-mono text-sm text-gray-100 border border-lf-blue rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-lf-light-blue overflow-auto placeholder-white",style:{backgroundColor:"#1E2939"},spellCheck:!1})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("label",{className:"block text-sm font-medium",children:e("editor.outputLabel",{defaultValue:"Output (Unminified Code)"})}),(0,l.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,l.jsx)("input",{type:"checkbox",checked:v,onChange:e=>{let t=e.target.checked;j(t),localStorage.setItem("showLineNumbers",t.toString())},className:"rounded border-lf-blue bg-lf-dark-blue text-lf-light-blue focus:ring-lf-light-blue"}),e("editor.showLineNumbers",{defaultValue:"Show line numbers"})]})]}),n?(0,l.jsx)("div",{className:"h-[500px] overflow-auto rounded-lg border border-lf-blue relative",children:(0,l.jsx)(x.A,{language:d&&({javascript:"javascript",css:"css",html:"markup",xml:"xml",json:"json"})[d]||"javascript",style:p.A,customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",minHeight:"100%",background:"#1E2939"},showLineNumbers:v,children:n})}):(0,l.jsx)("div",{className:"w-full h-[500px] p-4 font-mono text-sm text-gray-400 rounded-lg border border-lf-blue flex items-center justify-center",style:{backgroundColor:"#1E2939"},children:m&&t?(0,l.jsx)("span",{children:e("editor.processing",{defaultValue:"Processing..."})}):e("editor.outputPlaceholder",{defaultValue:"Unminified code will appear here..."})})]})]}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsxs)("button",{onClick:()=>
1{if(!n)return;let t=new Blob([n],{type:"text/plain;charset=utf-8"});(0,b.saveAs)(t,"lfunminify-unminified.".concat(d&&({javascript:"js",css:"css",html:"html",xml:"xml",json:"json"})[d]||"txt")),i.Ay.success(e("editor.download"))},disabled:!n,className:"flex items-center gap-2 px-4 py-2 bg-lf-blue text-lf-white rounded hover:bg-lf-dark-blue disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[(0,l.jsx)(f.a4x,{}),e("editor.download")]}),(0,l.jsxs)("button",{onClick:()=>{var e;return null==(e=C.current)?void 0:e.click()},disabled:m,className:"flex items-center gap-2 px-4 py-2 bg-lf-blue text-lf-white rounded hover:bg-lf-dark-blue disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[(0,l.jsx)(f.UDU,{}),e("editor.browseFile")]}),(0,l.jsxs)("button",{onClick:L,disabled:!n||N,className:"flex items-center gap-2 px-4 py-2 text-lf-white rounded disabled:opacity-50 disabled:cursor-not-allowed transition-all ".concat(N?"bg-green-600 hover:bg-green-600":"bg-lf-blue hover:bg-lf-dark-blue"),children:[(0,l.jsx)(f.nxz,{}),N?e("editor.copiedButton"):e("editor.copy")]}),(0,l.jsxs)("button",{onClick:()=>{r(""),o(""),u(""),C.current&&(C.current.value="")},disabled:!n,className:"flex items-center gap-2 px-4 py-2 bg-lf-red text-lf-white rounded hover:bg-red-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[(0,l.jsx)(f.IXo,{}),e("editor.clear")]})]}),w&&(0,l.jsx)("div",{className:"bg-red-50 border border-red-200 text-red-800 px-4 py-3 rounded-lg",role:"alert",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,l.jsxs)("div",{className:"ml-3 flex-1",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:e("editor.errorTitle",{defaultValue:"Error"})}),(0,l.jsx)("p",{className:"mt-1 text-sm",children:w})]}),(0,l.jsx)("button",{onClick:()=>y(null),className:"ml-auto flex-shrink-0 text-red-400 hover:text-red-500 focus:outline-none",children:(0,l.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.