Files
AllinSSL/frontend/static/js/index-DZhuixv2.js
2026-01-13 17:47:39 +08:00

2 lines
24 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{e,s as a,r as t,$ as s,f as n,d as o,c,g as r,o as l,N as i,h as u,B as p,j as d,i as g,k as f,l as _,m as y,n as w,p as m,b as h,q as v,t as k,v as b,w as I,x,y as A,z as P,A as q,a as O}from"./main-Cz0Kbk_r.js";import{u as S,E as j}from"./index-DBk1wb6q.js";import{u as K,a as C,b as E}from"./index-DajjVwSG.js";import{w as R,O as M,H as T,T as F,d as U}from"./business-CRcrdRsh.js";import{g as z,a as V,u as N,d as L,t as D,b as J}from"./access-BRiMVbLg.js";import{A as H}from"./data-DmQTBQWl.js";import{S as B}from"./index-DtI-RdxQ.js";import{T as W}from"./index-Dd9avlpg.js";import{n as G}from"./utils-CRt-4gJj.js";import{N as $}from"./text-DPk4KVNB.js";import{N as Q}from"./Alert-Bp4A0iuZ.js";import{N as X}from"./Flex-BzOy0L5a.js";import{B as Y}from"./index-DPPFu3oN.js";const Z=n(),ee=e("auth-api-manage-store",()=>{const{handleError:e}=K(),a=t({name:"",type:"btpanel",config:{url:"",api_key:"",ignore_ssl:"0"}}),n={dns:s("t_3_1745735765112"),host:s("t_0_1746754500246"),plugin:"插件"},o=()=>{a.value={name:"",type:"btpanel",config:{url:"",api_key:"",ignore_ssl:"0"}}};return{apiFormProps:a,accessTypeMap:n,fetchAccessList:async a=>{try{const e=await z(a).fetch();return{list:e.data||[],total:e.count}}catch(t){return e(t),{list:[],total:0}}},addNewAccess:async a=>{try{const{fetch:e,message:t}=V(a);t.value=!0,await e(),o()}catch(t){throw e(t)&&Z.error(s("t_8_1745289354902")),t}},updateExistingAccess:async a=>{try{const{fetch:e,message:t}=N(a);t.value=!0,await e(),o()}catch(t){throw e(t)&&Z.error(s("t_40_1745227838872")),t}},deleteExistingAccess:async a=>{try{const{fetch:e,message:t}=L({id:a});t.value=!0,await e(),o()}catch(t){throw e(t)&&Z.error(s("t_40_1745227838872")),t}},resetApiForm:o}}),ae=o({name:"ApiManageForm",props:{data:{type:Object,default:()=>{}}},setup(e){const{ApiManageForm:a}=de(e);return()=>c("div",{class:"p-4"},[c(a,{labelPlacement:"top",requireMarkPlacement:"right-hanging"},null)])}});function te(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!g(e)}const{accessTypeMap:se,apiFormProps:ne,fetchAccessList:oe,deleteExistingAccess:ce,addNewAccess:re,updateExistingAccess:le,resetApiForm:ie}=(()=>{const e=ee();return{...e,...a(e)}})(),{handleError:ue}=K(),pe=()=>{const{TableComponent:e,PageComponent:a,loading:t,param:n,fetch:o}=r({config:[{title:s("t_2_1745289353944"),key:"name",width:200,ellipsis:{tooltip:!0}},{title:s("t_1_1746754499371"),key:"type",width:140,render:e=>c(W,{round:!0,class:"!py-[4px] !px-[10px]",icon:e.type,type:"success"},null)},{title:s("t_2_1746754500270"),key:"type",width:200,render:e=>c(u,null,{default:()=>{var a;return[null==(a=e.access_type)?void 0:a.map(e=>c(i,{key:e,type:"dns"===e?"success":"info",size:"small",round:!0},{default:()=>[se[e]]}))]}})},{title:s("t_7_1745215914189"),key:"create_time",width:180},{title:s("t_0_1745295228865"),key:"update_time",width:180},{title:s("t_8_1745215914610"),key:"actions",width:200,align:"right",fixed:"right",render:e=>{let a,t,n;return c(u,{justify:"end"},{default:()=>[c(p,{size:"tiny",strong:!0,secondary:!0,type:"primary",class:"table-action-btn",onClick:()=>(async e=>{try{const{fetch:a,message:t}=D({id:e.id,type:e.type});t.value=!0,await a()}catch(a){ue(a)}})(e)},te(a=s("t_16_1746676855270"))?a:{default:()=>[a]}),c(p,{size:"tiny",strong:!0,secondary:!0,type:"primary",class:"table-action-btn",onClick:()=>f(e)},te(t=s("t_11_1745215915429"))?t:{default:()=>[t]}),c(p,{size:"tiny",strong:!0,secondary:!0,type:"error",class:"table-action-btn-danger",onClick:()=>_(e.id)},te(n=s("t_12_1745215914312"))?n:{default:()=>[n]})]})}}],request:oe,watchValue:["p","limit"],storage:"authApiManage",alias:{page:"p",pageSize:"limit"},defaultValue:{p:1,limit:10,search:""}}),{SearchComponent:g}=S({onSearch:e=>{n.value.search=e,o()}}),f=e=>{d({title:s("t_4_1745289354902"),area:500,component:ae,componentProps:{data:e},footer:!0,onUpdateShow:e=>{e||o(),ie()}})},_=e=>{C({title:s("t_5_1745289355718"),content:s("t_6_1745289358340"),confirmText:s("t_5_1744870862719"),cancelText:s("t_4_1744870861589"),onPositiveClick:async()=>{await ce(e),await o()}})};return l(o),{loading:t,fetch:o,TableComponent:e,PageComponent:a,SearchComponent:g,param:n,openAddForm:()=>{d({title:s("t_0_1745289355714"),area:500,component:ae,footer:!0,onUpdateShow:e=>{e||o(),ie()}})}}},de=e=>{var a;const{confirm:n}=q(),{open:o,close:r}=E({text:s("t_0_1746667592819")}),{useFormInput:u,useFormRadioButton:p,useFormSwitch:d,useFormTextarea:g,useFormCustom:O,useFormSelect:S,useFormHelp:j}=_(),K=(null==(a=e.data)?void 0:a.id)?t({...e.data,config:JSON.parse(e.data.config)}):ne,C=t(""),z=t([]),V={name:{required:!0,message:s("t_27_1745289355721"),trigger:"input"},type:{required:!0,message:s("t_28_1745289356040"),trigger:"change"},config:{host:{required:!0,trigger:"input",validator:(e,a,t)=>{if(!F(a)&&!U(a))return t(new Error(s("t_0_1749119980577")));t()}},port:{required:!0,trigger:"input",validator:(e,a,t)=>{if(!T(a.toString()))return t(new Error(s("t_1_1745317313096")));t()}},user:{required:!0,trigger:"input",message:s("t_3_1744164839524")},username:{trigger:"input",validator:(e,a,t)=>{if(!a){const e={westcn:s("t_0_1747365600180"),namedotcom:"请输入用户名",lecdn:"请输入用户名"};return t(new Error(e[K.value.type]||s("t_0_1747365600180")))}t()}},password:{trigger:"input",validator:(e,a,t)=>{if("ssh"===K.value.type){const e=K.value.config;return"password"!==(null==e?void 0:e.mode)||a?void t():t(new Error(s("t_0_1747711335067")))}if(!a){const e={westcn:s("t_1_1747365603108"),lecdn:"请输入密码"};return t(new Error(e[K.value.type]))}t()}},key:{required:!0,message:s("t_31_1745289355715"),trigger:"input"},url:{required:!0,trigger:"input",validator:(e,a,t)=>{if(!M(a)){const e={btpanel:s("t_2_1745317314362"),btwaf:s("t_0_1747271295174"),safeline:s("t_0_1747300383756"),lecdn:"请输入正确的URL地址",webhook:"请输入回调地址"};return t(new Error(e[K.value.type]))}t()}},api_key:{trigger:"input",validator:(e,a,t)=>{if(!a||!a.length){const e={cloudflare:s("t_0_1747042966820"),btpanel:s("t_1_1747042969705"),btwaf:s("t_1_1747300384579"),godaddy:s("t_0_1747984137443"),ns1:"请输入API Key",namecheap:"请输入API Key",constellix:"请输入API Key",spaceship:"请输入 Spaceship API Key"};return t(new Error(e[K.value.type]))}t()}},api_secret:{trigger:"input",validator:(e,a,t)=>{if(!a){const e={godaddy:s("t_1_1747984133312"),spaceship:"请输入 Spaceship API Secret"};return t(new Error(e[K.value.type]))}t()}},account_id:{trigger:"input",validator:(e,a,t)=>{if(!a){return t(new Error({btdomain:"请输入 宝塔域名 Account ID"}[K.value.type]))}t()}},access_secret:{required:!0,message:s("t_2_1747984134626"),trigger:"input"},api_token:{required:!0,message:s("t_0_1747617113090"),trigger:"input"},secret_access_key:{required:!0,message:"请输入Secret Access Key",trigger:"input"},api_user:{required:!0,message:"请输入API User",trigger:"input"},auth_id:{required:!0,message:"请输入Auth ID",trigger:"input"},auth_password:{required:!0,message:"请输入Auth Password",trigger:"input"},tenant_id:{required:!0,message:"请输入Tenant ID",trigger:"input"},client_id:{required:!0,message:"请输入Client ID",trigger:"input"},client_secret:{required:!0,message:"请输入Client Secret",trigger:"input"},secret_id:{required:!0,message:s("t_6_1745317313383"),trigger:"input"},access_key:{trigger:"input",validator:(e,a,t)=>{if(!a){const e={huawei:s("t_2_1747271295877"),baidu:s("t_3_1747271294475"),volcengine:s("t_3_1747365600828"),qiniu:s("t_3_1747984134586"),doge:s("t_0_1750320239265"),btdomain:"请输入 宝塔域名 Access Key"};return t(new Error(e[K.value.type]))}t()}},secret_key:{trigger:"input",validator:(e,a,t)=>{if(!a||!a.length){const e={tencentcloud:s("t_2_1747042967277"),huawei:s("t_3_1747042967608"),baidu:s("t_4_1747271294621"),volcengine:s("t_4_1747365600137"),doge:s("t_1_1750320241427"),constellix:"请输入Secret Key",btdomain:"请输入 宝塔域名 Secret Key"};return t(new Error(e[K.value.type]))}t()}},email:{trigger:"input",validator:(e,a,t)=>"cloudflare"!==K.value.type||a&&""!==a.trim()?R(a)?void t():t(new Error(s("t_5_1747042965911"))):t()},region:{required:!0,message:"请输入Region",trigger:"input"},"config.name":{required:!0,message:s("t_0_1750144125193"),trigger:"change"}}},N=Object.entries(H).filter(([e,a])=>!("boolean"==typeof a.notApi&&!a.notApi)).map(([e,a])=>({label:a.name,value:e,access:a.type||[]})),L=new Map([["btwaf","宝塔WAF-URL"],["btpanel","宝塔面板-URL"],["1panel","1Panel-URL"],["safeline","雷池WAF-URL"]]),D=f(()=>{var a,t;const n=[u(s("t_2_1745289353944"),"name"),O(()=>c(w,{label:s("t_41_1745289354902"),path:"type"},{default:()=>{var a;return[c(y,{class:"w-full",options:N,renderLabel:Y,renderTag:W,disabled:!!(null==(a=e.data)?void 0:a.id),filterable:!0,placeholder:s("t_0_1745833934390"),value:K.value.type,"onUpdate:value":e=>K.value.type=e},{empty:()=>c("span",{class:"text-[1.4rem]"},[s("t_0_1745833934390")])})]}}))];switch(K.value.type){case"ssh":{const e=[O(()=>c(x,{cols:24,xGap:4},{default:()=>[c(b,{label:s("t_1_1747711335336"),span:16,path:"config.host"},{default:()=>[c(k,{value:K.value.config.host,"onUpdate:value":e=>K.value.config.host=e,placeholder:s("t_2_1747711337958"),"allow-input":G},null)]}),c(b,{label:s("t_2_1745833931404"),span:8,path:"config.port"},{default:()=>[c(I,{value:K.value.config.port,"onUpdate:value":e=>K.value.config.port=e,showButton:!1},null)]})]})),u(s("t_44_1745289354583"),"config.user"),p(s("t_45_1745289355714"),"config.mode",[{label:s("t_48_1745289355714"),value:"password"},{label:s("t_1_1746667588689"),value:"key"}])],o=[];"password"===(null==(a=K.value.config)?void 0:a.mode)?o.push(u(s("t_48_1745289355714"),"config.password",{type:"password",showPasswordOn:"click",allowInput:G})):"key"===(null==(t=K.value.config)?void 0:t.mode)&&o.push(g(s("t_1_1746667588689"),"config.key",{rows:3,placeholder:s("t_0_1747709067998")}),u("私钥密码","config.password",{type:"password",showPasswordOn:"click",allowInput:G,placeholder:"请输入私钥密码(可选)"},{showRequireMark:!1})),n.push(...e,...o);break}case"1panel":n.push(O(()=>{const e=K.value.config.version||"v1";return c(w,{label:"版本",path:"config.version",showRequireMark:!1},{default:()=>[c(y,{class:"w-full",options:[{label:"v1",value:"v1"},{label:"v2",value:"v2"}],placeholder:"请选择版本",value:e,onUpdateValue:e=>{K.value.config.version=e}},null)]})}),u(L.get(K.value.type)||"","config.url",{allowInput:G}),u(s("t_55_1745289355715"),"config.api_key",{type:"password",showPasswordOn:"click",allowInput:G}),d(s("t_3_1746667592270"),"config.ignore_ssl",{checkedValue:"1",uncheckedValue:"0"},{showRequireMark:!1}));break;case"btpanel":case"btwaf":case"safeline":n.push(u(L.get(K.value.type)||"","config.url",{allowInput:G}),u("safeline"===K.value.type?s("t_1_1747617105179"):s("t_55_1745289355715"),"safeline"===K.value.type?"config.api_token":"config.api_key",{type:"password",showPasswordOn:"click",allowInput:G}),d(s("t_3_1746667592270"),"config.ignore_ssl",{checkedValue:"1",uncheckedValue:"0"},{showRequireMark:!1}));break;case"aliyun":n.push(u("AccessKeyId","config.access_key_id",{allowInput:G}),u("AccessKeySecret","config.access_key_secret",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"tencentcloud":n.push(u("SecretId","config.secret_id",{allowInput:G}),u("SecretKey","config.secret_key",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"huaweicloud":case"baidu":case"volcengine":case"doge":n.push(u("AccessKey","config.access_key",{allowInput:G}),u("SecretKey","config.secret_key",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"cloudflare":n.push(u("邮箱","config.email",{allowInput:G},{showRequireMark:!1}),u("APIKey","config.api_key",{type:"password",showPasswordOn:"click",allowInput:G}),O(()=>c(Q,{type:"error",class:"mt-[1.2rem] whitespace-nowrap",showIcon:!1},{default:()=>[c("span",{class:"text-[1.3rem]"},[h("使用API令牌时不要填写邮箱否则将作为Global Key请求Cloudflare")])]})));break;case"westcn":n.push(u("Username","config.username",{allowInput:G}),u("Password","config.password",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"godaddy":n.push(u("API Key","config.api_key",{type:"password",showPasswordOn:"click",allowInput:G}),u("API Secret","config.api_secret",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"qiniu":n.push(u("AccessKey","config.access_key",{allowInput:G}),u("AccessSecret","config.access_secret",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"namecheap":n.push(u("API User","config.api_user",{allowInput:G}),u("API Key","config.api_key",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"ns1":case"namesilo":case"bunny":case"rainyun":n.push(u("API Key","config.api_key",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"cloudns":n.push(u("Auth ID","config.auth_id",{allowInput:G}),u("Auth Password","config.auth_password",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"aws":n.push(u("Access Key ID","config.access_key_id",{allowInput:G}),u("Secret Access Key","config.secret_access_key",{type:"password",showPasswordOn:"click",allowInput:G}),u("Region","config.region",{allowInput:G}));break;case"azure":n.push(u("Tenant ID","config.tenant_id",{allowInput:G}),u("Client ID","config.client_id",{allowInput:G}),u("Client Secret","config.client_secret",{type:"password",showPasswordOn:"click",allowInput:G}),u("Environment","config.environment",{allowInput:G,placeholder:"public"}));break;case"namedotcom":n.push(u("Username","config.username",{allowInput:G}),u("API Token","config.api_token",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"gcore":n.push(u("API Token","config.api_token",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"jdcloud":n.push(u("Access Key ID","config.access_key_id",{allowInput:G}),u("Secret Access Key","config.secret_access_key",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"lecdn":n.push(u("URL","config.url",{allowInput:G}),u("Username","config.username",{allowInput:G}),u("Password","config.password",{type:"password",showPasswordOn:"click",allowInput:G}),d(s("t_3_1746667592270"),"config.ignore_ssl",{checkedValue:"1",uncheckedValue:"0"},{showRequireMark:!1}));break;case"constellix":n.push(u("API Key","config.api_key",{type:"password",showPasswordOn:"click",allowInput:G}),u("Secret Key","config.secret_key",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"webhook":n.push(u("WebHook回调地址","config.url"),S("请求方式","config.method",[{label:"POST",value:"POST"},{label:"GET",value:"GET"}]),g("WebHook请求头可选","config.headers",{rows:3,placeholder:"Content-Type: application/json"},{showRequireMark:!1}),g("WebHook推送通知回调数据可选","config.data",{rows:3,placeholder:'请使用JSON格式例如{"title":"test","content":"test"}'},{showRequireMark:!1}),d(s("t_3_1746667592270"),"config.ignore_ssl",{checkedValue:"1",uncheckedValue:"0"},{showRequireMark:!1}),O(()=>c("div",{class:"mt-4 p-4 bg-[var(--form-log-bg)] rounded-md"},[c("div",{class:"space-y-4 text-lg"},[c("div",null,[c("div",{class:"font-medium mb-3 text-xl"},[h("用于部署时可用的模板变量:")]),c("div",{class:"space-y-2 ml-4"},[c("div",null,[c("code",{class:"px-2 py-1 bg-[var(--form-log-code-bg)] rounded text-lg font-mono"},[h("__cert__")]),c("span",{class:"text-color5"},[h(":证书内容")])]),c("div",null,[c("code",{class:"px-2 py-1 bg-[var(--form-log-code-bg)] rounded text-lg font-mono"},[h("__key__")]),c("span",{class:"text-color5"},[h(":私钥内容")])])])]),c("div",null,[c("div",{class:"font-medium mb-3 text-xl"},[h("用于申请时可用的模板变量:")]),c("div",{class:"space-y-2 ml-4"},[c("div",null,[c("code",{class:"px-2 py-1 bg-[var(--form-log-code-bg)] rounded text-lg font-mono"},[h("__domain__")]),c("span",{class:"text-color5"},[h("完整域名_acme-challenge.allinssl.com")])]),c("div",null,[c("code",{class:"px-2 py-1 bg-[var(--form-log-code-bg)] rounded text-lg font-mono"},[h("__keyAuth__")]),c("span",{class:"text-color5"},[h(":域名解析值")])]),c("div",null,[c("code",{class:"px-2 py-1 bg-[var(--form-log-code-bg)] rounded text-lg font-mono"},[h("__action__")]),c("span",{class:"text-color5"},[h("执行的操作需要自行根据参数值判断为present时执行写入cleanup清理记录")])])])])])])));break;case"spaceship":n.push(u("API Key","config.api_key",{allowInput:G}),u("API Secret","config.api_secret",{type:"password",showPasswordOn:"click",allowInput:G}));break;case"btdomain":n.push(u("Access Key","config.access_key",{allowInput:G}),u("Secret Key","config.secret_key",{type:"password",showPasswordOn:"click",allowInput:G}),u("Account ID","config.account_id",{allowInput:G}));break;case"plugin":n.push(O(function(){return c(w,{label:s("t_1_1750144122230"),path:"config.name",showRequireMark:!0},{default:()=>[c(y,{class:"w-full",options:z.value,placeholder:s("t_2_1750144123753"),filterable:!0,renderLabel:Z,renderTag:ee,value:K.value.config.name,"onUpdate:value":e=>K.value.config.name=e,onUpdateValue:(e,a)=>{K.value.config.name=e,C.value=ae(a.config||{}),K.value.config.config&&"string"!=typeof K.value.config.config||(K.value.config.config={})}},{empty:function(){return c("span",{class:"text-[1.4rem]"},[s("t_0_1750210698345")])}})]})})),n.push(p("配置模式","config.mode",[{label:"默认",value:"default"},{label:"自定义",value:"custom"}],{},{showRequireMark:!1}));var o=K.value.config;o.mode=o.mode||"default";var r=z.value.find(function(e){return e.value===o.name});if("default"===o.mode){if(!o.config||"object"!=typeof o.config)if("string"==typeof o.config&&o.config.trim())try{o.config=JSON.parse(o.config.trim())}catch{o.config={}}else o.config={}}else if(void 0===o.config||null===o.config)o.config="";else if("object"==typeof o.config)if(0===Object.keys(o.config).length)o.config="";else try{o.config=JSON.stringify(o.config)}catch{o.config=""}r?"default"===o.mode?r.config&&0!==r.config.length?r.config.forEach(function(e){var a="config.config."+e.name;V.config.config||(V.config.config={}),V.config.config[e.name]={required:e.required,trigger:"input",message:"请输入"+(e.description||e.name)},n.push(((e,a,t)=>{const s={required:e.required||!1,showRequireMark:e.required||!1,trigger:e.required?"input":void 0};switch(e.type){case"string":default:return u(e.description,a,{allowInput:t},s);case"boolean":return d(e.description,a,{checkedValue:!0,uncheckedValue:!1},s);case"enum":const n=e.options||[];return S(e.description,a,n.map(e=>({label:"string"==typeof e?e:e.label||e,value:"string"==typeof e?e:e.value||e})),{},s)}})(e,a,G))}):n.push(O(function(){return c(w,{path:"config.placeholder",showRequireMark:!1},{default:()=>[c(m,{description:"该插件暂无配置项"},null)]})})):n.push(O(function(){return c(w,{path:"config.config"},{default:()=>[c(k,{type:"textarea",value:void 0===o.config||null===o.config||"object"==typeof o.config&&0===Object.keys(o.config).length?"":"string"==typeof o.config?o.config:JSON.stringify(o.config,null,2),onUpdateValue:e=>{o.config=e},placeholder:C.value,rows:4},null)],label:function(){return c("div",null,[c($,null,{default:()=>[h("自定义参数")]}),c(v,null,{default:()=>[C.value],trigger:function(){return c("span",{class:"inline-flex ml-2 -mt-1 cursor-pointer text-base rounded-full w-[14px] h-[14px] justify-center items-center text-orange-600 border border-orange-600"},[h("?")])}})])}})}),j([{content:'<span class="text-[1.4rem] text-[#FF4314]">未来版本将取消自定义参数填写。</span>',isHtml:!0}])):n.push(O(function(){return c(w,{path:"config.placeholder",showRequireMark:!1},{default:()=>[c(m,{description:"请选择插件以查看配置项"},null)]})}))}return n});A(()=>K.value.type,e=>{var a;switch(e){case"ssh":K.value.config={host:"",port:22,user:"root",mode:"password",password:""};break;case"1panel":K.value.config={url:"",api_key:"",ignore_ssl:"0",version:"v1"};break;case"btpanel":case"btwaf":K.value.config={url:"",api_key:"",ignore_ssl:"0"};break;case"aliyun":K.value.config={access_key_id:"",access_key_secret:""};break;case"baidu":case"huaweicloud":case"doge":K.value.config={access_key:"",secret_key:""};break;case"cloudflare":K.value.config={email:"",api_key:""};break;case"tencentcloud":K.value.config={secret_id:"",secret_key:""};break;case"godaddy":case"spaceship":K.value.config={api_key:"",api_secret:""};break;case"qiniu":K.value.config={access_key:"",access_secret:""};break;case"namecheap":K.value.config={api_user:"",api_key:""};break;case"ns1":case"namesilo":case"bunny":K.value.config={api_key:""};break;case"cloudns":K.value.config={auth_id:"",auth_password:""};break;case"aws":K.value.config={access_key_id:"",secret_access_key:"",region:""};break;case"azure":K.value.config={tenant_id:"",client_id:"",client_secret:"",environment:""};break;case"namedotcom":K.value.config={username:"",api_token:""};break;case"gcore":K.value.config={api_token:""};break;case"jdcloud":K.value.config={access_key_id:"",secret_access_key:""};break;case"lecdn":K.value.config={url:"",username:"",password:"",ignore_ssl:"0"};break;case"constellix":K.value.config={api_key:"",secret_key:""};break;case"webhook":K.value.config={url:"",method:"POST",headers:"Content-Type: application/json",data:"",ignore_ssl:"0"};break;case"btdomain":K.value.config={access_key:"",secret_key:"",account_id:""};break;case"plugin":K.value.config={name:(null==(a=z.value[0])?void 0:a.value)||"",mode:"default",config:{}}}});const W=({option:e})=>c(X,{class:"w-full"},{default:()=>[e.label?Y(e):c("span",{class:"text-[1.4rem] text-gray-400"},[s("t_0_1745833934390")])]}),Y=e=>{let a;const t={dns:s("t_3_1745735765112"),host:s("t_0_1746754500246"),plugin:"插件"};return c(X,{align:"center",size:"small",class:"w-full py-1"},{default:()=>[c(B,{icon:`resources-${e.value}`,size:"1.6rem"},null),c($,{class:"flex-1"},{default:()=>[e.label]}),e.access&&e.access.length>0&&c(X,{size:"small",class:"ml-auto"},te(a=e.access.map(e=>c(i,{key:e,type:"dns"===e?"success":"info",size:"small"},{default:()=>[t[e]||e]})))?a:{default:()=>[a]})]})},Z=e=>c(X,{justify:"space-between",class:"w-[38rem]"},{default:()=>[c(X,{size:"small",vertical:!0,class:"py-[8px]"},{default:()=>[c("div",{class:"flex items-center gap-2"},[c(B,{icon:`resources-${e.value}`,size:"1.6rem"},null),c($,{class:"text-[var(--color-card-title)]"},{default:()=>[e.label]})]),c("div",{title:e.description},[e.description&&c("div",{class:"text-[1.2rem] text-color5 mt-[0.2rem]"},[e.description])])]})]}),ee=e=>{const{option:a}=e;return c(X,{class:"w-full"},{default:()=>[(null==a?void 0:a.label)?c(X,{align:"center",size:"small"},{default:()=>[c(B,{icon:`resources-${a.value}`,size:"1.4rem"},null),c($,null,{default:()=>[a.label]})]}):c("span",{class:"text-[1.4rem] text-gray-400"},[s("t_2_1750210698518")])]})},ae=e=>s("t_3_1750210706775")+JSON.stringify(e||{}),{component:se,fetch:oe,validate:ce}=P({config:D,defaultValue:K,request:async e=>{try{let a;a="string"==typeof e.config.config?{name:e.config.name,config:JSON.parse(e.config.config)}:{name:e.config.name,config:e.config.config};const t={...e,config:JSON.stringify(a)};if("id"in e){const{id:e,name:a,config:s}=t;await le({id:e.toString(),name:a,config:s})}else await re(t)}catch(a){throw ue(new Error(s("t_4_1746667590873")))}},rules:V});return n(async e=>{try{await ce(),o(),await oe(),ie(),e()}catch(a){return ue(a)}finally{r()}}),l(async()=>{var e;try{const{data:a}=await J().fetch();if(a&&Array.isArray(a)){const t=[];a.forEach(e=>{t.push({label:e.name,value:e.name,description:e.actions.map(e=>e.description).join("、"),pluginName:e.name,config:e.config})}),z.value=t,C.value=ae((null==(e=t[0])?void 0:e.config)||{})}}catch(a){}}),{ApiManageForm:se}};const ge=o({name:"AuthApiManage",setup(){const{TableComponent:e,PageComponent:a,SearchComponent:t,openAddForm:n}=pe(),o=O(["contentPadding","borderColor","headerHeight","iconColorHover"]);return()=>c("div",{class:"h-full flex flex-col",style:o.value},[c("div",{class:"mx-auto max-w-[1600px] w-full p-6"},[c(Y,null,{headerLeft:()=>{let e;return c(p,{type:"primary",size:"large",class:"gradient-primary-btn px-5",onClick:n},"function"==typeof(a=e=s("t_0_1745289355714"))||"[object Object]"===Object.prototype.toString.call(a)&&!g(a)?e:{default:()=>[e]});var a},headerRight:()=>c(t,{class:"header-search",placeholder:s("t_0_1745289808449")},null),content:()=>c("div",{class:"rounded-lg"},[c(e,{size:"medium","scroll-x":"1560"},{empty:()=>c(j,{addButtonText:s("t_0_1745289355714"),onAddClick:n},null)})]),footerRight:()=>c("div",{class:"mt-4 flex justify-end"},[c(a,null,null)])})])])}});export{ge as default};