1import"../chunks/CWj6FrbW.js";import"../chunks/69_IOA4Y.js";import{p as be,g as ye,o as $e,x as se,y as Se,h as Ce,i as Ae,a as b,b as We,s as Me,l as d,j as Ee,e as y,k as re,z as m,$ as Ie,m as oe,c as l,n as f,r as n,t as M,f as E,q as Pe,d as _,u as Be}from"../chunks/7a2fV5I9.js";import{i as z}from"../chunks/Dw-yaK-_.js";import{s as Ne}from"../chunks/CiyEWm25.js";import{h as Re}from"../chunks/DKaByr9K.js";import{s as O,a as D}from"../chunks/3tOhmI7k.js";import{i as Te}from"../chunks/CWFN-V6k.js";import{w as ne,u as Ve,c as qe,b as de,W as Ke,m as Ue,a as ue}from"../chunks/C33EP41Y.js";import{p as ze}from"../chunks/BewnZnAa.js";import{g as Q}from"../chunks/BnvOT63w.js";import{g as Oe}from"../chunks/CvGBZicb.js";import{s as je}from"../chunks/DTqvXK41.js";import{g as Le}from"../chunks/B2GbTaMC.js";import{g as De}from"../chunks/fdCtUnn5.js";import{g as Fe}from"../chunks/8BNfc9w8.js";import{T as Ge}from"../chunks/WwSz7SIr.js";import{S as He}from"../chunks/242QKLwC.js";import{S as Je}from"../chunks/DOZMXA0t.js";import{f as Qe}from"../chunks/DKKyCjZm.js";var Xe=E('<button id="sidebar-toggle-button" class=" cursor-pointer flex rounded-lg hover:bg-gray-100 dark:hover:bg-gray-850 transition cursor-"><div class=" self-center p-1.5"><!></div></button>'),Ye=E("<div><!></div>"),Ze=E('<a draggable="false" href="/workspace/models"><span> </span> <span class="text-sm opacity-60"> </span></a>'),ea=E('<a draggable="false" href="/workspace/knowledge"><span> </span> <span class="text-sm opacity-60"> </span></a>'),aa=E('<a draggable="false" href="/workspace/prompts"><span> </span> <span class="text-sm opacity-60"> </span></a>'),ta=E('<a draggable="false" href="/workspace/skills"><span> </span> <span class="text-sm opacity-60"> </span></a>'),sa=E('<a draggable="false" href="/workspace/tools"><span> </span> <span class="text-sm opacity-60"> </span></a>'),ra=E('<div><nav class="pb-1 px-2.5 pt-2 backdrop-blur-xl drag-region select-none"><div class="flex items-center gap-0.5 md:gap-1"><!> <div class="flex w-full items-center"><div class="flex min-w-0 mr-1.5 items-center gap-0.5 md:gap-1 scrollbar-none overflow-x-auto w-fit text-center text-sm font-normal rounded-full bg-transparent py-1 touch-auto pointer-events-auto"><!> <!> <!> <!> <!></div> <div class="ml-auto flex shrink-0 items-center gap-1"><!></div></div></div></nav> <div class=" pb-1 px-3 flex-1 min-w-0 max-h-full overflow-y-auto overflow-x-hidden" id="workspace-container"><!></div></div>');function Sa(ve,ie){be(ie,!1);const g=()=>y(ze,"$page",h),pe=()=>y(ne,"$workspaceActions",h),s=()=>y(Ve,"$user",h),X=()=>y(qe,"$config",h),c=()=>y(ke,"$i18n",h),ge=()=>y(Ke,"$WEBUI_NAME",h),I=()=>y(ue,"$showSidebar",h),fe=()=>y(Ue,"$mobile",h),w=()=>y(de,"$workspaceCounts",h),[h,xe]=Me(),ke=ye("i18n");let Y=oe(!1),le=oe(""),x=oe(""),ce=oe([]);const F=p=>(p==null?void 0:p.total)??(Array.isArray(p)?p.length:null),G=p=>Qe(p??0),we=async()=>{var C,T,A,V,W,q,K,U,H,Z,J,ee,o,e,a,r,t,u,i,v,ae,te;const p=((C=s())==null?void 0:C.role)==="admin"||((V=(A=(T=s())==null?void 0:T.permissions)==null?void 0:A.workspace)==null?void 0:V.models),k=((W=s())==null?void 0:W.role)==="admin"||((U=(K=(q=s())==null?void 0:q.permissions)==null?void 0:K.workspace)==null?void 0:U.knowledge),$=((H=s())==null?void 0:H.role)==="admin"||((ee=(J=(Z=s())==null?void 0:Z.permissions)==null?void 0:J.workspace)==null?void 0:ee.prompts),P=((o=s())==null?void 0:o.role)==="admin"||((r=(a=(e=s())==null?void 0:e.permissions)==null?void 0:a.workspace)==null?void 0:r.skills),B=((u=(t=X())==null?void 0:t.features)==null?void 0:u.enable_plugins)&&(((i=s())==null?void 0:i.role)==="admin"||((te=(ae=(v=s())==null?void 0:v.permissions)==null?void 0:ae.workspace)==null?void 0:te.tools)),[j,N,S,R,L]=await Promise.all([p?Oe(localStorage.token,null,null,null,null,null,1).catch(()=>null):null,k?je(localStorage.token,null,null,1,null).catch(()=>null):null,$?Le(localStorage.token,null,null,null,null,null,1).catch(()=>null):null,P?De(localStorage.token,null,null,1).catch(()=>null):null,B?Fe(localStorage.token).catch(()=>null):null]);de.set({models:F(j),knowledge:F(N),prompts:F(S),skills:F(R),tools:F(L)})};$e(async()=>{var p,k,$,P,B,j,N,S,R,L,C,T,A,V,W,q,K,U;((p=s())==null?void 0:p.role)!=="admin"&&(g().url.pathname.includes("/models")&&!((P=($=(k=s())==null?void 0:k.permissions)==null?void 0:$.workspace)!=null&&P.models)?Q("/",{replaceState:!0}):g().url.pathname.includes("/knowledge")&&!((N=(j=(B=s())==null?void 0:B.permissions)==null?void 0:j.workspace)!=null&&N.knowledge)?Q("/",{replaceState:!0}):g().url.pathname.includes("/prompts")&&!((L=(R=(S=s())==null?void 0:S.permissions)==null?void 0:R.workspace)!=null&&L.prompts)?Q("/",{replaceState:!0}):g().url.pathname.includes("/tools")&&(!((T=(C=X())==null?void 0:C.features)!=null&&T.enable_plugins)||!((W=(V=(A
1=s())==null?void 0:A.permissions)==null?void 0:V.workspace)!=null&&W.tools))?Q("/",{replaceState:!0}):g().url.pathname.includes("/skills")&&!((U=(K=(q=s())==null?void 0:q.permissions)==null?void 0:K.workspace)!=null&&U.skills)&&Q("/",{replaceState:!0})),re(Y,!0)}),se(()=>(g(),d(le),ne),()=>{g().url.pathname!==d(le)&&(re(le,g().url.pathname),ne.set([]))}),se(()=>(d(Y),g()),()=>{d(Y)&&g().url.pathname.startsWith("/workspace")&&we()}),se(()=>g(),()=>{re(x,g().url.pathname.split("/")[2]??"")}),se(()=>pe(),()=>{re(ce,pe().filter(p=>p.visible??!0))}),Se(),Te();var me=Ce();Re("q5mosy",p=>{Ee(k=>{Ie.title=` 2 ${k??""} / ${ge()??""} 3 `},[()=>(c(),m(()=>c().t("Workspace")))])});var _e=Ae(me);{var he=p=>{var k=ra(),$=l(k),P=l($),B=l(P);{var j=o=>{var e=Ye(),a=l(e);{let r=Be(()=>(I(),c(),m(()=>I()?c().t("Close Sidebar"):c().t("Open Sidebar"))));Ge(a,{get content(){return d(r)},interactive:!0,children:(t,u)=>{var i=Xe(),v=l(i),ae=l(v);He(ae,{className:"size-4"}),n(v),n(i),M(te=>D(i,"aria-label",te),[()=>(I(),c(),m(()=>I()?c().t("Close Sidebar"):c().t("Open Sidebar")))]),Pe("click",i,()=>{ue.set(!I())}),b(t,i)},$$slots:{default:!0}})}n(e),M(()=>O(e,1,`${I()?"md:hidden":""} self-center flex flex-none items-center`)),b(o,e)};z(B,o=>{fe()&&o(j)})}var N=f(B,2),S=l(N),R=l(S);{var L=o=>{var e=Ze(),a=l(e),r=l(a,!0);n(a);var t=f(a,2),u=l(t,!0);n(t),n(e),M((i,v)=>{D(e,"aria-current",d(x)==="models"?"page":null),O(e,1,`min-w-fit px-1 text-sm inline-flex items-center gap-1 ${d(x)==="models"?"text-gray-900 dark:text-gray-100":"text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white"} transition select-none`),_(r,i),_(u,v)},[()=>(c(),m(()=>c().t("Models"))),()=>(w(),m(()=>G(w().models)))]),b(o,e)};z(R,o=>{s(),m(()=>{var e,a,r,t;return((e=s())==null?void 0:e.role)==="admin"||((t=(r=(a=s())==null?void 0:a.permissions)==null?void 0:r.workspace)==null?void 0:t.models)})&&o(L)})}var C=f(R,2);{var T=o=>{var e=ea(),a=l(e),r=l(a,!0);n(a);var t=f(a,2),u=l(t,!0);n(t),n(e),M((i,v)=>{D(e,"aria-current",d(x)==="knowledge"?"page":null),O(e,1,`min-w-fit px-1 text-sm inline-flex items-center gap-1 ${d(x)==="knowledge"?"text-gray-900 dark:text-gray-100":"text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white"} transition select-none`),_(r,i),_(u,v)},[()=>(c(),m(()=>c().t("Knowledge"))),()=>(w(),m(()=>G(w().knowledge)))]),b(o,e)};z(C,o=>{s(),m(()=>{var e,a,r,t;return((e=s())==null?void 0:e.role)==="admin"||((t=(r=(a=s())==null?void 0:a.permissions)==null?void 0:r.workspace)==null?void 0:t.knowledge)})&&o(T)})}var A=f(C,2);{var V=o=>{var e=aa(),a=l(e),r=l(a,!0);n(a);var t=f(a,2),u=l(t,!0);n(t),n(e),M((i,v)=>{D(e,"aria-current",d(x)==="prompts"?"page":null),O(e,1,`min-w-fit px-1 text-sm inline-flex items-center gap-1 ${d(x)==="prompts"?"text-gray-900 dark:text-gray-100":"text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white"} transition select-none`),_(r,i),_(u,v)},[()=>(c(),m(()=>c().t("Prompts"))),()=>(w(),m(()=>G(w().prompts)))]),b(o,e)};z(A,o=>{s(),m(()=>{var e,a,r,t;return((e=s())==null?void 0:e.role)==="admin"||((t=(r=(a=s())==null?void 0:a.permissions)==null?void 0:r.workspace)==null?void 0:t.prompts)})&&o(V)})}var W=f(A,2);{var q=o=>{var e=ta(),a=l(e),r=l(a,!0);n(a);var t=f(a,2),u=l(t,!0);n(t),n(e),M((i,v)=>{D(e,"aria-current",d(x)==="skills"?"page":null),O(e,1,`min-w-fit px-1 text-sm inline-flex items-center gap-1 ${d(x)==="skills"?"text-gray-900 dark:text-gray-100":"text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white"} transition select-none`),_(r,i),_(u,v)},[()=>(c(),m(()=>c().t("Skills"))),()=>(w(),m(()=>G(w().skills)))]),b(o,e)};z(W,o=>{s(),m(()=>{var e,a,r,t;return((e=s())==null?void 0:e.role)==="admin"||((t=(r=(a=s())==null?void 0:a.permissions)==null?void 0:r.workspace)==null?void 0:t.skills)})&&o(q)})}var K=f(W,2);{var U=o=>{var e=sa(),a=l(e),r=l(a,!0);n(a);var t=f(a,2),u=l(t,!0);n(t),n(e),M((i,v)=>{D(e,"aria-current",d(x)==="tools"?"page":null),O(e,1,`min-w-fit px-1 text-sm inline-flex items-center gap-1 ${d(x)==="tools"?"text-gray-900 dark:text-gray-100":"text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white"} transition select-none`),_(r,i),_(u,v)},[()=>(c(),m(()=>c().t("Tools"))),()=>(w(),m(()=>G(w().tools)))]),b(o,e)};z(K,o=>{X(),s(),m(()=>{var e,a,r,t,u,i;return((a=(e=X())==null?void 0:e.features)==null?void 0:a.enable_plugins)&&(((r=s())==null?void 0:r.role)==="admin"||((i=(u=(t=s())==null?void 0:t.permissions)==null?void 0:u.workspace)==null?void 0:i.tools))})&&o(U)})}n(S);var H=f(S,2),Z=l(H);Je(Z,{get actions(){return d(ce)}}),n(H),n(N),n(P),n($);var J=f($,2),ee=l(J);Ne(ee,ie,"default",{},null),n(J),n(k),M(()=>
3O(k,1,`flex flex-col flex-1 min-w-0 w-full h-screen max-h-[100dvh] transition-width duration-200 ease-in-out ${I()?"md:max-w-[calc(100%-var(--sidebar-width))]":"md:max-w-[calc(100%-42px)]"} max-w-full`)),b(p,k)};z(_e,p=>{d(Y)&&p(he)})}b(ve,me),We(),xe()}export{Sa as component}; 4//# sourceMappingURL=8.DIgNx3wr.js.map
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.