import{r as e,j as a}from"./vendor-react-AXa6hZO5.js";import{aj as t,ak as s,B as o}from"./c6eedc03a-C8LSdtro.js";import{i4 as n,i5 as i}from"./index-D35RxkWr.js";import{u as l,M as r}from"./vendor-intl-BdADXLLt.js";function d({isOpen:d,attachment:c,onConfirm:u,onClose:p}){const f=l(),[m,g]=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]),w=e.useCallback(()=>{g("utf-8"),p()},[p]),h=e.useMemo(()=>{if(!c?.encodingPending)return"";return new TextDecoder(m,{fatal:!1}).decode(c.encodingPending.buffer).slice(0,500)},[c?.encodingPending,m]),x=e.useCallback(e=>{if(e.preventDefault(),!c?.encodingPending)return;const a=new TextDecoder(m,{fatal:!1}).decode(c.encodingPending.buffer);u(a),g("utf-8")},[c?.encodingPending,m,u]);return a.jsx(t,{isOpen:d,onClose:w,modalSize:"md",hasCloseButton:!0,title:f.formatMessage({defaultMessage:"Select file encoding",id:"Duoty8G6d7"}),children:a.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4 mt-4",children:[a.jsx("p",{className:"text-sm text-text-300",children:a.jsx(r,{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(n,{size:"sm",value:m,onValueChange:e=>g(e),children:b.map(e=>a.jsx(i,{value:e.value,children:e.label},e.value))}),h&&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:h}),a.jsxs(s,{children:[a.jsx(o,{type:"button",variant:"secondary",onClick:w,children:a.jsx(r,{defaultMessage:"Cancel",id:"47FYwba+bI"})}),a.jsx(o,{type:"submit",variant:"primary",children:a.jsx(r,{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 u=Object.freeze(Object.defineProperty({__proto__:null,conf:{comments:{lineComment:"//"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}]},language:{keywords:["namespace","open","import","export","as","operation","function","body","adjoint","newtype","struct","controlled","if","elif","else","repeat","until","fixup","for","in","while","return","fail","within","apply","Adjoint","Controlled","Adj","Ctl","is","self","auto","distribute","invert","intrinsic","let","set","w/","new","not","and","or","use","borrow","using","borrowing","mutable","internal"],typeKeywords:["Unit","Int","BigInt","Double","Bool","String","Qubit","Result","Pauli","Range"],invalidKeywords:["abstract","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","enum","event","explicit","extern","finally","fixed","float","foreach","goto","implicit","int","interface","lock","long","null","object","operator","out","override","params","private","protected","public","readonly","ref","sbyte","sealed","short","sizeof","stackalloc","static","string","switch","this","throw","try","typeof","unit","ulong","unchecked","unsafe","ushort","virtual","void","volatile"],constants:["true","false","PauliI","PauliX","PauliY","PauliZ","One","Zero"],builtin:["X","Y","Z","H","HY","S","T","SWAP","CNOT","CCNOT","MultiX","R","RFrac","Rx","Ry","Rz","R1","R1Frac","Exp","ExpFrac","Measure","M","MultiM","Message","Length","Assert","AssertProb","AssertEqual"],operators:["and=","<-","->","*","*=","@","!","^","^=",":","::",".","..","==","...","=","=>",">",">=","<","<=","-","-=","!=","or=","%","%=","|","+","+=","?","/","/=","&&&","&&&=","^^^","^^^=",">>>",">>>=","<<<","<<<=","|||","|||=","~~~","_","w/","w/="],namespaceFollows:["namespace","open"],importsFollows:["import"],symbols:/[=><!~?:&|+\-*\/\^%@._]+/,escapes:/\\[\s\S]/,tokenizer:{root:[[/[a-zA-Z_$][\w$]*/,{cases:{"@namespaceFollows":{token:"keyword.$0",next:"@namespace"},"@importsFollows":{token:"keyword.$0",next:"@imports"},"@typeKeywords":"type","@keywords":"keyword","@constants":"constant","@builtin":"keyword","@invalidKeywords":"invalid","@default":"identifier"}}],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/\d+/,"number"],[/[;,.]/,"delimiter"],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}]],string:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",next:"@pop"}]],namespace:[{include:"@whitespace"},[/[A-Za-z]\w*/,"namespace"],[/[\.]/,"delimiter"],["","","@pop"]],imports:[{include:"@whitespace"},[/[A-Za-z]\w*(?=\.)/,"namespace"],[/[A-Za-z]\w*/,"identifier"],[/\*/,"wildcard"],[/[\.,]/,"delimiter"],["","","@pop"]],whitespace:[[/[ \t\r\n]+/,"white"],[/(\/\/).*/,"comment"]]}}},Symbol.toStringTag,{value:"Module"}));export{d as E,c as a,u as q};
