import{r as e,j as s}from"./vendor-react-Dp9pL_Wn.js";import{aC as a,bP as t,Y as o}from"./c2ee0272b-DPDuX889.js";import{S as n,a as r}from"./c627fcdb6-1_bsVTpt.js";import{u as i,M as l}from"./vendor-intl-D2wGIp4M.js";function d({isOpen:d,attachment:c,onConfirm:m,onClose:u}){const f=i(),[g,p]=e.useState("utf-8"),b=e.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]),h=e.useCallback(()=>{p("utf-8"),u()},[u]),w=e.useMemo(()=>{if(!c?.encodingPending)return"";return new TextDecoder(g,{fatal:!1}).decode(c.encodingPending.buffer).slice(0,500)},[c?.encodingPending,g]),x=e.useCallback(e=>{if(e.preventDefault(),!c?.encodingPending)return;const s=new TextDecoder(g,{fatal:!1}).decode(c.encodingPending.buffer);m(s),p("utf-8")},[c?.encodingPending,g,m]);return s.jsx(a,{isOpen:d,onClose:h,modalSize:"md",hasCloseButton:!0,title:f.formatMessage({defaultMessage:"Select file encoding",id:"Duoty8G6d7"}),children:s.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4 mt-4",children:[s.jsx("p",{className:"text-sm text-text-300",children:s.jsx(l,{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=>s.jsx("strong",{children:e})}})}),s.jsx(n,{size:"sm",value:g,onValueChange:e=>p(e),children:b.map(e=>s.jsx(r,{value:e.value,children:e.label},e.value))}),w&&s.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:w}),s.jsxs(t,{children:[s.jsx(o,{type:"button",variant:"secondary",onClick:h,children:s.jsx(l,{defaultMessage:"Cancel",id:"47FYwba+bI"})}),s.jsx(o,{type:"submit",variant:"primary",children:s.jsx(l,{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
 *-----------------------------------------------------------------------------*/const m=Object.freeze(Object.defineProperty({__proto__:null,conf:{comments:{lineComment:"#",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}]},language:{defaultToken:"",tokenPostfix:".hcl",keywords:["var","local","path","for_each","any","string","number","bool","true","false","null","if ","else ","endif ","for ","in","endfor"],operators:["=",">=","<=","==","!=","+","-","*","/","%","&&","||","!","<",">","?","...",":"],symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,terraformFunctions:/(abs|ceil|floor|log|max|min|pow|signum|chomp|format|formatlist|indent|join|lower|regex|regexall|replace|split|strrev|substr|title|trimspace|upper|chunklist|coalesce|coalescelist|compact|concat|contains|distinct|element|flatten|index|keys|length|list|lookup|map|matchkeys|merge|range|reverse|setintersection|setproduct|setunion|slice|sort|transpose|values|zipmap|base64decode|base64encode|base64gzip|csvdecode|jsondecode|jsonencode|urlencode|yamldecode|yamlencode|abspath|dirname|pathexpand|basename|file|fileexists|fileset|filebase64|templatefile|formatdate|timeadd|timestamp|base64sha256|base64sha512|bcrypt|filebase64sha256|filebase64sha512|filemd5|filemd1|filesha256|filesha512|md5|rsadecrypt|sha1|sha256|sha512|uuid|uuidv5|cidrhost|cidrnetmask|cidrsubnet|tobool|tolist|tomap|tonumber|toset|tostring)/,terraformMainBlocks:/(module|data|terraform|resource|provider|variable|output|locals)/,tokenizer:{root:[[/^@terraformMainBlocks([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)(\{)/,["type","","string","","string","","@brackets"]],[/(\w+[ \t]+)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)(\{)/,["identifier","","string","","string","","@brackets"]],[/(\w+[ \t]+)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)(=)(\{)/,["identifier","","string","","operator","","@brackets"]],{include:"@terraform"}],terraform:[[/@terraformFunctions(\()/,["type","@brackets"]],[/[a-zA-Z_]\w*-*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":"variable"}}],{include:"@whitespace"},{include:"@heredoc"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d*\d+[eE]([\-+]?\d+)?/,"number.float"],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/\d[\d']*/,"number"],[/\d/,"number"],[/[;,.]/,"delimiter"],[/"/,"string","@string"],[/'/,"invalid"]],heredoc:[[/<<[-]*\s*["]?([\w\-]+)["]?/,{token:"string.heredoc.delimiter",next:"@heredocBody.$1"}]],heredocBody:[[/([\w\-]+)$/,{cases:{"$1==$S2":[{token:"string.heredoc.delimiter",next:"@popall"}],"@default":"string.heredoc"}}],[/./,"string.heredoc"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"],[/#.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],string:[[/\$\{/,{token:"delimiter",next:"@stringExpression"}],[/[^\\"\$]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@popall"]],stringInsideExpression:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],stringExpression:[[/\}/,{token:"delimiter",next:"@pop"}],[/"/,"string","@stringInsideExpression"],{include:"@terraform"}]}}},Symbol.toStringTag,{value:"Module"}));export{d as E,c as a,m as h};
