@kahitsan/plugin-sdk 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/flow-bundle.js +1 -0
  2. package/dist/index.d.ts +40 -2
  3. package/dist/index.js +1 -1
  4. package/package.json +1 -1
  5. package/shell/_build/.vite/manifest.json +20 -19
  6. package/shell/_build/.vite/manifest.json.br +0 -0
  7. package/shell/_build/.vite/manifest.json.gz +0 -0
  8. package/shell/_build/assets/{_...slug_-BcdF4l5Z.js → _...slug_-B4-_ue16.js} +1 -1
  9. package/shell/_build/assets/_...slug_-B4-_ue16.js.br +0 -0
  10. package/shell/_build/assets/_...slug_-B4-_ue16.js.gz +0 -0
  11. package/shell/_build/assets/auth-Cej23JxT.js +72 -0
  12. package/shell/_build/assets/auth-Cej23JxT.js.br +0 -0
  13. package/shell/_build/assets/auth-Cej23JxT.js.gz +0 -0
  14. package/shell/_build/assets/client-BC2r94zJ.js +2 -0
  15. package/shell/_build/assets/client-BC2r94zJ.js.br +0 -0
  16. package/shell/_build/assets/client-BC2r94zJ.js.gz +0 -0
  17. package/shell/_build/assets/client-DHSje8fl.css +1 -0
  18. package/shell/_build/assets/client-DHSje8fl.css.br +0 -0
  19. package/shell/_build/assets/client-DHSje8fl.css.gz +0 -0
  20. package/shell/_build/assets/{index-CwObwzl5.js → index-CHZcwpj8.js} +1 -1
  21. package/shell/_build/assets/plugin-ui-CpJUaqcE.js +10 -0
  22. package/shell/_build/assets/plugin-ui-CpJUaqcE.js.br +0 -0
  23. package/shell/_build/assets/plugin-ui-CpJUaqcE.js.gz +0 -0
  24. package/shell/_build/assets/workspace-nav-aH0jw7aW.js +1 -0
  25. package/shell/_build/assets/workspace-nav-aH0jw7aW.js.br +0 -0
  26. package/shell/_build/assets/workspace-nav-aH0jw7aW.js.gz +0 -0
  27. package/shell/_server/assets/app-DHSje8fl.css +1 -0
  28. package/shell/_server/assets/app-DHSje8fl.css.br +0 -0
  29. package/shell/_server/assets/app-DHSje8fl.css.gz +0 -0
  30. package/shell/index.html +1 -1
  31. package/shell/index.html.br +0 -0
  32. package/shell/index.html.gz +0 -0
  33. package/shell/_build/assets/_...slug_-BcdF4l5Z.js.br +0 -0
  34. package/shell/_build/assets/_...slug_-BcdF4l5Z.js.gz +0 -0
  35. package/shell/_build/assets/auth-DnjIzX2B.js +0 -70
  36. package/shell/_build/assets/auth-DnjIzX2B.js.br +0 -0
  37. package/shell/_build/assets/auth-DnjIzX2B.js.gz +0 -0
  38. package/shell/_build/assets/client-BmadCoeU.css +0 -1
  39. package/shell/_build/assets/client-BmadCoeU.css.br +0 -0
  40. package/shell/_build/assets/client-BmadCoeU.css.gz +0 -0
  41. package/shell/_build/assets/client-StEn6jq1.js +0 -2
  42. package/shell/_build/assets/client-StEn6jq1.js.br +0 -0
  43. package/shell/_build/assets/client-StEn6jq1.js.gz +0 -0
  44. package/shell/_build/assets/plugin-ui-CBTroTyb.js +0 -10
  45. package/shell/_build/assets/plugin-ui-CBTroTyb.js.br +0 -0
  46. package/shell/_build/assets/plugin-ui-CBTroTyb.js.gz +0 -0
  47. package/shell/_build/assets/workspace-nav-fkYL3-AV.js +0 -1
  48. package/shell/_build/assets/workspace-nav-fkYL3-AV.js.br +0 -0
  49. package/shell/_build/assets/workspace-nav-fkYL3-AV.js.gz +0 -0
  50. package/shell/_server/assets/app-BmadCoeU.css +0 -1
  51. package/shell/_server/assets/app-BmadCoeU.css.br +0 -0
  52. package/shell/_server/assets/app-BmadCoeU.css.gz +0 -0
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_...slug_-B4-_ue16.js","assets/routing-C6AwqsGL.js","assets/plugin-ui-CpJUaqcE.js","assets/auth-Cej23JxT.js","assets/components-CWmQ2MDX.js","assets/api-keys-BNWgFkG0.js","assets/dashboard-pbkizuaa.js","assets/index-CHZcwpj8.js","assets/workspace-nav-aH0jw7aW.js","assets/login-pbkizuaa.js","assets/members-49i-57sG.js","assets/register-pbkizuaa.js","assets/settings-pbkizuaa.js","assets/users-pbkizuaa.js","assets/workspace-settings-pbkizuaa.js","assets/workspaces-pbkizuaa.js"])))=>i.map(i=>d[i]);
2
+ import{c as Dr,a as de,b as Wr,d as Ur,e as t,m as Y,g as jr,R as qr,u as Fr,s as Lt,f as Vr,S as _,o as rr,h as Br,i as Hr,j as Kr,k as W,l as Ye,n as ot,p as oe,q as Gr,r as Xr,t as Yr,v as Qr,w as Jr,x as Ke,y as V,z as i,A as d,B as nr,C as sr,D as $t,E as wt,F as qe,G as ar,H as _e,I as Q,J as z,K as ie,L as Z,M as ne,N as Me,O as Fe,P as Zr,Q as ir,T as Tt,U as Te,V as zt,W as en,X as tn,Y as rn}from"./routing-C6AwqsGL.js";import{w as nn,c as sn,r as an,u as Ze,f as on,n as ke,e as Ce,d as ln,A as or,M as cn,P as un,a as dn}from"./plugin-ui-CpJUaqcE.js";import{I as H,u as ze,a as fn,b as pn,c as Re,d as lr,s as hn,e as gn,S as vn,B as Rt,F as It,x as Ie,f as et,g as bn,h as mn,i as xn,T as kn,A as _n}from"./auth-Cej23JxT.js";import{b as $n,u as wn,l as yn,a as Sn,m as Cn,c as cr,d as En,e as Mn,i as Nn,f as yt,s as ur,g as Pn}from"./workspace-nav-aH0jw7aW.js";import{A as Ee}from"./components-CWmQ2MDX.js";const lt="Invariant Violation",{setPrototypeOf:An=function(e,n){return e.__proto__=n,e}}=Object;class St extends Error{framesToPop=1;name=lt;constructor(n=lt){super(typeof n=="number"?`${lt}: ${n} (see https://github.com/apollographql/invariant-packages)`:n),An(this,St.prototype)}}function ct(e,n){if(!e)throw new St(n)}const Ln=/^[A-Za-z]:\//;function Tn(e=""){return e&&e.replace(/\\/g,"/").replace(Ln,n=>n.toUpperCase())}const zn=/^[/\\]{2}/,Rn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,In=/^[A-Za-z]:$/,On=function(e){if(e.length===0)return".";e=Tn(e);const n=e.match(zn),r=vt(e),s=e[e.length-1]==="/";return e=Dn(e,!r),e.length===0?r?"/":s?"./":".":(s&&(e+="/"),In.test(e)&&(e+="/"),n?r?`//${e}`:`//./${e}`:r&&!vt(e)?`/${e}`:e)},dr=function(...e){if(e.length===0)return".";let n;for(const r of e)r&&r.length>0&&(n===void 0?n=r:n+=`/${r}`);return n===void 0?".":On(n.replace(/\/\/+/g,"/"))};function Dn(e,n){let r="",s=0,a=-1,o=0,p=null;for(let c=0;c<=e.length;++c){if(c<e.length)p=e[c];else{if(p==="/")break;p="/"}if(p==="/"){if(!(a===c-1||o===1))if(o===2){if(r.length<2||s!==2||r[r.length-1]!=="."||r[r.length-2]!=="."){if(r.length>2){const g=r.lastIndexOf("/");g===-1?(r="",s=0):(r=r.slice(0,g),s=r.length-1-r.lastIndexOf("/")),a=c,o=0;continue}else if(r.length>0){r="",s=0,a=c,o=0;continue}}n&&(r+=r.length>0?"/..":"..",s=2)}else r.length>0?r+=`/${e.slice(a+1,c)}`:r=e.slice(a+1,c),s=c-a-1;a=c,o=0}else p==="."&&o!==-1?++o:o=-1}return r}const vt=function(e){return Rn.test(e)};function Wn(e){return`virtual:${e}`}function Un(e){return e.handler?.endsWith(".html")?vt(e.handler)?e.handler:dr(e.root,e.handler):`$vinxi/handler/${e.name}`}const jn=new Proxy({},{get(e,n){return ct(typeof n=="string","Bundler name should be a string"),{name:n,type:"client",handler:Wn(Un({name:n})),baseURL:"/_build",chunks:new Proxy({},{get(r,s){ct(typeof s=="string","Chunk expected");let a=dr("/_build",s+".mjs");return{import(){return import(a)},output:{path:a}}}}),inputs:new Proxy({},{get(r,s){ct(typeof s=="string","Input must be string");let a=window.manifest[s].output;return{async import(){return import(a)},async assets(){return window.manifest[s].assets},output:{path:a}}}})}}});globalThis.MANIFEST=jn;const qn=e=>n=>{const{base:r}=n,s=Dr(()=>n.children),a=de(()=>Wr(s(),n.base||""));let o;const p=Ur(e,a,()=>o,{base:r,singleFlight:n.singleFlight,transformUrl:n.transformUrl});return e.create&&e.create(p),t(qr.Provider,{value:p,get children(){return t(Fn,{routerState:p,get root(){return n.root},get preload(){return n.rootPreload||n.rootLoad},get children(){return[Y(()=>(o=jr())&&null),t(Vn,{routerState:p,get branches(){return a()}})]}})}})};function Fn(e){const n=e.routerState.location,r=e.routerState.params,s=de(()=>e.preload&&Fr(()=>{Lt(!0),e.preload({params:r,location:n,intent:Vr()||"initial"}),Lt(!1)}));return t(_,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:a=>t(a,{params:r,location:n,get data(){return s()},get children(){return e.children}})})}function Vn(e){const n=[];let r;const s=de(rr(e.routerState.matches,(a,o,p)=>{let c=o&&a.length===o.length;const g=[];for(let l=0,w=a.length;l<w;l++){const b=o&&o[l],$=a[l];p&&b&&$.route.key===b.route.key?g[l]=p[l]:(c=!1,n[l]&&n[l](),Hr(y=>{n[l]=y,g[l]=Kr(e.routerState,g[l-1]||e.routerState.base,Ot(()=>s()[l+1]),()=>{const P=e.routerState.matches();return P[l]??P[0]})}))}return n.splice(a.length).forEach(l=>l()),p&&c?p:(r=g[0],g)}));return Ot(()=>s()&&r)()}const Ot=e=>()=>t(_,{get when(){return e()},keyed:!0,children:n=>t(Br.Provider,{value:n,get children(){return n.outlet()}})});function Bn([e,n],r,s){return[e,s?a=>n(s(a)):n]}function Hn(e){let n=!1;const r=a=>typeof a=="string"?{value:a}:a,s=Bn(W(r(e.get()),{equals:(a,o)=>a.value===o.value&&a.state===o.state}),void 0,a=>(!n&&e.set(a),ot.registry&&!ot.done&&(ot.done=!0),a));return e.init&&Ye(e.init((a=e.get())=>{n=!0,s[1](r(a)),n=!1})),qn({signal:s,create:e.create,utils:e.utils})}function Kn(e,n,r){return e.addEventListener(n,r),()=>e.removeEventListener(n,r)}function Gn(e,n){const r=e&&document.getElementById(e);r?r.scrollIntoView():n&&window.scrollTo(0,0)}const Xn=new Map;function Yn({preload:e=!0,explicitLinks:n=!1,actionBase:r="/_server",transformUrl:s}={}){return a=>{const o=a.base.path(),p=a.navigatorFactory(a.base);let c,g;function l(v){return v.namespaceURI==="http://www.w3.org/2000/svg"}function w(v){if(v.defaultPrevented||v.button!==0||v.metaKey||v.altKey||v.ctrlKey||v.shiftKey)return;const M=v.composedPath().find(S=>S instanceof Node&&S.nodeName.toUpperCase()==="A");if(!M||n&&!M.hasAttribute("link"))return;const C=l(M),x=C?M.href.baseVal:M.href;if((C?M.target.baseVal:M.target)||!x&&!M.hasAttribute("state"))return;const m=(M.getAttribute("rel")||"").split(/\s+/);if(M.hasAttribute("download")||m&&m.includes("external"))return;const h=C?new URL(x,document.baseURI):new URL(x);if(!(h.origin!==window.location.origin||o&&h.pathname&&!h.pathname.toLowerCase().startsWith(o.toLowerCase())))return[M,h]}function b(v){const M=w(v);if(!M)return;const[C,x]=M,N=a.parsePath(x.pathname+x.search+x.hash),m=C.getAttribute("state");v.preventDefault(),p(N,{resolve:!1,replace:C.hasAttribute("replace"),scroll:!C.hasAttribute("noscroll"),state:m?JSON.parse(m):void 0})}function $(v){const M=w(v);if(!M)return;const[C,x]=M;s&&(x.pathname=s(x.pathname)),a.preloadRoute(x,C.getAttribute("preload")!=="false")}function y(v){clearTimeout(c);const M=w(v);if(!M)return g=null;const[C,x]=M;g!==C&&(s&&(x.pathname=s(x.pathname)),c=setTimeout(()=>{a.preloadRoute(x,C.getAttribute("preload")!=="false"),g=C},20))}function P(v){if(v.defaultPrevented)return;let M=v.submitter&&v.submitter.hasAttribute("formaction")?v.submitter.getAttribute("formaction"):v.target.getAttribute("action");if(!M)return;if(!M.startsWith("https://action/")){const x=new URL(M,Gr);if(M=a.parsePath(x.pathname+x.search),!M.startsWith(r))return}if(v.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const C=Xn.get(M);if(C){v.preventDefault();const x=new FormData(v.target,v.submitter);C.call({r:a,f:v.target},v.target.enctype==="multipart/form-data"?x:new URLSearchParams(x))}}oe(["click","submit"]),document.addEventListener("click",b),e&&(document.addEventListener("mousemove",y,{passive:!0}),document.addEventListener("focusin",$,{passive:!0}),document.addEventListener("touchstart",$,{passive:!0})),document.addEventListener("submit",P),Ye(()=>{document.removeEventListener("click",b),e&&(document.removeEventListener("mousemove",y),document.removeEventListener("focusin",$),document.removeEventListener("touchstart",$)),document.removeEventListener("submit",P)})}}function Qn(e){const n=()=>{const s=window.location.pathname.replace(/^\/+/,"/")+window.location.search,a=window.history.state&&window.history.state._depth&&Object.keys(window.history.state).length===1?void 0:window.history.state;return{value:s+window.location.hash,state:a}},r=Qr();return Hn({get:n,set({value:s,replace:a,scroll:o,state:p}){a?window.history.replaceState(Xr(p),"",s):window.history.pushState(p,"",s),Gn(decodeURIComponent(window.location.hash.slice(1)),o),Yr()},init:s=>Kn(window,"popstate",Jr(s,a=>{if(a)return!r.confirm(a);{const o=n();return!r.confirm(o.value,{state:o.state})}})),create:Yn({preload:e.preload,explicitLinks:e.explicitLinks,actionBase:e.actionBase,transformUrl:e.transformUrl}),utils:{go:s=>window.history.go(s),beforeLeave:r}})(e)}function Jn(e){e.forEach(n=>{if(!n.attrs.href)return;let r=document.head.querySelector(`link[href="${n.attrs.href}"]`);r||(r=document.createElement("link"),r.setAttribute("rel","preload"),r.setAttribute("as","style"),r.setAttribute("href",n.attrs.href),document.head.appendChild(r))})}var Zn=d("<style>"),es=d("<link>"),ts=d("<script> "),rs=d("<noscript>");const ns={style:e=>(()=>{var n=Zn();return Ke(n,V(()=>e.attrs),!1,!0),i(n,()=>e.children),n})(),link:e=>(()=>{var n=es();return Ke(n,V(()=>e.attrs),!1,!1),n})(),script:e=>e.attrs.src?(()=>{var n=ts();return Ke(n,V(()=>e.attrs,{get id(){return e.key}}),!1,!0),n})():null,noscript:e=>(()=>{var n=rs();return Ke(n,V(()=>e.attrs),!1,!0),n})()};function ss(e,n){let{tag:r,attrs:{key:s,...a}={key:void 0},children:o}=e;return ns[r]({attrs:{...a,nonce:n},key:s,children:o})}function as(e,n,r,s="default"){return nr(async()=>{{const o=(await e.import())[s],c=(await n.inputs?.[e.src].assets()).filter(l=>l.tag==="style"||l.attrs.rel==="stylesheet");return typeof window<"u"&&Jn(c),{default:l=>[...c.map(w=>ss(w)),t(o,l)]}}})}const Ae={NORMAL:0,WILDCARD:1,PLACEHOLDER:2};function is(e={}){const n={options:e,rootNode:fr(),staticRoutesMap:{}},r=s=>e.strictTrailingSlash?s:s.replace(/\/$/,"")||"/";if(e.routes)for(const s in e.routes)Dt(n,r(s),e.routes[s]);return{ctx:n,lookup:s=>os(n,r(s)),insert:(s,a)=>Dt(n,r(s),a),remove:s=>ls(n,r(s))}}function os(e,n){const r=e.staticRoutesMap[n];if(r)return r.data;const s=n.split("/"),a={};let o=!1,p=null,c=e.rootNode,g=null;for(let l=0;l<s.length;l++){const w=s[l];c.wildcardChildNode!==null&&(p=c.wildcardChildNode,g=s.slice(l).join("/"));const b=c.children.get(w);if(b===void 0){if(c&&c.placeholderChildren.length>1){const $=s.length-l;c=c.placeholderChildren.find(y=>y.maxDepth===$)||null}else c=c.placeholderChildren[0]||null;if(!c)break;c.paramName&&(a[c.paramName]=w),o=!0}else c=b}return(c===null||c.data===null)&&p!==null&&(c=p,a[c.paramName||"_"]=g,o=!0),c?o?{...c.data,params:o?a:void 0}:c.data:null}function Dt(e,n,r){let s=!0;const a=n.split("/");let o=e.rootNode,p=0;const c=[o];for(const g of a){let l;if(l=o.children.get(g))o=l;else{const w=cs(g);l=fr({type:w,parent:o}),o.children.set(g,l),w===Ae.PLACEHOLDER?(l.paramName=g==="*"?`_${p++}`:g.slice(1),o.placeholderChildren.push(l),s=!1):w===Ae.WILDCARD&&(o.wildcardChildNode=l,l.paramName=g.slice(3)||"_",s=!1),c.push(l),o=l}}for(const[g,l]of c.entries())l.maxDepth=Math.max(c.length-g,l.maxDepth||0);return o.data=r,s===!0&&(e.staticRoutesMap[n]=o),o}function ls(e,n){let r=!1;const s=n.split("/");let a=e.rootNode;for(const o of s)if(a=a.children.get(o),!a)return r;if(a.data){const o=s.at(-1)||"";a.data=null,Object.keys(a.children).length===0&&a.parent&&(a.parent.children.delete(o),a.parent.wildcardChildNode=null,a.parent.placeholderChildren=[]),r=!0}return r}function fr(e={}){return{type:e.type||Ae.NORMAL,maxDepth:0,parent:e.parent||null,children:new Map,data:e.data||null,paramName:e.paramName||null,wildcardChildNode:null,placeholderChildren:[]}}function cs(e){return e.startsWith("**")?Ae.WILDCARD:e[0]===":"||e==="*"?Ae.PLACEHOLDER:Ae.NORMAL}const us="modulepreload",ds=function(e){return"/_build/"+e},Wt={},ve=function(n,r,s){let a=Promise.resolve();if(r&&r.length>0){let p=function(l){return Promise.all(l.map(w=>Promise.resolve(w).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),g=c?.nonce||c?.getAttribute("nonce");a=p(r.map(l=>{if(l=ds(l),l in Wt)return;Wt[l]=!0;const w=l.endsWith(".css"),b=w?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${b}`))return;const $=document.createElement("link");if($.rel=w?"stylesheet":us,w||($.as="script"),$.crossOrigin="",$.href=l,g&&$.setAttribute("nonce",g),document.head.appendChild($),w)return new Promise((y,P)=>{$.addEventListener("load",y),$.addEventListener("error",()=>P(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(p){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=p,window.dispatchEvent(c),!c.defaultPrevented)throw p}return a.then(p=>{for(const c of p||[])c.status==="rejected"&&o(c.reason);return n().catch(o)})},pr=[{page:!0,$component:{src:"src/routes/[...slug].tsx?pick=default&pick=$css",build:()=>ve(()=>import("./_...slug_-B4-_ue16.js"),__vite__mapDeps([0,1,2,3,4])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/[...slug].tsx?pick=default&pick=$css"].output.path))},path:"/*slug",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/[...slug].tsx"},{page:!0,$component:{src:"src/routes/api-keys.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./api-keys-BNWgFkG0.js"),__vite__mapDeps([5,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/api-keys.tsx?pick=default&pick=$css"].output.path))},path:"/api-keys",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/api-keys.tsx"},{page:!0,$component:{src:"src/routes/dashboard.tsx?pick=thisWeekToken&pick=thisYearToken&pick=default&pick=$css",build:()=>ve(()=>import("./dashboard-pbkizuaa.js"),__vite__mapDeps([6,4,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/dashboard.tsx?pick=thisWeekToken&pick=thisYearToken&pick=default&pick=$css"].output.path))},path:"/dashboard",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/dashboard.tsx"},{page:!0,$component:{src:"src/routes/index.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./index-CHZcwpj8.js"),__vite__mapDeps([7,1,3,4,8])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/index.tsx?pick=default&pick=$css"].output.path))},path:"/",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/index.tsx"},{page:!0,$component:{src:"src/routes/login.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./login-pbkizuaa.js"),__vite__mapDeps([9,4,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/login.tsx?pick=default&pick=$css"].output.path))},path:"/login",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/login.tsx"},{page:!0,$component:{src:"src/routes/members.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./members-49i-57sG.js"),__vite__mapDeps([10,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/members.tsx?pick=default&pick=$css"].output.path))},path:"/members",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/members.tsx"},{page:!0,$component:{src:"src/routes/register.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./register-pbkizuaa.js"),__vite__mapDeps([11,4,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/register.tsx?pick=default&pick=$css"].output.path))},path:"/register",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/register.tsx"},{page:!0,$component:{src:"src/routes/settings.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./settings-pbkizuaa.js"),__vite__mapDeps([12,4,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/settings.tsx?pick=default&pick=$css"].output.path))},path:"/settings",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/settings.tsx"},{page:!0,$component:{src:"src/routes/users.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./users-pbkizuaa.js"),__vite__mapDeps([13,4,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/users.tsx?pick=default&pick=$css"].output.path))},path:"/users",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/users.tsx"},{page:!0,$component:{src:"src/routes/workspace-settings.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./workspace-settings-pbkizuaa.js"),__vite__mapDeps([14,4,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/workspace-settings.tsx?pick=default&pick=$css"].output.path))},path:"/workspace-settings",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/workspace-settings.tsx"},{page:!0,$component:{src:"src/routes/workspaces.tsx?pick=default&pick=$css",build:()=>ve(()=>import("./workspaces-pbkizuaa.js"),__vite__mapDeps([15,4,1])),import:(()=>import(globalThis.MANIFEST.client.inputs["src/routes/workspaces.tsx?pick=default&pick=$css"].output.path))},path:"/workspaces",filePath:"/home/runner/work/plugin-sdk/plugin-sdk/shell-src/src/routes/workspaces.tsx"}],fs=ps(pr.filter(e=>e.page));function ps(e){function n(r,s,a,o){const p=Object.values(r).find(c=>a.startsWith(c.id+"/"));return p?(n(p.children||(p.children=[]),s,a.slice(p.id.length)),r):(r.push({...s,id:a,path:a.replace(/\([^)/]+\)/g,"").replace(/\/+/g,"/")}),r)}return e.sort((r,s)=>r.path.length-s.path.length).reduce((r,s)=>n(r,s,s.path,s.path),[])}function hs(e){return e.$HEAD||e.$GET||e.$POST||e.$PUT||e.$PATCH||e.$DELETE}is({routes:pr.reduce((e,n)=>{if(!hs(n))return e;let r=n.path.replace(/\([^)/]+\)/g,"").replace(/\/+/g,"/").replace(/\*([^/]*)/g,(s,a)=>`**:${a}`).split("/").map(s=>s.startsWith(":")||s.startsWith("*")?s:encodeURIComponent(s)).join("/");if(/:[^/]*\?/g.test(r))throw new Error(`Optional parameters are not supported in API routes: ${r}`);if(e[r])throw new Error(`Duplicate API routes for "${r}" found at "${e[r].route.path}" and "${n.path}"`);return e[r]={route:n},e},{})});function gs(){function e(r){return{...r,...r.$$route?r.$$route.require().route:void 0,info:{...r.$$route?r.$$route.require().route.info:{},filesystem:!0},component:r.$component&&as(r.$component,globalThis.MANIFEST.client,globalThis.MANIFEST.ssr),children:r.children?r.children.map(e):void 0}}return fs.map(e)}let Ut;const vs=()=>Ut||(Ut=gs());var bs=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ms=e=>t(H,V(e,{iconNode:bs,name:"plus"})),hr=ms,xs=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ks=e=>t(H,V(e,{iconNode:xs,name:"triangle-alert"})),_s=ks;function $s(e){e&&queueMicrotask(()=>{const n='input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])',r='input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled])',s=e.querySelector("[data-autofocus]");if(s){if(s.matches(n)){s.focus();return}const p=s.querySelector(n);if(p){p.focus();return}}const a=e.querySelector(r);if(a){a.focus();return}e.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')?.focus()})}var ws=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ys=e=>t(H,V(e,{iconNode:ws,name:"check"})),je=ys,Ss=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Cs=e=>t(H,V(e,{iconNode:Ss,name:"chevron-left"})),Es=Cs,Ms=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ns=e=>t(H,V(e,{iconNode:Ms,name:"chevron-right"})),Ps=Ns,As=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Ls=e=>t(H,V(e,{iconNode:As,name:"clock"})),Ts=Ls,zs=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Rs=e=>t(H,V(e,{iconNode:zs,name:"search"})),Ct=Rs,Is=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Os=e=>t(H,V(e,{iconNode:Is,name:"calendar-days"})),Ds=Os,Ws=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],Us=e=>t(H,V(e,{iconNode:Ws,name:"store"})),js=Us,qs=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Fs=e=>t(H,V(e,{iconNode:qs,name:"trash-2"})),Vs=Fs,Bs=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Hs=e=>t(H,V(e,{iconNode:Bs,name:"package"})),Ks=Hs,Gs=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],Xs=e=>t(H,V(e,{iconNode:Gs,name:"at-sign"})),Ys=Xs,Qs=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],Js=e=>t(H,V(e,{iconNode:Qs,name:"boxes"})),gr=Js,Zs=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ea=e=>t(H,V(e,{iconNode:Zs,name:"circle-alert"})),ta=ea,ra=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],na=e=>t(H,V(e,{iconNode:ra,name:"circle-slash"})),sa=na,aa=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],ia=e=>t(H,V(e,{iconNode:aa,name:"clipboard-list"})),oa=ia,la=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],ca=e=>t(H,V(e,{iconNode:la,name:"corner-down-right"})),ua=ca,da=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],fa=e=>t(H,V(e,{iconNode:da,name:"ellipsis"})),pa=fa,ha=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ga=e=>t(H,V(e,{iconNode:ha,name:"eye"})),va=ga,ba=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ma=e=>t(H,V(e,{iconNode:ba,name:"file-text"})),xa=ma,ka=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],_a=e=>t(H,V(e,{iconNode:ka,name:"inbox"})),vr=_a,$a=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wa=e=>t(H,V(e,{iconNode:$a,name:"info"})),ya=wa,Sa=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Ca=e=>t(H,V(e,{iconNode:Sa,name:"key-round"})),Ea=Ca,Ma=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Na=e=>t(H,V(e,{iconNode:Ma,name:"message-square"})),Pa=Na,Aa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],La=e=>t(H,V(e,{iconNode:Aa,name:"panel-left-close"})),Ta=La,za=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Ra=e=>t(H,V(e,{iconNode:za,name:"panel-left"})),Ia=Ra,Oa=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Da=e=>t(H,V(e,{iconNode:Oa,name:"pencil"})),Wa=Da,Ua=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ja=e=>t(H,V(e,{iconNode:Ua,name:"refresh-cw"})),qa=ja,Fa=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Va=e=>t(H,V(e,{iconNode:Fa,name:"settings"})),br=Va,Ba=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],Ha=e=>t(H,V(e,{iconNode:Ba,name:"shopping-cart"})),Ka=Ha,Ga=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Xa=e=>t(H,V(e,{iconNode:Ga,name:"sliders-horizontal"})),Ya=Xa,Qa=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ja=e=>t(H,V(e,{iconNode:Qa,name:"trophy"})),Za=Ja,ei=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],ti=e=>t(H,V(e,{iconNode:ei,name:"users"})),ri=ti,ni=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],si=e=>t(H,V(e,{iconNode:ni,name:"volume-2"})),ai=si,ii=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],oi=e=>t(H,V(e,{iconNode:ii,name:"volume-x"})),li=oi;async function ci(e){if(!e)return new Set;const n=await fetch("/api/capabilities",{credentials:"include",headers:{"X-Workspace-Id":String(e)}});if(!n.ok)return new Set;const r=await n.json();return new Set(r.capabilities.filter(s=>s.enabled).map(s=>s.key))}const mr=$t(()=>new Set),ui=e=>{const{activeWorkspace:n}=ze(),[r]=sr(()=>n()?.ws_id,ci),s=()=>r()??new Set;return t(mr.Provider,{value:s,get children(){return e.children}})};function di(){return wt(mr)}const xr=$t();let ut=100;const dt=e=>n=>n.map(r=>r.id===e?{...r,leaving:!0}:r),ft=e=>n=>n.filter(r=>r.id!==e);function jt(e){return e==="achievement"?"achievement":e==="info"?"system":"message"}const fi=e=>{const[n,r]=W([]),[s,a]=W([]),o=()=>s().filter(v=>v.unread).length,p=(v,M,C,x)=>{const N=++ut,m=v==="achievement"?4500:3500;r(h=>[...h,{id:N,type:v,title:M,desc:C,dur:m,leaving:!1}]),a(h=>[{id:N,type:v,category:x?.category??jt(v),title:M,desc:C,time:"now",unread:!0,source:x?.source,contextUrl:x?.contextUrl},...h]),setTimeout(()=>r(dt(N)),m),setTimeout(()=>r(ft(N)),m+240)},c=v=>{r(dt(v)),setTimeout(()=>r(ft(v)),240)},g=(v,M,C)=>{const x=++ut,N=v==="achievement"?4500:3500;r(m=>[...m,{id:x,type:v,title:M,desc:C,dur:N,leaving:!1}]),setTimeout(()=>r(dt(x)),N),setTimeout(()=>r(ft(x)),N+240)},l=v=>{a(M=>M.map(C=>C.id===v?{...C,unread:!1}:C))},w=()=>{a(v=>v.map(M=>({...M,unread:!1})))},b=()=>{a(v=>v.filter(M=>M.unread))},$=(v,M,C,x)=>{const N=++ut;a(m=>[{id:N,type:v,category:x?.category??jt(v),title:M,desc:C,time:x?.time??"now",unread:x?.unread??!0,source:x?.source,contextUrl:x?.contextUrl},...m])},y=v=>{a(M=>M.filter(C=>C.id!==v))},P=()=>{a([])};return t(xr.Provider,{value:{toasts:n,notifications:s,unreadCount:o,pushToast:p,pushToastOnly:g,addNotification:$,dismissToast:c,markRead:l,markAllRead:w,clearRead:b,dismiss:y,resetNotifications:P},get children(){return e.children}})};function pi(){const e=wt(xr);if(!e)throw new Error("useNotifications must be used within NotificationProvider");return e}const hi={boxes:gr,"key-round":Ea,users:ri,"building-2":En,receipt:an,package:Ks,"calendar-days":Ds,"file-text":xa,"credit-card":sn,"clipboard-list":oa,"message-square":Pa,wallet:nn,"shopping-cart":Ka,clock:Ts,store:js,"layout-dashboard":cr,megaphone:Cn,activity:Sn,"layout-grid":yn,"users-round":wn,"book-open":$n},pt=gr,qt=new Map,gi=/^[a-z][a-z0-9-]{0,40}$/;function bt(e){if(!e)return pt;const n=hi[e];if(n)return n;if(!gi.test(e))return pt;let r=qt.get(e);return r||(r=nr(async()=>{try{return{default:(await ve(()=>import(`lucide-solid/icons/${e}`),[])).default}}catch{return{default:pt}}}),qt.set(e,r)),r}function vi(e){const n=r=>({href:r.path??"",label:r.label,icon:bt(r.icon),capability:r.capability,requiredPermission:r.requiredPermission,children:r.type==="group"?(r.children??[]).map(n):void 0});return e.map(r=>r.type==="group"?{kind:"section",id:r.id??"",label:r.label,icon:bt(r.icon),items:(r.children??[]).map(n)}:n(r))}function bi(e){const n=e.navTree();return n?vi(n):Mn(e.plugins().filter(r=>r.nav).map(r=>({href:r.href,label:r.nav.label,icon:bt(r.nav.icon),capability:r.capabilityKey,requiredPermission:r.navPermission??void 0,section:r.nav.section??void 0,order:r.nav.order??void 0})))}const kr=$t(),mi=e=>{const n=qe(),r=ar();fn();const{theme:s,toggleTheme:a,mode:o,setThemeMode:p}=pn(),c=pi(),g=typeof window<"u"?window.matchMedia("(max-width: 819px)"):null,[l,w]=W(g?.matches??!1);g&&g.addEventListener("change",A=>w(A.matches));const b=typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)"):null,[$,y]=W(b?.matches??!1);b&&b.addEventListener("change",A=>y(A.matches));const[P,v]=W(null),M=()=>{const A=P();return A===null?l():A},C=()=>{v(!M()),it()},[x,N]=W("root"),[m,h]=W("in"),[S,I]=W(""),[R,E]=W(!0),[O,X]=W(null),[ee,se]=W(0),[fe,re]=W(!1),[le,ce]=W(!1),[ge,f]=W(!1),[u,k]=W(!1),[L,T]=W(""),B=Re(),{activeWorkspace:q,setActiveWsId:D}=ze(),F=lr(),K=()=>B()?.user?.role==="superuser",U=()=>q(),J=()=>B()?.workspaces??[],ue=()=>U()?.ws_role,Oe=()=>J().length>1,tt=de(()=>{const A=L().trim().toLowerCase();return A?J().filter(j=>j.ws_name.toLowerCase().includes(A)):J()}),De=()=>J().length>2,rt=()=>{if(K())return"superuser";const A=U()?.ws_role_names??[];return A.length===0?"":A.length===1?A[0]:`${A.length} roles`},nt=di(),me=Ze(),Ne=de(()=>bi(me)),ye=()=>gn(me.activeThemeVariants(),o()),xe=A=>Pn(A,K(),ue(),F.has,j=>nt().has(j)),Se=de(()=>{const A=B()?.devMode===!0,j=[],ae=[];for(const G of Ne())if(Nn(G)){const pe=G.items.filter(be=>xe(be));pe.length>0&&j.push({section:G,visibleItems:pe})}else if(xe(G)){if(A&&G.href==="/dashboard")continue;ae.push(G)}return{sections:j,items:ae}}),Pe=()=>S().trim().toLowerCase(),We=A=>{const j=S().trim();if(!j)return[{text:A,match:!1}];const ae=A.toLowerCase().indexOf(j.toLowerCase());return ae===-1?[{text:A,match:!1}]:[{text:A.slice(0,ae),match:!1},{text:A.slice(ae,ae+j.length),match:!0},{text:A.slice(ae+j.length),match:!1}].filter(G=>G.text.length>0)},$e=A=>{const j=Pe();return j?A.toLowerCase().includes(j):!0},st=de(()=>{if(!Pe())return[];const j=[];for(const G of Se().sections){const pe=G.visibleItems.filter(be=>$e(be.label)).map(be=>({item:be,section:G.section.label}));($e(G.section.label)||pe.length>0)&&j.push({section:{id:G.section.id,label:G.section.label,icon:G.section.icon},items:pe})}const ae=Se().items.filter(G=>$e(G.label)).map(G=>({item:G,section:"Workspace"}));if(ae.length>0&&j.unshift({section:{id:"_root",label:"Workspace",icon:cr},items:ae}),K()){const G=yt.filter(pe=>$e(pe.label)).map(pe=>({item:pe,section:"Platform"}));G.length>0&&j.push({section:{id:"_platform",label:"Platform",icon:ur},items:G})}return j}),Ve=de(()=>{const A=x();return A==="root"?null:Se().sections.find(j=>j.section.id===A)??null}),Mt=de(()=>{for(const A of Se().sections)if(A.visibleItems.some(j=>Be(j)))return A.section.id;return null});let Nt="";_e(()=>{if(!B()?.devMode)return;const A=n.pathname,j=Mt();j&&A!==Nt&&(Nt=A,h("in"),N(j))});const Mr=A=>n.pathname===A,Be=A=>A.href&&(n.pathname===A.href||n.pathname.startsWith(A.href+"/"))?!0:A.children?.some(j=>Be(j))??!1,Nr=A=>A.items.some(j=>Be(j));let we;const He=A=>{if(R())try{we=we||new(window.AudioContext||window.webkitAudioContext),we.state==="suspended"&&we.resume(),A.forEach((j,ae)=>{const G=we.createOscillator(),pe=we.createGain();G.type="square",G.frequency.value=j;const be=we.currentTime+ae*.07;pe.gain.setValueAtTime(1e-4,be),pe.gain.exponentialRampToValueAtTime(.06,be+.004),pe.gain.exponentialRampToValueAtTime(1e-4,be+.07),G.connect(pe),pe.connect(we.destination),G.start(be),G.stop(be+.08)})}catch{}},Pr=()=>He([760]),at=()=>He([620]),Pt=()=>He([360]),At=()=>He([520]),Ar=A=>{h("in"),N(A),At()},Lr=()=>{h("out"),N("root"),Pt()},Tr=A=>{r(A),X(null),I(""),at()},zr=A=>{r(A),N("root"),h("out"),I(""),k(!1),X(null),at()},it=()=>{ce(!1),re(!1),X(null),f(!1),k(!1),I("")},Rr=A=>{if(B()?.devMode){D(A.ws_id),ce(!1),fetch("/api/_dev/view-as",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({workspaceId:A.ws_id})}).then(()=>window.location.reload()).catch(()=>window.location.reload());return}D(A.ws_id),ce(!1),T(""),c.resetNotifications(),r("/",{replace:!0})},Ir=async()=>{await hn()};if(typeof window<"u"){const A=j=>{(j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"&&(j.preventDefault(),M()?(k(ae=>!ae),ce(!1),re(!1),X(null)):document.querySelector("[data-sidebar-search]")?.focus()),j.key==="Escape"&&(I(""),it())};document.addEventListener("keydown",A),Ye(()=>document.removeEventListener("keydown",A))}if(typeof window<"u"){const A=j=>{const ae=j.target;ae&&(ae.closest("[data-user-menu]")||f(!1))};document.addEventListener("click",A),Ye(()=>document.removeEventListener("click",A))}const Or={theme:s,toggleTheme:a,themeMode:o,setThemeMode:p,themeVariantOptions:ye,notifCtx:c,reducedMotion:$,collapsed:M,toggleCollapse:C,level:x,dir:m,query:S,setQuery:I,soundOn:R,setSoundOn:E,flyoutId:O,setFlyoutId:X,flyoutTop:ee,setFlyoutTop:se,notifOpen:fe,setNotifOpen:re,wsOpen:le,setWsOpen:ce,userMenuOpen:ge,setUserMenuOpen:f,searchFlyoutOpen:u,setSearchFlyoutOpen:k,wsQuery:L,setWsQuery:T,me:B,perms:F,isSuperuser:K,currentWorkspace:U,allWorkspaces:J,workspaceRole:ue,hasMultipleOrgs:Oe,filteredWorkspaces:tt,showWorkspaceSearch:De,displayRole:rt,navEntries:Ne,canSee:xe,visibleEntries:Se,queryTrimmed:Pe,highlightSegments:We,matchesQuery:$e,nestedSearchResults:st,currentSection:Ve,activeParent:Mt,isActive:Mr,isActiveOrChild:Be,sectionContainsActive:Nr,tickHover:Pr,tickClick:at,tickBack:Pt,tickSection:At,goInto:Ar,goBack:Lr,choose:Tr,chooseResult:zr,closeAllPops:it,switchWorkspace:Rr,handleLogout:Ir};return t(kr.Provider,{value:Or,get children(){return e.children}})},he=()=>{const e=wt(kr);if(!e)throw new Error("useSidebarState must be used within a SidebarStateProvider");return e},te={"clip-path":"polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px)"},Qe={success:{icon:je,ring:"border-emerald-500/50",dot:"bg-emerald-400",text:"text-emerald-300"},info:{icon:ya,ring:"border-sky-500/50",dot:"bg-sky-400",text:"text-sky-300"},warning:{icon:_s,ring:"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_50%,transparent)]",dot:"bg-[var(--ks-accent,#fbbf24)]",text:"text-[var(--ks-accent,#fbbf24)]"},error:{icon:ta,ring:"border-red-500/50",dot:"bg-red-400",text:"text-red-300"},achievement:{icon:Za,ring:"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_70%,transparent)]",dot:"bg-[var(--ks-accent,#fbbf24)]",text:"text-[var(--ks-accent,#fbbf24)]"}},xi={admin:"text-[var(--ks-accent,#fbbf24)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)] border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_20%,transparent)]",accountant:"text-blue-400 bg-blue-500/10 border-blue-500/20",director:"text-emerald-400 bg-emerald-500/10 border-emerald-500/20",office_staff:"text-cyan-400 bg-cyan-500/10 border-cyan-500/20",workspace_member:"text-[var(--ks-fg,#ffffff)] bg-[color-mix(in_srgb,var(--ks-surface-sunken,#141414)_30%,transparent)] border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_30%,transparent)]",superuser:"text-red-400 bg-red-500/10 border-red-500/20"},ki=e=>{const n=e.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():e.slice(0,2).toUpperCase()};var _i=d('<button type=button class="text-[10px] text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_90%,transparent)] hover:text-[var(--ks-accent,#fbbf24)] cursor-pointer">Mark all read'),$i=d('<div class="fixed z-50 w-[252px] bg-[var(--ks-surface,#0f0f0f)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)]"role=dialog aria-label="Workspace Inbox"style=top:8px><div class="flex items-center justify-between px-3 py-2 border-b border-[color-mix(in_srgb,var(--ks-border,#27272a)_70%,transparent)]"><span class="text-[12px] font-semibold text-[var(--ks-fg,#ffffff)]">Workspace Inbox</span></div><div class="max-h-[280px] overflow-y-auto">'),wi=d('<div><div class="min-w-0 flex-1"><p class="text-[12px] text-[var(--ks-fg,#ffffff)] leading-tight truncate"></p><p class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] truncate"></p></div><span class="text-[10px] text-[var(--ks-fg-subtle,#71717a)] shrink-0">');const yi=()=>{const{notifOpen:e,collapsed:n,reducedMotion:r,notifCtx:s,setNotifOpen:a}=he();return t(_,{get when(){return e()},get children(){var o=$i(),p=o.firstChild;p.firstChild;var c=p.nextSibling;return i(p,t(_,{get when(){return s.unreadCount()>0},get children(){var g=_i();return g.$$click=()=>s.markAllRead(),g}}),null),i(c,t(Q,{get each(){return s.notifications()},children:g=>{const l=Qe[g.type]??Qe.info,w=l.icon;return(()=>{var b=wi(),$=b.firstChild,y=$.firstChild,P=y.nextSibling,v=$.nextSibling;return i(b,t(w,{size:15,get class(){return`shrink-0 mt-0.5 ${l.text}`}}),$),i(y,()=>g.title),i(P,()=>g.desc),i(v,()=>g.time),z(()=>ie(b,`flex gap-2.5 px-3 py-2.5 border-b border-[color-mix(in_srgb,var(--ks-border,#27272a)_40%,transparent)] ${g.unread?"bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_4%,transparent)]":""}`)),b})()}})),i(o,t(Ee,{href:"/inbox",onClick:()=>a(!1),class:"block w-full text-center text-[11px] text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-fg,#ffffff)] py-2",children:"View all"}),null),z(g=>Z(o,{left:n()?"80px":"264px",...te,...r()?{}:{animation:"pop .14s ease"}},g)),o}})};oe(["click"]);var Si=d('<div class="text-xs text-red-400 bg-red-500/10 border border-red-500/20 rounded p-3 mb-4">Only workspace admins can edit permissions.'),Ci=d('<div class="text-xs text-[var(--ks-fg-subtle,#71717a)] text-center py-10">Loading…'),Ei=d("<div class=space-y-3>"),Mi=d('<span class="text-[11px] text-[var(--ks-fg-subtle,#71717a)]">Pick a role to start granting permissions'),Ni=d('<div class="mt-4 flex items-center gap-2">'),Pi=d('<div class="mt-4 p-2 rounded bg-red-500/10 border border-red-500/20 text-red-400 text-xs">'),Ai=d(`<div class="flex flex-col min-h-0"><div class="flex-1 overflow-x-hidden overflow-y-auto p-5"><div class="flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_20%,transparent)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_5%,transparent)] p-3 mb-4"><div class="text-[11px] text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_90%,transparent)] leading-relaxed"><span class="font-medium text-[var(--ks-accent,#fbbf24)]">Admin</span> is a built-in role for every workspace. Admins of <span class=text-[var(--ks-accent,#fde68a)]></span> always have full access to this page, so there's nothing to configure for them here.</div></div></div><div class="flex items-center justify-between gap-2 p-4 border-t border-[var(--ks-border,#27272a)]"><div class="flex items-center gap-2">`),Li=d('<div class="rounded-lg border border-dashed border-[var(--ks-border,#27272a)] bg-[color-mix(in_srgb,var(--ks-surface,#0f0f0f)_30%,transparent)] p-6 text-center mb-4"><p class="text-xs text-[var(--ks-fg-subtle,#71717a)] mb-3">No roles are configured for this page yet. Admins always have access; add a role below to grant additional access.'),Ti=d('<div class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] mt-0.5">'),zi=d('<div class="mt-3 pt-3 border-t border-[var(--ks-border,#27272a)] grid grid-cols-1 sm:grid-cols-2 gap-2">'),Ri=d('<div class="rounded-lg border border-[var(--ks-border,#27272a)] bg-[color-mix(in_srgb,var(--ks-surface,#0f0f0f)_40%,transparent)] p-4"><div class="flex items-start justify-between gap-3 mb-3"><div class=min-w-0><div class="text-sm font-medium text-[var(--ks-fg,#ffffff)] truncate"></div></div><div class="flex items-center gap-2 shrink-0"><div class="inline-flex rounded-md border border-[var(--ks-border-strong,#3f3f46)] overflow-hidden text-[11px]"></div><button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-red-400 transition-colors cursor-pointer">'),Ii=d('<span class="block text-[10px] text-[var(--ks-fg-subtle,#71717a)] mt-0.5">'),Oi=d('<label class="flex items-start gap-2 p-2 rounded border border-[var(--ks-border,#27272a)] hover:border-[var(--ks-border-strong,#3f3f46)] cursor-pointer transition-colors"><input type=checkbox class="mt-0.5 accent-[var(--ks-accent,#fbbf24)]"><span class="flex-1 min-w-0"><span class="block text-xs text-[var(--ks-fg,#ffffff)] font-medium">'),Di=d('<p class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] italic">Every role in this workspace is already configured for this page.'),Wi=d('<span class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] font-mono select-text">'),Ui=d('<span class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] font-mono select-text truncate"title="Plugin serving this route (name@version) — surfaces which pm2 process ops should target in prod"><span class=text-[var(--ks-fg-subtle,#71717a)]>@'),ji=d('<button type=button class="inline-flex items-center gap-1 px-2 py-1 text-[11px] transition-colors cursor-pointer"><span>');function mt(e){return new Set(e.filter(n=>!n.is_destructive).map(n=>n.code))}function qi(e,n){const r=n.map(a=>a.code),s=n.find(a=>a.action==="view")?.code;switch(e){case"none":return new Set;case"viewer":return new Set(s?[s]:[]);case"editor":return mt(n);case"full":return new Set(r);case"custom":return new Set}}function Fi(e){return e.filter(r=>!r.is_destructive).some(r=>r.action!=="view")}function xt(e){return e.every(n=>!n.is_destructive)}function _r(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function Ft(e){return(n,r)=>{const s=e.find(o=>o.id===n),a=e.find(o=>o.id===r);return(s?.sort_order??0)-(a?.sort_order??0)}}function Vi(e,n,r,s){if(e.size===0)return!0;const a=n.find(o=>o.action==="view")?.code;return!!(a&&e.size===1&&e.has(a)||_r(e,r)&&!xt(n)||e.size===s)}function Bi(e,n,r){const s=new Set;for(const a of n)a.role_id===e&&a.allowed&&r.has(a.permission_code)&&s.add(a.permission_code);return s}function Hi(e,n){const r=new Set(n),s=new Map;for(const a of e){if(!a.allowed||!r.has(a.permission_code))continue;const o=s.get(a.role_id)??new Set;o.add(a.permission_code),s.set(a.role_id,o)}return s}function Ki(e,n,r){const s=[];for(const[a,o]of e){const p=n.get(a)??new Set;for(const c of r){const g=o.has(c),l=p.has(c);g!==l&&s.push({role_id:a,permission_code:c,allowed:g})}}return s}function Gi(e){const n=Re(),{activeWorkspace:r}=ze(),s=lr(),a=Ze(),o=()=>r()?.ws_id??null,p=de(()=>{const f=a.plugins(),u=f.find(k=>k.name===e.module)??f.find(k=>k.capabilityKey===e.module);return u?{name:u.name,version:u.version}:null}),[c,g]=W(null),[l,w]=W(!1),b=async()=>{const f=o();if(f){w(!0);try{const u=await fetch(`/api/workspaces/${f}/role-permissions`,{credentials:"include",headers:{"X-Workspace-Id":String(f)}});if(!u.ok){g(null);return}g(await u.json())}catch{g(null)}finally{w(!1)}}};_e(()=>{e.active&&o()&&b()});const[$,y]=W(new Map),[P,v]=W([]),[M,C]=W(new Set),[x,N]=W(!1),[m,h]=W("");_e(()=>{const f=c();if(!f)return;const u=f.permissions.filter(D=>D.module===e.module),k=new Set(u.map(D=>D.code)),L=new Map,T=[],B=new Set,q=mt(u);for(const D of f.roles){if(D.name.toLowerCase()==="admin")continue;const F=Bi(D.id,f.grants,k);L.set(D.id,F),F.size>0&&(T.push(D.id),Vi(F,u,q,k.size)||B.add(D.id))}y(L),v(T.sort(Ft(f.roles))),C(B),h("")});const S=de(()=>{const f=c();return f?f.permissions.filter(u=>u.module===e.module).sort((u,k)=>u.sort_order-k.sort_order):[]}),I=de(()=>{const f=c();return f?f.roles.filter(u=>u.name.toLowerCase()!=="admin"):[]}),R=de(()=>{const f=new Set(P());return I().filter(u=>!f.has(u.id))}),E=f=>$().get(f)??new Set,O=f=>{if(M().has(f))return"custom";const u=S(),k=u.map(q=>q.code),L=u.find(q=>q.action==="view")?.code,T=E(f);if(T.size===0)return"none";if(L&&T.size===1&&T.has(L))return"viewer";const B=mt(u);return _r(T,B)&&!xt(u)?"editor":T.size===k.length?"full":"custom"},X=(f,u)=>{y(k=>{const L=new Map(k);return L.set(f,u),L})},ee=(f,u)=>{y(k=>{const L=new Map(k),T=new Set(L.get(f)??[]);return T.has(u)?T.delete(u):T.add(u),L.set(f,T),L})},se=(f,u)=>{const k=S();if(u==="custom"){C(L=>{const T=new Set(L);return T.add(f),T});return}C(L=>{const T=new Set(L);return T.delete(f),T}),X(f,qi(u,k))},fe=f=>{v(u=>{if(u.includes(f))return u;const L=c()?.roles??[];return[...u,f].sort(Ft(L))}),y(u=>{const k=new Map(u);return k.has(f)||k.set(f,new Set),k})},re=f=>{v(u=>u.filter(k=>k!==f)),y(u=>{const k=new Map(u);return k.set(f,new Set),k}),C(u=>{const k=new Set(u);return k.delete(f),k})},le=async()=>{const f=o();if(!f)return;const k=S().map(q=>q.code),L=c(),T=Hi(L?.grants??[],k),B=Ki($(),T,k);if(B.length===0){e.onClose?.();return}N(!0),h("");try{const q=await fetch(`/api/workspaces/${f}/role-permissions`,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json","X-Workspace-Id":String(f)},body:JSON.stringify({grants:B})});if(!q.ok){const D=await q.json().catch(()=>({}));h(D.error||"Failed to save permissions");return}await b(),s.refetch(),e.onSaved?.(),e.onClose?.()}catch(q){h(q.message||"Failed to save permissions")}finally{N(!1)}},ce=()=>n()?.user?.role==="superuser"||r()?.ws_role==="admin",ge=f=>c()?.roles.find(u=>u.id===f);return(()=>{var f=Ai(),u=f.firstChild,k=u.firstChild,L=k.firstChild,T=L.firstChild,B=T.nextSibling,q=B.nextSibling,D=u.nextSibling,F=D.firstChild;return i(u,t(_,{get when(){return!ce()},get children(){return Si()}}),k),i(k,t(ur,{size:14,class:"text-[var(--ks-accent,#fbbf24)] mt-0.5 shrink-0"}),L),i(q,()=>r()?.ws_name),i(u,t(_,{get when(){return l()},get children(){return Ci()}}),null),i(u,t(_,{get when(){return Y(()=>!l())()&&c()},get children(){return[t(_,{get when(){return P().length>0},get fallback(){return Li()},get children(){var K=Ei();return i(K,t(Q,{get each(){return P()},children:U=>{const J=()=>O(U),ue=()=>ge(U);return(()=>{var Oe=Ri(),tt=Oe.firstChild,De=tt.firstChild,rt=De.firstChild,nt=De.nextSibling,me=nt.firstChild,Ne=me.nextSibling;return i(rt,()=>ue()?.name??U),i(De,t(_,{get when(){return ue()?.description},get children(){var ye=Ti();return i(ye,()=>ue().description),ye}}),null),i(me,t(Ue,{get active(){return J()==="none"},onClick:()=>se(U,"none"),icon:sa,label:"No access"}),null),i(me,t(Ue,{get active(){return J()==="viewer"},onClick:()=>se(U,"viewer"),icon:va,label:"Viewer"}),null),i(me,t(_,{get when(){return Y(()=>!!Fi(S()))()&&!xt(S())},get children(){return t(Ue,{get active(){return J()==="editor"},onClick:()=>se(U,"editor"),icon:Wa,label:"Editor"})}}),null),i(me,t(Ue,{get active(){return J()==="full"},onClick:()=>se(U,"full"),icon:je,label:"Full access"}),null),i(me,t(Ue,{get active(){return J()==="custom"},onClick:()=>se(U,"custom"),icon:Ya,label:"Custom"}),null),Ne.$$click=()=>re(U),i(Ne,t(Vs,{size:13})),i(Oe,t(_,{get when(){return J()==="custom"},get children(){var ye=zi();return i(ye,t(Q,{get each(){return S()},children:xe=>{const Se=()=>E(U).has(xe.code);return(()=>{var Pe=Oi(),We=Pe.firstChild,$e=We.nextSibling,st=$e.firstChild;return We.addEventListener("change",()=>ee(U,xe.code)),i(st,()=>xe.label),i($e,t(_,{get when(){return xe.description},get children(){var Ve=Ii();return i(Ve,()=>xe.description),Ve}}),null),z(()=>We.checked=Se()),Pe})()}})),ye}}),null),z(()=>ne(Ne,"title",`Remove ${ue()?.name??U} from this page`)),Oe})()}})),K}}),(()=>{var K=Ni();return i(K,t(_,{get when(){return R().length>0},get fallback(){return Di()},get children(){return[t(vn,{value:null,placeholder:"+ Add role",searchPlaceholder:"Search roles…",get options(){return R().map(U=>({value:U.id,label:U.name,description:U.description??void 0}))},onChange:U=>{U&&fe(Number(U.value))},triggerClass:"inline-flex items-center gap-1.5 text-xs text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_90%,transparent)] hover:text-[var(--ks-accent,#fbbf24)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_5%,transparent)] hover:bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)] border border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_20%,transparent)] rounded px-3 py-1.5 cursor-pointer transition-colors",noMatchLabel:"No matching roles",emptyLabel:"No roles available"}),t(_,{get when(){return P().length===0},get children(){return[t(hr,{size:11,class:"text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_60%,transparent)]"}),Mi()]}})]}})),K})()]}}),null),i(u,t(_,{get when(){return m()},get children(){var K=Pi();return i(K,m),K}}),null),i(D,t(_,{get when(){return p()},get fallback(){return Wi()},children:K=>(()=>{var U=Ui(),J=U.firstChild;return i(U,()=>K().name,J),i(U,()=>K().version,null),U})()}),F),i(F,t(Rt,{intent:"secondary",variant:"clip2",type:"button",get disabled(){return x()},onClick:()=>e.onClose?.(),children:"Cancel"}),null),i(F,t(Rt,{intent:"primary",variant:"clip1",type:"button",get disabled(){return x()||!ce()},onClick:le,get children(){return x()?"Saving…":"Save permissions"}}),null),f})()}function Ue(e){return(()=>{var n=ji(),r=n.firstChild;return n.$$click=()=>e.onClick(),i(n,t(Me,{get component(){return e.icon},size:11}),r),i(r,()=>e.label),z(s=>Fe(n,{"bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)] text-[var(--ks-accent,#fbbf24)]":e.active,"text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-fg,#ffffff)]":!e.active},s)),n})()}oe(["click"]);var Xi=d('<p class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] mb-3">How <span class=text-[var(--ks-fg,#ffffff)]></span> works — drag nodes to arrange, click a node to focus its connections, scroll to zoom.'),Yi=d('<p class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] mb-3">Which roles can act on <span class=text-[var(--ks-fg,#ffffff)]></span>. Admins always have full access and are omitted. Drag to pan, scroll to zoom.'),Qi=d('<div class="flex flex-col min-h-0"><div class="flex items-center gap-1 px-5 pt-4"></div><div class="flex-1 overflow-auto p-5">'),Ji=d('<div class="text-xs text-[var(--ks-fg-subtle,#71717a)] text-center py-10">Loading…'),Zi=d('<div class="text-xs text-red-400 text-center py-10">'),eo=d('<button type=button class="px-3 py-1.5 text-xs rounded-md transition-colors cursor-pointer">');const to={create:"Create",add:"Add",new:"Create",edit:"Edit",update:"Update",delete:"Delete",remove:"Delete",archive:"Archive",restore:"Restore",void:"Void",settle:"Settle",charge:"Charge",pay:"Pay",refund:"Refund",regenerate:"Regenerate",export:"Export",approve:"Approve",reject:"Reject",toggle:"Toggle"},ro=new Set(["create","add","new","edit","update"]),Ge=e=>e.replace(/[^a-zA-Z0-9]+/g,"_");function no(e,n,r){const s=e.permissions.map(l=>l.split(".").slice(1).join(".")).filter(l=>l&&l.split(".")[0]!=="view"),a=[ke("open","trigger",`Open ${e.label}`,{out:[Ce("data")]})],o=[],p=[];for(const l of s){const w=l.split(".")[0].toLowerCase(),b=to[w]??w.charAt(0).toUpperCase()+w.slice(1),$=`act_${Ge(l)}`;if(o.push(Ce($,b)),ro.has(w)){const y=`${$}_form`,P=`${$}_commit`;a.push(ke($,"trigger",`${b} button`,{out:[Ce(y)]})),a.push(ke(y,"modal",`${e.label} form`,{out:[Ce(P)]})),a.push(ke(P,"commit",b,{detail:`${e.key}.${l}`})),p.push(P)}else{const y=`${$}_commit`;a.push(ke($,"trigger",`${b} button`,{out:[Ce(y)]})),a.push(ke(y,"commit",b,{detail:`${e.key}.${l}`})),p.push(y)}}a.push(ke("data","data",`${e.label} list`,{out:o}));const c=a.find(l=>l.id===(p[0]??"data"));c.out=c.out??[];const g=new Set;for(const l of n){const w=`call_${Ge(l.provider)}_${Ge(l.capability)}`;g.has(w)||(g.add(w),a.push(ke(w,"call",`${r.get(l.provider)??l.provider}.${l.capability}`,{detail:`${l.provider}:${l.capability}`})),c.out.push(Ce(w,l.granted?void 0:"ungranted")))}for(const l of e.emits){const w=`emit_${Ge(l)}`;a.push(ke(w,"emit",l)),c.out.push(Ce(w))}return ln({id:`${e.key}.surface`,title:e.label,nodes:a})}function so(e){const{activeWorkspace:n}=ze(),r=()=>n()?.ws_id??null,[s,a]=W("flow"),[o,p]=W(null),[c,g]=W(null),[l,w]=W(!1),[b,$]=W("");_e(()=>{const C=r();if(!e.active||!C)return;const x=s();x==="flow"&&o()||x==="permissions"&&c()||y(x,C)});const y=async(C,x)=>{w(!0),$("");try{const N=C==="flow"?"/api/plugins/graph":`/api/workspaces/${x}/role-permissions`,m=await fetch(N,{credentials:"include",headers:{"X-Workspace-Id":String(x)}});if(!m.ok){$("Could not load this view.");return}const h=await m.json();C==="flow"?p(h):g(h)}catch{$("Could not load this view.")}finally{w(!1)}},P=()=>o()?.plugins.find(C=>C.key===e.module),v=de(()=>{const C=o(),x=P();if(!C||!x)return{nodes:[],edges:[]};const N=new Map(C.plugins.map(h=>[h.name,h.label])),m=C.edges.filter(h=>h.consumer===x.name);return on(no(x,m,N))}),M=de(()=>{const C=c();if(!C)return{nodes:[],edges:[]};const x=C.permissions.filter(E=>E.module===e.module).sort((E,O)=>Number(E.is_destructive)-Number(O.is_destructive)),N=new Set(x.map(E=>E.code)),m=new Set(C.grants.filter(E=>E.allowed&&N.has(E.permission_code)).map(E=>E.permission_code)),h=C.roles.filter(E=>E.name.toLowerCase()!=="admin"&&C.grants.some(O=>O.role_id===E.id&&O.allowed&&N.has(O.permission_code))),S=[...h.map(E=>({id:`role:${E.id}`,label:E.name,sublabel:"role",accent:"info",lane:0})),...x.map(E=>({id:`perm:${E.code}`,label:E.label,sublabel:E.is_destructive?"destructive":"action",accent:m.has(E.code)?"primary":"muted",lane:1}))],I=new Set(h.map(E=>E.id)),R=C.grants.filter(E=>E.allowed&&N.has(E.permission_code)&&I.has(E.role_id)).map(E=>({from:`role:${E.role_id}`,to:`perm:${E.permission_code}`,accent:"success"}));return{nodes:S,edges:R}});return(()=>{var C=Qi(),x=C.firstChild,N=x.nextSibling;return i(x,t(Vt,{get active(){return s()==="flow"},onClick:()=>a("flow"),label:"Flow"}),null),i(x,t(Vt,{get active(){return s()==="permissions"},onClick:()=>a("permissions"),label:"Permissions"}),null),i(N,t(_,{get when(){return!l()},get fallback(){return Ji()},get children(){return t(_,{get when(){return!b()},get fallback(){return(()=>{var m=Zi();return i(m,b),m})()},get children(){return[t(_,{get when(){return s()==="flow"},get children(){return[(()=>{var m=Xi(),h=m.firstChild,S=h.nextSibling;return i(S,()=>e.moduleLabel),m})(),t(It,{get nodes(){return v().nodes},get edges(){return v().edges},layout:"layered",direction:"vertical",interactive:!0,animated:!0,height:440,get ariaLabel(){return`${e.moduleLabel} interaction flow`},emptyLabel:"This plugin declares no cross-plugin calls or events."})]}}),t(_,{get when(){return s()==="permissions"},get children(){return[(()=>{var m=Yi(),h=m.firstChild,S=h.nextSibling;return i(S,()=>e.moduleLabel),m})(),t(It,{get nodes(){return M().nodes},get edges(){return M().edges},layout:"bipartite",interactive:!0,animated:!0,height:340,get ariaLabel(){return`${e.moduleLabel} role to permission map`},emptyLabel:"No roles are granted access to this page yet."})]}})]}})}})),C})()}function Vt(e){return(()=>{var n=eo();return n.$$click=()=>e.onClick(),i(n,()=>e.label),z(r=>Fe(n,{"bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)] text-[var(--ks-accent,#fbbf24)]":e.active,"text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-fg,#ffffff)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)]":!e.active},r)),n})()}oe(["click"]);async function $r(e,n,r,s){const a=await fetch(e,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json","X-Workspace-Id":String(n)},body:JSON.stringify({routePath:r,prefs:s})});return a.ok?{ok:!0}:{ok:!1,error:(await a.json().catch(()=>({}))).error||`Save failed (${a.status})`}}function ao(e,n,r){return $r("/api/plugins/ui/route-settings/me",e,n,r)}function io(e,n,r){return $r("/api/plugins/ui/route-settings/workspace-default",e,n,r)}var oo=d('<p class="text-[12px] text-red-400 mb-3">'),lo=d('<label class="flex items-center justify-between gap-3 mt-3 text-[12px] text-[var(--ks-fg-muted,#a1a1aa)]">Starting invoice number<input type=number min=1>'),co=d('<label class="flex items-center justify-between gap-3 mt-3 text-[12px] text-[var(--ks-fg-muted,#a1a1aa)]">Invoice prefix<input type=text maxlength=20>'),uo=d(`<div class=max-w-2xl><h2 class="text-[15px] font-semibold text-[var(--ks-fg,#ffffff)]">Display</h2><p class="text-[12px] text-[var(--ks-fg-subtle,#71717a)] mb-4">Preferred page size for list pages. Your choice wins; otherwise the workspace default applies; otherwise the page's built-in default. List pages honor this as they adopt the setting.</p><div class="flex flex-col gap-5"><div class="rounded-lg border border-[var(--ks-border,#27272a)] p-4"><div class="flex items-center justify-between"><div><p class="text-[13px] font-medium text-[var(--ks-fg,#ffffff)]">Sales invoice numbering</p><p class="text-[11px] text-[var(--ks-fg-subtle,#71717a)]">Automatically assign invoice IDs to sales dated July 1, 2026 or later.</p></div><input type=checkbox aria-label="Enable sales invoice numbering">`),fo=d('<label class="flex items-center justify-between gap-3"><span class="text-[12px] text-[var(--ks-fg-muted,#a1a1aa)]">Workspace default<span class=text-[var(--ks-fg-subtle,#71717a)]> (admins)</span></span><select class="bg-[var(--ks-surface,#0f0f0f)] border border-[var(--ks-border-strong,#3f3f46)] rounded px-2 py-1 text-[12px] text-[var(--ks-fg,#ffffff)]"><option value>Use page default (<!>)'),po=d('<div class="rounded-lg border border-[var(--ks-border,#27272a)] p-4"><div class="flex items-center justify-between mb-3"><span class="text-[13px] font-medium text-[var(--ks-fg,#ffffff)]"> page size</span><span class="text-[11px] text-[var(--ks-fg-subtle,#71717a)]">Effective: <!> per page</span></div><label class="flex items-center justify-between gap-3 mb-2"><span class="text-[12px] text-[var(--ks-fg-muted,#a1a1aa)]">My page size</span><select class="bg-[var(--ks-surface,#0f0f0f)] border border-[var(--ks-border-strong,#3f3f46)] rounded px-2 py-1 text-[12px] text-[var(--ks-fg,#ffffff)]"><option value>Use workspace default'),Bt=d("<option>");const Ht=[10,25,50,100],ho=[{routePath:"/payees",label:"Payees",key:"pageSize",default:25}];function go(e){const n=Ze(),[r,s]=W(""),[a,o]=W(""),[p,c]=W(!1),[g,l]=W(100),[w,b]=W(100),[$,y]=W(""),P=x=>n.routeSettings()[x],v=(x,N)=>{const m=x?.[N];return typeof m=="number"?m:void 0};async function M(x,N,m,h){const S=e.wsId;if(S==null)return;const I=h===""?{}:{[m]:Number(h)};o(""),s(`${x}:${N}`);const E=await(x==="user"?ao:io)(S,N,I);if(s(""),!E.ok){o(E.error);return}n.refetch()}async function C(x=p()){const N=e.wsId;if(N==null)return;o(""),s("invoice-settings");const m=await fetch("/api/transactions/invoice-settings",{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json","X-Workspace-Id":String(N)},body:JSON.stringify({enabled:x,first_number:g(),next_number:w(),prefix:$()})});if(s(""),!m.ok){const h=await m.json().catch(()=>({}));o(h.error??`Save failed (${m.status})`)}}return _e(()=>{const x=e.wsId;x!=null&&fetch("/api/transactions/invoice-settings",{credentials:"include",headers:{"X-Workspace-Id":String(x)}}).then(N=>N.ok?N.json():null).then(N=>{N&&(c(N.enabled===!0),l(N.first_number??N.next_number??100),b(N.next_number??100),y(N.prefix??""))})}),(()=>{var x=uo(),N=x.firstChild,m=N.nextSibling,h=m.nextSibling,S=h.firstChild,I=S.firstChild,R=I.firstChild,E=R.nextSibling;return i(x,t(_,{get when(){return a()},get children(){var O=oo();return i(O,a),O}}),h),E.addEventListener("change",O=>{c(O.currentTarget.checked),C(O.currentTarget.checked)}),i(S,t(_,{get when(){return e.canEditDefault},get children(){return[(()=>{var O=lo(),X=O.firstChild,ee=X.nextSibling;return ee.addEventListener("change",se=>l(Number(se.currentTarget.value))),ee.addEventListener("blur",()=>void C()),z(()=>ee.value=g()),O})(),(()=>{var O=co(),X=O.firstChild,ee=X.nextSibling;return ee.addEventListener("change",se=>y(se.currentTarget.value)),ee.addEventListener("blur",()=>void C()),z(()=>ee.value=$()),O})()]}}),null),i(h,t(Q,{each:ho,children:O=>{const X=()=>v(P(O.routePath)?.userPref,O.key),ee=()=>v(P(O.routePath)?.workspaceDefault,O.key),se=()=>X()??ee()??O.default;return(()=>{var fe=po(),re=fe.firstChild,le=re.firstChild,ce=le.firstChild,ge=le.nextSibling,f=ge.firstChild,u=f.nextSibling;u.nextSibling;var k=re.nextSibling,L=k.firstChild,T=L.nextSibling;return T.firstChild,i(le,()=>O.label,ce),i(ge,se,u),T.addEventListener("change",B=>void M("user",O.routePath,O.key,B.currentTarget.value)),i(T,t(Q,{each:Ht,children:B=>(()=>{var q=Bt();return i(q,B),z(()=>q.value=String(B)),q})()}),null),i(fe,t(_,{get when(){return e.canEditDefault},get children(){var B=fo(),q=B.firstChild,D=q.nextSibling,F=D.firstChild,K=F.firstChild,U=K.nextSibling;return U.nextSibling,D.addEventListener("change",J=>void M("ws",O.routePath,O.key,J.currentTarget.value)),i(F,()=>O.default,U),i(D,t(Q,{each:Ht,children:J=>(()=>{var ue=Bt();return i(ue,J),z(()=>ue.value=String(J)),ue})()}),null),z(()=>D.disabled=r()===`ws:${O.routePath}`),z(()=>D.value=ee()===void 0?"":String(ee())),B}}),null),z(()=>T.disabled=r()===`user:${O.routePath}`),z(()=>T.value=X()===void 0?"":String(X())),fe})()}}),null),z(()=>E.disabled=!e.canEditDefault||r()==="invoice-settings"),z(()=>E.checked=p()),x})()}var vo=d('<div class="fixed inset-0 z-[9999] flex items-center justify-center bg-[color-mix(in_srgb,var(--ks-bg,#0a0a0a)_60%,transparent)]"><div class="card-bg rounded-xl border border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_30%,transparent)] w-full max-w-3xl max-h-[90vh] overflow-hidden flex flex-col"role=dialog aria-modal=true><div class="flex items-start justify-between p-5 border-b border-[var(--ks-border,#27272a)]"><div class="flex items-start gap-3"><div><h2 class="text-base font-semibold text-[var(--ks-fg,#ffffff)]"> settings</h2><p class="text-xs text-[var(--ks-fg-subtle,#71717a)] mt-0.5">Sharing &amp; flow for <span class=text-[var(--ks-fg,#ffffff)]></span></p></div></div><button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] transition-colors cursor-pointer"title=Close aria-label=Close></button></div><div class="flex items-center gap-1 px-3 pt-2 border-b border-[color-mix(in_srgb,var(--ks-border,#27272a)_60%,transparent)]"></div><div class="flex-1 min-h-0 overflow-hidden"><div class=h-full></div><div class=h-full>'),bo=d('<div class="h-full overflow-y-auto p-5">'),mo=d('<button type=button class="px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer">');function xo(e){const{activeWorkspace:n}=ze(),r=Re(),[s,a]=W("share"),o=()=>r()?.user?.role==="superuser"||n()?.ws_role==="admin";return t(Zr,{get children(){var p=vo(),c=p.firstChild,g=c.firstChild,l=g.firstChild,w=l.firstChild,b=w.firstChild,$=b.firstChild,y=b.nextSibling,P=y.firstChild,v=P.nextSibling,M=l.nextSibling,C=g.nextSibling,x=C.nextSibling,N=x.firstChild,m=N.nextSibling;return p.$$click=()=>e.onClose(),c.$$click=h=>h.stopPropagation(),ir($s,c),i(l,t(br,{size:20,class:"text-[var(--ks-accent,#fbbf24)] shrink-0 mt-0.5"}),w),i(b,()=>e.moduleLabel,$),i(v,()=>n()?.ws_name),M.$$click=()=>e.onClose(),i(M,t(Ie,{size:18})),i(C,t(ht,{get active(){return s()==="share"},onClick:()=>a("share"),label:"Share"}),null),i(C,t(ht,{get active(){return s()==="flow"},onClick:()=>a("flow"),label:"Connections"}),null),i(C,(()=>{var h=Y(()=>e.module==="transactions");return()=>h()&&t(ht,{get active(){return s()==="display"},onClick:()=>a("display"),label:"Display"})})(),null),i(N,t(Gi,{get module(){return e.module},get moduleLabel(){return e.moduleLabel},get active(){return Y(()=>!!e.open)()&&s()==="share"},onClose:()=>e.onClose()})),i(m,t(so,{get module(){return e.module},get moduleLabel(){return e.moduleLabel},get active(){return Y(()=>!!e.open)()&&s()==="flow"}})),i(x,(()=>{var h=Y(()=>e.module==="transactions");return()=>h()&&(()=>{var S=bo();return i(S,t(go,{get wsId(){return n()?.ws_id},get canEditDefault(){return o()}})),z(()=>S.classList.toggle("hidden",s()!=="display")),S})()})(),null),z(h=>{var S={"opacity-0 pointer-events-none invisible":!e.open},I=`${e.moduleLabel} settings`,R=s()!=="share",E=s()!=="flow";return h.e=Fe(p,S,h.e),I!==h.t&&ne(c,"aria-label",h.t=I),R!==h.a&&N.classList.toggle("hidden",h.a=R),E!==h.o&&m.classList.toggle("hidden",h.o=E),h},{e:void 0,t:void 0,a:void 0,o:void 0}),p}})}function ht(e){return(()=>{var n=mo();return n.$$click=()=>e.onClick(),i(n,()=>e.label),z(r=>Fe(n,{"border-[var(--ks-accent,#fbbf24)] text-[var(--ks-accent,#fbbf24)]":e.active,"border-transparent text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-fg,#ffffff)]":!e.active},r)),n})()}oe(["click"]);var ko=d("<button type=button>");function wr(e){const n=Re(),r=et(),{activeWorkspace:s}=ze(),a=qe(),[o,p]=W(!1),[c,g]=W(!1);_e(rr(()=>a.pathname,()=>p(!1),{defer:!0}));const l=()=>r()||n()?.user?.role==="superuser"||s()?.ws_role==="admin",w=b=>{b.preventDefault(),b.stopPropagation(),g(!0),p(!0)};return t(_,{get when(){return l()},get children(){return[(()=>{var b=ko();return b.$$click=w,i(b,t(br,{size:14})),z($=>{var y=`${e.moduleLabel} settings`,P=`${e.moduleLabel} settings`,v=`inline-flex items-center justify-center w-6 h-6 rounded text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-accent,#fbbf24)] hover:bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)] transition-colors cursor-pointer ${e.class??""}`;return y!==$.e&&ne(b,"aria-label",$.e=y),P!==$.t&&ne(b,"title",$.t=P),v!==$.a&&ie(b,$.a=v),$},{e:void 0,t:void 0,a:void 0}),b})(),t(_,{get when(){return c()},get children(){return t(xo,{get module(){return e.module},get moduleLabel(){return e.moduleLabel},get open(){return o()},onClose:()=>p(!1)})}})]}})}oe(["click"]);var _o=d('<div class="fixed z-50 w-[180px] bg-[var(--ks-surface,#0f0f0f)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] p-1.5"role=dialog style=left:76px><p class="text-[10px] uppercase tracking-[0.16em] text-[var(--ks-fg-subtle,#71717a)] px-2 py-1">'),$o=d('<div class="relative flex items-center"><button type=button><span class="text-[12px] truncate">');const wo=()=>{const{flyoutId:e,flyoutTop:n,reducedMotion:r,visibleEntries:s,isActive:a,choose:o}=he();return t(_,{get when(){return e()},children:p=>{const c=de(()=>s().sections.find(g=>g.section.id===p()));return t(_,{get when(){return c()},children:g=>(()=>{var l=_o(),w=l.firstChild;return i(w,()=>g().section.label),i(l,t(Q,{get each(){return g().visibleItems},children:b=>{const $=b.icon;return(()=>{var y=$o(),P=y.firstChild,v=P.firstChild;return P.$$click=()=>o(b.href),i(P,t($,{size:15,class:"shrink-0"}),v),i(v,()=>b.label),i(y,t(_,{get when(){return b.capability},get children(){return t(wr,{get module(){return b.capability},get moduleLabel(){return b.label},class:"absolute right-1 top-1/2 -translate-y-1/2"})}}),null),z(()=>ie(P,`navrow flex-1 min-w-0 flex items-center gap-2.5 px-2 py-2 cursor-pointer text-left ${b.capability?"pr-8":""} ${a(b.href)?"text-[var(--ks-accent,#fbbf24)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)]":"text-[var(--ks-fg,#ffffff)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)]"}`)),y})()}}),null),z(b=>{var $={top:`${Math.max(8,n())}px`,...te,...r()?{}:{animation:"pop .14s ease"}},y=g().section.label;return b.e=Z(l,$,b.e),y!==b.t&&ne(l,"aria-label",b.t=y),b},{e:void 0,t:void 0}),l})()})}})};oe(["click"]);var yo=d('<span class="grid place-items-center bg-gradient-to-br from-[var(--ks-accent,#fbbf24)] to-orange-600 text-[var(--ks-fg-on-accent,#18181b)] font-bold tracking-tight shrink-0"aria-hidden=true>'),So=d('<img alt aria-hidden=true class="object-cover shrink-0">'),Co=d("<img alt=Hilinga>"),Eo=d("<span>"),Mo=d("<span aria-hidden>"),No=d('<mark class="bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_25%,transparent)] text-[var(--ks-accent,#fde68a)] rounded-sm px-0.5">');const Je=e=>t(_,{get when(){return e.logoUrl},get fallback(){return(()=>{var n=yo();return i(n,()=>ki(e.name)),z(r=>Z(n,{width:`${e.size??30}px`,height:`${e.size??30}px`,"font-size":`${Math.max(8,Math.floor((e.size??30)*.4))}px`,...te},r)),n})()},children:n=>(()=>{var r=So();return z(s=>{var a=n(),o={width:`${e.size??30}px`,height:`${e.size??30}px`,...te};return a!==s.e&&ne(r,"src",s.e=a),s.t=Z(r,o,s.t),s},{e:void 0,t:void 0}),r})()}),yr=e=>(()=>{var n=Co();return z(r=>{var s=bn("/pwa-192.png"),a=e.size??16,o=e.size??16,p=`rounded shrink-0 ${e.class??""}`,c=`${e.size??16}px`,g=`${e.size??16}px`;return s!==r.e&&ne(n,"src",r.e=s),a!==r.t&&ne(n,"width",r.t=a),o!==r.a&&ne(n,"height",r.a=o),p!==r.o&&ie(n,r.o=p),c!==r.i&&Tt(n,"width",r.i=c),g!==r.n&&Tt(n,"height",r.n=g),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),n})(),Po=()=>{const{displayRole:e}=he(),n=()=>e().toLowerCase().replace(/\s+/g,"_");return t(_,{get when(){return e()},get children(){var r=Eo();return i(r,e),z(()=>ie(r,`inline-block text-[8px] font-semibold px-1.5 py-[1px] border uppercase tracking-[0.12em] leading-[1.2] ${xi[n()]||"text-[var(--ks-fg-muted,#a1a1aa)] bg-[var(--ks-surface-raised,#1a1a1a)] border-[var(--ks-border-strong,#3f3f46)]"}`)),r}})},Le=e=>{const{reducedMotion:n}=he();return(()=>{var r=Mo();return z(s=>{var a=`absolute left-0 ${e.inset} w-[3px] bg-[var(--ks-accent,#fbbf24)]`,o=n()?void 0:{animation:"pulseBar 2s ease-in-out infinite"};return a!==s.e&&ie(r,s.e=a),s.t=Z(r,o,s.t),s},{e:void 0,t:void 0}),r})()},kt=e=>{const{highlightSegments:n}=he();return t(Q,{get each(){return n(e.label)},children:r=>t(_,{get when(){return r.match},get fallback(){return Y(()=>r.text)},get children(){var s=No();return i(s,()=>r.text),s}})})};var Ao=d('<button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] cursor-pointer"aria-label="Clear search">'),Lo=d('<div class="fixed z-50 w-[262px] bg-[var(--ks-surface,#0f0f0f)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] p-2"style=left:80px;top:8px><div class="w-full flex items-center gap-2 h-9 bg-[color-mix(in_srgb,var(--ks-bg,#0a0a0a)_60%,transparent)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] focus-within:border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_60%,transparent)] pl-2.5 pr-1.5"><input type=text placeholder="Search all menus…"class="text-[12px] text-[var(--ks-fg,#ffffff)] placeholder:text-[var(--ks-fg-subtle,#71717a)] flex-1 min-w-0 bg-transparent border-0 outline-none"></div><div class="mt-2 max-h-[320px] overflow-y-auto">'),To=d('<p class="text-[12px] text-[var(--ks-fg-subtle,#71717a)] px-3 py-6 text-center">Type to search every section.'),zo=d('<p class="text-[12px] text-[var(--ks-fg-subtle,#71717a)] px-3 py-6 text-center">Nothing matches &ldquo;<!>&rdquo;.'),Ro=d('<div><p class="text-[10px] uppercase tracking-[0.16em] text-[var(--ks-fg-subtle,#71717a)] px-2 py-1">'),Io=d('<button type=button><span class="flex-1 text-[12px] truncate">');const Oo=()=>{const{searchFlyoutOpen:e,collapsed:n,reducedMotion:r,query:s,setQuery:a,queryTrimmed:o,nestedSearchResults:p,isActive:c,chooseResult:g}=he();return t(_,{get when(){return Y(()=>!!e())()&&n()},get children(){var l=Lo(),w=l.firstChild,b=w.firstChild,$=w.nextSibling;return i(w,t(Ct,{size:14,class:"text-[var(--ks-fg-subtle,#71717a)] shrink-0"}),b),b.$$input=y=>a(y.currentTarget.value),ir(y=>{queueMicrotask(()=>y?.focus())},b),i(w,t(_,{get when(){return s().length>0},get children(){var y=Ao();return y.$$click=()=>a(""),i(y,t(Ie,{size:13})),y}}),null),i($,t(_,{get when(){return o()},get fallback(){return To()},get children(){return t(_,{get when(){return p().length>0},get fallback(){return(()=>{var y=zo(),P=y.firstChild,v=P.nextSibling;return v.nextSibling,i(y,()=>s().trim(),v),y})()},get children(){return t(Q,{get each(){return p()},children:y=>(()=>{var P=Ro(),v=P.firstChild;return i(v,()=>y.section.label),i(P,t(Q,{get each(){return y.items},children:M=>{const C=M.item.icon,x=()=>c(M.item.href);return(()=>{var N=Io(),m=N.firstChild;return N.$$click=()=>g(M.item.href),i(N,t(C,{size:15,class:"shrink-0"}),m),i(m,t(kt,{get label(){return M.item.label}})),z(()=>ie(N,`navrow w-full flex items-center gap-2.5 px-2.5 py-2 text-left cursor-pointer ${x()?"text-[var(--ks-accent,#fbbf24)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)]":"text-[var(--ks-fg,#ffffff)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)]"}`)),N})()}}),null),P})()})}})}})),z(y=>{var P={...te,...r()?{}:{animation:"pop .14s ease"}},v=te;return y.e=Z(l,P,y.e),y.t=Z(w,v,y.t),y},{e:void 0,t:void 0}),z(()=>b.value=s()),l}})};oe(["input","click"]);var Do=d('<div class="fixed bottom-4 right-4 z-[60] flex flex-col gap-2 w-[300px] pointer-events-none">'),Wo=d('<p class="text-[9px] uppercase tracking-[0.2em] text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_80%,transparent)] mb-0.5">Achievement'),Uo=d('<div><div class="flex items-start gap-2.5 p-3"><span></span><div class="min-w-0 flex-1"><p class="text-[13px] font-semibold text-[var(--ks-fg,#ffffff)] leading-tight"></p><p class="text-[11px] text-[var(--ks-fg-muted,#a1a1aa)] leading-snug mt-0.5"></p></div><button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] cursor-pointer shrink-0"aria-label="Dismiss notification"></button></div><span>');const jo=()=>{const{notifCtx:e,reducedMotion:n}=he();return(()=>{var r=Do();return i(r,t(Q,{get each(){return e.toasts()},children:s=>{const a=Qe[s.type]??Qe.info,o=a.icon,p=s.type==="achievement";return(()=>{var c=Uo(),g=c.firstChild,l=g.firstChild,w=l.nextSibling,b=w.firstChild,$=b.nextSibling,y=w.nextSibling,P=g.nextSibling;return i(l,t(o,{size:15,get class(){return a.text}})),i(w,t(_,{when:p,get children(){return Wo()}}),b),i(b,()=>s.title),i($,()=>s.desc),y.$$click=()=>e.dismissToast(s.id),i(y,t(Ie,{size:13})),z(v=>{var M=`pointer-events-auto relative overflow-hidden bg-[var(--ks-surface,#0f0f0f)] border ${a.ring} shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_50%,transparent)] ${p?"ring-1 ring-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_30%,transparent)]":""}`,C={...te,...n()?{}:{animation:`${s.leaving?"toastOut":"toastIn"} .24s cubic-bezier(.2,.8,.2,1) forwards`}},x=`grid place-items-center w-7 h-7 shrink-0 border ${a.ring} ${p?"bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_15%,transparent)]":""}`,N=te,m=`absolute bottom-0 left-0 h-[2px] ${a.dot}`,h=n()?void 0:{animation:`bar ${s.dur}ms linear forwards`};return M!==v.e&&ie(c,v.e=M),v.t=Z(c,C,v.t),x!==v.a&&ie(l,v.a=x),v.o=Z(l,N,v.o),m!==v.i&&ie(P,v.i=m),v.n=Z(P,h,v.n),v},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),c})()}})),r})()};oe(["click"]);var qo=d('<div class="px-2 py-1.5 border-b border-[var(--ks-border,#27272a)]"><input type=text placeholder="Search workspaces\\u2026"autofocus class="w-full px-2 py-1.5 text-xs bg-[var(--ks-bg,#0a0a0a)] border border-[var(--ks-border,#27272a)] text-[var(--ks-fg,#ffffff)] placeholder:text-[var(--ks-fg-subtle,#71717a)] focus:outline-none focus:border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_50%,transparent)]">'),Fo=d('<div class="fixed z-50 w-[228px] bg-[var(--ks-surface,#0f0f0f)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] p-1.5"role=dialog aria-label="Switch workspace"style=left:8px;top:52px><p class="text-[10px] uppercase tracking-[0.16em] text-[var(--ks-fg-subtle,#71717a)] px-2 py-1">Switch workspace</p><div class="max-h-64 overflow-y-auto">'),Vo=d('<div class="fixed z-50 w-[228px] bg-[var(--ks-surface,#0f0f0f)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] p-1.5"role=dialog aria-label="Switch workspace"style=left:76px;top:10px><p class="text-[10px] uppercase tracking-[0.16em] text-[var(--ks-fg-subtle,#71717a)] px-2 py-1">Switch workspace'),Bo=d('<div class="px-3 py-3 text-xs text-[var(--ks-fg-subtle,#71717a)] text-center">No matches'),Kt=d('<button type=button class="navrow w-full flex items-center gap-2.5 px-2 py-2 hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)] cursor-pointer text-left"><span>');const Ho=null,Ko=()=>{const{wsOpen:e,collapsed:n,currentWorkspace:r,reducedMotion:s,showWorkspaceSearch:a,wsQuery:o,setWsQuery:p,filteredWorkspaces:c,switchWorkspace:g}=he();return[t(_,{get when(){return Y(()=>!!(e()&&!n()))()&&r()},get children(){var l=Fo(),w=l.firstChild,b=w.nextSibling;return i(l,t(_,{get when(){return a()},get children(){var $=qo(),y=$.firstChild;return y.$$input=P=>p(P.currentTarget.value),z(P=>Z(y,te,P)),z(()=>y.value=o()),$}}),b),i(b,t(Q,{get each(){return c()},get fallback(){return Bo()},children:$=>(()=>{var y=Kt(),P=y.firstChild;return y.$$click=()=>g($),i(y,t(Je,{get name(){return $.ws_name},get logoUrl(){return $.ws_logo_url},size:26}),P),i(P,()=>$.ws_name),i(y,t(_,{get when(){return $.ws_id===r()?.ws_id},get children(){return t(je,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"})}}),null),z(()=>ie(P,`text-[12px] truncate flex-1 ${$.ws_id===r()?.ws_id?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg,#ffffff)]"}`)),y})()})),z($=>Z(l,{...te,...s()?{}:{animation:"pop .14s ease"}},$)),l}}),t(_,{get when(){return Y(()=>!!(e()&&n()))()&&r()},get children(){var l=Vo();return l.firstChild,i(l,t(Q,{get each(){return c()},children:w=>(()=>{var b=Kt(),$=b.firstChild;return b.$$click=()=>g(w),i(b,t(Je,{get name(){return w.ws_name},get logoUrl(){return w.ws_logo_url},size:26}),$),i($,()=>w.ws_name),i(b,t(_,{get when(){return w.ws_id===r()?.ws_id},get children(){return t(je,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"})}}),null),z(()=>ie($,`text-[12px] truncate flex-1 ${w.ws_id===r()?.ws_id?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg,#ffffff)]"}`)),b})()}),null),z(w=>Z(l,{...te,...s()?{}:{animation:"pop .14s ease"}},w)),l}})]},Go=()=>{const{wsOpen:e,currentWorkspace:n}=he();return t(_,{get when(){return Y(()=>!!e())()&&n()},get children(){return t(_,{when:Ho,get fallback(){return t(Ko,{})},children:r=>t(Me,{get component(){return r()}})})}})};oe(["input","click"]);var Xo=d('<div class="mx-2 mb-1 pb-1 border-b border-[color-mix(in_srgb,var(--ks-border,#27272a)_70%,transparent)] text-center"><span class="text-[9px] text-[var(--ks-fg-subtle,#71717a)] tracking-wide">v'),Yo=d('<button type=button class="text-[10px] text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_90%,transparent)] hover:text-[var(--ks-accent,#fbbf24)] cursor-pointer px-1">'),Qo=d('<div class="mx-2 mb-1 pb-2 border-b border-[color-mix(in_srgb,var(--ks-border,#27272a)_70%,transparent)]"><p class="text-[9px] uppercase tracking-[0.16em] text-[var(--ks-fg-subtle,#71717a)] px-1 pb-1">Your roles</p><div class="flex flex-wrap gap-1 px-1">'),Jo=d('<div class="px-3 py-2"><span class="block text-[10px] text-[var(--ks-fg-subtle,#71717a)] mb-1.5"aria-hidden=true>Theme'),Zo=d('<div class="my-1 mx-2 border-t border-[color-mix(in_srgb,var(--ks-border,#27272a)_70%,transparent)]">'),el=d('<div class="px-3 py-1 text-[9px] uppercase tracking-wider text-blue-300/70"> route'),tl=d('<div class="px-3 py-1 text-[9px] uppercase tracking-wider text-blue-300/70">View as user'),rl=d('<div class="px-3 pt-1.5 pb-1 text-[9px] uppercase tracking-wider text-blue-300/70">Role'),nl=d('<div class="flex flex-wrap gap-1 px-3 pb-1.5"><button type=button class="px-1.5 py-0.5 text-[10px] rounded border border-dashed border-[var(--ks-border-strong,#3f3f46)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-blue-500/40 hover:text-blue-200 flex items-center gap-0.5"> role'),sl=d('<div class="text-[9px] text-blue-300/50"> permissions (this route)'),al=d('<div class="mx-3 mb-2 p-2 rounded border border-blue-500/20 bg-blue-500/[0.04] flex flex-col gap-1.5"><input type=text placeholder="role name (e.g. accountant)"class="w-full bg-[var(--ks-surface,#0f0f0f)] border border-[var(--ks-border-strong,#3f3f46)] rounded px-1.5 py-1 text-[11px] text-[var(--ks-fg,#ffffff)] focus:outline-none focus:border-blue-400/50"><div class="flex flex-col gap-0.5 max-h-32 overflow-y-auto"></div><button type=button class="text-[10px] rounded border border-blue-400/50 bg-blue-500/15 text-blue-100 px-2 py-1 disabled:opacity-40 hover:bg-blue-500/25">Create &amp; apply role'),il=d('<span class="inline-flex items-center text-[10px] px-1.5 py-px border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)] text-[var(--ks-fg,#ffffff)] rounded">'),ol=d('<button type=button class="w-full flex items-center justify-between gap-2 px-3 py-1.5 text-[12px] text-[var(--ks-fg,#ffffff)] hover:bg-blue-500/5 transition-colors"><span class=truncate>'),ll=d('<button type=button class="px-2 py-0.5 text-[10px] rounded border transition-colors">'),cl=d('<label class="flex items-center gap-1.5 text-[10px] text-[var(--ks-fg,#ffffff)] cursor-pointer"><input type=checkbox class=accent-blue-500><span class=truncate>'),ul=d('<div class="fixed z-50 w-[200px] bg-[var(--ks-surface,#0f0f0f)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] py-1"role=dialog aria-label="User menu"data-user-menu style=left:80px;bottom:12px>'),dl=d('<div data-user-menu class="absolute left-0 right-0 bottom-full mb-1 z-50 bg-[var(--ks-surface,#0f0f0f)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_70%,transparent)] shadow-2xl shadow-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] py-1"role=dialog aria-label="User menu">');const fl=null,pl=null;async function Gt(e){await fetch("/api/_dev/view-as",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),window.location.reload()}async function hl(e,n){await fetch("/api/_dev/roles",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e,permissions:n})}),window.location.reload()}const gt=5,Xt=()=>{const{themeMode:e,setThemeMode:n,themeVariantOptions:r,currentWorkspace:s}=he(),a=()=>s()?.ws_role_names??[],[o,p]=W(!1),c=et(),g=Re(),[l]=sr(c,async()=>{const m=await fetch("/api/_dev/info");return m.ok?await m.json():null}),w=qe(),b=()=>{const m=w.pathname.split("/")[1]??"";return l()?.plugins?.find(h=>h.routeBase===m)},$=()=>b()?.permissions??l()?.pluginPermissions??[],[y,P]=W(!1),[v,M]=W(""),[C,x]=W([]),N=m=>x(h=>h.includes(m)?h.filter(S=>S!==m):[...h,m]);return[(()=>{var m=Xo(),h=m.firstChild;return h.firstChild,i(h,()=>"0.0.0",null),m})(),t(_,{get when(){return a().length>1},get children(){var m=Qo(),h=m.firstChild,S=h.nextSibling;return i(S,t(Q,{get each(){return Y(()=>!!o())()?a():a().slice(0,gt)},children:I=>(()=>{var R=il();return i(R,I),R})()}),null),i(S,t(_,{get when(){return a().length>gt},get children(){var I=Yo();return I.$$click=()=>p(R=>!R),i(I,(()=>{var R=Y(()=>!!o());return()=>R()?"show less":`+${a().length-gt} more`})()),z(()=>ne(I,"aria-expanded",o())),I}}),null),m}}),(()=>{var m=Jo();return m.firstChild,i(m,t(mn,{get options(){return r()},get value(){return e()},onChange:h=>n(h),class:"w-full [&>button]:flex-1",testIdPrefix:"theme-mode"}),null),m})(),t(_,{when:fl,children:m=>t(Me,{get component(){return m()}})}),t(_,{get when(){return c()},get children(){return[Zo(),t(_,{get when(){return b()},get children(){var m=el(),h=m.firstChild;return i(m,()=>b().name,h),m}}),tl(),t(Q,{get each(){return l()?.users},children:m=>(()=>{var h=ol(),S=h.firstChild;return h.$$click=()=>void Gt({userId:m.id}),i(S,()=>m.name),i(h,t(_,{get when(){return g()?.user?.id===m.id},get children(){return t(je,{size:13,class:"text-blue-400 shrink-0"})}}),null),h})()}),rl(),(()=>{var m=nl(),h=m.firstChild,S=h.firstChild;return i(m,t(Q,{get each(){return l()?.roles},children:I=>(()=>{var R=ll();return R.$$click=()=>void Gt({role:I}),i(R,I),z(E=>Fe(R,{"border-blue-400/60 bg-blue-500/15 text-blue-200":l()?.view.role===I,"border-[var(--ks-border-strong,#3f3f46)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-blue-500/30":l()?.view.role!==I},E)),R})()}),h),h.$$click=()=>P(I=>!I),i(h,t(hr,{size:10}),S),m})(),t(_,{get when(){return y()},get children(){var m=al(),h=m.firstChild,S=h.nextSibling,I=S.nextSibling;return h.$$input=R=>M(R.currentTarget.value),i(m,t(_,{get when(){return b()},get children(){var R=sl(),E=R.firstChild;return i(R,()=>b().name,E),R}}),S),i(S,t(Q,{get each(){return $()},children:R=>(()=>{var E=cl(),O=E.firstChild,X=O.nextSibling;return O.addEventListener("change",()=>N(R)),i(X,R),z(()=>O.checked=C().includes(R)),E})()})),I.$$click=()=>void hl(v().trim(),C()),z(()=>I.disabled=!v().trim()),z(()=>h.value=v()),m}})]}}),t(_,{when:pl,children:m=>t(Me,{get component(){return m()}})})]},Sr=e=>{const{userMenuOpen:n,collapsed:r,reducedMotion:s}=he();return t(_,{get when(){return Y(()=>e.variant==="rail")()?Y(()=>!!n())()&&r():n()},get children(){return t(_,{get when(){return e.variant==="rail"},get fallback(){return(()=>{var a=dl();return i(a,t(Xt,{})),z(o=>Z(a,te,o)),a})()},get children(){var a=ul();return i(a,t(Xt,{})),z(o=>Z(a,{...te,...s()?{}:{animation:"pop .14s ease"}},o)),a}})}})};oe(["click","input"]);var gl=d('<span class="absolute top-0.5 right-0.5 min-w-[14px] h-[14px] px-0.5 grid place-items-center text-[8px] font-bold text-[var(--ks-fg,#ffffff)] bg-red-500 rounded-md">'),vl=d('<div class="flex flex-col items-center gap-1.5 py-2 border-b border-[color-mix(in_srgb,var(--ks-border,#27272a)_60%,transparent)] shrink-0"><button type=button title="Search (\\u2318K)"aria-label=Search class="navrow p-2 text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-accent,#fbbf24)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)] cursor-pointer">'),bl=d('<div class="w-8 h-px bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)] my-1.5 mx-auto">'),ml=d('<nav class="flex-1 overflow-y-auto py-2 space-y-1 overflow-x-visible">'),xl=d('<div class="p-2 shrink-0"><button type=button class="navrow w-full flex justify-center py-1 cursor-pointer"aria-label="User menu"data-user-menu>'),kl=d('<div class="border-t border-[color-mix(in_srgb,var(--ks-border,#27272a)_60%,transparent)] px-3 py-2 shrink-0 flex items-center justify-center">'),_l=d('<button type=button class="cursor-pointer shrink-0"data-testid=workspace-switcher-trigger style=width:34px;height:34px>'),$l=d("<div><button type=button><span class=relative><span></span></span><span>"),wl=d('<span class="absolute -top-2 -right-2 z-10 grid place-items-center w-[20px] h-[20px] bg-[var(--ks-accent,#fbbf24)] text-[var(--ks-fg-on-accent,#18181b)] border-2 border-[var(--ks-bg,#18181b)] rounded-full">'),Yt=d("<span>"),Qt=d('<span class="w-full text-[9px] leading-tight text-center line-clamp-1">');const yl=null,Sl=()=>{const{collapsed:e,currentWorkspace:n,setWsOpen:r,setNotifOpen:s,setSearchFlyoutOpen:a,setFlyoutId:o,setFlyoutTop:p,tickClick:c,notifCtx:g,perms:l,visibleEntries:w,sectionContainsActive:b,activeParent:$,flyoutId:y,isActiveOrChild:P,reducedMotion:v,isActive:M,isSuperuser:C,me:x,userMenuOpen:N,setUserMenuOpen:m}=he();return t(_,{get when(){return e()},get children(){return[(()=>{var h=vl(),S=h.firstChild;return i(h,t(_,{get when(){return n()},children:I=>(()=>{var R=_l();return R.$$click=()=>{r(E=>!E),s(!1),a(!1),o(null),c()},i(R,t(Je,{get name(){return I().ws_name},get logoUrl(){return I().ws_logo_url},size:34})),z(()=>ne(R,"title",I().ws_name)),R})()}),S),S.$$click=()=>{a(I=>!I),r(!1),s(!1),o(null),c()},i(S,t(Ct,{size:17})),i(h,t(Ee,{href:"/inbox",onClick:()=>{s(!1),r(!1),a(!1),o(null),c()},title:"Workspace Inbox","aria-label":"Workspace Inbox",get class(){return`navrow relative p-2 ${M("/inbox")?"text-[var(--ks-accent,#fbbf24)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)]":"text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-accent,#fbbf24)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)]"}`},get children(){return[t(vr,{size:17}),t(_,{get when(){return g.unreadCount()>0},get children(){var I=gl();return i(I,()=>g.unreadCount()),I}})]}}),null),h})(),(()=>{var h=ml();return i(h,t(_,{get when(){return!l.loading()},get children(){return[t(Q,{get each(){return w().sections},children:S=>{const I=()=>b(S.section),R=()=>$()===S.section.id,E=()=>I()||R(),O=()=>y()===S.section.id,X=S.section.icon,ee=R()?S.visibleItems.find(fe=>P(fe))?.icon:void 0,se=()=>E()?"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_50%,transparent)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_14.000000000000002%,transparent)]":O()?"border-[var(--ks-border-strong,#3f3f46)] bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_40%,transparent)]":"border-transparent";return(()=>{var fe=$l(),re=fe.firstChild,le=re.firstChild,ce=le.firstChild,ge=le.nextSibling;return re.$$click=f=>{O()?o(null):(o(S.section.id),p(f.currentTarget.getBoundingClientRect().top),r(!1),s(!1),a(!1)),c()},i(re,t(_,{get when(){return E()},get children(){return t(Le,{inset:"top-1 bottom-1"})}}),le),i(ce,t(X,{size:19,class:"ic"})),i(le,t(_,{get when(){return R()&&ee},children:f=>{const u=f();return(()=>{var k=wl();return i(k,t(u,{size:12,"stroke-width":2.6})),z(L=>Z(k,v()?void 0:{animation:"pip .25s ease"},L)),k})()}}),null),i(ge,(()=>{var f=Y(()=>!!R());return()=>f()?S.visibleItems.find(u=>P(u))?.label??S.section.label:S.section.label})()),z(f=>{var u=R()?`${S.section.label} › ${S.visibleItems.find(D=>P(D))?.label??""}`:S.section.label,k=R()?`${S.section.label} › ${S.visibleItems.find(D=>P(D))?.label??""}`:S.section.label,L=`navrow group relative w-full flex flex-col items-center gap-1 px-1 py-1 cursor-pointer ${E()?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)]"}`,T=`grid place-items-center p-2.5 border transition-colors ${se()}`,B=te,q=`w-full text-[9px] leading-tight text-center line-clamp-1 ${R()?"text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_90%,transparent)] font-medium":""}`;return u!==f.e&&ne(re,"title",f.e=u),k!==f.t&&ne(re,"aria-label",f.t=k),L!==f.a&&ie(re,f.a=L),T!==f.o&&ie(ce,f.o=T),f.i=Z(ce,B,f.i),q!==f.n&&ie(ge,f.n=q),f},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),fe})()}}),t(Q,{get each(){return w().items},children:S=>{const I=()=>P(S),R=S.icon;return t(Ee,{get href(){return S.href},get title(){return S.label},get"aria-label"(){return S.label},onClick:c,get class(){return`navrow group relative w-full flex flex-col items-center gap-1 px-1 py-1 cursor-pointer ${I()?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)]"}`},get children(){return[t(_,{get when(){return I()},get children(){return t(Le,{inset:"top-1 bottom-1"})}}),(()=>{var E=Yt();return i(E,t(R,{size:19,class:"ic"})),z(O=>{var X=`grid place-items-center p-2.5 border transition-colors ${I()?"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_50%,transparent)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_14.000000000000002%,transparent)]":"border-transparent"}`,ee=te;return X!==O.e&&ie(E,O.e=X),O.t=Z(E,ee,O.t),O},{e:void 0,t:void 0}),E})(),(()=>{var E=Qt();return i(E,()=>S.label),E})()]}})}}),t(_,{get when(){return C()},get children(){return[bl(),t(Q,{each:yt,children:S=>{const I=()=>M(S.href),R=S.icon;return t(Ee,{get href(){return S.href},get title(){return S.label},get"aria-label"(){return S.label},onClick:c,get class(){return`navrow group relative w-full flex flex-col items-center gap-1 px-1 py-1 cursor-pointer ${I()?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)]"}`},get children(){return[t(_,{get when(){return I()},get children(){return t(Le,{inset:"top-1 bottom-1"})}}),(()=>{var E=Yt();return i(E,t(R,{size:19,class:"ic"})),z(O=>{var X=`grid place-items-center p-2.5 border transition-colors ${I()?"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_50%,transparent)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_14.000000000000002%,transparent)]":"border-transparent"}`,ee=te;return X!==O.e&&ie(E,O.e=X),O.t=Z(E,ee,O.t),O},{e:void 0,t:void 0}),E})(),(()=>{var E=Qt();return i(E,()=>S.label),E})()]}})}})]}})]}})),h})(),t(_,{when:yl,children:h=>t(Me,{get component(){return h()}})}),(()=>{var h=xl(),S=h.firstChild;return S.$$click=I=>{I.stopPropagation();const R=!N();m(R),R&&(r(!1),s(!1),o(null))},i(S,t(or,{get name(){return x()?.user?.name??""},get image(){return x()?.user?.image},size:"md"})),z(()=>ne(S,"title",x()?.user?.name??"")),h})(),(()=>{var h=kl();return i(h,t(yr,{size:16})),h})()]}})};oe(["click"]);var Cl=d('<span class="flex-1 text-[14px] font-medium truncate">'),El=d('<div class="relative group/navrow">'),Ml=d('<div class="h-14 flex items-center gap-1 px-2 border-b border-[color-mix(in_srgb,var(--ks-border,#27272a)_60%,transparent)] shrink-0">'),Nl=d('<kbd class="px-1 py-0.5 rounded border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)] text-[10px] font-mono text-[var(--ks-fg-subtle,#71717a)] shrink-0 select-none pointer-events-none">⌘K'),Pl=d('<button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] cursor-pointer"aria-label="Clear search">'),Al=d('<div class="p-2 shrink-0"><div class="w-full flex items-center gap-2 h-9 bg-[color-mix(in_srgb,var(--ks-bg,#0a0a0a)_60%,transparent)] border border-[color-mix(in_srgb,var(--ks-border-strong,#3f3f46)_60%,transparent)] focus-within:border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_60%,transparent)] transition-colors pl-2.5 pr-1.5"><input data-sidebar-search type=text placeholder="Search anything…"class="text-[12px] text-[var(--ks-fg,#ffffff)] placeholder:text-[var(--ks-fg-subtle,#71717a)] flex-1 min-w-0 bg-transparent border-0 outline-none">'),Ll=d('<button type=button title="Back to sections"aria-label="Back to sections"class="navrow flex items-center gap-2 px-2.5 py-2 mb-1 shrink-0 w-full text-left cursor-pointer text-[var(--ks-fg,#ffffff)] hover:text-[var(--ks-accent,#fbbf24)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)] transition-colors">'),Tl=d('<span class="flex-1 text-[14px] font-medium truncate">Workspace Inbox'),zl=d('<span class="min-w-[18px] h-[18px] px-1 grid place-items-center text-[10px] font-bold text-[var(--ks-fg,#ffffff)] bg-red-500 rounded-md shrink-0">'),Rl=d('<div class="text-[10px] font-semibold uppercase tracking-[0.18em] px-2.5 pt-2 pb-1 text-[var(--ks-fg-subtle,#71717a)]">Workspace'),Il=d('<div class="text-[10px] font-semibold uppercase tracking-[0.18em] px-2.5 pt-4 pb-1 text-[var(--ks-fg-subtle,#71717a)]">Platform'),Ol=d('<nav class="flex-1 overflow-y-auto px-1.5 pb-2 overflow-x-hidden">'),Dl=d('<div class="relative p-2 shrink-0"><div class="relative flex items-center gap-2.5 px-2 py-2 hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)] transition-colors"><button type=button class="flex items-center gap-2.5 flex-1 min-w-0 text-left cursor-pointer"aria-haspopup=dialog data-user-menu><div class="min-w-0 flex-1"><p class="text-[12px] text-[var(--ks-fg,#ffffff)] font-medium truncate leading-tight"></p><div class=mt-0.5></div></div></button><button type=button class="p-1 text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-accent,#fbbf24)] cursor-pointer shrink-0"></button><button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg-muted,#a1a1aa)] cursor-pointer shrink-0"aria-label="More options"data-user-menu>'),Wl=d('<div class="border-t border-[color-mix(in_srgb,var(--ks-border,#27272a)_60%,transparent)] px-3 py-2 shrink-0 flex items-center justify-center gap-2">'),Ul=d('<button type=button class="navrow flex items-center gap-2 flex-1 min-w-0 px-1.5 py-1.5 hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)] cursor-pointer text-left"aria-haspopup=dialog data-testid=workspace-switcher-trigger><span class="text-[13px] font-semibold text-[var(--ks-fg,#ffffff)] truncate flex-1">'),jl=d('<span class="text-[13px] font-semibold text-[var(--ks-fg,#ffffff)] truncate flex-1">'),ql=d('<p class="text-[12px] text-[var(--ks-fg-subtle,#71717a)] px-3 py-6 text-center">Nothing matches &ldquo;<!>&rdquo;.'),Fl=d('<button type=button class="navrow w-full flex items-center gap-2.5 px-2.5 py-2 text-left cursor-pointer text-[var(--ks-fg,#ffffff)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)]"><div class="min-w-0 flex-1"><span class="block text-[13px] truncate"></span><span class="block text-[10px] text-[var(--ks-fg-subtle,#71717a)] truncate">section'),Vl=d('<div><div class="text-[10px] font-semibold uppercase tracking-[0.18em] px-2.5 pt-3 pb-1 text-[var(--ks-fg-subtle,#71717a)]">'),Bl=d('<button type=button><span class="flex-1 text-[13px] truncate">'),Hl=d('<span class="flex items-center gap-1 text-[10px] text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_80%,transparent)] truncate">'),Kl=d('<button type=button><div class="flex-1 min-w-0"><span class="block text-[14px] font-medium truncate">'),Gl=d('<span class="text-[10px] text-blue-300/70 tracking-wide">running on <span class="text-blue-300 font-semibold">Plugin SDK</span> v');const Xl=null,Yl=null;function Jt(e){return e.capability??e.requiredPermission?.split(".")[0]}const Ql="absolute right-1.5 top-1/2 -translate-y-1/2 opacity-60 group-hover/navrow:opacity-100 focus-within:opacity-100",Jl="navrow group relative w-full flex items-center gap-3 py-2.5 px-2.5 text-left cursor-pointer",Xe="text-[var(--ks-accent,#fbbf24)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)]",_t="text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-fg,#ffffff)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_50%,transparent)]";function Zl(e,n){return`${Jl} ${n?"pr-9":""} ${e?Xe:_t}`}const ec=()=>{const{collapsed:e,currentWorkspace:n,hasMultipleOrgs:r,setWsOpen:s,setNotifOpen:a,setFlyoutId:o,tickClick:p,wsOpen:c,notifCtx:g,query:l,setQuery:w,currentSection:b,queryTrimmed:$,goBack:y,reducedMotion:P,dir:v,perms:M,nestedSearchResults:C,matchesQuery:x,goInto:N,isActive:m,chooseResult:h,level:S,visibleEntries:I,isActiveOrChild:R,tickHover:E,sectionContainsActive:O,activeParent:X,isSuperuser:ee,userMenuOpen:se,setUserMenuOpen:fe,me:re,soundOn:le,setSoundOn:ce}=he(),ge=f=>(()=>{var u=El();return i(u,t(Ee,{get href(){return f.href},onMouseEnter:E,onClick:p,get class(){return Zl(f.active,!!f.module)},get style(){return f.active?te:void 0},get children(){return[t(_,{get when(){return f.active},get children(){return t(Le,{inset:"top-1.5 bottom-1.5"})}}),t(f.icon,{get size(){return f.iconSize??18},class:"ic shrink-0"}),(()=>{var k=Cl();return i(k,()=>f.label),k})()]}}),null),i(u,t(_,{get when(){return f.module},children:k=>t(wr,{get module(){return k()},get moduleLabel(){return f.label},class:Ql})}),null),u})();return t(_,{get when(){return!e()},get children(){return[(()=>{var f=Ml();return i(f,t(_,{get when(){return n()},children:u=>(()=>{var k=Ul(),L=k.firstChild;return k.$$click=()=>{s(T=>!T),a(!1),o(null),p()},i(k,t(Je,{get name(){return u().ws_name},get logoUrl(){return u().ws_logo_url},size:30}),L),i(L,()=>u().ws_name),i(k,t(xn,{size:13,class:"text-[var(--ks-fg-subtle,#71717a)] shrink-0"}),null),z(T=>{var B=c(),q=te;return B!==T.e&&ne(k,"aria-expanded",T.e=B),T.t=Z(k,q,T.t),T},{e:void 0,t:void 0}),k})()})),f})(),(()=>{var f=Al(),u=f.firstChild,k=u.firstChild;return i(u,t(Ct,{size:14,class:"text-[var(--ks-fg-subtle,#71717a)] shrink-0"}),k),k.$$input=L=>w(L.currentTarget.value),i(u,t(_,{get when(){return l().length===0},get children(){return Nl()}}),null),i(u,t(_,{get when(){return l().length>0},get children(){var L=Pl();return L.$$click=()=>w(""),i(L,t(Ie,{size:13})),L}}),null),z(L=>Z(u,te,L)),z(()=>k.value=l()),f})(),t(_,{get when(){return Y(()=>!!b())()&&!$()},get children(){var f=Ll();return Te(f,"click",y,!0),i(f,t(Es,{size:17,class:"shrink-0"}),null),i(f,t(_,{get when(){return b()},children:u=>{const k=u().section.icon;return[t(k,{size:16,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"}),(()=>{var L=jl();return i(L,()=>u().section.label),L})()]}}),null),z(u=>Z(f,te,u)),f}}),(()=>{var f=Ol();return i(f,t(_,{get when(){return!M.loading()},get children(){return[t(_,{get when(){return $()},get children(){return t(_,{get when(){return C().length>0},get fallback(){return(()=>{var u=ql(),k=u.firstChild,L=k.nextSibling;return L.nextSibling,i(u,()=>l().trim(),L),u})()},get children(){return t(Q,{get each(){return C()},children:u=>(()=>{var k=Vl(),L=k.firstChild;return i(L,()=>u.section.label),i(k,t(_,{get when(){return Y(()=>!!(x(u.section.label)&&u.section.id!=="_root"))()&&u.section.id!=="_platform"},get children(){var T=Fl(),B=T.firstChild,q=B.firstChild;return T.$$click=()=>{N(u.section.id),w(""),p()},i(T,()=>{const D=u.section.icon;return t(D,{size:16,class:"shrink-0"})},B),i(q,t(kt,{get label(){return u.section.label}})),T}}),null),i(k,t(Q,{get each(){return u.items},children:T=>{const B=T.item.icon,q=()=>m(T.item.href);return(()=>{var D=Bl(),F=D.firstChild;return D.$$click=()=>h(T.item.href),i(D,t(B,{size:15,class:"shrink-0"}),F),i(F,t(kt,{get label(){return T.item.label}})),z(()=>ie(D,`navrow w-full flex items-center gap-2.5 px-2.5 py-2 pl-6 text-left cursor-pointer ${q()?Xe:"text-[var(--ks-fg,#ffffff)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)]"}`)),D})()}}),null),k})()})}})}}),t(_,{get when(){return Y(()=>!$())()&&S()==="root"},get children(){return[t(Ee,{href:"/inbox",onClick:()=>{a(!1),s(!1),o(null),p()},get class(){return`navrow group relative w-full flex items-center gap-3 py-2.5 px-2.5 text-left ${m("/inbox")?Xe:_t}`},get style(){return m("/inbox")?te:void 0},"aria-label":"Workspace Inbox",get children(){return[t(_,{get when(){return m("/inbox")},get children(){return t(Le,{inset:"top-1.5 bottom-1.5"})}}),t(vr,{size:18,class:"ic shrink-0"}),Tl(),t(_,{get when(){return g.unreadCount()>0},get children(){var u=zl();return i(u,()=>g.unreadCount()),u}})]}}),Rl(),t(Q,{get each(){return I().items},children:u=>t(ge,{get href(){return u.href},get label(){return u.label},get icon(){return u.icon},get active(){return R(u)},get module(){return Jt(u)}})}),t(Q,{get each(){return I().sections},children:u=>{const k=()=>O(u.section),L=()=>X()===u.section.id,T=L()?u.visibleItems.find(D=>R(D)):void 0,B=u.section.icon,q=()=>k()?Xe:L()?"text-[var(--ks-fg,#ffffff)]":_t;return(()=>{var D=Kl(),F=D.firstChild,K=F.firstChild;return Te(D,"mouseenter",E),D.$$click=()=>N(u.section.id),i(D,t(_,{get when(){return k()||L()},get children(){return t(Le,{inset:"top-1.5 bottom-1.5"})}}),F),i(D,t(B,{size:18,class:"ic shrink-0"}),F),i(K,()=>u.section.label),i(F,t(_,{get when(){return L()&&T},get children(){var U=Hl();return i(U,t(ua,{size:10,class:"shrink-0"}),null),i(U,()=>T.label,null),U}}),null),i(D,t(Ps,{size:16,class:"shrink-0 text-[var(--ks-fg-subtle,#71717a)]"}),null),z(U=>{var J=`navrow group relative w-full flex items-center gap-3 py-2.5 px-2.5 text-left cursor-pointer ${q()}`,ue=k()?te:void 0;return J!==U.e&&ie(D,U.e=J),U.t=Z(D,ue,U.t),U},{e:void 0,t:void 0}),D})()}}),t(_,{get when(){return ee()},get children(){return[Il(),t(Q,{each:yt,children:u=>t(ge,{get href(){return u.href},get label(){return u.label},get icon(){return u.icon},get active(){return m(u.href)}})})]}})]}}),t(_,{get when(){return Y(()=>!$()&&S()!=="root")()&&b()},get children(){return t(Q,{get each(){return b().visibleItems},children:u=>t(ge,{get href(){return u.href},get label(){return u.label},get icon(){return u.icon},iconSize:17,get active(){return m(u.href)},get module(){return Jt(u)}})})}})]}})),z(u=>Z(f,P()?void 0:{animation:`${$()||v()==="in"?"slideIn":"slideOut"} .18s ease`},u)),f})(),t(_,{when:Xl,children:f=>t(Me,{get component(){return f()}})}),(()=>{var f=Dl(),u=f.firstChild,k=u.firstChild,L=k.firstChild,T=L.firstChild,B=T.nextSibling,q=k.nextSibling,D=q.nextSibling;return k.$$click=F=>{F.stopPropagation();const K=!se();fe(K),K&&(s(!1),a(!1),o(null))},i(k,t(or,{get name(){return re()?.user?.name??""},get image(){return re()?.user?.image},size:"md"}),L),i(T,()=>re()?.user?.name??""),i(B,t(Po,{})),q.$$click=F=>{F.stopPropagation(),ce(K=>!K)},i(q,(()=>{var F=Y(()=>!!le());return()=>F()?t(ai,{size:14}):t(li,{size:14})})()),D.$$click=F=>{F.stopPropagation();const K=!se();fe(K),K&&(s(!1),a(!1),o(null))},i(D,t(pa,{size:14})),i(f,t(Sr,{variant:"docked"}),null),z(F=>{var K=te,U=se(),J=le()?"Mute UI sound":"Enable UI sound",ue=le()?"Mute UI sound":"Enable UI sound";return F.e=Z(u,K,F.e),U!==F.t&&ne(k,"aria-expanded",F.t=U),J!==F.a&&ne(q,"title",F.a=J),ue!==F.o&&ne(q,"aria-label",F.o=ue),F},{e:void 0,t:void 0,a:void 0,o:void 0}),f})(),(()=>{var f=Wl();return i(f,t(yr,{size:16,get class(){return"[filter:sepia(1)_saturate(6)_hue-rotate(185deg)_brightness(0.95)]"}}),null),i(f,(()=>{var u=Y(()=>!0);return()=>u()?(()=>{var k=Gl(),L=k.firstChild,T=L.nextSibling;return T.nextSibling,i(k,()=>re()?.sdkVersion||"?",null),k})():t(_,{when:Yl,children:k=>t(Me,{get component(){return k()}})})})(),null),f})()]}})};oe(["input","click"]);var tc=d('<aside class="sticky left-0 top-0 h-screen z-40 flex flex-col border-r border-[color-mix(in_srgb,var(--ks-border,#27272a)_60%,transparent)] bg-[var(--ks-surface,#0f0f0f)] shrink-0 overflow-visible transition-[width] duration-200 ease-out"><button type=button class="navrow absolute -right-3 top-16 z-30 w-6 h-6 grid place-items-center bg-[var(--ks-surface-raised,#1a1a1a)] border border-[var(--ks-border-strong,#3f3f46)] text-[var(--ks-fg,#ffffff)] hover:text-[var(--ks-accent,#fbbf24)] rounded-full cursor-pointer shadow">'),rc=d('<div class="fixed inset-0 z-40 cursor-default"aria-label=Close>');const nc=()=>{const{collapsed:e,toggleCollapse:n,flyoutId:r,notifOpen:s,wsOpen:a,searchFlyoutOpen:o,closeAllPops:p}=he();return[(()=>{var c=tc(),g=c.firstChild;return Te(g,"click",n,!0),i(g,(()=>{var l=Y(()=>!!e());return()=>l()?t(Ia,{size:13}):t(Ta,{size:13})})()),i(c,t(Sl,{}),null),i(c,t(Sr,{variant:"rail"}),null),i(c,t(ec,{}),null),z(l=>{var w=!e(),b=!!e(),$=e()?"Expand":"Collapse",y=e()?"Expand sidebar":"Collapse sidebar";return w!==l.e&&c.classList.toggle("w-[256px]",l.e=w),b!==l.t&&c.classList.toggle("w-[72px]",l.t=b),$!==l.a&&ne(g,"title",l.a=$),y!==l.o&&ne(g,"aria-label",l.o=y),l},{e:void 0,t:void 0,a:void 0,o:void 0}),c})(),t(_,{get when(){return a()||s()||r()||o()},get children(){var c=rc();return Te(c,"click",p,!0),c}}),t(Go,{}),t(Oo,{}),t(yi,{}),t(wo,{}),t(jo,{})]},sc=()=>t(mi,{get children(){return t(nc,{})}});oe(["click"]);function ac(){const e=new Image;e.onload=()=>{const r=document.createElement("canvas");r.width=64,r.height=64;const s=r.getContext("2d");if(!s)return;s.drawImage(e,0,0,64,64),s.globalCompositeOperation="color",s.fillStyle="#2563eb",s.fillRect(0,0,64,64),s.globalCompositeOperation="source-atop",s.fillStyle="rgba(37, 99, 235, 0.5)",s.fillRect(0,0,64,64);const a=r.toDataURL("image/png");document.querySelectorAll('link[rel~="icon"]').forEach(p=>p.remove());const o=document.createElement("link");o.rel="icon",o.type="image/png",o.href=a,document.head.appendChild(o)},e.src="/favicon-32.png"}function ic(){const e=et();return _e(()=>{e()&&typeof document<"u"&&ac()}),null}function oc(){const e=et(),n=Ze(),r=qe(),s=ar();return _e(()=>{if(!e()||!n.ready())return;const a=n.plugins();if(a.length===0)return;const o=r.pathname.split("/").filter(Boolean)[0]??"";if(a.some(c=>c.routeBase===o))return;const p=`/${a[0].routeBase}`;r.pathname!==p&&s(p,{replace:!0})}),null}var lc=d('<div class="bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_10%,transparent)] border-b border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_20%,transparent)] px-4 py-2.5 flex items-center gap-3 text-sm"><span class="text-[var(--ks-fg,#ffffff)] flex-1 min-w-0">Pick a username so you can sign in without your email next time.</span><button aria-label=Dismiss class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] shrink-0">');const Cr="ks_username_banner_dismissed";function cc(){try{return localStorage.getItem(Cr)==="1"}catch{return!1}}function uc(){const e=Re(),[n,r]=W(cc()),s=()=>!!e()?.user&&!e()?.user?.username&&!n(),a=()=>{try{localStorage.setItem(Cr,"1")}catch{}r(!0)};return t(_,{get when(){return s()},get children(){var o=lc(),p=o.firstChild,c=p.nextSibling;return i(o,t(Ys,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"}),p),i(o,t(Ee,{href:"/settings#username",class:"text-[var(--ks-accent,#fbbf24)] hover:text-[var(--ks-accent,#fbbf24)] text-xs uppercase tracking-widest font-medium shrink-0",children:"Set username"}),c),c.$$click=a,i(c,t(Ie,{size:14})),o}})}oe(["click"]);const[Er,Et]=W(null),dc=Er;function fc(){const e=Er();if(!e){window.location.reload();return}navigator.serviceWorker.addEventListener("controllerchange",()=>{window.location.reload()},{once:!0}),e.postMessage({type:"SKIP_WAITING"})}function pc(){Et(null)}function hc(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Et(e)})}function gc(){typeof window>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js?v=0.0.0").then(n=>{n.waiting&&navigator.serviceWorker.controller&&Et(n.waiting),n.addEventListener("updatefound",()=>{const r=n.installing;r&&hc(r)})}).catch(()=>{})})}var vc=d('<div role=status aria-live=polite class="fixed left-1/2 -translate-x-1/2 bottom-4 z-[60] card-bg border border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_40%,transparent)] rounded-md shadow-lg px-4 py-3 flex items-center gap-3 text-sm max-w-[90vw]"><span class="text-[var(--ks-fg,#ffffff)] flex-1 min-w-0">A new version of Hilinga is available.</span><button class="text-[var(--ks-accent,#fbbf24)] hover:text-[var(--ks-accent,#fbbf24)] text-xs uppercase tracking-widest font-medium shrink-0">Reload</button><button aria-label="Dismiss update prompt"class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] shrink-0">');function bc(){return t(_,{get when(){return dc()},get children(){var e=vc(),n=e.firstChild,r=n.nextSibling,s=r.nextSibling;return i(e,t(qa,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"}),n),Te(r,"click",fc,!0),Te(s,"click",pc,!0),i(s,t(Ie,{size:14})),e}})}oe(["click"]);const mc="ks_active_workspace_id",Zt="__ksApiFetchPatched";function xc(e){return typeof e=="string"?e:e instanceof URL?e.href:e.url}function kc(e){if(e.startsWith("/api/"))return!0;try{const n=new URL(e,typeof window<"u"?window.location.href:void 0);return n.origin===window.location.origin&&n.pathname.startsWith("/api/")}catch{return!1}}function _c(){if(typeof window>"u")return;const e=window;if(e[Zt])return;e[Zt]=!0;const n=window.fetch.bind(window);window.fetch=async(r,s)=>{let a=!1;try{const p=xc(r);if(a=kc(p),a){let c=null;try{c=localStorage.getItem(mc)}catch{}if(c){const g=new Headers(s?.headers??(r instanceof Request?r.headers:void 0));g.has("X-Workspace-Id")||(g.set("X-Workspace-Id",c),s={...s??{},headers:g})}}}catch{}const o=await n(r,s);return a&&o.status===401&&!$c()&&(window.location.href="/login"),o}}function $c(){const e=window.location.pathname;return e==="/login"||e==="/register"}_c();var wc=d("<div class=ks-route-progress aria-hidden=true>"),yc=d('<div class="page-bg min-h-screen flex"><main class="flex-1 h-screen min-w-0 overflow-y-auto overflow-x-hidden flex flex-col">');function er(){const e=en();return t(_,{get when(){return e()},get children(){return wc()}})}function Sc(e){let n=!1;return _e(()=>{n||(n=!0,e.onRender())}),null}function Cc(e){const n=qe(),r=()=>n.pathname==="/login"||n.pathname==="/register",[s,a]=W(!1);return t(_,{get when(){return!r()},get fallback(){return[t(er,{}),t(zt,{get children(){return e.children}})]},get children(){return t(_n,{get children(){return t(ui,{get children(){return t(un,{get children(){return t(fi,{get children(){var o=yc(),p=o.firstChild;return o.$$contextmenu=c=>{const g=c.target;g instanceof HTMLInputElement||g instanceof HTMLTextAreaElement||g instanceof HTMLElement&&g.isContentEditable||c.preventDefault()},i(o,t(er,{}),p),i(o,t(ic,{}),p),i(o,t(oc,{}),p),i(o,t(sc,{}),p),i(p,t(uc,{}),null),i(p,t(zt,{get fallback(){return Y(()=>!!s())()?[]:t(dn,{})},get children(){return[t(Sc,{onRender:()=>a(!0)}),Y(()=>e.children)]}}),null),o}})}})}})}})}})}function Ec(){const e=Qn;return t(kn,{get children(){return t(cn,{get children(){return[t(e,{root:Cc,get children(){return t(vs,{})}}),t(bc,{})]}})}})}oe(["contextmenu"]);const Mc=e=>null;var Nc=d("<span style=font-size:1.5em;text-align:center;position:fixed;left:0px;bottom:55%;width:100%>");const Pc=e=>{const n="Error | Uncaught Client Exception";return t(tn,{fallback:r=>(console.error(r),[(()=>{var s=Nc();return i(s,n),s})(),t(Mc,{code:500})]),get children(){return e.children}})};function tr(e){return e.children}function Ac(){return t(tr,{get children(){return t(tr,{get children(){return t(Pc,{get children(){return t(Ec,{})}})}})}})}function Lc(e,n){rn(e,n)}const Tc=localStorage.getItem("ks-erp-theme"),zc=Tc||"dark";document.documentElement.classList.add(zc);Lc(()=>t(Ac,{}),document.getElementById("app"));gc();const Uc=void 0;export{Uc as default};