import{_ as S}from"./AbstraButton.vue_vue_type_script_setup_true_lang-CQ398DyA.js";import{e as z,V as C,K as D,r as c,n as B,H as k,f as d,g as u,k as h,x as s,C as f,S as _,s as e,T as p,J as t,D as T,$ as V,a0 as E,aU as N,W as P,j as $,a_ as F,ar as M}from"./jwt-decode.esm-rEBc1yJt.js";import{G as R}from"./PhArrowLeft.vue-C32mSFEh.js";import"./router-BaFu-do7.js";import{M as j,i as U}from"./member-qsE1qwIO.js";import{a as G}from"./organization-DI9u_TkV.js";import"./tables-DdYqLMX_.js";import"./LoadingOutlined-BWNNCw0T.js";import"./ts.worker-BI7fZ7sa.js";import"./string-BwJCihDb.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l=new Error().stack;l&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[l]="8a90fb0f-ad0b-4692-a38c-471d82b0271e",i._sentryDebugIdIdentifier="sentry-dbid-8a90fb0f-ad0b-4692-a38c-471d82b0271e")}catch{}})();const H={class:"ai-skills-page"},J={class:"ai-skills-header"},K={class:"header-left"},O={key:0,class:"loading-container"},W={key:0,class:"ai-skills-footer"},q=z({__name:"AiSkills",setup(i){const l=C(),g=D(),n=l.params.organizationId,y=new G,w=new j,b=c(!0),m=c(!1),o=c(""),v=c(!1);B(async()=>{try{const[a,r]=await Promise.all([y.listSkills(n),w.me(n).catch(()=>null)]);a.length>0&&(o.value=a[0].content),v.value=U(r)}catch(a){k.error(a instanceof Error?a.message:"Failed to load skill")}finally{b.value=!1}});async function I(){m.value=!0;try{await y.upsertSkill(n,{content:o.value}),k.success(t.translate("i18n_aiskills_saved"))}catch(a){k.error(a instanceof Error?a.message:"Failed to save")}finally{m.value=!1}}function x(){g.push({name:"projects",params:{organizationId:n}})}return(a,r)=>(u(),d("div",H,[h("div",J,[h("div",K,[s(e(T),{type:"text",class:"back-button",onClick:x},{default:f(()=>[s(e(R),{size:16}),_(" "+p(e(t).translate("i18n_billing_back")),1)]),_:1}),s(e(V),{level:2,style:{margin:"0"}},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_title")),1)]),_:1}),s(e(E),{type:"secondary"},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_subtitle")),1)]),_:1})])]),b.value?(u(),d("div",O,[s(e(N),{size:"large"})])):(u(),d(P,{key:1},[s(e(F),{value:o.value,"onUpdate:value":r[0]||(r[0]=A=>o.value=A),placeholder:e(t).translate("i18n_aiskills_placeholder"),"auto-size":{minRows:20},disabled:!v.value,class:"ai-skills-editor"},null,8,["value","placeholder","disabled"]),v.value?(u(),d("div",W,[s(S,{type:"primary",loading:m.value,onClick:I},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_save")),1)]),_:1},8,["loading"])])):$("",!0)],64))]))}}),le=M(q,[["__scopeId","data-v-90157cc8"]]);export{le as default};
//# sourceMappingURL=AiSkills-DvNz7xrG.js.map
