import{_ as j}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as O}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{bm as B,_ as R,h as N}from"./index-BTglIPU2.js?v=1773287522785";import{s as V,d as F}from"./index-D1qDe5-C.js?v=1773287522785";import{k as P,R as T,r as d,$ as U,Z as A,a0 as n,a9 as m,_ as i,S as g,X as E,aa as p,F as I,u as M}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as X,a6 as Z}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index-COOnaZWq.js?v=1773287522785";import"./index-CZps0rIN.js?v=1773287522785";import"./index-lEMZglLp.js?v=1773287522785";import"./useSocket-DTHwGZgK.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";const q={class:"p-20px"},z={class:"w-460px"};function G(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!M(o)}const le=P({__name:"index",props:{url:{default:""},mirrors:{default:()=>({})}},emits:["refresh"],setup(o,{expose:b,emit:S}){const h=o,_=S,{t:l}=T(),v=B(),r=d(null),c=d([]),$=({option:e})=>n(I,null,[e.title?"".concat(e.value,"(").concat(e.title,")"):e.label]),k=e=>{r.value=e},D=async e=>{await F({registry_mirrors_address:e}),await x()},x=async()=>{await _("refresh",e=>{f(e)})},w=()=>{const{url:e,mirrors:t}=h;e&&(r.value=e),f(t)},f=e=>{c.value=Object.entries(e).map(([t,a])=>({label:()=>{let s;return n("div",{class:"flex items-center justify-between w-full"},[n("span",{class:"mr-16px"},["".concat(t,"(").concat(a,")")]),n(R,{type:"error",onClick:u=>{u.stopPropagation(),D(t)}},G(s=l("Public.Btn.Del"))?s:{default:()=>[s]})])},title:a,value:t})),c.value.push({label:l("Docker.Setting.url.index_5"),value:""})};return w(),b({onConfirm:({hide:e})=>(N({title:l("Docker.Setting.url.confirmTitle"),content:l("Docker.Setting.url.confirmContent"),onConfirm:async({hide:t})=>{await V({registry_mirrors_address:r.value?r.value:""}),v.getSetting(),_("refresh"),t(),e()}}),!1)}),(e,t)=>{const a=Z,s=X,u=O,y=j;return U(),A("div",q,[n(u,null,{default:m(()=>[n(s,{label:e.$t("Docker.Setting.index_7"),"show-feedback":!1},{default:m(()=>[i("div",z,[n(a,{value:g(r),"onUpdate:value":t[0]||(t[0]=C=>E(r)?r.value=C:null),filterable:!0,options:g(c),"consistent-menu-width":!1,"render-tag":$,placeholder:e.$t("Docker.Setting.url.index_1"),onSearch:k},null,8,["value","options","placeholder"])])]),_:1},8,["label"])]),_:1}),n(y,{class:"mt-24px"},{default:m(()=>[i("li",null,p(e.$t("Docker.Setting.url.index_2")),1),i("li",null,p(e.$t("Docker.Setting.url.index_3")),1),i("li",null,p(e.$t("Docker.Setting.url.index_4")),1)]),_:1})])}}});export{le as default};
