import{f as h}from"./nuxt-link.a91ddf68.js";import{y as v,l as s,S as b,q as C}from"./auth.8c936e9a.js";import"./app.config.5ff5ca90.js";import{b as U}from"./entry.0b5898f4.js";import{h as t,r as l,c as g,q as c}from"./runtime-core.esm-bundler.24b58585.js";import"./composables.050e3231.js";import"./utils.61cc85c6.js";import"./layout.1eaf47bc.js";import"./page.16487999.js";import"./_plugin-vue_export-helper.c27b6911.js";const T=v({props:{entity:{type:Object,required:!0}},emits:["updated","failed"],setup(i,{emit:y}){if(!i.entity)return()=>t("div",[]);const r=l([]),o=l(""),u=h(),d=g(()=>{const e=new URL("authorize",u.publicUrl);return e.searchParams.set("client_id",i.entity.id),r.value.length>0&&e.searchParams.set("scope",encodeURIComponent(r.value.join(" "))),o.value&&e.searchParams.set("redirect_uri",encodeURIComponent(o.value)),e.href});c("ScopeList");const p=e=>{const n=r.value.indexOf(e);n===-1?r.value.push(e):r.value.splice(n,1)},m=()=>{const e=s({labelContent:"Redirect URL",props:{placeholder:"..."},value:o}),n=s({labelContent:"Generated URL",props:{disabled:!0},value:d}),f=c("ClientScopeList");return t("div",[t("h6","URL Generator"),t("div",{class:"mb-1"},["Generate an authorize url by picking the scopes it needs to function."]),t("hr"),t(f,{withHeader:!1,withSearch:!1,query:{filter:{client_id:i.entity.id},relations:["scope"]}},{[b.ITEM]:a=>C({validationTranslator:U(a.translatorLocale),value:r.value.indexOf(a.data.scope.name)!==-1,onChange(R){p(a.data.scope.name)},label:!0,labelContent:a.data.scope.name})}),t("hr"),e,t("hr"),n])};return()=>m()}});export{T as default};
