@kahitsan/plugin-sdk 0.8.0 → 0.8.1

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 (33) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/shell/_build/.vite/manifest.json +7 -7
  4. package/shell/_build/.vite/manifest.json.br +0 -0
  5. package/shell/_build/.vite/manifest.json.gz +0 -0
  6. package/shell/_build/assets/client-Bf7-2Yun.js +2 -0
  7. package/shell/_build/assets/client-Bf7-2Yun.js.br +0 -0
  8. package/shell/_build/assets/client-Bf7-2Yun.js.gz +0 -0
  9. package/shell/_build/assets/client-GDtwpC-d.css +1 -0
  10. package/shell/_build/assets/client-GDtwpC-d.css.br +0 -0
  11. package/shell/_build/assets/client-GDtwpC-d.css.gz +0 -0
  12. package/shell/_build/assets/{index-CHZcwpj8.js → index-CTiiFAXk.js} +1 -1
  13. package/shell/_build/assets/workspace-nav-DId-5rKi.js +1 -0
  14. package/shell/_build/assets/workspace-nav-DId-5rKi.js.br +0 -0
  15. package/shell/_build/assets/workspace-nav-DId-5rKi.js.gz +0 -0
  16. package/shell/_server/assets/app-GDtwpC-d.css +1 -0
  17. package/shell/_server/assets/app-GDtwpC-d.css.br +0 -0
  18. package/shell/_server/assets/app-GDtwpC-d.css.gz +0 -0
  19. package/shell/index.html +1 -1
  20. package/shell/index.html.br +0 -0
  21. package/shell/index.html.gz +0 -0
  22. package/shell/_build/assets/client-BC2r94zJ.js +0 -2
  23. package/shell/_build/assets/client-BC2r94zJ.js.br +0 -0
  24. package/shell/_build/assets/client-BC2r94zJ.js.gz +0 -0
  25. package/shell/_build/assets/client-DHSje8fl.css +0 -1
  26. package/shell/_build/assets/client-DHSje8fl.css.br +0 -0
  27. package/shell/_build/assets/client-DHSje8fl.css.gz +0 -0
  28. package/shell/_build/assets/workspace-nav-aH0jw7aW.js +0 -1
  29. package/shell/_build/assets/workspace-nav-aH0jw7aW.js.br +0 -0
  30. package/shell/_build/assets/workspace-nav-aH0jw7aW.js.gz +0 -0
  31. package/shell/_server/assets/app-DHSje8fl.css +0 -1
  32. package/shell/_server/assets/app-DHSje8fl.css.br +0 -0
  33. package/shell/_server/assets/app-DHSje8fl.css.gz +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kahitsan/plugin-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "THE single public author surface for Hilinga plugins: createPlugin, auth guards, the workspace-scoped data surface (makeDataSurface) + migrations + withTenantContext, cross-plugin RPC, and the wire-protocol verify surface. One npm package, no -composite/-protocol companions. Self-contained, no kernel internals, no signing capability.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,8 +27,8 @@
27
27
  "file": "assets/routing-C6AwqsGL.js",
28
28
  "name": "routing"
29
29
  },
30
- "_workspace-nav-aH0jw7aW.js": {
31
- "file": "assets/workspace-nav-aH0jw7aW.js",
30
+ "_workspace-nav-DId-5rKi.js": {
31
+ "file": "assets/workspace-nav-DId-5rKi.js",
32
32
  "name": "workspace-nav",
33
33
  "imports": [
34
34
  "_auth-Cej23JxT.js",
@@ -70,7 +70,7 @@
70
70
  ]
71
71
  },
72
72
  "src/routes/index.tsx?pick=default&pick=$css": {
73
- "file": "assets/index-CHZcwpj8.js",
73
+ "file": "assets/index-CTiiFAXk.js",
74
74
  "name": "index",
75
75
  "src": "src/routes/index.tsx?pick=default&pick=$css",
76
76
  "isEntry": true,
@@ -78,7 +78,7 @@
78
78
  "imports": [
79
79
  "_routing-C6AwqsGL.js",
80
80
  "_auth-Cej23JxT.js",
81
- "_workspace-nav-aH0jw7aW.js",
81
+ "_workspace-nav-DId-5rKi.js",
82
82
  "_components-CWmQ2MDX.js"
83
83
  ]
84
84
  },
@@ -159,7 +159,7 @@
159
159
  ]
160
160
  },
161
161
  "virtual:$vinxi/handler/client": {
162
- "file": "assets/client-BC2r94zJ.js",
162
+ "file": "assets/client-Bf7-2Yun.js",
163
163
  "name": "client",
164
164
  "src": "virtual:$vinxi/handler/client",
165
165
  "isEntry": true,
@@ -167,7 +167,7 @@
167
167
  "_routing-C6AwqsGL.js",
168
168
  "_plugin-ui-CpJUaqcE.js",
169
169
  "_auth-Cej23JxT.js",
170
- "_workspace-nav-aH0jw7aW.js",
170
+ "_workspace-nav-DId-5rKi.js",
171
171
  "_components-CWmQ2MDX.js"
172
172
  ],
173
173
  "dynamicImports": [
@@ -184,7 +184,7 @@
184
184
  "src/routes/workspaces.tsx?pick=default&pick=$css"
185
185
  ],
186
186
  "css": [
187
- "assets/client-DHSje8fl.css"
187
+ "assets/client-GDtwpC-d.css"
188
188
  ]
189
189
  }
190
190
  }
