import{f as h,F as f,i as _,j as b,k as m,l as U,m as v,_ as C,r as c,o as g,c as k,b as s,w as V,a}from"./entry.c7cd0af6.js";const y=h({components:{FormInput:f,FormInputCheckbox:_,ClientScopeList:b},props:{entity:{type:Object,required:!0}},emits:["updated","failed"],setup(t,{emit:l}){const o=m([]),r=m(""),d=v(),p=U(()=>{const n=new URL("authorize",d.public.publicUrl);return n.searchParams.set("client_id",t.entity.id),o.value.length>0&&n.searchParams.set("scope",encodeURIComponent(o.value.join(" "))),r.value&&n.searchParams.set("redirect_uri",encodeURIComponent(r.value)),n.href}),i=n=>{const e=o.value.indexOf(n);e===-1?o.value.push(n):o.value.splice(e,1)},u={filter:{client_id:t.entity.id},relations:["scope"]};return{toggleScope:i,query:u,redirectUri:r,generatedUrl:p,scopes:o}}},"$p4xkk2I3Jk"),I=a("h6",null,"URL Generator",-1),L=a("div",{class:"mb-1"}," Generate an authorize url by picking the scopes it needs to function. ",-1),R=a("hr",null,null,-1),F=a("hr",null,null,-1),$=a("hr",null,null,-1);function q(t,l,o,r,d,p){const i=c("FormInputCheckbox"),u=c("ClientScopeList"),n=c("FormInput");return g(),k("div",null,[I,L,R,s(u,{"header-title":!1,"header-search":!1,query:t.query,item:{class:""}},{item:V(e=>[s(i,{"validation-translator":e.translatorLocale,"model-value":t.scopes.indexOf(e.data.scope.name)!==-1,label:!0,"label-content":e.data.scope.name,"onUpdate:modelValue":x=>t.toggleScope(e.data.scope.name)},null,8,["validation-translator","model-value","label-content","onUpdate:modelValue"])]),_:1},8,["query"]),F,s(n,{modelValue:t.redirectUri,"onUpdate:modelValue":l[0]||(l[0]=e=>t.redirectUri=e),"label-content":"Redirect URL",label:!0,placeholder:"..."},null,8,["modelValue"]),$,s(n,{modelValue:t.generatedUrl,"onUpdate:modelValue":l[1]||(l[1]=e=>t.generatedUrl=e),"label-content":"Generated URL",label:!0,disabled:!0},null,8,["modelValue"])])}const j=C(y,[["render",q]]);export{j as default};
