1/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as O,u as X,f as Z,g as b,h as i,t as s,j as t,i as a,w as o,aA as ee,c as te,a5 as g,av as le,m as N,n as _,o as h,a2 as ae,ae as oe,a4 as pe,af as se,aC as re,Y as d,by as ue,a6 as ie,a0 as ne,an as de,aB as ce,b_ as me,aw as ye,aN as _e,a1 as he,ap as ve,Q as Ae,R as m,J as fe}from"./7Rh2xM73.js";const be={class:"oauth-apply-page"},ge={class:"page-header"},we={class:"apply-container"},xe={class:"form-tip"},ke={key:0,class:"logo-preview-row"},Ce=["src","alt"],Ve={class:"form-tip"},Te={class:"agreement-content"},Ue={class:"agreement-footer"},Se={key:0},Fe={key:0,class:"detail-logo-section"},Re={class:"detail-logo-wrapper"},De=["src","alt"],Ne={key:1,class:"app-credentials"},qe={__name:"apply",setup(ze){const{t:e}=X(),x=_(null),k=_(!1),w=_(!1),C=_(!1),v=_(!1),r=_(null),V=_([]),u=Ae({app_name:"",logo:"",redirect_uri:"",website:"",description:"",allowed_ips:"",agreement:!1}),q=()=>{m.error(e("oauthApply.logoLoadFail")),u.logo=""},z=()=>{w.value=!1,window.open("/user/policy?tab=oauth","_blank")},P={app_name:[{required:!0,message:e("oauthApply.appNameRequired")}],redirect_uri:[{required:!0,message:e("oauthApply.redirectUriRequired")},{type:"url",message:e("oauthApply.urlInvalid")}],description:[{required:!0,message:e("oauthApply.descriptionRequired")}]},E=fe(()=>
1r.value?[{label:e("oauthApply.labelAppName"),value:r.value.app_name},{label:e("oauthApply.labelRedirectUri"),value:r.value.redirect_uri},{label:e("oauthApply.labelWebsite"),value:r.value.website||"-"},{label:e("oauthApply.labelDescription"),value:r.value.description},{label:e("oauthApply.labelIpWhitelist"),value:r.value.allowed_ips||e("oauthApply.noLimit")},{label:e("oauthApply.labelContact"),value:r.value.contact_name},{label:e("oauthApply.labelEmail"),value:r.value.contact_email},{label:e("oauthApply.labelPhone"),value:r.value.contact_phone||"-"},{label:e("oauthApply.labelStatus"),value:T(r.value.status)},{label:e("oauthApply.labelCreateTime"),value:r.value.create_time},{label:e("oauthApply.labelRemark"),value:r.value.remark||"-"}]:[]),I=n=>({0:"orange",1:"green",2:"red",3:"gray"})[n]||"default",T=n=>({0:e("oauthApply.statusPending"),1:e("oauthApply.statusApproved"),2:e("oauthApply.statusRejected"),3:e("oauthApply.statusDisabled")})[n]||e("oauthApply.statusUnknown"),L=async()=>{if(!await x.value.validate()){k.value=!0;try{const l=await N().post("/av1/oauth/apply",u);l.code===200?(m.success(e("oauthApply.submitSuccess")),x.value.resetFields(),U()):m.error(l.msg||e("oauthApply.submitFail"))}catch(l){m.error(e("oauthApply.submitFail")+"ï¼"+(l.message||e("oauthApply.networkError")))}finally{k.value=!1}}},U=async()=>{try{const n=await N().post("/av1/oauth/myapps");n.code===200&&(V.value=n.data||[])}catch(n){console.error("loadApplyList error:",n)}},B=n=>{r.value=n,v.value=!1,C.value=!0},S=async n=>{if(!n){m.error(e("oauthApply.copyEmpty"));return}try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n),m.success(e("oauthApply.copySuccess"));else{const l=document.createElement("textarea");l.value=n,l.style.position="fixed",l.style.left="-999999px",document.body.appendChild(l),l.focus(),l.select();try{document.execCommand("copy"),m.success(e("oauthApply.copySuccess"))}catch{m.error(e("oauthApply.copyFail"))}document.body.removeChild(l)}}catch{m.error(e("oauthApply.copyFail"))}};return Z(()=>{U()}),(n,l)=>{const y=pe,c=oe,$=se,M=re,F=ie,j=ue,A=ne,W=ae,R=ee,f=ce,J=me,K=ye,Q=de,D=le,Y=_e,G=he,H=ve;return h(),b("div",be,[i("div",ge,[i("h1",null,s(t(e)("oauthApply.pageTitle")),1),i("p",null,s(t(e)("oauthApply.pageDesc")),1)]),i("div",we,[a(R,{class:"apply-form-card"},{default:o(()=>[a(W,{model:u,layout:"vertical",rules:P,ref_key:"formRef",ref:x},{default:o(()=>[a(c,{field:"app_name",label:t(e)("oauthApply.appName"),required:""},{default:o(()=>[a(y,{modelValue:u.app_name,"onUpdate:modelValue":l[0]||(l[0]=p=>u.app_name=p),placeholder:t(e)("oauthApply.appNamePh"),size:"large"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(c,{field:"logo",label:t(e)("oauthApply.logo")},{extra:o(()=>[i("span",xe,s(t(e)("oauthApply.logoTip")),1)]),default:o(()=>[a(y,{modelValue:u.logo,"onUpdate:modelValue":l[1]||(l[1]=p=>u.logo=p),placeholder:t(e)("oauthApply.logoPh"),size:"large","allow-clear":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),u.logo?(h(),b("div",ke,[i("img",{src:u.logo,alt:t(e)("oauthApply.logo"),onError:q},null,40,Ce)])):g("",!0),a(c,{field:"redirect_uri",label:t(e)("oauthApply.redirectUri"),required:""},{extra:o(()=>[i("span",Ve,s(t(e)("oauthApply.redirectUriTip")),1)]),default:o(()=>[a(y,{modelValue:u.redirect_uri,"onUpdate:modelValue":l[2]||(l[2]=p=>u.redirect_uri=p),placeholder:t(e)("oauthApply.redirectUriPh"),size:"large"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(c,{field:"website",label:t(e)("oauthApply.website")},{default:o(()=>[a(y,{modelValue:u.website,"onUpdate:modelValue":l[3]||(l[3]=p=>u.website=p),placeholder:t(e)("oauthApply.websitePh"),size:"large"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(c,{field:"description",label:t(e)("oauthApply.description"),required:""},{default:o(()=>[a($,{modelValue:u.description,"onUpdate:modelValue":l[4]||(l[4]=p=>u.description=p),placeholder:t(e)("oauthApply.descriptionPh"),rows:4},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(M,{type:"info",style:{"margin-bottom":"20px"}},{title:o(()=>[d(s(t(e)("oauthApply.contactTitle")),1)]),default:o(()=>
1[d(" "+s(t(e)("oauthApply.contactDesc")),1)]),_:1}),a(c,null,{default:o(()=>[a(j,{modelValue:u.agreement,"onUpdate:modelValue":l[6]||(l[6]=p=>u.agreement=p)},{default:o(()=>[d(s(t(e)("oauthApply.agreement"))+" ",1),a(F,{onClick:l[5]||(l[5]=p=>w.value=!0)},{default:o(()=>[d(s(t(e)("oauthApply.agreementLink")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(c,null,{default:o(()=>[a(A,{type:"primary",size:"large",loading:k.value,disabled:!u.agreement,onClick:L,long:""},{default:o(()=>[d(s(t(e)("oauthApply.submit")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1},8,["model"])]),_:1}),V.value.length>0?(h(),te(R,{key:0,class:"apply-history-card",title:t(e)("oauthApply.history")},{default:o(()=>[a(Q,{data:V.value,pagination:!1},{columns:o(()=>[a(f,{title:t(e)("oauthApply.labelAppName"),"data-index":"app_name"},null,8,["title"]),a(f,{title:t(e)("oauthApply.labelRedirectUri"),"data-index":"redirect_uri"},{cell:o(({record:p})=>[a(J,{ellipsis:{rows:1},style:{"max-width":"200px"}},{default:o(()=>[d(s(p.redirect_uri),1)]),_:2},1024)]),_:1},8,["title"]),a(f,{title:t(e)("oauthApply.colStatus"),"data-index":"status"},{cell:o(({record:p})=>[a(K,{color:I(p.status)},{default:o(()=>[d(s(T(p.status)),1)]),_:2},1032,["color"])]),_:1},8,["title"]),a(f,{title:t(e)("oauthApply.colCreateTime"),"data-index":"create_time"},null,8,["title"]),a(f,{title:t(e)("oauthApply.colAction")},{cell:o(({record:p})=>[a(A,{type:"text",size:"small",onClick:Pe=>B(p)},{default:o(()=>[d(s(t(e)("oauthApply.view")),1)]),_:1},8,["onClick"])]),_:1},8,["title"])]),_:1},8,["data"])]),_:1},8,["title"])):g("",!0)]),a(D,{visible:w.value,"onUpdate:visible":l[7]||(l[7]=p=>w.value=p),title:t(e)("oauthApply.modalTitle"),footer:!1,width:"700px"},{default:o(()=>[i("div",Te,[i("h3",null,s(t(e)("oauthApply.modalTitle")),1),i("p",null,s(t(e)("oauthApply.agreement1")),1),i("p",null,s(t(e)("oauthApply.agreement2")),1),i("p",null,s(t(e)("oauthApply.agreement3")),1),i("p",null,s(t(e)("oauthApply.agreement4")),1),i("p",null,s(t(e)("oauthApply.agreement5")),1),i("div",Ue,[a(F,{onClick:z},{default:o(()=>[d(s(t(e)("oauthApply.viewFullPolicy")),1)]),_:1})])])]),_:1}
1,8,["visible","title"]),a(D,{visible:C.value,"onUpdate:visible":l[11]||(l[11]=p=>C.value=p),title:t(e)("oauthApply.detailTitle"),footer:!1,width:"600px"},{default:o(()=>[r.value?(h(),b("div",Se,[r.value.logo?(h(),b("div",Fe,[i("div",Re,[i("img",{src:r.value.logo,alt:t(e)("oauthApply.logo")},null,8,De)])])):g("",!0),a(Y,{data:E.value,layout:"vertical",bordered:""},null,8,["data"]),r.value.status===1?(h(),b("div",Ne,[a(G,null,{default:o(()=>[d(s(t(e)("oauthApply.appCredentials")),1)]),_:1}),a(c,{label:"App Key"},{default:o(()=>[a(y,{"model-value":r.value.app_key,readonly:""},{suffix:o(()=>[a(A,{type:"text",size:"small",onClick:l[8]||(l[8]=p=>S(r.value.app_key))},{default:o(()=>[d(s(t(e)("oauthApply.copy")),1)]),_:1})]),_:1},8,["model-value"])]),_:1}),a(c,{label:"App Secret"},{default:o(()=>[a(y,{"model-value":r.value.app_secret,readonly:"",type:v.value?"text":"password"},{suffix:o(()=>[a(H,null,{default:o(()=>[a(A,{type:"text",size:"small",onClick:l[9]||(l[9]=p=>v.value=!v.value)},{default:o(()=>[d(s(v.value?t(e)("oauthApply.hide"):t(e)("oauthApply.show")),1)]),_:1}),a(A,{type:"text",size:"small",onClick:l[10]||(l[10]=p=>S(r.value.app_secret))},{default:o(()=>[d(s(t(e)("oauthApply.copy")),1)]),_:1})]),_:1})]),_:1},8,["model-value","type"])]),_:1})])):g("",!0)])):g("",!0)]),_:1}
1,8,["visible","title"])])}}},ut=O(qe,[["__scopeId","data-v-c7ed34cb"]]);export{ut as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.