Binary file
Binary file
@@ -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-CTiiFAXk.js","assets/workspace-nav-DId-5rKi.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 Ir,a as le,b as Or,d as Dr,e as r,m as G,g as Wr,R as Ur,u as jr,s as Pt,f as qr,S as y,o as er,h as Fr,i as Vr,j as Br,k as W,l as Ye,n as it,p as oe,q as Hr,r as Kr,t as Gr,v as Xr,w as Yr,x as Ke,y as F,z as i,A as d,B as tr,C as rr,D as _t,E as $t,F as Fe,G as nr,H as _e,I as Q,J as z,K as ae,L as Y,M as ie,N as Ae,O as Ve,P as Qr,Q as sr,T as At,U as Te,V as Tt,W as Jr,X as Zr,Y as en}from"./routing-C6AwqsGL.js";import{w as tn,c as rn,r as nn,u as Ze,f as sn,n as ke,e as Ce,d as an,A as ar,M as on,P as ln,a as cn}from"./plugin-ui-CpJUaqcE.js";import{I as B,u as ze,a as un,b as dn,c as Re,d as ir,s as fn,e as pn,S as hn,B as Lt,F as zt,x as Ie,f as et,g as gn,h as vn,i as mn,T as bn,A as xn}from"./auth-Cej23JxT.js";import{b as kn,u as _n,l as $n,a as wn,m as yn,c as or,d as Sn,i as Cn,e as Mn}from"./workspace-nav-DId-5rKi.js";import{A as Le}from"./components-CWmQ2MDX.js";const ot="Invariant Violation",{setPrototypeOf:En=function(e,n){return e.__proto__=n,e}}=Object;class wt extends Error{framesToPop=1;name=ot;constructor(n=ot){super(typeof n=="number"?`${ot}: ${n} (see https://github.com/apollographql/invariant-packages)`:n),En(this,wt.prototype)}}function lt(e,n){if(!e)throw new wt(n)}const Nn=/^[A-Za-z]:\//;function Pn(e=""){return e&&e.replace(/\\/g,"/").replace(Nn,n=>n.toUpperCase())}const An=/^[/\\]{2}/,Tn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Ln=/^[A-Za-z]:$/,zn=function(e){if(e.length===0)return".";e=Pn(e);const n=e.match(An),t=gt(e),s=e[e.length-1]==="/";return e=Rn(e,!t),e.length===0?t?"/":s?"./":".":(s&&(e+="/"),Ln.test(e)&&(e+="/"),n?t?`//${e}`:`//./${e}`:t&&!gt(e)?`/${e}`:e)},lr=function(...e){if(e.length===0)return".";let n;for(const t of e)t&&t.length>0&&(n===void 0?n=t:n+=`/${t}`);return n===void 0?".":zn(n.replace(/\/\/+/g,"/"))};function Rn(e,n){let t="",s=0,a=-1,o=0,f=null;for(let c=0;c<=e.length;++c){if(c<e.length)f=e[c];else{if(f==="/")break;f="/"}if(f==="/"){if(!(a===c-1||o===1))if(o===2){if(t.length<2||s!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){const g=t.lastIndexOf("/");g===-1?(t="",s=0):(t=t.slice(0,g),s=t.length-1-t.lastIndexOf("/")),a=c,o=0;continue}else if(t.length>0){t="",s=0,a=c,o=0;continue}}n&&(t+=t.length>0?"/..":"..",s=2)}else t.length>0?t+=`/${e.slice(a+1,c)}`:t=e.slice(a+1,c),s=c-a-1;a=c,o=0}else f==="."&&o!==-1?++o:o=-1}return t}const gt=function(e){return Tn.test(e)};function In(e){return`virtual:${e}`}function On(e){return e.handler?.endsWith(".html")?gt(e.handler)?e.handler:lr(e.root,e.handler):`$vinxi/handler/${e.name}`}const Dn=new Proxy({},{get(e,n){return lt(typeof n=="string","Bundler name should be a string"),{name:n,type:"client",handler:In(On({name:n})),baseURL:"/_build",chunks:new Proxy({},{get(t,s){lt(typeof s=="string","Chunk expected");let a=lr("/_build",s+".mjs");return{import(){return import(a)},output:{path:a}}}}),inputs:new Proxy({},{get(t,s){lt(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=Dn;const Wn=e=>n=>{const{base:t}=n,s=Ir(()=>n.children),a=le(()=>Or(s(),n.base||""));let o;const f=Dr(e,a,()=>o,{base:t,singleFlight:n.singleFlight,transformUrl:n.transformUrl});return e.create&&e.create(f),r(Ur.Provider,{value:f,get children(){return r(Un,{routerState:f,get root(){return n.root},get preload(){return n.rootPreload||n.rootLoad},get children(){return[G(()=>(o=Wr())&&null),r(jn,{routerState:f,get branches(){return a()}})]}})}})};function Un(e){const n=e.routerState.location,t=e.routerState.params,s=le(()=>e.preload&&jr(()=>{Pt(!0),e.preload({params:t,location:n,intent:qr()||"initial"}),Pt(!1)}));return r(y,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:a=>r(a,{params:t,location:n,get data(){return s()},get children(){return e.children}})})}function jn(e){const n=[];let t;const s=le(er(e.routerState.matches,(a,o,f)=>{let c=o&&a.length===o.length;const g=[];for(let l=0,$=a.length;l<$;l++){const m=o&&o[l],_=a[l];f&&m&&_.route.key===m.route.key?g[l]=f[l]:(c=!1,n[l]&&n[l](),Vr(w=>{n[l]=w,g[l]=Br(e.routerState,g[l-1]||e.routerState.base,Rt(()=>s()[l+1]),()=>{const P=e.routerState.matches();return P[l]??P[0]})}))}return n.splice(a.length).forEach(l=>l()),f&&c?f:(t=g[0],g)}));return Rt(()=>s()&&t)()}const Rt=e=>()=>r(y,{get when(){return e()},keyed:!0,children:n=>r(Fr.Provider,{value:n,get children(){return n.outlet()}})});function qn([e,n],t,s){return[e,s?a=>n(s(a)):n]}function Fn(e){let n=!1;const t=a=>typeof a=="string"?{value:a}:a,s=qn(W(t(e.get()),{equals:(a,o)=>a.value===o.value&&a.state===o.state}),void 0,a=>(!n&&e.set(a),it.registry&&!it.done&&(it.done=!0),a));return e.init&&Ye(e.init((a=e.get())=>{n=!0,s[1](t(a)),n=!1})),Wn({signal:s,create:e.create,utils:e.utils})}function Vn(e,n,t){return e.addEventListener(n,t),()=>e.removeEventListener(n,t)}function Bn(e,n){const t=e&&document.getElementById(e);t?t.scrollIntoView():n&&window.scrollTo(0,0)}const Hn=new Map;function Kn({preload:e=!0,explicitLinks:n=!1,actionBase:t="/_server",transformUrl:s}={}){return a=>{const o=a.base.path(),f=a.navigatorFactory(a.base);let c,g;function l(v){return v.namespaceURI==="http://www.w3.org/2000/svg"}function $(v){if(v.defaultPrevented||v.button!==0||v.metaKey||v.altKey||v.ctrlKey||v.shiftKey)return;const M=v.composedPath().find(C=>C instanceof Node&&C.nodeName.toUpperCase()==="A");if(!M||n&&!M.hasAttribute("link"))return;const S=l(M),x=S?M.href.baseVal:M.href;if((S?M.target.baseVal:M.target)||!x&&!M.hasAttribute("state"))return;const b=(M.getAttribute("rel")||"").split(/\s+/);if(M.hasAttribute("download")||b&&b.includes("external"))return;const h=S?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 m(v){const M=$(v);if(!M)return;const[S,x]=M,E=a.parsePath(x.pathname+x.search+x.hash),b=S.getAttribute("state");v.preventDefault(),f(E,{resolve:!1,replace:S.hasAttribute("replace"),scroll:!S.hasAttribute("noscroll"),state:b?JSON.parse(b):void 0})}function _(v){const M=$(v);if(!M)return;const[S,x]=M;s&&(x.pathname=s(x.pathname)),a.preloadRoute(x,S.getAttribute("preload")!=="false")}function w(v){clearTimeout(c);const M=$(v);if(!M)return g=null;const[S,x]=M;g!==S&&(s&&(x.pathname=s(x.pathname)),c=setTimeout(()=>{a.preloadRoute(x,S.getAttribute("preload")!=="false"),g=S},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,Hr);if(M=a.parsePath(x.pathname+x.search),!M.startsWith(t))return}if(v.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const S=Hn.get(M);if(S){v.preventDefault();const x=new FormData(v.target,v.submitter);S.call({r:a,f:v.target},v.target.enctype==="multipart/form-data"?x:new URLSearchParams(x))}}oe(["click","submit"]),document.addEventListener("click",m),e&&(document.addEventListener("mousemove",w,{passive:!0}),document.addEventListener("focusin",_,{passive:!0}),document.addEventListener("touchstart",_,{passive:!0})),document.addEventListener("submit",P),Ye(()=>{document.removeEventListener("click",m),e&&(document.removeEventListener("mousemove",w),document.removeEventListener("focusin",_),document.removeEventListener("touchstart",_)),document.removeEventListener("submit",P)})}}function Gn(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}},t=Xr();return Fn({get:n,set({value:s,replace:a,scroll:o,state:f}){a?window.history.replaceState(Kr(f),"",s):window.history.pushState(f,"",s),Bn(decodeURIComponent(window.location.hash.slice(1)),o),Gr()},init:s=>Vn(window,"popstate",Yr(s,a=>{if(a)return!t.confirm(a);{const o=n();return!t.confirm(o.value,{state:o.state})}})),create:Kn({preload:e.preload,explicitLinks:e.explicitLinks,actionBase:e.actionBase,transformUrl:e.transformUrl}),utils:{go:s=>window.history.go(s),beforeLeave:t}})(e)}function Xn(e){e.forEach(n=>{if(!n.attrs.href)return;let t=document.head.querySelector(`link[href="${n.attrs.href}"]`);t||(t=document.createElement("link"),t.setAttribute("rel","preload"),t.setAttribute("as","style"),t.setAttribute("href",n.attrs.href),document.head.appendChild(t))})}var Yn=d("<style>"),Qn=d("<link>"),Jn=d("<script> "),Zn=d("<noscript>");const es={style:e=>(()=>{var n=Yn();return Ke(n,F(()=>e.attrs),!1,!0),i(n,()=>e.children),n})(),link:e=>(()=>{var n=Qn();return Ke(n,F(()=>e.attrs),!1,!1),n})(),script:e=>e.attrs.src?(()=>{var n=Jn();return Ke(n,F(()=>e.attrs,{get id(){return e.key}}),!1,!0),n})():null,noscript:e=>(()=>{var n=Zn();return Ke(n,F(()=>e.attrs),!1,!0),n})()};function ts(e,n){let{tag:t,attrs:{key:s,...a}={key:void 0},children:o}=e;return es[t]({attrs:{...a,nonce:n},key:s,children:o})}function rs(e,n,t,s="default"){return tr(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"&&Xn(c),{default:l=>[...c.map($=>ts($)),r(o,l)]}}})}const Pe={NORMAL:0,WILDCARD:1,PLACEHOLDER:2};function ns(e={}){const n={options:e,rootNode:cr(),staticRoutesMap:{}},t=s=>e.strictTrailingSlash?s:s.replace(/\/$/,"")||"/";if(e.routes)for(const s in e.routes)It(n,t(s),e.routes[s]);return{ctx:n,lookup:s=>ss(n,t(s)),insert:(s,a)=>It(n,t(s),a),remove:s=>as(n,t(s))}}function ss(e,n){const t=e.staticRoutesMap[n];if(t)return t.data;const s=n.split("/"),a={};let o=!1,f=null,c=e.rootNode,g=null;for(let l=0;l<s.length;l++){const $=s[l];c.wildcardChildNode!==null&&(f=c.wildcardChildNode,g=s.slice(l).join("/"));const m=c.children.get($);if(m===void 0){if(c&&c.placeholderChildren.length>1){const _=s.length-l;c=c.placeholderChildren.find(w=>w.maxDepth===_)||null}else c=c.placeholderChildren[0]||null;if(!c)break;c.paramName&&(a[c.paramName]=$),o=!0}else c=m}return(c===null||c.data===null)&&f!==null&&(c=f,a[c.paramName||"_"]=g,o=!0),c?o?{...c.data,params:o?a:void 0}:c.data:null}function It(e,n,t){let s=!0;const a=n.split("/");let o=e.rootNode,f=0;const c=[o];for(const g of a){let l;if(l=o.children.get(g))o=l;else{const $=is(g);l=cr({type:$,parent:o}),o.children.set(g,l),$===Pe.PLACEHOLDER?(l.paramName=g==="*"?`_${f++}`:g.slice(1),o.placeholderChildren.push(l),s=!1):$===Pe.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=t,s===!0&&(e.staticRoutesMap[n]=o),o}function as(e,n){let t=!1;const s=n.split("/");let a=e.rootNode;for(const o of s)if(a=a.children.get(o),!a)return t;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=[]),t=!0}return t}function cr(e={}){return{type:e.type||Pe.NORMAL,maxDepth:0,parent:e.parent||null,children:new Map,data:e.data||null,paramName:e.paramName||null,wildcardChildNode:null,placeholderChildren:[]}}function is(e){return e.startsWith("**")?Pe.WILDCARD:e[0]===":"||e==="*"?Pe.PLACEHOLDER:Pe.NORMAL}const os="modulepreload",ls=function(e){return"/_build/"+e},Ot={},ge=function(n,t,s){let a=Promise.resolve();if(t&&t.length>0){let f=function(l){return Promise.all(l.map($=>Promise.resolve($).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),g=c?.nonce||c?.getAttribute("nonce");a=f(t.map(l=>{if(l=ls(l),l in Ot)return;Ot[l]=!0;const $=l.endsWith(".css"),m=$?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const _=document.createElement("link");if(_.rel=$?"stylesheet":os,$||(_.as="script"),_.crossOrigin="",_.href=l,g&&_.setAttribute("nonce",g),document.head.appendChild(_),$)return new Promise((w,P)=>{_.addEventListener("load",w),_.addEventListener("error",()=>P(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(f){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=f,window.dispatchEvent(c),!c.defaultPrevented)throw f}return a.then(f=>{for(const c of f||[])c.status==="rejected"&&o(c.reason);return n().catch(o)})},ur=[{page:!0,$component:{src:"src/routes/[...slug].tsx?pick=default&pick=$css",build:()=>ge(()=>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:()=>ge(()=>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:()=>ge(()=>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:()=>ge(()=>import("./index-CTiiFAXk.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:()=>ge(()=>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:()=>ge(()=>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:()=>ge(()=>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:()=>ge(()=>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:()=>ge(()=>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:()=>ge(()=>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:()=>ge(()=>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"}],cs=us(ur.filter(e=>e.page));function us(e){function n(t,s,a,o){const f=Object.values(t).find(c=>a.startsWith(c.id+"/"));return f?(n(f.children||(f.children=[]),s,a.slice(f.id.length)),t):(t.push({...s,id:a,path:a.replace(/\([^)/]+\)/g,"").replace(/\/+/g,"/")}),t)}return e.sort((t,s)=>t.path.length-s.path.length).reduce((t,s)=>n(t,s,s.path,s.path),[])}function ds(e){return e.$HEAD||e.$GET||e.$POST||e.$PUT||e.$PATCH||e.$DELETE}ns({routes:ur.reduce((e,n)=>{if(!ds(n))return e;let t=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(t))throw new Error(`Optional parameters are not supported in API routes: ${t}`);if(e[t])throw new Error(`Duplicate API routes for "${t}" found at "${e[t].route.path}" and "${n.path}"`);return e[t]={route:n},e},{})});function fs(){function e(t){return{...t,...t.$$route?t.$$route.require().route:void 0,info:{...t.$$route?t.$$route.require().route.info:{},filesystem:!0},component:t.$component&&rs(t.$component,globalThis.MANIFEST.client,globalThis.MANIFEST.ssr),children:t.children?t.children.map(e):void 0}}return cs.map(e)}let Dt;const ps=()=>Dt||(Dt=fs());var hs=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gs=e=>r(B,F(e,{iconNode:hs,name:"plus"})),dr=gs,vs=[["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"}]],ms=e=>r(B,F(e,{iconNode:vs,name:"triangle-alert"})),bs=ms;function xs(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"])',t='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 f=s.querySelector(n);if(f){f.focus();return}}const a=e.querySelector(t);if(a){a.focus();return}e.querySelector('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')?.focus()})}var ks=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_s=e=>r(B,F(e,{iconNode:ks,name:"check"})),qe=_s,$s=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ws=e=>r(B,F(e,{iconNode:$s,name:"chevron-left"})),ys=ws,Ss=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cs=e=>r(B,F(e,{iconNode:Ss,name:"chevron-right"})),Wt=Cs,Ms=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Es=e=>r(B,F(e,{iconNode:Ms,name:"clock"})),Ns=Es,Ps=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],As=e=>r(B,F(e,{iconNode:Ps,name:"search"})),yt=As,Ts=[["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"}]],Ls=e=>r(B,F(e,{iconNode:Ts,name:"calendar-days"})),zs=Ls,Rs=[["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"}]],Is=e=>r(B,F(e,{iconNode:Rs,name:"store"})),Os=Is,Ds=[["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"}]],Ws=e=>r(B,F(e,{iconNode:Ds,name:"trash-2"})),Us=Ws,js=[["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"}]],qs=e=>r(B,F(e,{iconNode:js,name:"package"})),Fs=qs,Vs=[["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"}]],Bs=e=>r(B,F(e,{iconNode:Vs,name:"at-sign"})),Hs=Bs,Ks=[["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"}]],Gs=e=>r(B,F(e,{iconNode:Ks,name:"boxes"})),fr=Gs,Xs=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Ys=e=>r(B,F(e,{iconNode:Xs,name:"building-2"})),Qs=Ys,Js=[["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"}]],Zs=e=>r(B,F(e,{iconNode:Js,name:"circle-alert"})),ea=Zs,ta=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],ra=e=>r(B,F(e,{iconNode:ta,name:"circle-slash"})),na=ra,sa=[["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"}]],aa=e=>r(B,F(e,{iconNode:sa,name:"clipboard-list"})),ia=aa,oa=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],la=e=>r(B,F(e,{iconNode:oa,name:"corner-down-right"})),ca=la,ua=[["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"}]],da=e=>r(B,F(e,{iconNode:ua,name:"eye"})),fa=da,pa=[["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"}]],ha=e=>r(B,F(e,{iconNode:pa,name:"file-text"})),ga=ha,va=[["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"}]],ma=e=>r(B,F(e,{iconNode:va,name:"inbox"})),pr=ma,ba=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xa=e=>r(B,F(e,{iconNode:ba,name:"info"})),ka=xa,_a=[["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"}]],$a=e=>r(B,F(e,{iconNode:_a,name:"key-round"})),wa=$a,ya=[["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"}]],Sa=e=>r(B,F(e,{iconNode:ya,name:"message-square"})),Ca=Sa,Ma=[["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"}]],Ea=e=>r(B,F(e,{iconNode:Ma,name:"panel-left-close"})),Na=Ea,Pa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Aa=e=>r(B,F(e,{iconNode:Pa,name:"panel-left"})),Ta=Aa,La=[["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"}]],za=e=>r(B,F(e,{iconNode:La,name:"pencil"})),Ra=za,Ia=[["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"}]],Oa=e=>r(B,F(e,{iconNode:Ia,name:"refresh-cw"})),Da=Oa,Wa=[["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"}]],Ua=e=>r(B,F(e,{iconNode:Wa,name:"settings"})),hr=Ua,ja=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],qa=e=>r(B,F(e,{iconNode:ja,name:"shield"})),Fa=qa,Va=[["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"}]],Ba=e=>r(B,F(e,{iconNode:Va,name:"shopping-cart"})),Ha=Ba,Ka=[["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"}]],Ga=e=>r(B,F(e,{iconNode:Ka,name:"sliders-horizontal"})),Xa=Ga,Ya=[["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"}]],Qa=e=>r(B,F(e,{iconNode:Ya,name:"trophy"})),Ja=Qa,Za=[["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"}]],ei=e=>r(B,F(e,{iconNode:Za,name:"users"})),ti=ei;async function ri(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 t=await n.json();return new Set(t.capabilities.filter(s=>s.enabled).map(s=>s.key))}const gr=_t(()=>new Set),ni=e=>{const{activeWorkspace:n}=ze(),[t]=rr(()=>n()?.ws_id,ri),s=()=>t()??new Set;return r(gr.Provider,{value:s,get children(){return e.children}})};function si(){return $t(gr)}const vr=_t();let ct=100;const ut=e=>n=>n.map(t=>t.id===e?{...t,leaving:!0}:t),dt=e=>n=>n.filter(t=>t.id!==e);function Ut(e){return e==="achievement"?"achievement":e==="info"?"system":"message"}const ai=e=>{const[n,t]=W([]),[s,a]=W([]),o=()=>s().filter(v=>v.unread).length,f=(v,M,S,x)=>{const E=++ct,b=v==="achievement"?4500:3500;t(h=>[...h,{id:E,type:v,title:M,desc:S,dur:b,leaving:!1}]),a(h=>[{id:E,type:v,category:x?.category??Ut(v),title:M,desc:S,time:"now",unread:!0,source:x?.source,contextUrl:x?.contextUrl},...h]),setTimeout(()=>t(ut(E)),b),setTimeout(()=>t(dt(E)),b+240)},c=v=>{t(ut(v)),setTimeout(()=>t(dt(v)),240)},g=(v,M,S)=>{const x=++ct,E=v==="achievement"?4500:3500;t(b=>[...b,{id:x,type:v,title:M,desc:S,dur:E,leaving:!1}]),setTimeout(()=>t(ut(x)),E),setTimeout(()=>t(dt(x)),E+240)},l=v=>{a(M=>M.map(S=>S.id===v?{...S,unread:!1}:S))},$=()=>{a(v=>v.map(M=>({...M,unread:!1})))},m=()=>{a(v=>v.filter(M=>M.unread))},_=(v,M,S,x)=>{const E=++ct;a(b=>[{id:E,type:v,category:x?.category??Ut(v),title:M,desc:S,time:x?.time??"now",unread:x?.unread??!0,source:x?.source,contextUrl:x?.contextUrl},...b])},w=v=>{a(M=>M.filter(S=>S.id!==v))},P=()=>{a([])};return r(vr.Provider,{value:{toasts:n,notifications:s,unreadCount:o,pushToast:f,pushToastOnly:g,addNotification:_,dismissToast:c,markRead:l,markAllRead:$,clearRead:m,dismiss:w,resetNotifications:P},get children(){return e.children}})};function ii(){const e=$t(vr);if(!e)throw new Error("useNotifications must be used within NotificationProvider");return e}const oi={boxes:fr,"key-round":wa,users:ti,"building-2":Qs,receipt:nn,package:Fs,"calendar-days":zs,"file-text":ga,"credit-card":rn,"clipboard-list":ia,"message-square":Ca,wallet:tn,"shopping-cart":Ha,clock:Ns,store:Os,"layout-dashboard":or,megaphone:yn,activity:wn,"layout-grid":$n,"users-round":_n,"book-open":kn},ft=fr,jt=new Map,li=/^[a-z][a-z0-9-]{0,40}$/;function vt(e){if(!e)return ft;const n=oi[e];if(n)return n;if(!li.test(e))return ft;let t=jt.get(e);return t||(t=tr(async()=>{try{return{default:(await ge(()=>import(`lucide-solid/icons/${e}`),[])).default}}catch{return{default:ft}}}),jt.set(e,t)),t}function ci(e){const n=t=>({href:t.path??"",label:t.label,icon:vt(t.icon),capability:t.capability,requiredPermission:t.requiredPermission,children:t.type==="group"?(t.children??[]).map(n):void 0});return e.map(t=>t.type==="group"?{kind:"section",id:t.id??"",label:t.label,icon:vt(t.icon),items:(t.children??[]).map(n)}:n(t))}function ui(e){const n=e.navTree();return n?ci(n):Sn(e.plugins().filter(t=>t.nav).map(t=>({href:t.href,label:t.nav.label,icon:vt(t.nav.icon),capability:t.capabilityKey,requiredPermission:t.navPermission??void 0,section:t.nav.section??void 0,order:t.nav.order??void 0})))}const mr=_t(),di=e=>{const n=Fe(),t=nr();un();const{theme:s,toggleTheme:a,mode:o,setThemeMode:f}=dn(),c=ii(),g=typeof window<"u"?window.matchMedia("(max-width: 819px)"):null,[l,$]=W(g?.matches??!1);g&&g.addEventListener("change",A=>$(A.matches));const m=typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)"):null,[_,w]=W(m?.matches??!1);m&&m.addEventListener("change",A=>w(A.matches));const[P,v]=W(null),M=()=>{const A=P();return A===null?l():A},S=()=>{v(!M()),at()},[x,E]=W("root"),[b,h]=W("in"),[C,O]=W(""),[I,N]=W(!0),[D,X]=W(null),[te,ne]=W(0),[ce,re]=W(!1),[fe,ue]=W(!1),[he,p]=W(!1),[u,k]=W(!1),[T,L]=W(""),q=Re(),{activeWorkspace:V,setActiveWsId:R}=ze(),H=ir(),J=()=>q()?.user?.role==="superuser",U=()=>V(),Z=()=>q()?.workspaces??[],pe=()=>U()?.ws_role,Oe=()=>Z().length>1,tt=le(()=>{const A=T().trim().toLowerCase();return A?Z().filter(j=>j.ws_name.toLowerCase().includes(A)):Z()}),De=()=>Z().length>2,rt=()=>{if(J())return"superuser";const A=U()?.ws_role_names??[];return A.length===0?"":A.length===1?A[0]:`${A.length} roles`},nt=si(),be=Ze(),Me=le(()=>ui(be)),we=()=>pn(be.activeThemeVariants(),o()),xe=A=>Mn(A,J(),pe(),H.has,j=>nt().has(j)),ye=le(()=>{const A=q()?.devMode===!0,j=[],se=[];for(const K of Me())if(Cn(K)){const ve=K.items.filter(me=>xe(me));ve.length>0&&j.push({section:K,visibleItems:ve})}else if(xe(K)){if(A&&K.href==="/dashboard")continue;se.push(K)}return{sections:j,items:se}}),Ee=()=>C().trim().toLowerCase(),We=A=>{const j=C().trim();if(!j)return[{text:A,match:!1}];const se=A.toLowerCase().indexOf(j.toLowerCase());return se===-1?[{text:A,match:!1}]:[{text:A.slice(0,se),match:!1},{text:A.slice(se,se+j.length),match:!0},{text:A.slice(se+j.length),match:!1}].filter(K=>K.text.length>0)},Se=A=>{const j=Ee();return j?A.toLowerCase().includes(j):!0},Ne=A=>A.href&&(n.pathname===A.href||n.pathname.startsWith(A.href+"/"))?!0:A.children?.some(j=>Ne(j))??!1,Be=le(()=>{if(!Ee())return[];const j=[];for(const K of ye().sections){const ve=K.visibleItems.filter(me=>Se(me.label)).map(me=>({item:me,section:K.section.label}));(Se(K.section.label)||ve.length>0)&&j.push({section:{id:K.section.id,label:K.section.label,icon:K.section.icon},items:ve})}const se=ye().items.filter(K=>Se(K.label)).map(K=>({item:K,section:"Workspace"}));return se.length>0&&j.unshift({section:{id:"_root",label:"Workspace",icon:or},items:se}),j}),Sr=le(()=>{const A=x();return A==="root"?null:ye().sections.find(j=>j.section.id===A)??null}),Ct=le(()=>{for(const A of ye().sections)if(A.visibleItems.some(j=>Ne(j)))return A.section.id;return null});let Mt="";_e(()=>{if(!q()?.devMode)return;const A=n.pathname,j=Ct();j&&A!==Mt&&(Mt=A,h("in"),E(j))});const Cr=A=>n.pathname===A,Mr=A=>A.items.some(j=>Ne(j));let $e;const He=A=>{if(I())try{$e=$e||new(window.AudioContext||window.webkitAudioContext),$e.state==="suspended"&&$e.resume(),A.forEach((j,se)=>{const K=$e.createOscillator(),ve=$e.createGain();K.type="square",K.frequency.value=j;const me=$e.currentTime+se*.07;ve.gain.setValueAtTime(1e-4,me),ve.gain.exponentialRampToValueAtTime(.06,me+.004),ve.gain.exponentialRampToValueAtTime(1e-4,me+.07),K.connect(ve),ve.connect($e.destination),K.start(me),K.stop(me+.08)})}catch{}},Er=()=>He([760]),st=()=>He([620]),Et=()=>He([360]),Nt=()=>He([520]),Nr=A=>{h("in"),E(A),Nt()},Pr=()=>{h("out"),E("root"),Et()},Ar=A=>{t(A),X(null),O(""),st()},Tr=A=>{t(A),E("root"),h("out"),O(""),k(!1),X(null),st()},at=()=>{ue(!1),re(!1),X(null),p(!1),k(!1),O("")},Lr=A=>{if(q()?.devMode){R(A.ws_id),ue(!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}R(A.ws_id),ue(!1),L(""),c.resetNotifications(),t("/",{replace:!0})},zr=async()=>{await fn()};if(typeof window<"u"){const A=j=>{if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"&&(j.preventDefault(),M()?(k(se=>!se),ue(!1),re(!1),X(null)):document.querySelector("[data-sidebar-search]")?.focus()),j.key==="Escape"){if(document.querySelector("[data-user-menu-edit]"))return;O(""),at()}};document.addEventListener("keydown",A),Ye(()=>document.removeEventListener("keydown",A))}if(typeof window<"u"){const A=j=>{const se=j.target;se&&(document.querySelector("[data-user-menu-modal]")||se.closest("[data-user-menu]")||p(!1))};document.addEventListener("click",A),Ye(()=>document.removeEventListener("click",A))}const Rr={theme:s,toggleTheme:a,themeMode:o,setThemeMode:f,themeVariantOptions:we,notifCtx:c,reducedMotion:_,collapsed:M,toggleCollapse:S,level:x,dir:b,query:C,setQuery:O,soundOn:I,setSoundOn:N,flyoutId:D,setFlyoutId:X,flyoutTop:te,setFlyoutTop:ne,notifOpen:ce,setNotifOpen:re,wsOpen:fe,setWsOpen:ue,userMenuOpen:he,setUserMenuOpen:p,searchFlyoutOpen:u,setSearchFlyoutOpen:k,wsQuery:T,setWsQuery:L,me:q,perms:H,isSuperuser:J,currentWorkspace:U,allWorkspaces:Z,workspaceRole:pe,hasMultipleOrgs:Oe,filteredWorkspaces:tt,showWorkspaceSearch:De,displayRole:rt,navEntries:Me,canSee:xe,visibleEntries:ye,queryTrimmed:Ee,highlightSegments:We,matchesQuery:Se,nestedSearchResults:Be,currentSection:Sr,activeParent:Ct,isActive:Cr,isActiveOrChild:Ne,sectionContainsActive:Mr,tickHover:Er,tickClick:st,tickBack:Et,tickSection:Nt,goInto:Nr,goBack:Pr,choose:Ar,chooseResult:Tr,closeAllPops:at,switchWorkspace:Lr,handleLogout:zr};return r(mr.Provider,{value:Rr,get children(){return e.children}})},de=()=>{const e=$t(mr);if(!e)throw new Error("useSidebarState must be used within a SidebarStateProvider");return e},ee={"clip-path":"polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px)"},Qe={success:{icon:qe,ring:"border-emerald-500/50",dot:"bg-emerald-400",text:"text-emerald-300"},info:{icon:ka,ring:"border-sky-500/50",dot:"bg-sky-400",text:"text-sky-300"},warning:{icon:bs,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:ea,ring:"border-red-500/50",dot:"bg-red-400",text:"text-red-300"},achievement:{icon:Ja,ring:"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_70%,transparent)]",dot:"bg-[var(--ks-accent,#fbbf24)]",text:"text-[var(--ks-accent,#fbbf24)]"}},fi={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"},pi=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 hi=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'),gi=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">'),vi=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 mi=()=>{const{notifOpen:e,collapsed:n,reducedMotion:t,notifCtx:s,setNotifOpen:a}=de();return r(y,{get when(){return e()},get children(){var o=gi(),f=o.firstChild;f.firstChild;var c=f.nextSibling;return i(f,r(y,{get when(){return s.unreadCount()>0},get children(){var g=hi();return g.$$click=()=>s.markAllRead(),g}}),null),i(c,r(Q,{get each(){return s.notifications()},children:g=>{const l=Qe[g.type]??Qe.info,$=l.icon;return(()=>{var m=vi(),_=m.firstChild,w=_.firstChild,P=w.nextSibling,v=_.nextSibling;return i(m,r($,{size:15,get class(){return`shrink-0 mt-0.5 ${l.text}`}}),_),i(w,()=>g.title),i(P,()=>g.desc),i(v,()=>g.time),z(()=>ae(m,`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)]":""}`)),m})()}})),i(o,r(Le,{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=>Y(o,{left:n()?"80px":"264px",...ee,...t()?{}:{animation:"pop .14s ease"}},g)),o}})};oe(["click"]);var bi=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.'),xi=d('<div class="text-xs text-[var(--ks-fg-subtle,#71717a)] text-center py-10">Loading…'),ki=d("<div class=space-y-3>"),_i=d('<span class="text-[11px] text-[var(--ks-fg-subtle,#71717a)]">Pick a role to start granting permissions'),$i=d('<div class="mt-4 flex items-center gap-2">'),wi=d('<div class="mt-4 p-2 rounded bg-red-500/10 border border-red-500/20 text-red-400 text-xs">'),yi=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">`),Si=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.'),Ci=d('<div class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] mt-0.5">'),Mi=d('<div class="mt-3 pt-3 border-t border-[var(--ks-border,#27272a)] grid grid-cols-1 sm:grid-cols-2 gap-2">'),Ei=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">'),Ni=d('<span class="block text-[10px] text-[var(--ks-fg-subtle,#71717a)] mt-0.5">'),Pi=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">'),Ai=d('<p class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] italic">Every role in this workspace is already configured for this page.'),Ti=d('<span class="text-[11px] text-[var(--ks-fg-subtle,#71717a)] font-mono select-text">'),Li=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)]>@'),zi=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 Ri(e,n){const t=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(t);case"custom":return new Set}}function Ii(e){return e.filter(t=>!t.is_destructive).some(t=>t.action!=="view")}function bt(e){return e.every(n=>!n.is_destructive)}function br(e,n){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}function qt(e){return(n,t)=>{const s=e.find(o=>o.id===n),a=e.find(o=>o.id===t);return(s?.sort_order??0)-(a?.sort_order??0)}}function Oi(e,n,t,s){if(e.size===0)return!0;const a=n.find(o=>o.action==="view")?.code;return!!(a&&e.size===1&&e.has(a)||br(e,t)&&!bt(n)||e.size===s)}function Di(e,n,t){const s=new Set;for(const a of n)a.role_id===e&&a.allowed&&t.has(a.permission_code)&&s.add(a.permission_code);return s}function Wi(e,n){const t=new Set(n),s=new Map;for(const a of e){if(!a.allowed||!t.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 Ui(e,n,t){const s=[];for(const[a,o]of e){const f=n.get(a)??new Set;for(const c of t){const g=o.has(c),l=f.has(c);g!==l&&s.push({role_id:a,permission_code:c,allowed:g})}}return s}function ji(e){const n=Re(),{activeWorkspace:t}=ze(),s=ir(),a=Ze(),o=()=>t()?.ws_id??null,f=le(()=>{const p=a.plugins(),u=p.find(k=>k.name===e.module)??p.find(k=>k.capabilityKey===e.module);return u?{name:u.name,version:u.version}:null}),[c,g]=W(null),[l,$]=W(!1),m=async()=>{const p=o();if(p){$(!0);try{const u=await fetch(`/api/workspaces/${p}/role-permissions`,{credentials:"include",headers:{"X-Workspace-Id":String(p)}});if(!u.ok){g(null);return}g(await u.json())}catch{g(null)}finally{$(!1)}}};_e(()=>{e.active&&o()&&m()});const[_,w]=W(new Map),[P,v]=W([]),[M,S]=W(new Set),[x,E]=W(!1),[b,h]=W("");_e(()=>{const p=c();if(!p)return;const u=p.permissions.filter(R=>R.module===e.module),k=new Set(u.map(R=>R.code)),T=new Map,L=[],q=new Set,V=mt(u);for(const R of p.roles){if(R.name.toLowerCase()==="admin")continue;const H=Di(R.id,p.grants,k);T.set(R.id,H),H.size>0&&(L.push(R.id),Oi(H,u,V,k.size)||q.add(R.id))}w(T),v(L.sort(qt(p.roles))),S(q),h("")});const C=le(()=>{const p=c();return p?p.permissions.filter(u=>u.module===e.module).sort((u,k)=>u.sort_order-k.sort_order):[]}),O=le(()=>{const p=c();return p?p.roles.filter(u=>u.name.toLowerCase()!=="admin"):[]}),I=le(()=>{const p=new Set(P());return O().filter(u=>!p.has(u.id))}),N=p=>_().get(p)??new Set,D=p=>{if(M().has(p))return"custom";const u=C(),k=u.map(V=>V.code),T=u.find(V=>V.action==="view")?.code,L=N(p);if(L.size===0)return"none";if(T&&L.size===1&&L.has(T))return"viewer";const q=mt(u);return br(L,q)&&!bt(u)?"editor":L.size===k.length?"full":"custom"},X=(p,u)=>{w(k=>{const T=new Map(k);return T.set(p,u),T})},te=(p,u)=>{w(k=>{const T=new Map(k),L=new Set(T.get(p)??[]);return L.has(u)?L.delete(u):L.add(u),T.set(p,L),T})},ne=(p,u)=>{const k=C();if(u==="custom"){S(T=>{const L=new Set(T);return L.add(p),L});return}S(T=>{const L=new Set(T);return L.delete(p),L}),X(p,Ri(u,k))},ce=p=>{v(u=>{if(u.includes(p))return u;const T=c()?.roles??[];return[...u,p].sort(qt(T))}),w(u=>{const k=new Map(u);return k.has(p)||k.set(p,new Set),k})},re=p=>{v(u=>u.filter(k=>k!==p)),w(u=>{const k=new Map(u);return k.set(p,new Set),k}),S(u=>{const k=new Set(u);return k.delete(p),k})},fe=async()=>{const p=o();if(!p)return;const k=C().map(V=>V.code),T=c(),L=Wi(T?.grants??[],k),q=Ui(_(),L,k);if(q.length===0){e.onClose?.();return}E(!0),h("");try{const V=await fetch(`/api/workspaces/${p}/role-permissions`,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json","X-Workspace-Id":String(p)},body:JSON.stringify({grants:q})});if(!V.ok){const R=await V.json().catch(()=>({}));h(R.error||"Failed to save permissions");return}await m(),s.refetch(),e.onSaved?.(),e.onClose?.()}catch(V){h(V.message||"Failed to save permissions")}finally{E(!1)}},ue=()=>n()?.user?.role==="superuser"||t()?.ws_role==="admin",he=p=>c()?.roles.find(u=>u.id===p);return(()=>{var p=yi(),u=p.firstChild,k=u.firstChild,T=k.firstChild,L=T.firstChild,q=L.nextSibling,V=q.nextSibling,R=u.nextSibling,H=R.firstChild;return i(u,r(y,{get when(){return!ue()},get children(){return bi()}}),k),i(k,r(Fa,{size:14,class:"text-[var(--ks-accent,#fbbf24)] mt-0.5 shrink-0"}),T),i(V,()=>t()?.ws_name),i(u,r(y,{get when(){return l()},get children(){return xi()}}),null),i(u,r(y,{get when(){return G(()=>!l())()&&c()},get children(){return[r(y,{get when(){return P().length>0},get fallback(){return Si()},get children(){var J=ki();return i(J,r(Q,{get each(){return P()},children:U=>{const Z=()=>D(U),pe=()=>he(U);return(()=>{var Oe=Ei(),tt=Oe.firstChild,De=tt.firstChild,rt=De.firstChild,nt=De.nextSibling,be=nt.firstChild,Me=be.nextSibling;return i(rt,()=>pe()?.name??U),i(De,r(y,{get when(){return pe()?.description},get children(){var we=Ci();return i(we,()=>pe().description),we}}),null),i(be,r(Ue,{get active(){return Z()==="none"},onClick:()=>ne(U,"none"),icon:na,label:"No access"}),null),i(be,r(Ue,{get active(){return Z()==="viewer"},onClick:()=>ne(U,"viewer"),icon:fa,label:"Viewer"}),null),i(be,r(y,{get when(){return G(()=>!!Ii(C()))()&&!bt(C())},get children(){return r(Ue,{get active(){return Z()==="editor"},onClick:()=>ne(U,"editor"),icon:Ra,label:"Editor"})}}),null),i(be,r(Ue,{get active(){return Z()==="full"},onClick:()=>ne(U,"full"),icon:qe,label:"Full access"}),null),i(be,r(Ue,{get active(){return Z()==="custom"},onClick:()=>ne(U,"custom"),icon:Xa,label:"Custom"}),null),Me.$$click=()=>re(U),i(Me,r(Us,{size:13})),i(Oe,r(y,{get when(){return Z()==="custom"},get children(){var we=Mi();return i(we,r(Q,{get each(){return C()},children:xe=>{const ye=()=>N(U).has(xe.code);return(()=>{var Ee=Pi(),We=Ee.firstChild,Se=We.nextSibling,Ne=Se.firstChild;return We.addEventListener("change",()=>te(U,xe.code)),i(Ne,()=>xe.label),i(Se,r(y,{get when(){return xe.description},get children(){var Be=Ni();return i(Be,()=>xe.description),Be}}),null),z(()=>We.checked=ye()),Ee})()}})),we}}),null),z(()=>ie(Me,"title",`Remove ${pe()?.name??U} from this page`)),Oe})()}})),J}}),(()=>{var J=$i();return i(J,r(y,{get when(){return I().length>0},get fallback(){return Ai()},get children(){return[r(hn,{value:null,placeholder:"+ Add role",searchPlaceholder:"Search roles…",get options(){return I().map(U=>({value:U.id,label:U.name,description:U.description??void 0}))},onChange:U=>{U&&ce(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"}),r(y,{get when(){return P().length===0},get children(){return[r(dr,{size:11,class:"text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_60%,transparent)]"}),_i()]}})]}})),J})()]}}),null),i(u,r(y,{get when(){return b()},get children(){var J=wi();return i(J,b),J}}),null),i(R,r(y,{get when(){return f()},get fallback(){return Ti()},children:J=>(()=>{var U=Li(),Z=U.firstChild;return i(U,()=>J().name,Z),i(U,()=>J().version,null),U})()}),H),i(H,r(Lt,{intent:"secondary",variant:"clip2",type:"button",get disabled(){return x()},onClick:()=>e.onClose?.(),children:"Cancel"}),null),i(H,r(Lt,{intent:"primary",variant:"clip1",type:"button",get disabled(){return x()||!ue()},onClick:fe,get children(){return x()?"Saving…":"Save permissions"}}),null),p})()}function Ue(e){return(()=>{var n=zi(),t=n.firstChild;return n.$$click=()=>e.onClick(),i(n,r(Ae,{get component(){return e.icon},size:11}),t),i(t,()=>e.label),z(s=>Ve(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 qi=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.'),Fi=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.'),Vi=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">'),Bi=d('<div class="text-xs text-[var(--ks-fg-subtle,#71717a)] text-center py-10">Loading…'),Hi=d('<div class="text-xs text-red-400 text-center py-10">'),Ki=d('<button type=button class="px-3 py-1.5 text-xs rounded-md transition-colors cursor-pointer">');const Gi={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"},Xi=new Set(["create","add","new","edit","update"]),Ge=e=>e.replace(/[^a-zA-Z0-9]+/g,"_");function Yi(e,n,t){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=[],f=[];for(const l of s){const $=l.split(".")[0].toLowerCase(),m=Gi[$]??$.charAt(0).toUpperCase()+$.slice(1),_=`act_${Ge(l)}`;if(o.push(Ce(_,m)),Xi.has($)){const w=`${_}_form`,P=`${_}_commit`;a.push(ke(_,"trigger",`${m} button`,{out:[Ce(w)]})),a.push(ke(w,"modal",`${e.label} form`,{out:[Ce(P)]})),a.push(ke(P,"commit",m,{detail:`${e.key}.${l}`})),f.push(P)}else{const w=`${_}_commit`;a.push(ke(_,"trigger",`${m} button`,{out:[Ce(w)]})),a.push(ke(w,"commit",m,{detail:`${e.key}.${l}`})),f.push(w)}}a.push(ke("data","data",`${e.label} list`,{out:o}));const c=a.find(l=>l.id===(f[0]??"data"));c.out=c.out??[];const g=new Set;for(const l of n){const $=`call_${Ge(l.provider)}_${Ge(l.capability)}`;g.has($)||(g.add($),a.push(ke($,"call",`${t.get(l.provider)??l.provider}.${l.capability}`,{detail:`${l.provider}:${l.capability}`})),c.out.push(Ce($,l.granted?void 0:"ungranted")))}for(const l of e.emits){const $=`emit_${Ge(l)}`;a.push(ke($,"emit",l)),c.out.push(Ce($))}return an({id:`${e.key}.surface`,title:e.label,nodes:a})}function Qi(e){const{activeWorkspace:n}=ze(),t=()=>n()?.ws_id??null,[s,a]=W("flow"),[o,f]=W(null),[c,g]=W(null),[l,$]=W(!1),[m,_]=W("");_e(()=>{const S=t();if(!e.active||!S)return;const x=s();x==="flow"&&o()||x==="permissions"&&c()||w(x,S)});const w=async(S,x)=>{$(!0),_("");try{const E=S==="flow"?"/api/plugins/graph":`/api/workspaces/${x}/role-permissions`,b=await fetch(E,{credentials:"include",headers:{"X-Workspace-Id":String(x)}});if(!b.ok){_("Could not load this view.");return}const h=await b.json();S==="flow"?f(h):g(h)}catch{_("Could not load this view.")}finally{$(!1)}},P=()=>o()?.plugins.find(S=>S.key===e.module),v=le(()=>{const S=o(),x=P();if(!S||!x)return{nodes:[],edges:[]};const E=new Map(S.plugins.map(h=>[h.name,h.label])),b=S.edges.filter(h=>h.consumer===x.name);return sn(Yi(x,b,E))}),M=le(()=>{const S=c();if(!S)return{nodes:[],edges:[]};const x=S.permissions.filter(N=>N.module===e.module).sort((N,D)=>Number(N.is_destructive)-Number(D.is_destructive)),E=new Set(x.map(N=>N.code)),b=new Set(S.grants.filter(N=>N.allowed&&E.has(N.permission_code)).map(N=>N.permission_code)),h=S.roles.filter(N=>N.name.toLowerCase()!=="admin"&&S.grants.some(D=>D.role_id===N.id&&D.allowed&&E.has(D.permission_code))),C=[...h.map(N=>({id:`role:${N.id}`,label:N.name,sublabel:"role",accent:"info",lane:0})),...x.map(N=>({id:`perm:${N.code}`,label:N.label,sublabel:N.is_destructive?"destructive":"action",accent:b.has(N.code)?"primary":"muted",lane:1}))],O=new Set(h.map(N=>N.id)),I=S.grants.filter(N=>N.allowed&&E.has(N.permission_code)&&O.has(N.role_id)).map(N=>({from:`role:${N.role_id}`,to:`perm:${N.permission_code}`,accent:"success"}));return{nodes:C,edges:I}});return(()=>{var S=Vi(),x=S.firstChild,E=x.nextSibling;return i(x,r(Ft,{get active(){return s()==="flow"},onClick:()=>a("flow"),label:"Flow"}),null),i(x,r(Ft,{get active(){return s()==="permissions"},onClick:()=>a("permissions"),label:"Permissions"}),null),i(E,r(y,{get when(){return!l()},get fallback(){return Bi()},get children(){return r(y,{get when(){return!m()},get fallback(){return(()=>{var b=Hi();return i(b,m),b})()},get children(){return[r(y,{get when(){return s()==="flow"},get children(){return[(()=>{var b=qi(),h=b.firstChild,C=h.nextSibling;return i(C,()=>e.moduleLabel),b})(),r(zt,{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."})]}}),r(y,{get when(){return s()==="permissions"},get children(){return[(()=>{var b=Fi(),h=b.firstChild,C=h.nextSibling;return i(C,()=>e.moduleLabel),b})(),r(zt,{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."})]}})]}})}})),S})()}function Ft(e){return(()=>{var n=Ki();return n.$$click=()=>e.onClick(),i(n,()=>e.label),z(t=>Ve(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},t)),n})()}oe(["click"]);async function xr(e,n,t,s){const a=await fetch(e,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json","X-Workspace-Id":String(n)},body:JSON.stringify({routePath:t,prefs:s})});return a.ok?{ok:!0}:{ok:!1,error:(await a.json().catch(()=>({}))).error||`Save failed (${a.status})`}}function Ji(e,n,t){return xr("/api/plugins/ui/route-settings/me",e,n,t)}function Zi(e,n,t){return xr("/api/plugins/ui/route-settings/workspace-default",e,n,t)}var eo=d('<p class="text-[12px] text-red-400 mb-3">'),to=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>'),ro=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>'),no=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">`),so=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 (<!>)'),ao=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'),Vt=d("<option>");const Bt=[10,25,50,100],io=[{routePath:"/payees",label:"Payees",key:"pageSize",default:25}];function oo(e){const n=Ze(),[t,s]=W(""),[a,o]=W(""),[f,c]=W(!1),[g,l]=W(100),[$,m]=W(100),[_,w]=W(""),P=x=>n.routeSettings()[x],v=(x,E)=>{const b=x?.[E];return typeof b=="number"?b:void 0};async function M(x,E,b,h){const C=e.wsId;if(C==null)return;const O=h===""?{}:{[b]:Number(h)};o(""),s(`${x}:${E}`);const N=await(x==="user"?Ji:Zi)(C,E,O);if(s(""),!N.ok){o(N.error);return}n.refetch()}async function S(x=f()){const E=e.wsId;if(E==null)return;o(""),s("invoice-settings");const b=await fetch("/api/transactions/invoice-settings",{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json","X-Workspace-Id":String(E)},body:JSON.stringify({enabled:x,first_number:g(),next_number:$(),prefix:_()})});if(s(""),!b.ok){const h=await b.json().catch(()=>({}));o(h.error??`Save failed (${b.status})`)}}return _e(()=>{const x=e.wsId;x!=null&&fetch("/api/transactions/invoice-settings",{credentials:"include",headers:{"X-Workspace-Id":String(x)}}).then(E=>E.ok?E.json():null).then(E=>{E&&(c(E.enabled===!0),l(E.first_number??E.next_number??100),m(E.next_number??100),w(E.prefix??""))})}),(()=>{var x=no(),E=x.firstChild,b=E.nextSibling,h=b.nextSibling,C=h.firstChild,O=C.firstChild,I=O.firstChild,N=I.nextSibling;return i(x,r(y,{get when(){return a()},get children(){var D=eo();return i(D,a),D}}),h),N.addEventListener("change",D=>{c(D.currentTarget.checked),S(D.currentTarget.checked)}),i(C,r(y,{get when(){return e.canEditDefault},get children(){return[(()=>{var D=to(),X=D.firstChild,te=X.nextSibling;return te.addEventListener("change",ne=>l(Number(ne.currentTarget.value))),te.addEventListener("blur",()=>void S()),z(()=>te.value=g()),D})(),(()=>{var D=ro(),X=D.firstChild,te=X.nextSibling;return te.addEventListener("change",ne=>w(ne.currentTarget.value)),te.addEventListener("blur",()=>void S()),z(()=>te.value=_()),D})()]}}),null),i(h,r(Q,{each:io,children:D=>{const X=()=>v(P(D.routePath)?.userPref,D.key),te=()=>v(P(D.routePath)?.workspaceDefault,D.key),ne=()=>X()??te()??D.default;return(()=>{var ce=ao(),re=ce.firstChild,fe=re.firstChild,ue=fe.firstChild,he=fe.nextSibling,p=he.firstChild,u=p.nextSibling;u.nextSibling;var k=re.nextSibling,T=k.firstChild,L=T.nextSibling;return L.firstChild,i(fe,()=>D.label,ue),i(he,ne,u),L.addEventListener("change",q=>void M("user",D.routePath,D.key,q.currentTarget.value)),i(L,r(Q,{each:Bt,children:q=>(()=>{var V=Vt();return i(V,q),z(()=>V.value=String(q)),V})()}),null),i(ce,r(y,{get when(){return e.canEditDefault},get children(){var q=so(),V=q.firstChild,R=V.nextSibling,H=R.firstChild,J=H.firstChild,U=J.nextSibling;return U.nextSibling,R.addEventListener("change",Z=>void M("ws",D.routePath,D.key,Z.currentTarget.value)),i(H,()=>D.default,U),i(R,r(Q,{each:Bt,children:Z=>(()=>{var pe=Vt();return i(pe,Z),z(()=>pe.value=String(Z)),pe})()}),null),z(()=>R.disabled=t()===`ws:${D.routePath}`),z(()=>R.value=te()===void 0?"":String(te())),q}}),null),z(()=>L.disabled=t()===`user:${D.routePath}`),z(()=>L.value=X()===void 0?"":String(X())),ce})()}}),null),z(()=>N.disabled=!e.canEditDefault||t()==="invoice-settings"),z(()=>N.checked=f()),x})()}var lo=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>'),co=d('<div class="h-full overflow-y-auto p-5">'),uo=d('<button type=button class="px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer">');function fo(e){const{activeWorkspace:n}=ze(),t=Re(),[s,a]=W("share"),o=()=>t()?.user?.role==="superuser"||n()?.ws_role==="admin";return r(Qr,{get children(){var f=lo(),c=f.firstChild,g=c.firstChild,l=g.firstChild,$=l.firstChild,m=$.firstChild,_=m.firstChild,w=m.nextSibling,P=w.firstChild,v=P.nextSibling,M=l.nextSibling,S=g.nextSibling,x=S.nextSibling,E=x.firstChild,b=E.nextSibling;return f.$$click=()=>e.onClose(),c.$$click=h=>h.stopPropagation(),sr(xs,c),i(l,r(hr,{size:20,class:"text-[var(--ks-accent,#fbbf24)] shrink-0 mt-0.5"}),$),i(m,()=>e.moduleLabel,_),i(v,()=>n()?.ws_name),M.$$click=()=>e.onClose(),i(M,r(Ie,{size:18})),i(S,r(pt,{get active(){return s()==="share"},onClick:()=>a("share"),label:"Share"}),null),i(S,r(pt,{get active(){return s()==="flow"},onClick:()=>a("flow"),label:"Connections"}),null),i(S,(()=>{var h=G(()=>e.module==="transactions");return()=>h()&&r(pt,{get active(){return s()==="display"},onClick:()=>a("display"),label:"Display"})})(),null),i(E,r(ji,{get module(){return e.module},get moduleLabel(){return e.moduleLabel},get active(){return G(()=>!!e.open)()&&s()==="share"},onClose:()=>e.onClose()})),i(b,r(Qi,{get module(){return e.module},get moduleLabel(){return e.moduleLabel},get active(){return G(()=>!!e.open)()&&s()==="flow"}})),i(x,(()=>{var h=G(()=>e.module==="transactions");return()=>h()&&(()=>{var C=co();return i(C,r(oo,{get wsId(){return n()?.ws_id},get canEditDefault(){return o()}})),z(()=>C.classList.toggle("hidden",s()!=="display")),C})()})(),null),z(h=>{var C={"opacity-0 pointer-events-none invisible":!e.open},O=`${e.moduleLabel} settings`,I=s()!=="share",N=s()!=="flow";return h.e=Ve(f,C,h.e),O!==h.t&&ie(c,"aria-label",h.t=O),I!==h.a&&E.classList.toggle("hidden",h.a=I),N!==h.o&&b.classList.toggle("hidden",h.o=N),h},{e:void 0,t:void 0,a:void 0,o:void 0}),f}})}function pt(e){return(()=>{var n=uo();return n.$$click=()=>e.onClick(),i(n,()=>e.label),z(t=>Ve(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},t)),n})()}oe(["click"]);var po=d("<button type=button>");function kr(e){const n=Re(),t=et(),{activeWorkspace:s}=ze(),a=Fe(),[o,f]=W(!1),[c,g]=W(!1);_e(er(()=>a.pathname,()=>f(!1),{defer:!0}));const l=()=>t()||n()?.user?.role==="superuser"||s()?.ws_role==="admin",$=m=>{m.preventDefault(),m.stopPropagation(),g(!0),f(!0)};return r(y,{get when(){return l()},get children(){return[(()=>{var m=po();return m.$$click=$,i(m,r(hr,{size:14})),z(_=>{var w=`${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 w!==_.e&&ie(m,"aria-label",_.e=w),P!==_.t&&ie(m,"title",_.t=P),v!==_.a&&ae(m,_.a=v),_},{e:void 0,t:void 0,a:void 0}),m})(),r(y,{get when(){return c()},get children(){return r(fo,{get module(){return e.module},get moduleLabel(){return e.moduleLabel},get open(){return o()},onClose:()=>f(!1)})}})]}})}oe(["click"]);var ho=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">'),go=d('<div class="relative flex items-center"><button type=button><span class="text-[12px] truncate">');const vo=()=>{const{flyoutId:e,flyoutTop:n,reducedMotion:t,visibleEntries:s,isActive:a,choose:o}=de();return r(y,{get when(){return e()},children:f=>{const c=le(()=>s().sections.find(g=>g.section.id===f()));return r(y,{get when(){return c()},children:g=>(()=>{var l=ho(),$=l.firstChild;return i($,()=>g().section.label),i(l,r(Q,{get each(){return g().visibleItems},children:m=>{const _=m.icon;return(()=>{var w=go(),P=w.firstChild,v=P.firstChild;return P.$$click=()=>o(m.href),i(P,r(_,{size:15,class:"shrink-0"}),v),i(v,()=>m.label),i(w,r(y,{get when(){return m.capability},get children(){return r(kr,{get module(){return m.capability},get moduleLabel(){return m.label},class:"absolute right-1 top-1/2 -translate-y-1/2"})}}),null),z(()=>ae(P,`navrow flex-1 min-w-0 flex items-center gap-2.5 px-2 py-2 cursor-pointer text-left ${m.capability?"pr-8":""} ${a(m.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)]"}`)),w})()}}),null),z(m=>{var _={top:`${Math.max(8,n())}px`,...ee,...t()?{}:{animation:"pop .14s ease"}},w=g().section.label;return m.e=Y(l,_,m.e),w!==m.t&&ie(l,"aria-label",m.t=w),m},{e:void 0,t:void 0}),l})()})}})};oe(["click"]);var mo=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>'),bo=d('<img alt aria-hidden=true class="object-cover shrink-0">'),xo=d("<img alt=Hilinga>"),ko=d("<span>"),_o=d("<span aria-hidden>"),$o=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=>r(y,{get when(){return e.logoUrl},get fallback(){return(()=>{var n=mo();return i(n,()=>pi(e.name)),z(t=>Y(n,{width:`${e.size??30}px`,height:`${e.size??30}px`,"font-size":`${Math.max(8,Math.floor((e.size??30)*.4))}px`,...ee},t)),n})()},children:n=>(()=>{var t=bo();return z(s=>{var a=n(),o={width:`${e.size??30}px`,height:`${e.size??30}px`,...ee};return a!==s.e&&ie(t,"src",s.e=a),s.t=Y(t,o,s.t),s},{e:void 0,t:void 0}),t})()}),_r=e=>(()=>{var n=xo();return z(t=>{var s=gn("/pwa-192.png"),a=e.size??16,o=e.size??16,f=`rounded shrink-0 ${e.class??""}`,c=`${e.size??16}px`,g=`${e.size??16}px`;return s!==t.e&&ie(n,"src",t.e=s),a!==t.t&&ie(n,"width",t.t=a),o!==t.a&&ie(n,"height",t.a=o),f!==t.o&&ae(n,t.o=f),c!==t.i&&At(n,"width",t.i=c),g!==t.n&&At(n,"height",t.n=g),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),n})(),wo=()=>{const{displayRole:e}=de(),n=()=>e().toLowerCase().replace(/\s+/g,"_");return r(y,{get when(){return e()},get children(){var t=ko();return i(t,e),z(()=>ae(t,`inline-block text-[8px] font-semibold px-1.5 py-[1px] border uppercase tracking-[0.12em] leading-[1.2] ${fi[n()]||"text-[var(--ks-fg-muted,#a1a1aa)] bg-[var(--ks-surface-raised,#1a1a1a)] border-[var(--ks-border-strong,#3f3f46)]"}`)),t}})},je=e=>{const{reducedMotion:n}=de();return(()=>{var t=_o();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&&ae(t,s.e=a),s.t=Y(t,o,s.t),s},{e:void 0,t:void 0}),t})()},xt=e=>{const{highlightSegments:n}=de();return r(Q,{get each(){return n(e.label)},children:t=>r(y,{get when(){return t.match},get fallback(){return G(()=>t.text)},get children(){var s=$o();return i(s,()=>t.text),s}})})};var yo=d('<button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] cursor-pointer"aria-label="Clear search">'),So=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">'),Co=d('<p class="text-[12px] text-[var(--ks-fg-subtle,#71717a)] px-3 py-6 text-center">Type to search every section.'),Mo=d('<p class="text-[12px] text-[var(--ks-fg-subtle,#71717a)] px-3 py-6 text-center">Nothing matches &ldquo;<!>&rdquo;.'),Eo=d('<div><p class="text-[10px] uppercase tracking-[0.16em] text-[var(--ks-fg-subtle,#71717a)] px-2 py-1">'),No=d('<button type=button><span class="flex-1 text-[12px] truncate">');const Po=()=>{const{searchFlyoutOpen:e,collapsed:n,reducedMotion:t,query:s,setQuery:a,queryTrimmed:o,nestedSearchResults:f,isActive:c,chooseResult:g}=de();return r(y,{get when(){return G(()=>!!e())()&&n()},get children(){var l=So(),$=l.firstChild,m=$.firstChild,_=$.nextSibling;return i($,r(yt,{size:14,class:"text-[var(--ks-fg-subtle,#71717a)] shrink-0"}),m),m.$$input=w=>a(w.currentTarget.value),sr(w=>{queueMicrotask(()=>w?.focus())},m),i($,r(y,{get when(){return s().length>0},get children(){var w=yo();return w.$$click=()=>a(""),i(w,r(Ie,{size:13})),w}}),null),i(_,r(y,{get when(){return o()},get fallback(){return Co()},get children(){return r(y,{get when(){return f().length>0},get fallback(){return(()=>{var w=Mo(),P=w.firstChild,v=P.nextSibling;return v.nextSibling,i(w,()=>s().trim(),v),w})()},get children(){return r(Q,{get each(){return f()},children:w=>(()=>{var P=Eo(),v=P.firstChild;return i(v,()=>w.section.label),i(P,r(Q,{get each(){return w.items},children:M=>{const S=M.item.icon,x=()=>c(M.item.href);return(()=>{var E=No(),b=E.firstChild;return E.$$click=()=>g(M.item.href),i(E,r(S,{size:15,class:"shrink-0"}),b),i(b,r(xt,{get label(){return M.item.label}})),z(()=>ae(E,`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)]"}`)),E})()}}),null),P})()})}})}})),z(w=>{var P={...ee,...t()?{}:{animation:"pop .14s ease"}},v=ee;return w.e=Y(l,P,w.e),w.t=Y($,v,w.t),w},{e:void 0,t:void 0}),z(()=>m.value=s()),l}})};oe(["input","click"]);var Ao=d('<div class="fixed bottom-4 right-4 z-[60] flex flex-col gap-2 w-[300px] pointer-events-none">'),To=d('<p class="text-[9px] uppercase tracking-[0.2em] text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_80%,transparent)] mb-0.5">Achievement'),Lo=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 zo=()=>{const{notifCtx:e,reducedMotion:n}=de();return(()=>{var t=Ao();return i(t,r(Q,{get each(){return e.toasts()},children:s=>{const a=Qe[s.type]??Qe.info,o=a.icon,f=s.type==="achievement";return(()=>{var c=Lo(),g=c.firstChild,l=g.firstChild,$=l.nextSibling,m=$.firstChild,_=m.nextSibling,w=$.nextSibling,P=g.nextSibling;return i(l,r(o,{size:15,get class(){return a.text}})),i($,r(y,{when:f,get children(){return To()}}),m),i(m,()=>s.title),i(_,()=>s.desc),w.$$click=()=>e.dismissToast(s.id),i(w,r(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)] ${f?"ring-1 ring-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_30%,transparent)]":""}`,S={...ee,...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} ${f?"bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_15%,transparent)]":""}`,E=ee,b=`absolute bottom-0 left-0 h-[2px] ${a.dot}`,h=n()?void 0:{animation:`bar ${s.dur}ms linear forwards`};return M!==v.e&&ae(c,v.e=M),v.t=Y(c,S,v.t),x!==v.a&&ae(l,v.a=x),v.o=Y(l,E,v.o),b!==v.i&&ae(P,v.i=b),v.n=Y(P,h,v.n),v},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),c})()}})),t})()};oe(["click"]);var Ro=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)]">'),Io=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">'),Oo=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'),Do=d('<div class="px-3 py-3 text-xs text-[var(--ks-fg-subtle,#71717a)] text-center">No matches'),Ht=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 Wo=null,Uo=()=>{const{wsOpen:e,collapsed:n,currentWorkspace:t,reducedMotion:s,showWorkspaceSearch:a,wsQuery:o,setWsQuery:f,filteredWorkspaces:c,switchWorkspace:g}=de();return[r(y,{get when(){return G(()=>!!(e()&&!n()))()&&t()},get children(){var l=Io(),$=l.firstChild,m=$.nextSibling;return i(l,r(y,{get when(){return a()},get children(){var _=Ro(),w=_.firstChild;return w.$$input=P=>f(P.currentTarget.value),z(P=>Y(w,ee,P)),z(()=>w.value=o()),_}}),m),i(m,r(Q,{get each(){return c()},get fallback(){return Do()},children:_=>(()=>{var w=Ht(),P=w.firstChild;return w.$$click=()=>g(_),i(w,r(Je,{get name(){return _.ws_name},get logoUrl(){return _.ws_logo_url},size:26}),P),i(P,()=>_.ws_name),i(w,r(y,{get when(){return _.ws_id===t()?.ws_id},get children(){return r(qe,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"})}}),null),z(()=>ae(P,`text-[12px] truncate flex-1 ${_.ws_id===t()?.ws_id?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg,#ffffff)]"}`)),w})()})),z(_=>Y(l,{...ee,...s()?{}:{animation:"pop .14s ease"}},_)),l}}),r(y,{get when(){return G(()=>!!(e()&&n()))()&&t()},get children(){var l=Oo();return l.firstChild,i(l,r(Q,{get each(){return c()},children:$=>(()=>{var m=Ht(),_=m.firstChild;return m.$$click=()=>g($),i(m,r(Je,{get name(){return $.ws_name},get logoUrl(){return $.ws_logo_url},size:26}),_),i(_,()=>$.ws_name),i(m,r(y,{get when(){return $.ws_id===t()?.ws_id},get children(){return r(qe,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"})}}),null),z(()=>ae(_,`text-[12px] truncate flex-1 ${$.ws_id===t()?.ws_id?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg,#ffffff)]"}`)),m})()}),null),z($=>Y(l,{...ee,...s()?{}:{animation:"pop .14s ease"}},$)),l}})]},jo=()=>{const{wsOpen:e,currentWorkspace:n}=de();return r(y,{get when(){return G(()=>!!e())()&&n()},get children(){return r(y,{when:Wo,get fallback(){return r(Uo,{})},children:t=>r(Ae,{get component(){return t()}})})}})};oe(["input","click"]);var qo=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'),Fo=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">'),Vo=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">'),Bo=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'),Ho=d('<div class="my-1 mx-2 border-t border-[color-mix(in_srgb,var(--ks-border,#27272a)_70%,transparent)]">'),Ko=d('<div class="px-3 py-1 text-[9px] uppercase tracking-wider text-blue-300/70"> route'),Go=d('<div class="px-3 py-1 text-[9px] uppercase tracking-wider text-blue-300/70">View as user'),Xo=d('<div class="px-3 pt-1.5 pb-1 text-[9px] uppercase tracking-wider text-blue-300/70">Role'),Yo=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'),Qo=d('<div class="text-[9px] text-blue-300/50"> permissions (this route)'),Jo=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'),Zo=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">'),el=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>'),tl=d('<button type=button class="px-2 py-0.5 text-[10px] rounded border transition-colors">'),rl=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>'),nl=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>'),sl=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 al=null,il=null,Kt=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 ol(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 ht=5,Xt=()=>{const{themeMode:e,setThemeMode:n,themeVariantOptions:t,currentWorkspace:s}=de(),a=()=>s()?.ws_role_names??[],[o,f]=W(!1),c=et(),g=Re(),[l]=rr(c,async()=>{const b=await fetch("/api/_dev/info");return b.ok?await b.json():null}),$=Fe(),m=()=>{const b=$.pathname.split("/")[1]??"";return l()?.plugins?.find(h=>h.routeBase===b)},_=()=>m()?.permissions??l()?.pluginPermissions??[],[w,P]=W(!1),[v,M]=W(""),[S,x]=W([]),E=b=>x(h=>h.includes(b)?h.filter(C=>C!==b):[...h,b]);return[(()=>{var b=qo(),h=b.firstChild;return h.firstChild,i(h,()=>"0.0.0",null),b})(),r(y,{get when(){return a().length>1},get children(){var b=Vo(),h=b.firstChild,C=h.nextSibling;return i(C,r(Q,{get each(){return G(()=>!!o())()?a():a().slice(0,ht)},children:O=>(()=>{var I=Zo();return i(I,O),I})()}),null),i(C,r(y,{get when(){return a().length>ht},get children(){var O=Fo();return O.$$click=()=>f(I=>!I),i(O,(()=>{var I=G(()=>!!o());return()=>I()?"show less":`+${a().length-ht} more`})()),z(()=>ie(O,"aria-expanded",o())),O}}),null),b}}),(()=>{var b=Bo();return b.firstChild,i(b,r(vn,{get options(){return t()},get value(){return e()},onChange:h=>n(h),class:"w-full [&>button]:flex-1",testIdPrefix:"theme-mode"}),null),b})(),r(y,{when:al,children:b=>r(Ae,{get component(){return b()}})}),r(y,{get when(){return c()},get children(){return[Ho(),r(y,{get when(){return m()},get children(){var b=Ko(),h=b.firstChild;return i(b,()=>m().name,h),b}}),Go(),r(Q,{get each(){return l()?.users},children:b=>(()=>{var h=el(),C=h.firstChild;return h.$$click=()=>void Gt({userId:b.id}),i(C,()=>b.name),i(h,r(y,{get when(){return g()?.user?.id===b.id},get children(){return r(qe,{size:13,class:"text-blue-400 shrink-0"})}}),null),h})()}),Xo(),(()=>{var b=Yo(),h=b.firstChild,C=h.firstChild;return i(b,r(Q,{get each(){return l()?.roles},children:O=>(()=>{var I=tl();return I.$$click=()=>void Gt({role:O}),i(I,O),z(N=>Ve(I,{"border-blue-400/60 bg-blue-500/15 text-blue-200":l()?.view.role===O,"border-[var(--ks-border-strong,#3f3f46)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-blue-500/30":l()?.view.role!==O},N)),I})()}),h),h.$$click=()=>P(O=>!O),i(h,r(dr,{size:10}),C),b})(),r(y,{get when(){return w()},get children(){var b=Jo(),h=b.firstChild,C=h.nextSibling,O=C.nextSibling;return h.$$input=I=>M(I.currentTarget.value),i(b,r(y,{get when(){return m()},get children(){var I=Qo(),N=I.firstChild;return i(I,()=>m().name,N),I}}),C),i(C,r(Q,{get each(){return _()},children:I=>(()=>{var N=rl(),D=N.firstChild,X=D.nextSibling;return D.addEventListener("change",()=>E(I)),i(X,I),z(()=>D.checked=S().includes(I)),N})()})),O.$$click=()=>void ol(v().trim(),S()),z(()=>O.disabled=!v().trim()),z(()=>h.value=v()),b}})]}}),r(y,{when:il,children:b=>r(Ae,{get component(){return b()}})})]},$r=e=>{const{userMenuOpen:n,collapsed:t,reducedMotion:s}=de();return r(y,{get when(){return G(()=>e.variant==="rail")()?G(()=>!!n())()&&t():n()},get children(){return[r(y,{when:Kt,children:a=>r(Ae,{get component(){return a()}})}),r(y,{get when(){return e.variant==="rail"},get fallback(){return r(y,{when:!Kt,get children(){var a=sl();return i(a,r(Xt,{})),z(o=>Y(a,ee,o)),a}})},get children(){var a=nl();return i(a,r(Xt,{})),z(o=>Y(a,{...ee,...s()?{}:{animation:"pop .14s ease"}},o)),a}})]}})};oe(["click","input"]);var ll=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">'),cl=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">'),ul=d('<nav class="flex-1 overflow-y-auto py-2 space-y-1 overflow-x-visible">'),dl=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>'),fl=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">'),pl=d('<button type=button class="cursor-pointer shrink-0"data-testid=workspace-switcher-trigger style=width:34px;height:34px>'),hl=d("<div><button type=button><span class=relative><span></span></span><span>"),gl=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">'),vl=d("<span>"),ml=d('<span class="w-full text-[9px] leading-tight text-center line-clamp-1">');const bl=()=>{const{collapsed:e,currentWorkspace:n,setWsOpen:t,setNotifOpen:s,setSearchFlyoutOpen:a,setFlyoutId:o,setFlyoutTop:f,tickClick:c,notifCtx:g,perms:l,visibleEntries:$,sectionContainsActive:m,activeParent:_,flyoutId:w,isActiveOrChild:P,reducedMotion:v,isActive:M,isSuperuser:S,me:x,userMenuOpen:E,setUserMenuOpen:b}=de();return r(y,{get when(){return e()},get children(){return[(()=>{var h=cl(),C=h.firstChild;return i(h,r(y,{get when(){return n()},children:O=>(()=>{var I=pl();return I.$$click=()=>{t(N=>!N),s(!1),a(!1),o(null),c()},i(I,r(Je,{get name(){return O().ws_name},get logoUrl(){return O().ws_logo_url},size:34})),z(()=>ie(I,"title",O().ws_name)),I})()}),C),C.$$click=()=>{a(O=>!O),t(!1),s(!1),o(null),c()},i(C,r(yt,{size:17})),i(h,r(Le,{href:"/inbox",onClick:()=>{s(!1),t(!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[r(pr,{size:17}),r(y,{get when(){return g.unreadCount()>0},get children(){var O=ll();return i(O,()=>g.unreadCount()),O}})]}}),null),h})(),(()=>{var h=ul();return i(h,r(y,{get when(){return!l.loading()},get children(){return[r(Q,{get each(){return $().sections},children:C=>{const O=()=>m(C.section),I=()=>_()===C.section.id,N=()=>O()||I(),D=()=>w()===C.section.id,X=C.section.icon,te=I()?C.visibleItems.find(ce=>P(ce))?.icon:void 0,ne=()=>N()?"border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_50%,transparent)] bg-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_14.000000000000002%,transparent)]":D()?"border-[var(--ks-border-strong,#3f3f46)] bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_40%,transparent)]":"border-transparent";return(()=>{var ce=hl(),re=ce.firstChild,fe=re.firstChild,ue=fe.firstChild,he=fe.nextSibling;return re.$$click=p=>{D()?o(null):(o(C.section.id),f(p.currentTarget.getBoundingClientRect().top),t(!1),s(!1),a(!1)),c()},i(re,r(y,{get when(){return N()},get children(){return r(je,{inset:"top-1 bottom-1"})}}),fe),i(ue,r(X,{size:19,class:"ic"})),i(fe,r(y,{get when(){return I()&&te},children:p=>{const u=p();return(()=>{var k=gl();return i(k,r(u,{size:12,"stroke-width":2.6})),z(T=>Y(k,v()?void 0:{animation:"pip .25s ease"},T)),k})()}}),null),i(he,(()=>{var p=G(()=>!!I());return()=>p()?C.visibleItems.find(u=>P(u))?.label??C.section.label:C.section.label})()),z(p=>{var u=I()?`${C.section.label} › ${C.visibleItems.find(R=>P(R))?.label??""}`:C.section.label,k=I()?`${C.section.label} › ${C.visibleItems.find(R=>P(R))?.label??""}`:C.section.label,T=`navrow group relative w-full flex flex-col items-center gap-1 px-1 py-1 cursor-pointer ${N()?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)]"}`,L=`grid place-items-center p-2.5 border transition-colors ${ne()}`,q=ee,V=`w-full text-[9px] leading-tight text-center line-clamp-1 ${I()?"text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_90%,transparent)] font-medium":""}`;return u!==p.e&&ie(re,"title",p.e=u),k!==p.t&&ie(re,"aria-label",p.t=k),T!==p.a&&ae(re,p.a=T),L!==p.o&&ae(ue,p.o=L),p.i=Y(ue,q,p.i),V!==p.n&&ae(he,p.n=V),p},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),ce})()}}),r(Q,{get each(){return $().items},children:C=>{const O=()=>P(C),I=C.icon;return r(Le,{get href(){return C.href},get title(){return C.label},get"aria-label"(){return C.label},onClick:c,get class(){return`navrow group relative w-full flex flex-col items-center gap-1 px-1 py-1 cursor-pointer ${O()?"text-[var(--ks-accent,#fbbf24)]":"text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)]"}`},get children(){return[r(y,{get when(){return O()},get children(){return r(je,{inset:"top-1 bottom-1"})}}),(()=>{var N=vl();return i(N,r(I,{size:19,class:"ic"})),z(D=>{var X=`grid place-items-center p-2.5 border transition-colors ${O()?"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"}`,te=ee;return X!==D.e&&ae(N,D.e=X),D.t=Y(N,te,D.t),D},{e:void 0,t:void 0}),N})(),(()=>{var N=ml();return i(N,()=>C.label),N})()]}})}})]}})),h})(),(()=>{var h=dl(),C=h.firstChild;return C.$$click=O=>{O.stopPropagation();const I=!E();b(I),I&&(t(!1),s(!1),o(null))},i(C,r(ar,{get name(){return x()?.user?.name??""},get image(){return x()?.user?.image},size:"md"})),z(()=>ie(C,"title",x()?.user?.name??"")),h})(),(()=>{var h=fl();return i(h,r(_r,{size:16})),h})()]}})};oe(["click"]);var xl=d('<span class="flex-1 text-[14px] font-medium truncate">'),kl=d('<div class="relative group/navrow">'),_l=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">'),$l=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'),wl=d('<button type=button class="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg,#ffffff)] cursor-pointer"aria-label="Clear search">'),yl=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">'),Sl=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">'),Cl=d('<span class="flex-1 text-[14px] font-medium truncate">Workspace Inbox'),Ml=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">'),El=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'),Nl=d('<nav class="flex-1 overflow-y-auto px-1.5 pb-2 overflow-x-hidden">'),Pl=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="text-[var(--ks-fg-subtle,#71717a)] hover:text-[var(--ks-fg-muted,#a1a1aa)] cursor-pointer shrink-0"aria-label="Open user menu"data-user-menu>'),Al=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">'),Tl=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">'),Ll=d('<span class="text-[13px] font-semibold text-[var(--ks-fg,#ffffff)] truncate flex-1">'),zl=d('<p class="text-[12px] text-[var(--ks-fg-subtle,#71717a)] px-3 py-6 text-center">Nothing matches &ldquo;<!>&rdquo;.'),Rl=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'),Il=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)]">'),Ol=d('<button type=button><span class="flex-1 text-[13px] truncate">'),Dl=d('<span class="flex items-center gap-1 text-[10px] text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_80%,transparent)] truncate">'),Wl=d('<button type=button><div class="flex-1 min-w-0"><span class="block text-[14px] font-medium truncate">'),Ul=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 jl=null;function Yt(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",Fl="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)]",kt="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 Vl(e,n){return`${Fl} ${n?"pr-9":""} ${e?Xe:kt}`}const Bl=()=>{const{collapsed:e,currentWorkspace:n,hasMultipleOrgs:t,setWsOpen:s,setNotifOpen:a,setFlyoutId:o,tickClick:f,wsOpen:c,notifCtx:g,query:l,setQuery:$,currentSection:m,queryTrimmed:_,goBack:w,reducedMotion:P,dir:v,perms:M,nestedSearchResults:S,matchesQuery:x,goInto:E,isActive:b,chooseResult:h,level:C,visibleEntries:O,isActiveOrChild:I,tickHover:N,sectionContainsActive:D,activeParent:X,isSuperuser:te,userMenuOpen:ne,setUserMenuOpen:ce,me:re,soundOn:fe,setSoundOn:ue}=de(),he=p=>(()=>{var u=kl();return i(u,r(Le,{get href(){return p.href},onMouseEnter:N,onClick:f,get class(){return Vl(p.active,!!p.module)},get style(){return p.active?ee:void 0},get children(){return[r(y,{get when(){return p.active},get children(){return r(je,{inset:"top-1.5 bottom-1.5"})}}),r(p.icon,{get size(){return p.iconSize??18},class:"ic shrink-0"}),(()=>{var k=xl();return i(k,()=>p.label),k})()]}}),null),i(u,r(y,{get when(){return p.module},children:k=>r(kr,{get module(){return k()},get moduleLabel(){return p.label},class:ql})}),null),u})();return r(y,{get when(){return!e()},get children(){return[(()=>{var p=_l();return i(p,r(y,{get when(){return n()},children:u=>(()=>{var k=Tl(),T=k.firstChild;return k.$$click=()=>{s(L=>!L),a(!1),o(null),f()},i(k,r(Je,{get name(){return u().ws_name},get logoUrl(){return u().ws_logo_url},size:30}),T),i(T,()=>u().ws_name),i(k,r(mn,{size:13,class:"text-[var(--ks-fg-subtle,#71717a)] shrink-0"}),null),z(L=>{var q=c(),V=ee;return q!==L.e&&ie(k,"aria-expanded",L.e=q),L.t=Y(k,V,L.t),L},{e:void 0,t:void 0}),k})()})),p})(),(()=>{var p=yl(),u=p.firstChild,k=u.firstChild;return i(u,r(yt,{size:14,class:"text-[var(--ks-fg-subtle,#71717a)] shrink-0"}),k),k.$$input=T=>$(T.currentTarget.value),i(u,r(y,{get when(){return l().length===0},get children(){return $l()}}),null),i(u,r(y,{get when(){return l().length>0},get children(){var T=wl();return T.$$click=()=>$(""),i(T,r(Ie,{size:13})),T}}),null),z(T=>Y(u,ee,T)),z(()=>k.value=l()),p})(),r(y,{get when(){return G(()=>!!m())()&&!_()},get children(){var p=Sl();return Te(p,"click",w,!0),i(p,r(ys,{size:17,class:"shrink-0"}),null),i(p,r(y,{get when(){return m()},children:u=>{const k=u().section.icon;return[r(k,{size:16,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"}),(()=>{var T=Ll();return i(T,()=>u().section.label),T})()]}}),null),z(u=>Y(p,ee,u)),p}}),(()=>{var p=Nl();return i(p,r(y,{get when(){return!M.loading()},get children(){return[r(y,{get when(){return _()},get children(){return r(y,{get when(){return S().length>0},get fallback(){return(()=>{var u=zl(),k=u.firstChild,T=k.nextSibling;return T.nextSibling,i(u,()=>l().trim(),T),u})()},get children(){return r(Q,{get each(){return S()},children:u=>(()=>{var k=Il(),T=k.firstChild;return i(T,()=>u.section.label),i(k,r(y,{get when(){return G(()=>!!(x(u.section.label)&&u.section.id!=="_root"))()&&u.section.id!=="_platform"},get children(){var L=Rl(),q=L.firstChild,V=q.firstChild;return L.$$click=()=>{E(u.section.id),$(""),f()},i(L,()=>{const R=u.section.icon;return r(R,{size:16,class:"shrink-0"})},q),i(V,r(xt,{get label(){return u.section.label}})),L}}),null),i(k,r(Q,{get each(){return u.items},children:L=>{const q=L.item.icon,V=()=>b(L.item.href);return(()=>{var R=Ol(),H=R.firstChild;return R.$$click=()=>h(L.item.href),i(R,r(q,{size:15,class:"shrink-0"}),H),i(H,r(xt,{get label(){return L.item.label}})),z(()=>ae(R,`navrow w-full flex items-center gap-2.5 px-2.5 py-2 pl-6 text-left cursor-pointer ${V()?Xe:"text-[var(--ks-fg,#ffffff)] hover:bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_60%,transparent)]"}`)),R})()}}),null),k})()})}})}}),r(y,{get when(){return G(()=>!_())()&&C()==="root"},get children(){return[r(Le,{href:"/inbox",onClick:()=>{a(!1),s(!1),o(null),f()},get class(){return`navrow group relative w-full flex items-center gap-3 py-2.5 px-2.5 text-left ${b("/inbox")?Xe:kt}`},get style(){return b("/inbox")?ee:void 0},"aria-label":"Workspace Inbox",get children(){return[r(y,{get when(){return b("/inbox")},get children(){return r(je,{inset:"top-1.5 bottom-1.5"})}}),r(pr,{size:18,class:"ic shrink-0"}),Cl(),r(y,{get when(){return g.unreadCount()>0},get children(){var u=Ml();return i(u,()=>g.unreadCount()),u}})]}}),El(),r(Q,{get each(){return O().items},children:u=>r(he,{get href(){return u.href},get label(){return u.label},get icon(){return u.icon},get active(){return I(u)},get module(){return Yt(u)}})}),r(Q,{get each(){return O().sections},children:u=>{const k=()=>D(u.section),T=()=>X()===u.section.id,L=T()?u.visibleItems.find(R=>I(R)):void 0,q=u.section.icon,V=()=>k()?Xe:T()?"text-[var(--ks-fg,#ffffff)]":kt;return(()=>{var R=Wl(),H=R.firstChild,J=H.firstChild;return Te(R,"mouseenter",N),R.$$click=()=>E(u.section.id),i(R,r(y,{get when(){return k()||T()},get children(){return r(je,{inset:"top-1.5 bottom-1.5"})}}),H),i(R,r(q,{size:18,class:"ic shrink-0"}),H),i(J,()=>u.section.label),i(H,r(y,{get when(){return T()&&L},get children(){var U=Dl();return i(U,r(ca,{size:10,class:"shrink-0"}),null),i(U,()=>L.label,null),U}}),null),i(R,r(Wt,{size:16,class:"shrink-0 text-[var(--ks-fg-subtle,#71717a)]"}),null),z(U=>{var Z=`navrow group relative w-full flex items-center gap-3 py-2.5 px-2.5 text-left cursor-pointer ${V()}`,pe=k()?ee:void 0;return Z!==U.e&&ae(R,U.e=Z),U.t=Y(R,pe,U.t),U},{e:void 0,t:void 0}),R})()}})]}}),r(y,{get when(){return G(()=>!_()&&C()!=="root")()&&m()},get children(){return r(Q,{get each(){return m().visibleItems},children:u=>r(he,{get href(){return u.href},get label(){return u.label},get icon(){return u.icon},iconSize:17,get active(){return b(u.href)},get module(){return Yt(u)}})})}})]}})),z(u=>Y(p,P()?void 0:{animation:`${_()||v()==="in"?"slideIn":"slideOut"} .18s ease`},u)),p})(),(()=>{var p=Pl(),u=p.firstChild,k=u.firstChild,T=k.firstChild,L=T.firstChild,q=L.nextSibling,V=k.nextSibling;return k.$$click=R=>{R.stopPropagation();const H=!ne();ce(H),H&&(s(!1),a(!1),o(null))},i(k,r(ar,{get name(){return re()?.user?.name??""},get image(){return re()?.user?.image},size:"md"}),T),i(L,()=>re()?.user?.name??""),i(q,r(wo,{})),V.$$click=R=>{R.stopPropagation();const H=!ne();ce(H),H&&(s(!1),a(!1),o(null))},i(V,r(Wt,{size:14})),i(p,r($r,{variant:"docked"}),null),z(R=>{var H=ee,J=ne();return R.e=Y(u,H,R.e),J!==R.t&&ie(k,"aria-expanded",R.t=J),R},{e:void 0,t:void 0}),p})(),(()=>{var p=Al();return i(p,r(_r,{size:16,get class(){return"[filter:sepia(1)_saturate(6)_hue-rotate(185deg)_brightness(0.95)]"}}),null),i(p,(()=>{var u=G(()=>!0);return()=>u()?(()=>{var k=Ul(),T=k.firstChild,L=T.nextSibling;return L.nextSibling,i(k,()=>re()?.sdkVersion||"?",null),k})():r(y,{when:jl,children:k=>r(Ae,{get component(){return k()}})})})(),null),p})()]}})};oe(["input","click"]);var Hl=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">'),Kl=d('<div class="fixed inset-0 z-40 cursor-default"aria-label=Close>');const Gl=()=>{const{collapsed:e,toggleCollapse:n,flyoutId:t,notifOpen:s,wsOpen:a,searchFlyoutOpen:o,closeAllPops:f}=de();return[(()=>{var c=Hl(),g=c.firstChild;return Te(g,"click",n,!0),i(g,(()=>{var l=G(()=>!!e());return()=>l()?r(Ta,{size:13}):r(Na,{size:13})})()),i(c,r(bl,{}),null),i(c,r($r,{variant:"rail"}),null),i(c,r(Bl,{}),null),z(l=>{var $=!e(),m=!!e(),_=e()?"Expand":"Collapse",w=e()?"Expand sidebar":"Collapse sidebar";return $!==l.e&&c.classList.toggle("w-[256px]",l.e=$),m!==l.t&&c.classList.toggle("w-[72px]",l.t=m),_!==l.a&&ie(g,"title",l.a=_),w!==l.o&&ie(g,"aria-label",l.o=w),l},{e:void 0,t:void 0,a:void 0,o:void 0}),c})(),r(y,{get when(){return a()||s()||t()||o()},get children(){var c=Kl();return Te(c,"click",f,!0),c}}),r(jo,{}),r(Po,{}),r(mi,{}),r(vo,{}),r(zo,{})]},Xl=()=>r(di,{get children(){return r(Gl,{})}});oe(["click"]);function Yl(){const e=new Image;e.onload=()=>{const t=document.createElement("canvas");t.width=64,t.height=64;const s=t.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=t.toDataURL("image/png");document.querySelectorAll('link[rel~="icon"]').forEach(f=>f.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 Ql(){const e=et();return _e(()=>{e()&&typeof document<"u"&&Yl()}),null}function Jl(){const e=et(),n=Ze(),t=Fe(),s=nr();return _e(()=>{if(!e()||!n.ready())return;const a=n.plugins();if(a.length===0)return;const o=t.pathname.split("/").filter(Boolean)[0]??"";if(a.some(c=>c.routeBase===o))return;const f=`/${a[0].routeBase}`;t.pathname!==f&&s(f,{replace:!0})}),null}var Zl=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 wr="ks_username_banner_dismissed";function ec(){try{return localStorage.getItem(wr)==="1"}catch{return!1}}function tc(){const e=Re(),[n,t]=W(ec()),s=()=>!!e()?.user&&!e()?.user?.username&&!n(),a=()=>{try{localStorage.setItem(wr,"1")}catch{}t(!0)};return r(y,{get when(){return s()},get children(){var o=Zl(),f=o.firstChild,c=f.nextSibling;return i(o,r(Hs,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"}),f),i(o,r(Le,{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,r(Ie,{size:14})),o}})}oe(["click"]);const[yr,St]=W(null),rc=yr;function nc(){const e=yr();if(!e){window.location.reload();return}navigator.serviceWorker.addEventListener("controllerchange",()=>{window.location.reload()},{once:!0}),e.postMessage({type:"SKIP_WAITING"})}function sc(){St(null)}function ac(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&St(e)})}function ic(){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&&St(n.waiting),n.addEventListener("updatefound",()=>{const t=n.installing;t&&ac(t)})}).catch(()=>{})})}var oc=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 lc(){return r(y,{get when(){return rc()},get children(){var e=oc(),n=e.firstChild,t=n.nextSibling,s=t.nextSibling;return i(e,r(Da,{size:14,class:"text-[var(--ks-accent,#fbbf24)] shrink-0"}),n),Te(t,"click",nc,!0),Te(s,"click",sc,!0),i(s,r(Ie,{size:14})),e}})}oe(["click"]);const cc="ks_active_workspace_id",Qt="__ksApiFetchPatched";function uc(e){return typeof e=="string"?e:e instanceof URL?e.href:e.url}function dc(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 fc(){if(typeof window>"u")return;const e=window;if(e[Qt])return;e[Qt]=!0;const n=window.fetch.bind(window);window.fetch=async(t,s)=>{let a=!1;try{const f=uc(t);if(a=dc(f),a){let c=null;try{c=localStorage.getItem(cc)}catch{}if(c){const g=new Headers(s?.headers??(t instanceof Request?t.headers:void 0));g.has("X-Workspace-Id")||(g.set("X-Workspace-Id",c),s={...s??{},headers:g})}}}catch{}const o=await n(t,s);return a&&o.status===401&&!pc()&&(window.location.href="/login"),o}}function pc(){const e=window.location.pathname;return e==="/login"||e==="/register"}fc();var hc=d("<div class=ks-route-progress aria-hidden=true>"),gc=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 Jt(){const e=Jr();return r(y,{get when(){return e()},get children(){return hc()}})}function vc(e){let n=!1;return _e(()=>{n||(n=!0,e.onRender())}),null}function mc(e){const n=Fe(),t=()=>n.pathname==="/login"||n.pathname==="/register",[s,a]=W(!1);return r(y,{get when(){return!t()},get fallback(){return[r(Jt,{}),r(Tt,{get children(){return e.children}})]},get children(){return r(xn,{get children(){return r(ni,{get children(){return r(ln,{get children(){return r(ai,{get children(){var o=gc(),f=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,r(Jt,{}),f),i(o,r(Ql,{}),f),i(o,r(Jl,{}),f),i(o,r(Xl,{}),f),i(f,r(tc,{}),null),i(f,r(Tt,{get fallback(){return G(()=>!!s())()?[]:r(cn,{})},get children(){return[r(vc,{onRender:()=>a(!0)}),G(()=>e.children)]}}),null),o}})}})}})}})}})}function bc(){const e=Gn;return r(bn,{get children(){return r(on,{get children(){return[r(e,{root:mc,get children(){return r(ps,{})}}),r(lc,{})]}})}})}oe(["contextmenu"]);const xc=e=>null;var kc=d("<span style=font-size:1.5em;text-align:center;position:fixed;left:0px;bottom:55%;width:100%>");const _c=e=>{const n="Error | Uncaught Client Exception";return r(Zr,{fallback:t=>(console.error(t),[(()=>{var s=kc();return i(s,n),s})(),r(xc,{code:500})]),get children(){return e.children}})};function Zt(e){return e.children}function $c(){return r(Zt,{get children(){return r(Zt,{get children(){return r(_c,{get children(){return r(bc,{})}})}})}})}function wc(e,n){en(e,n)}const yc=localStorage.getItem("ks-erp-theme"),Sc=yc||"dark";document.documentElement.classList.add(Sc);wc(()=>r($c,{}),document.getElementById("app"));ic();const Ac=void 0;export{Ac as default};