import{u as e,r as s,j as a,M as t}from"./vendor--leCAzSo.js";import{v as n,aX as o,B as i}from"./ca9c256b9-7brFE8T2.js";import{iT as l,iU as r}from"./index-DZuQva-j.js";function d({isOpen:d,attachment:c,onConfirm:g,onClose:u}){const f=e(),[m,p]=s.useState("utf-8"),b=s.useMemo(()=>function(e){return[{value:"utf-8",label:e.formatMessage({defaultMessage:"Default (UTF-8)",id:"QJ0ownoZRd"})},{value:"windows-1252",label:e.formatMessage({defaultMessage:"Western European (Windows-1252)",id:"uMZxG9zGvp"})},{value:"windows-1250",label:e.formatMessage({defaultMessage:"Central European (Windows-1250)",id:"Q4V+DsnBh+"})},{value:"windows-1251",label:e.formatMessage({defaultMessage:"Cyrillic (Windows-1251)",id:"q1BWaIlpbN"})},{value:"iso-8859-1",label:e.formatMessage({defaultMessage:"Latin-1 (ISO-8859-1)",id:"oNp1waFarV"})},{value:"shift_jis",label:e.formatMessage({defaultMessage:"Japanese (Shift_JIS)",id:"k4+9F0xUH9"})},{value:"gb18030",label:e.formatMessage({defaultMessage:"Chinese (GB18030)",id:"ILxlzNXiro"})},{value:"euc-kr",label:e.formatMessage({defaultMessage:"Korean (EUC-KR)",id:"qphPEQ/z5U"})},{value:"windows-1256",label:e.formatMessage({defaultMessage:"Arabic (Windows-1256)",id:"X5tUyXfqsl"})},{value:"windows-1254",label:e.formatMessage({defaultMessage:"Turkish (Windows-1254)",id:"2epHWDjRXo"})},{value:"windows-1253",label:e.formatMessage({defaultMessage:"Greek (Windows-1253)",id:"4VcUGIGtNu"})},{value:"tis-620",label:e.formatMessage({defaultMessage:"Thai (TIS-620)",id:"Vuh/a7xjtE"})}]}(f),[f]),w=s.useCallback(()=>{p("utf-8"),u()},[u]),v=s.useMemo(()=>{if(!c?.encodingPending)return"";return new TextDecoder(m,{fatal:!1}).decode(c.encodingPending.buffer).slice(0,500)},[c?.encodingPending,m]),h=s.useCallback(e=>{if(e.preventDefault(),!c?.encodingPending)return;const s=new TextDecoder(m,{fatal:!1}).decode(c.encodingPending.buffer);g(s),p("utf-8")},[c?.encodingPending,m,g]);return a.jsx(n,{isOpen:d,onClose:w,modalSize:"md",hasCloseButton:!0,title:f.formatMessage({defaultMessage:"Select file encoding",id:"Duoty8G6d7"}),children:a.jsxs("form",{onSubmit:h,className:"flex flex-col gap-4 mt-4",children:[a.jsx("p",{className:"text-sm text-text-300",children:a.jsx(t,{defaultMessage:"The text encoding for <b>{fileName}</b> could not be determined. Choose an encoding and verify with the preview.",id:"ysZbg4a2QH",values:{fileName:c?.file_name,b:e=>a.jsx("strong",{children:e})}})}),a.jsx(l,{size:"sm",value:m,onValueChange:e=>p(e),children:b.map(e=>a.jsx(r,{value:e.value,children:e.label},e.value))}),v&&a.jsx("pre",{className:"overflow-auto max-h-64 rounded border border-border-400 bg-bg-000 p-3 text-xs text-text-200 whitespace-pre-wrap",children:v}),a.jsxs(o,{children:[a.jsx(i,{type:"button",variant:"secondary",onClick:w,children:a.jsx(t,{defaultMessage:"Cancel",id:"47FYwba+bI"})}),a.jsx(i,{type:"submit",variant:"primary",children:a.jsx(t,{defaultMessage:"Confirm",id:"N2IrpMDHDB"})})]})]})})}const c=Object.freeze(Object.defineProperty({__proto__:null,EncodingPickerModal:d},Symbol.toStringTag,{value:"Module"}));
/*!-----------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
 * Released under the MIT license
 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
 *-----------------------------------------------------------------------------*/var g={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{markers:{start:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),end:new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")}}};const u=Object.freeze(Object.defineProperty({__proto__:null,conf:g,language:{defaultToken:"",tokenPostfix:".java",keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false","yield","record","sealed","non-sealed","permits"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,tokenizer:{root:[["non-sealed","keyword.non-sealed"],[/[a-zA-Z_$][\w$]*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":"identifier"}}],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/@\s*[a-zA-Z_\$][\w\$]*/,"annotation"],[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/,"number.float"],[/0[xX](@hexdigits)[Ll]?/,"number.hex"],[/0(@octaldigits)[Ll]?/,"number.octal"],[/0[bB](@binarydigits)[Ll]?/,"number.binary"],[/(@digits)[fFdD]/,"number.float"],[/(@digits)[lL]?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/"""/,"string","@multistring"],[/"/,"string","@string"],[/'[^\\']'/,"string"],[/(')(@escapes)(')/,["string","string.escape","string"]],[/'/,"string.invalid"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@javadoc"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],javadoc:[[/[^\/*]+/,"comment.doc"],[/\/\*/,"comment.doc.invalid"],[/\*\//,"comment.doc","@pop"],[/[\/*]/,"comment.doc"]],string:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],multistring:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"""/,"string","@pop"],[/./,"string"]]}}},Symbol.toStringTag,{value:"Module"}));export{d as E,c as a,u as j};
