moi-computer 0.13.1-next.3 → 0.13.1-next.4

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 (82) hide show
  1. package/client/app/app-provider.tsx +14 -20
  2. package/client/app/app-router.tsx +5 -8
  3. package/client/app/routes/workspace-route.tsx +28 -11
  4. package/client/app/shell/sidebar-layout.tsx +5 -10
  5. package/client/features/app-settings/api.ts +3 -3
  6. package/client/features/applets/applet-cache.ts +1 -2
  7. package/client/features/applets/use-applet.ts +18 -20
  8. package/client/features/chat/chat-store.ts +1 -1
  9. package/client/features/chat/connection/chat-connection.ts +25 -68
  10. package/client/features/chat/connection/chat-frames.ts +20 -32
  11. package/client/features/chat/sessions/api.ts +2 -2
  12. package/client/features/collab/presence/client.ts +63 -83
  13. package/client/features/collab/presence/provider.tsx +8 -2
  14. package/client/features/dev/chat-states-page.tsx +1 -1
  15. package/client/features/dev/harness-debug-page.tsx +2 -2
  16. package/client/features/scratchpad/scratchpad.tsx +29 -20
  17. package/client/features/views/api.ts +5 -6
  18. package/client/features/workspace/api.ts +6 -11
  19. package/client/features/workspace/harness-transition.ts +3 -5
  20. package/client/features/workspace/remote.ts +9 -0
  21. package/client/features/workspace/settings/use-env-vars.ts +4 -4
  22. package/client/features/workspace/use-workspace-navigation.ts +1 -1
  23. package/client/features/workspace/use-workspace-socket.ts +51 -0
  24. package/client/features/workspace/workspace-content.tsx +3 -7
  25. package/client/features/workspace/workspace-layout-context.tsx +6 -13
  26. package/client/features/workspace/workspace-state.ts +17 -6
  27. package/client/runtime/app-context.ts +2 -2
  28. package/client/runtime/app-events.ts +75 -0
  29. package/client/runtime/reconnecting-socket.ts +115 -0
  30. package/client/runtime/{use-workspace-events.ts → use-client-events.ts} +9 -10
  31. package/dist/{chunk-f44cs6mw.js → chunk-0t8m1ehd.js} +2 -2
  32. package/dist/chunk-851bx8ss.js +72 -0
  33. package/dist/{chunk-xj1pjhng.js → chunk-c8g5x288.js} +1 -1
  34. package/dist/chunk-cty37f3v.js +1 -0
  35. package/dist/chunk-dy6f6h3e.js +5 -0
  36. package/dist/chunk-j6928pwm.js +1 -0
  37. package/dist/{chunk-r95acex1.js → chunk-k32585ne.js} +70 -70
  38. package/dist/chunk-qtkv7hp8.js +2 -0
  39. package/dist/chunk-rh58dc0y.js +2 -0
  40. package/dist/{chunk-a865c7x4.js → chunk-wjbejzek.js} +1 -1
  41. package/dist/index.html +1 -1
  42. package/lib/events.ts +61 -0
  43. package/lib/ids.ts +2 -8
  44. package/lib/types.ts +12 -15
  45. package/package.json +1 -1
  46. package/server/AGENTS.md +3 -3
  47. package/server/README.md +29 -15
  48. package/server/api/index.ts +54 -35
  49. package/server/applets/views.ts +15 -14
  50. package/server/applets/widgets.ts +4 -3
  51. package/server/cli/commands/refresh.ts +2 -5
  52. package/server/control.ts +24 -33
  53. package/server/events.ts +14 -13
  54. package/server/harness/README.md +7 -7
  55. package/server/harness/acp/session.ts +9 -5
  56. package/server/harness/auth.ts +7 -30
  57. package/server/harness/claude-code/session.ts +8 -4
  58. package/server/harness/codex/NOTES.md +1 -1
  59. package/server/harness/codex/session.ts +18 -10
  60. package/server/harness/hermes/NOTES.md +3 -3
  61. package/server/harness/openclaw/session.ts +9 -5
  62. package/server/onboarding/jobs.ts +7 -7
  63. package/server/operations/commands.ts +1 -1
  64. package/server/scratchpad/executor.ts +2 -2
  65. package/server/scratchpad/relay.ts +3 -3
  66. package/server/sessions/archive.ts +1 -1
  67. package/server/sessions/lifecycle.ts +1 -1
  68. package/server/sessions/pending-views.ts +17 -11
  69. package/server/web.ts +40 -30
  70. package/server/workspace-state/index.ts +15 -4
  71. package/server/workspaces/config.ts +14 -13
  72. package/server/workspaces/env-apply.ts +1 -1
  73. package/server/workspaces/layout.ts +40 -7
  74. package/server/workspaces/shared.ts +1 -1
  75. package/client/features/scratchpad/scratch-executor.ts +0 -20
  76. package/client/runtime/workspace-events.ts +0 -168
  77. package/dist/chunk-0h4zypgf.js +0 -1
  78. package/dist/chunk-1tksq43z.js +0 -72
  79. package/dist/chunk-6gxf0xr8.js +0 -5
  80. package/dist/chunk-h3qag4a6.js +0 -2
  81. package/dist/chunk-q2tpy0h7.js +0 -2
  82. package/dist/chunk-w5h9grdr.js +0 -1
@@ -1,2 +0,0 @@
1
- var ht=Object.create;var{getPrototypeOf:gt,defineProperty:ar,getOwnPropertyNames:ut}=Object;var xr=Object.prototype.hasOwnProperty;function mt(r){return this[r]}var ft,bt,e=(r,t,a)=>{var o=r!=null&&typeof r==="object";if(o){var i=t?ft??=new WeakMap:bt??=new WeakMap,c=i.get(r);if(c)return c}a=r!=null?ht(gt(r)):{};let d=t||!r||!r.__esModule||!xr.call(r,"default")?ar(a,"default",{value:r,enumerable:!0}):a;if(r&&typeof r==="object"||typeof r==="function"){for(let n of ut(r))if(!xr.call(d,n))ar(d,n,{get:mt.bind(r,n),enumerable:!0})}if(o)i.set(r,d);return d};var C=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var xt=(r)=>r;function yt(r,t){this[r]=xt.bind(null,t)}var Bt=(r,t)=>{for(var a in t)ar(r,a,{get:t[a],enumerable:!0,configurable:!0,set:yt.bind(t,a)})};var tn=((r)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var yr,ir,F,Le=(r,t)=>{for(var[a,o,i]of yr||[])for(var c=[r],d=globalThis,n=d.document,s,p,g,h,u;p=c.pop();)if(!ir[p]&&(g=o[p])){ir[p]=1;for(h=1;h<g.length;h++)c.push(i[g[h]]);if(!t&&p!==r&&(s=n&&n.head)){if(F===void 0)F=(h=n.querySelector("meta[property=csp-nonce]"))&&(h.nonce||h.getAttribute("nonce"))||"";if(u=n.createElement("link"),u.rel="modulepreload",u.crossOrigin="",F)u.nonce=F;u.href=new d.URL(g[0],a),s.appendChild(u)}}},kt=(r,t,a,o)=>{for(var i={},c=0;c<t.length;c++)i[t[c]]=a[c];(yr||=[]).push([r,i,t]),ir||={},Le(t[o],1)};kt(import.meta.url,["h3qag4a6","1tksq43z","w5h9grdr","a865c7x4","nf2wkvf9","r95acex1","6gxf0xr8","q2tpy0h7","f44cs6mw","0h4zypgf","xj1pjhng"],[["/chunk-h3qag4a6.js"],["/chunk-1tksq43z.js",6,0,7,8],["/chunk-w5h9grdr.js",7],["/chunk-a865c7x4.js",0,8],["/chunk-nf2wkvf9.js"],["/chunk-r95acex1.js",6,7,0,10,8],["/chunk-6gxf0xr8.js",0,7,8],["/chunk-q2tpy0h7.js",0,8],["/chunk-f44cs6mw.js"],["/chunk-0h4zypgf.js",10],["/chunk-xj1pjhng.js"]],0);
2
- if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);var P=["pink","orange","amber","lime","emerald","cyan","blue","violet"];function Q(r){return typeof r==="string"&&P.includes(r)}function Jr(r){let t=2166136261;for(let a=0;a<r.length;a++)t^=r.charCodeAt(a),t=Math.imul(t,16777619);return P[(t>>>0)%P.length]??P[0]}var rn=1;var _t=8192,Ct=320;function Fe(r){return typeof r==="object"&&r!==null&&!Array.isArray(r)}function L(r,t=256){return typeof r==="string"&&r.length>0&&!r.includes("\x00")&&new TextEncoder().encode(r).length<=t}function kr(r){return Fe(r)&&L(r.id,240)&&r.id.trim().length>0&&(r.name===void 0||L(r.name)&&r.name.trim().length>0)&&Q(r.color)&&(r.avatar===void 0||L(r.avatar,_t))&&(r.email===void 0||L(r.email,Ct))}function N(r,t){return typeof r==="string"&&r.length<=t&&!r.includes("\x00")}function Et(r){if(!N(r,2048))return!1;try{return["http:","https:"].includes(new URL(r).protocol)}catch{return!1}}function ot(r){if(!Fe(r)||!N(r.id,240)||!r.id.trim()||r.id!==r.id.trim()||!N(r.name,256)||r.avatar!==void 0&&!Et(r.avatar))throw Error("Invalid identity");let t={id:r.id,name:r.name,...r.avatar!==void 0?{avatar:r.avatar}:{}};if(r.type==="agent")return{...t,type:"agent"};if(r.type==="user"&&N(r.email,320)&&typeof r.isAnonymous==="boolean")return{...t,type:"user",email:r.email,isAnonymous:r.isAnonymous};throw Error("Invalid identity")}var Be=(r)=>`${r.type}:${r.id}`,vt=(r)=>r.type==="agent"?`agent:${r.id}`:r.id;var W,zr=0,_r=0,nr=new Set,Te=()=>W,wr=()=>_r,ce=()=>zr;function Qr(r){return nr.add(r),()=>{nr.delete(r)}}function wt(r){let t=r===null?null:ot(r);if((W&&Be(W))!==(t&&Be(t)))zr++;_r++,W=t,nr.forEach((o)=>o())}var At=["Curious Kiwi","Cheerful Cherry","Sleepy Peach","Excited Banana","Cosmic Mango","Velvet Lemon","Electric Plum","Wandering Pear","Dramatic Papaya","Suspicious Pineapple","Confused Coconut","Sneaky Tangerine","Gentle Fig","Quiet Apricot","Mellow Melon","Dreamy Guava"];function Cr(r,t){let a=r.filter((o)=>o!==t);return a[Math.floor(Math.random()*a.length)]??r[0]}function Pt(r){return{name:Cr(At,r?.name),color:Cr(P,r?.color)}}function jt(r,t){let a=t.name.trim();return{id:r,...a?{name:a}:{},color:t.color}}function Er(){return jt(`local-${crypto.randomUUID().slice(0,8)}`,Pt())}var cr="moi:local-profile",_,S,D=new Set;function lr(r,t){return JSON.stringify(r)===JSON.stringify(t)}function j(r){if(!r||typeof r.id!=="string"||!r.id.trim())throw Error("A user profile needs an id.");if(r.name!==void 0&&typeof r.name!=="string")throw Error("A user profile name must be a string when provided.");if(r.color!==void 0&&!Q(r.color))throw Error("A user profile color must be one of the user palette names.");let t=r.id.trim(),a=r.name?.trim(),o={id:t,...a?{name:a}:{},color:r.color??Jr(t),...r.avatar!==void 0?{avatar:r.avatar}:{},...r.email!==void 0?{email:r.email}:{}};if(!kr(o))throw Error("Invalid user profile.");return Object.freeze(o)}var sr,Ar;function pe(){let r=Te();if(r===void 0)return _;if(r!==Ar){Ar=r;let t=!r||r.type==="user"&&r.isAnonymous?void 0:j({id:vt(r),name:r.name||void 0,avatar:r.avatar,email:r.type==="user"?r.email||void 0:void 0});if(!lr(sr,t))sr=t}return sr}function St(r){let t=pe(),a=we(),o=()=>{let c=pe(),d=we();if(t===c&&a===d)return;t=c,a=d,r()};D.add(o);let i=Qr(o);return()=>{D.delete(o),i()}}function we(){return Te()!==void 0?"external":S}function on({provider:r,profile:t}){if(we()==="external")return;if(r===void 0){if(S===void 0||S==="local")return;S=void 0,_=void 0}else{let a=t===void 0?void 0:j(t);if(S===r&&lr(_,a))return;S=r,_=a}D.forEach((a)=>a())}function Mt(){try{localStorage.setItem(cr,JSON.stringify(_))}catch{}}function eo(r){if(we()!==void 0&&we()!=="local")return;let t=j(r);S="local",_=t,Mt(),D.forEach((a)=>a())}function jr(r,t){if(!r||!t||t.provider!==void 0||we()!==void 0)return;try{let a=localStorage.getItem(cr);if(a){eo(JSON.parse(a));return}}catch{}eo(Er())}function Pr(r){if(r.key!==cr||!r.newValue||we()!=="local")return;try{let t=j(JSON.parse(r.newValue));if(lr(t,_))return;_=t,D.forEach((a)=>a())}catch{}}function Mr(){return window.addEventListener("storage",Pr),()=>window.removeEventListener("storage",Pr)}var Ot={setTimeout:(r,t)=>setTimeout(r,t),clearTimeout:(r)=>clearTimeout(r),setInterval:(r,t)=>setInterval(r,t),clearInterval:(r)=>clearInterval(r)},qt=class{#r=Ot;#t=!1;setTimeoutProvider(r){this.#r=r}setTimeout(r,t){return this.#r.setTimeout(r,t)}clearTimeout(r){this.#r.clearTimeout(r)}setInterval(r,t){return this.#r.setInterval(r,t)}clearInterval(r){this.#r.clearInterval(r)}},ze=new qt;function Or(r){setTimeout(r,0)}var pr=typeof window>"u"||"Deno"in globalThis;function H(){}function Ur(r,t){return typeof r==="function"?r(t):r}function to(r){return typeof r==="number"&&r>=0&&r!==1/0}function ro(r,t){return Math.max(r+(t||0)-Date.now(),0)}function U(r,t){return typeof r==="function"?r(t):r}function er(r,t){let{type:a="all",exact:o,fetchStatus:i,predicate:c,queryKey:d,stale:n}=r;if(d){if(o){if(t.queryHash!==R(d,t.options))return!1}else if(!E(t.queryKey,d))return!1}if(a!=="all"){let s=t.isActive();if(a==="active"&&!s)return!1;if(a==="inactive"&&s)return!1}if(typeof n==="boolean"&&t.isStale()!==n)return!1;if(i&&i!==t.state.fetchStatus)return!1;if(c&&!c(t))return!1;return!0}function B(r,t){let{exact:a,status:o,predicate:i,mutationKey:c}=r;if(c){if(!t.options.mutationKey)return!1;if(a){if(He(t.options.mutationKey)!==He(c))return!1}else if(!E(t.options.mutationKey,c))return!1}if(o&&t.state.status!==o)return!1;if(i&&!i(t))return!1;return!0}function R(r,t){return(t?.queryKeyHashFn||He)(r)}function He(r){return JSON.stringify(r,(t,a)=>dr(a)?Object.keys(a).sort().reduce((o,i)=>(o[i]=a[i],o),{}):a)}function E(r,t){if(r===t)return!0;if(typeof r!==typeof t)return!1;if(r&&t&&typeof r==="object"&&typeof t==="object"){if(Array.isArray(r)&&Array.isArray(t)){for(let o=0;o<t.length;o++)if(!E(r[o],t[o]))return!1;return!0}let a=Object.keys(t);for(let o of a)if(!E(r[o],t[o]))return!1;return!0}return!1}var Dt=Object.prototype.hasOwnProperty;function Ue(r,t,a=0){if(r===t)return r;if(a>500)return t;let o=qr(r)&&qr(t);if(!o&&!(dr(r)&&dr(t)))return t;let i=(o?r:Object.keys(r)).length,c=o?t:Object.keys(t),d=c.length,n=o?Array(d):{},s=0;for(let p=0;p<d;p++){let g=o?p:c[p],h=r[g],u=t[g];if(h===u){if(n[g]=h,o?p<i:Dt.call(r,g))s++;continue}if(h===null||u===null||typeof h!=="object"||typeof u!=="object"){n[g]=u;continue}let y=Ue(h,u,a+1);if(n[g]=y,y===h)s++}return i===d&&s===i?r:n}function It(r,t){if(!t||Object.keys(r).length!==Object.keys(t).length)return!1;for(let a in r)if(r[a]!==t[a])return!1;return!0}function qr(r){return Array.isArray(r)&&r.length===Object.keys(r).length}function dr(r){if(!Dr(r))return!1;let t=r.constructor;if(t===void 0)return!0;let a=t.prototype;if(!Dr(a))return!1;if(!a.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf(r)!==Object.prototype)return!1;return!0}function Dr(r){return Object.prototype.toString.call(r)==="[object Object]"}function Rr(r){return new Promise((t)=>{ze.setTimeout(t,r)})}function Sr(r,t,a){if(typeof a.structuralSharing==="function")return a.structuralSharing(r,t);else if(a.structuralSharing!==!1)return Ue(r,t);return t}function Tr(r,t,a=0){let o=[...r,t];return a&&o.length>a?o.slice(1):o}function Fr(r,t,a=0){let o=[t,...r];return a&&o.length>a?o.slice(0,-1):o}var O=Symbol();function K(r,t){if(!r.queryFn&&t?.initialPromise)return()=>t.initialPromise;if(!r.queryFn||r.queryFn===O)return()=>Promise.reject(Error(`Missing queryFn: '${r.queryHash}'`));return r.queryFn}function tr(r,t){if(typeof r==="function")return r(...t);return!!r}function Lr(r,t,a){let o=!1,i;return Object.defineProperty(r,"signal",{enumerable:!0,get:()=>{if(i??=t(),o)return i;if(o=!0,i.aborted)a();else i.addEventListener("abort",a,{once:!0});return i}}),r}var Ut=()=>pr,rr=()=>Ut();var ye=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(r){return this.listeners.add(r),this.onSubscribe(),()=>{this.listeners.delete(r),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Rt=class extends ye{#r;#t;#a;constructor(){super();this.#a=(r)=>{if(typeof window<"u"&&window.addEventListener){let t=()=>r();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){if(!this.#t)this.setEventListener(this.#a)}onUnsubscribe(){if(!this.hasListeners())this.#t?.(),this.#t=void 0}setEventListener(r){this.#a=r,this.#t?.(),this.#t=r((t)=>{if(typeof t==="boolean")this.setFocused(t);else this.onFocus()})}setFocused(r){if(this.#r!==r)this.#r=r,this.onFocus()}onFocus(){let r=this.isFocused();this.listeners.forEach((t)=>{t(r)})}isFocused(){if(typeof this.#r==="boolean")return this.#r;return globalThis.document?.visibilityState!=="hidden"}},or=new Rt;var Nr=Or;function Tt(){let r=[],t=0,a=(n)=>{n()},o=(n)=>{n()},i=Nr,c=(n)=>{if(t)r.push(n);else i(()=>{a(n)})},d=()=>{let n=r;if(r=[],n.length)i(()=>{o(()=>{n.forEach((s)=>{a(s)})})})};return{batch:(n)=>{let s;t++;try{s=n()}finally{if(t--,!t)d()}return s},batchCalls:(n)=>(...s)=>{c(()=>{n(...s)})},schedule:c,setNotifyFunction:(n)=>{a=n},setBatchNotifyFunction:(n)=>{o=n},setScheduler:(n)=>{i=n}}}var M=Tt();var Ft=class extends ye{#r=!0;#t;#a;constructor(){super();this.#a=(r)=>{if(typeof window<"u"&&window.addEventListener){let t=()=>r(!0),a=()=>r(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",a)}}}}onSubscribe(){if(!this.#t)this.setEventListener(this.#a)}onUnsubscribe(){if(!this.hasListeners())this.#t?.(),this.#t=void 0}setEventListener(r){this.#a=r,this.#t?.(),this.#t=r(this.setOnline.bind(this))}setOnline(r){if(this.#r!==r)this.#r=r,this.listeners.forEach((t)=>{t(r)})}isOnline(){return this.#r}},I=new Ft;function Qt(r){return Math.min(1000*2**r,30000)}function hr(r){return(r??"online")==="online"?I.isOnline():!0}var V=class extends Error{constructor(r){super("CancelledError");this.revert=r?.revert,this.silent=r?.silent}};function Y(r){let t=!1,a=0,o,i="pending",c,d,n=new Promise((v,f)=>{c=v,d=f});n.catch(H);let s=()=>i!=="pending",p=(v)=>{if(!s()){let f=new V(v);m(f),r.onCancel?.(f)}},g=()=>{t=!0},h=()=>{t=!1},u=()=>or.isFocused()&&(r.networkMode==="always"||I.isOnline())&&r.canRun(),y=()=>hr(r.networkMode)&&r.canRun(),w=(v)=>{if(!s())o?.(),i="resolved",c(v)},m=(v)=>{if(!s())o?.(),i="rejected",d(v)},k=()=>new Promise((v)=>{o=(f)=>{if(s()||u())v(f)},r.onPause?.()}).then(()=>{if(o=void 0,!s())r.onContinue?.()}),T=()=>{if(s())return;let v,f=a===0?r.initialPromise:void 0;try{v=f??r.fn()}catch(b){v=Promise.reject(b)}Promise.resolve(v).then(w).catch((b)=>{if(s())return;let z=r.retry??(rr()?0:3),A=r.retryDelay??Qt,dt=typeof A==="function"?A(a,b):A,pt=z===!0||typeof z==="number"&&a<z||typeof z==="function"&&z(a,b);if(t||!pt){m(b);return}a++,r.onFail?.(a,b),Rr(dt).then(()=>u()?void 0:k()).then(()=>{if(t)m(b);else T()})})};return{promise:n,status:()=>i,cancel:p,continue:()=>(o?.(),n),cancelRetry:g,continueRetry:h,canStart:y,start:()=>{if(y())T();else k().then(T);return n}}}var X=class{#r;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),to(this.gcTime))this.#r=ze.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime(r){this.gcTime=Math.max(this.gcTime||0,r??(rr()?1/0:300000))}clearGcTimeout(){if(this.#r!==void 0)ze.clearTimeout(this.#r),this.#r=void 0}};function Br(r){return{onFetch:(t,a)=>{let o=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,c=t.state.data?.pages||[],d=t.state.data?.pageParams||[],n={pages:[],pageParams:[]},s=0,p=async()=>{let g=!1,h=(w)=>{Lr(w,()=>t.signal,()=>g=!0)},u=K(t.options,t.fetchOptions),y=async(w,m,k)=>{if(g)return Promise.reject(t.signal.reason);if(m==null&&w.pages.length)return Promise.resolve(w);let v=(()=>{let A={client:t.client,queryKey:t.queryKey,pageParam:m,direction:k?"backward":"forward",meta:t.options.meta};return h(A),A})(),f=await u(v),{maxPages:b}=t.options,z=k?Fr:Tr;return{pages:z(w.pages,f,b),pageParams:z(w.pageParams,m,b)}};if(i&&c.length){let w=i==="backward",m=w?Lt:Wr,k={pages:c,pageParams:d};n=await y(k,m(o,k),w)}else{let w=r??c.length;do{let m=s===0?d[0]??o.initialPageParam:Wr(o,n);if(s>0&&m==null)break;n=await y(n,m),s++}while(s<w)}return n};if(t.options.persister)t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},a);else t.fetchFn=p}}}function Wr(r,{pages:t,pageParams:a}){let o=t.length-1;return t.length>0?r.getNextPageParam(t[o],t,a[o],a):void 0}function Lt(r,{pages:t,pageParams:a}){return t.length>0?r.getPreviousPageParam?.(t[0],t,a[0],a):void 0}var Vr=class extends X{#r;#t;#a;#o;#i;#e;#c;#n;constructor(r){super();this.#n=!1,this.#c=r.defaultOptions,this.setOptions(r.options),this.observers=[],this.#i=r.client,this.#o=this.#i.getQueryCache(),this.queryKey=r.queryKey,this.queryHash=r.queryHash,this.#t=Kr(this.options),this.state=r.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#r}get promise(){return this.#e?.promise}setOptions(r){if(this.options={...this.#c,...r},r?._type)this.#r=r._type;if(this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let t=Kr(this.options);if(t.data!==void 0)this.setState(Hr(t.data,t.dataUpdatedAt)),this.#t=t}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#o.remove(this)}setData(r,t){let a=Sr(this.state.data,r,this.options);return this.#s({data:a,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),a}setState(r){this.#s({type:"setState",state:r})}cancel(r){let t=this.#e?.promise;return this.#e?.cancel(r),t?t.then(H).catch(H):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some((r)=>U(r.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){if(this.getObserversCount()>0)return this.observers.some((r)=>U(r.options.staleTime,this)==="static");return!1}isStale(){if(this.getObserversCount()>0)return this.observers.some((r)=>r.getCurrentResult().isStale);return this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){if(this.state.data===void 0)return!0;if(r==="static")return!1;if(this.state.isInvalidated)return!0;return!ro(this.state.dataUpdatedAt,r)}onFocus(){this.observers.find((r)=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#e?.continue()}onOnline(){this.observers.find((r)=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#e?.continue()}addObserver(r){if(!this.observers.includes(r))this.observers.push(r),this.clearGcTimeout(),this.#o.notify({type:"observerAdded",query:this,observer:r})}removeObserver(r){let t=this.observers.indexOf(r);if(t!==-1){if(this.observers.splice(t,1),!this.observers.length){if(this.#e)if(this.#n||this.state.fetchStatus==="paused"&&this.state.status==="pending")this.#e.cancel({revert:!0});else this.#e.cancelRetry();this.scheduleGc()}this.#o.notify({type:"observerRemoved",query:this,observer:r})}}getObserversCount(){return this.observers.length}invalidate(){if(!this.state.isInvalidated)this.#s({type:"invalidate"})}async fetch(r,t){if(this.state.fetchStatus!=="idle"&&this.#e?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#e)return this.#e.continueRetry(),this.#e.promise}if(r)this.setOptions(r);if(!this.options.queryFn){let s=this.observers.find((p)=>p.options.queryFn);if(s)this.setOptions(s.options)}let a=new AbortController,o=(s)=>{Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(this.#n=!0,a.signal)})},i=()=>{let s=K(this.options,t),g=(()=>{let h={client:this.#i,queryKey:this.queryKey,meta:this.meta};return o(h),h})();if(this.#n=!1,this.options.persister)return this.options.persister(s,g,this);return s(g)},d=(()=>{let s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return o(s),s})();if((this.#r==="infinite"?Br(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#a=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)this.#s({type:"fetch",meta:d.fetchOptions?.meta});let n=this.#e=Y({initialPromise:t?.initialPromise,fn:d.fetchFn,onCancel:(s)=>{if(s instanceof V&&s.revert)this.setState({...this.#a,fetchStatus:"idle"});a.abort()},onFail:(s,p)=>{this.#s({type:"failed",failureCount:s,error:p})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0});try{let s=await n.start();if(s===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(s),this.#o.config.onSuccess?.(s,this),this.#o.config.onSettled?.(s,this.state.error,this),s}catch(s){if(s instanceof V){if(s.silent)return this.#e.promise;else if(s.revert){if(this.state.data===void 0)throw s;return this.state.data}}throw this.#s({type:"error",error:s}),this.#o.config.onError?.(s,this),this.#o.config.onSettled?.(this.state.data,s,this),s}finally{if(this.#e===n)this.#e=void 0;this.scheduleGc()}}#s(r){let t=(a)=>{switch(r.type){case"failed":return{...a,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,..._o(a.data,this.options),fetchMeta:r.meta??null};case"success":let o={...a,...Hr(r.data,r.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#a=r.manual?o:void 0,o;case"error":let i=r.error;return{...a,error:i,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...r.state}}};this.state=t(this.state),M.batch(()=>{this.observers.slice().forEach((a)=>{a.onQueryUpdate()}),this.#o.notify({query:this,type:"updated",action:r})})}};function _o(r,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hr(t.networkMode)?"fetching":"paused",...r===void 0&&{error:null,status:"pending"}}}function Hr(r,t){return{data:r,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Kr(r){let t=typeof r.initialData==="function"?r.initialData():r.initialData,a=t!==void 0,o=a?typeof r.initialDataUpdatedAt==="function"?r.initialDataUpdatedAt():r.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:a?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var $r=class extends X{#r;#t;#a;#o;constructor(r){super();this.#r=r.client,this.mutationId=r.mutationId,this.#a=r.mutationCache,this.#t=[],this.state=r.state||Mo(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){if(!this.#t.includes(r))this.#t.push(r),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",mutation:this,observer:r})}removeObserver(r){this.#t=this.#t.filter((t)=>t!==r),this.scheduleGc(),this.#a.notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){if(!this.#t.length)if(this.state.status==="pending")this.scheduleGc();else this.#a.remove(this)}continue(){return this.#o?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(r){let t=()=>{this.#i({type:"continue"})},a={client:this.#r,meta:this.options.meta,mutationKey:this.options.mutationKey},o=this.#o=Y({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn(r,a)},onFail:(d,n)=>{this.#i({type:"failed",failureCount:d,error:n})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#a.canRun(this)}),i=this.state.status==="pending",c=!o.canStart();try{if(i)t();else{if(this.#i({type:"pending",variables:r,isPaused:c}),this.#a.config.onMutate)await this.#a.config.onMutate(r,this,a);let n=await this.options.onMutate?.(r,a);if(n!==this.state.context)this.#i({type:"pending",context:n,variables:r,isPaused:c})}let d=await o.start();return await this.#a.config.onSuccess?.(d,r,this.state.context,this,a),await this.options.onSuccess?.(d,r,this.state.context,a),await this.#a.config.onSettled?.(d,null,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(d,null,r,this.state.context,a),this.#i({type:"success",data:d}),d}catch(d){try{await this.#a.config.onError?.(d,r,this.state.context,this,a)}catch(n){Promise.reject(n)}try{await this.options.onError?.(d,r,this.state.context,a)}catch(n){Promise.reject(n)}try{await this.#a.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,a)}catch(n){Promise.reject(n)}try{await this.options.onSettled?.(void 0,d,r,this.state.context,a)}catch(n){Promise.reject(n)}throw this.#i({type:"error",error:d}),d}finally{if(this.#o===o)this.#o=void 0;this.#a.runNext(this)}}#i(r){let t=(a)=>{switch(r.type){case"failed":return{...a,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...a,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:r.error,failureCount:a.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=t(this.state),M.batch(()=>{this.#t.forEach((a)=>{a.onMutationUpdate(r)}),this.#a.notify({mutation:this,type:"updated",action:r})})}};function Mo(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yr=class extends ye{#r;#t;#a;constructor(r={}){super();this.config=r,this.#r=new Set,this.#t=new Map,this.#a=0}build(r,t,a){let o=new $r({client:r,mutationCache:this,mutationId:++this.#a,options:r.defaultMutationOptions(t),state:a});return this.add(o),o}add(r){this.#r.add(r);let t=J(r);if(typeof t==="string"){let a=this.#t.get(t);if(a)a.push(r);else this.#t.set(t,[r])}this.notify({type:"added",mutation:r})}remove(r){if(this.#r.delete(r)){let t=J(r);if(typeof t==="string"){let a=this.#t.get(t);if(a){if(a.length>1){let o=a.indexOf(r);if(o!==-1)a.splice(o,1)}else if(a[0]===r)this.#t.delete(t)}}}this.notify({type:"removed",mutation:r})}canRun(r){let t=J(r);if(typeof t==="string"){let a=this.#t.get(t)?.find((o)=>o.state.status==="pending");return!a||a===r}else return!0}runNext(r){let t=J(r);if(typeof t==="string")return this.#t.get(t)?.find((a)=>a!==r&&a.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){M.batch(()=>{this.#r.forEach((r)=>{this.notify({type:"removed",mutation:r})}),this.#r.clear(),this.#t.clear()})}getAll(){return Array.from(this.#r)}find(r){let t={exact:!0,...r};return this.getAll().find((a)=>B(t,a))}findAll(r={}){return this.getAll().filter((t)=>B(r,t))}notify(r){M.batch(()=>{this.listeners.forEach((t)=>{t(r)})})}resumePausedMutations(){let r=this.getAll().filter((t)=>t.state.isPaused);return M.batch(()=>Promise.all(r.map((t)=>t.continue().catch(H))))}};function J(r){return r.options.scope?.id}var Xr=class extends ye{#r;constructor(r={}){super();this.config=r,this.#r=new Map}build(r,t,a){let o=t.queryKey,i=t.queryHash??R(o,t),c=this.get(i);if(!c)c=new Vr({client:r,queryKey:o,queryHash:i,options:r.defaultQueryOptions(t),state:a,defaultOptions:r.getQueryDefaults(o)}),this.add(c);return c}add(r){if(!this.#r.has(r.queryHash))this.#r.set(r.queryHash,r),this.notify({type:"added",query:r})}remove(r){let t=this.#r.get(r.queryHash);if(t){if(r.destroy(),t===r)this.#r.delete(r.queryHash);this.notify({type:"removed",query:r})}}clear(){M.batch(()=>{this.getAll().forEach((r)=>{this.remove(r)})})}get(r){return this.#r.get(r)}getAll(){return[...this.#r.values()]}find(r){let t={exact:!0,...r};return this.getAll().find((a)=>er(t,a))}findAll(r={}){let t=this.getAll();return Object.keys(r).length>0?t.filter((a)=>er(r,a)):t}notify(r){M.batch(()=>{this.listeners.forEach((t)=>{t(r)})})}onFocus(){M.batch(()=>{this.getAll().forEach((r)=>{r.onFocus()})})}onOnline(){M.batch(()=>{this.getAll().forEach((r)=>{r.onOnline()})})}};var gr=class{#r;#t;#a;#o;#i;#e;#c;#n;constructor(r={}){this.#r=r.queryCache||new Xr,this.#t=r.mutationCache||new Yr,this.#a=r.defaultOptions||{},this.#o=new Map,this.#i=new Map,this.#e=0}mount(){if(this.#e++,this.#e!==1)return;this.#c=or.subscribe(async(r)=>{if(r)await this.resumePausedMutations(),this.#r.onFocus()}),this.#n=I.subscribe(async(r)=>{if(r)await this.resumePausedMutations(),this.#r.onOnline()})}unmount(){if(this.#e--,this.#e!==0)return;this.#c?.(),this.#c=void 0,this.#n?.(),this.#n=void 0}isFetching(r){return this.#r.findAll({...r,fetchStatus:"fetching"}).length}isMutating(r){return this.#t.findAll({...r,status:"pending"}).length}getQueryData(r){let t=this.defaultQueryOptions({queryKey:r});return this.#r.get(t.queryHash)?.state.data}ensureQueryData(r){let t=this.defaultQueryOptions(r),a=this.#r.build(this,t),o=a.state.data;if(o===void 0)return this.fetchQuery(r);if(r.revalidateIfStale&&a.isStaleByTime(U(t.staleTime,a)))this.prefetchQuery(t);return Promise.resolve(o)}getQueriesData(r){return this.#r.findAll(r).map(({queryKey:t,state:a})=>[t,a.data])}setQueryData(r,t,a){let o=this.defaultQueryOptions({queryKey:r}),i=this.#r.get(o.queryHash)?.state.data,c=Ur(t,i);if(c===void 0)return;return this.#r.build(this,o).setData(c,{...a,manual:!0})}setQueriesData(r,t,a){return M.batch(()=>this.#r.findAll(r).map(({queryKey:o})=>[o,this.setQueryData(o,t,a)]))}getQueryState(r){let t=this.defaultQueryOptions({queryKey:r});return this.#r.get(t.queryHash)?.state}removeQueries(r){let t=this.#r;M.batch(()=>{t.findAll(r).forEach((a)=>{t.remove(a)})})}resetQueries(r,t){let a=this.#r;return M.batch(()=>{let o=a.findAll(r),i=new Set(o);return o.forEach((c)=>{c.reset()}),this.refetchQueries({type:"active",predicate:(c)=>i.has(c)},t)})}cancelQueries(r,t={}){let a={revert:!0,...t},o=M.batch(()=>this.#r.findAll(r).map((i)=>i.cancel(a)));return Promise.all(o).then(H).catch(H)}invalidateQueries(r,t={}){return M.batch(()=>{if(this.#r.findAll(r).forEach((a)=>{a.invalidate()}),r?.refetchType==="none")return Promise.resolve();return this.refetchQueries({...r,type:r?.refetchType??r?.type??"active"},t)})}refetchQueries(r,t={}){let a={...t,cancelRefetch:t.cancelRefetch??!0},o=M.batch(()=>this.#r.findAll(r).filter((i)=>!i.isDisabled()&&!i.isStatic()).map((i)=>{let c=i.fetch(void 0,a);if(!a.throwOnError)c=c.catch(H);return i.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(o).then(H)}async query(r){let t=this.defaultQueryOptions(r);if(t.retry===void 0)t.retry=!1;let a=this.#r.build(this,t),o=a.isStaleByTime(U(t.staleTime,a))?await a.fetch(t):a.state.data,i=t.select;if(i)return i(o);return o}fetchQuery(r){let t=this.defaultQueryOptions(r);if(t.retry===void 0)t.retry=!1;let a=this.#r.build(this,t);return a.isStaleByTime(U(t.staleTime,a))?a.fetch(t):Promise.resolve(a.state.data)}prefetchQuery(r){return this.fetchQuery(r).then(H).catch(H)}infiniteQuery(r){return r._type="infinite",this.query(r)}fetchInfiniteQuery(r){return r._type="infinite",this.fetchQuery(r)}prefetchInfiniteQuery(r){return this.fetchInfiniteQuery(r).then(H).catch(H)}ensureInfiniteQueryData(r){return r._type="infinite",this.ensureQueryData(r)}resumePausedMutations(){if(I.isOnline())return this.#t.resumePausedMutations();return Promise.resolve()}getQueryCache(){return this.#r}getMutationCache(){return this.#t}getDefaultOptions(){return this.#a}setDefaultOptions(r){this.#a=r}setQueryDefaults(r,t){this.#o.set(He(r),{queryKey:r,defaultOptions:t})}getQueryDefaults(r){let t=[...this.#o.values()],a={};return t.forEach((o)=>{if(E(r,o.queryKey))Object.assign(a,o.defaultOptions)}),a}setMutationDefaults(r,t){this.#i.set(He(r),{mutationKey:r,defaultOptions:t})}getMutationDefaults(r){let t=[...this.#i.values()],a={};return t.forEach((o)=>{if(E(r,o.mutationKey))Object.assign(a,o.defaultOptions)}),a}defaultQueryOptions(r){if(r._defaulted)return r;let t={...this.#a.queries,...this.getQueryDefaults(r.queryKey),...r,_defaulted:!0};if(!t.queryHash)t.queryHash=R(t.queryKey,t);if(t.refetchOnReconnect===void 0)t.refetchOnReconnect=t.networkMode!=="always";if(t.throwOnError===void 0)t.throwOnError=!!t.suspense;if(!t.networkMode&&t.persister)t.networkMode="offlineFirst";if(t.queryFn===O)t.enabled=!1;return t}defaultMutationOptions(r){if(r?._defaulted)return r;return{...this.#a.mutations,...r?.mutationKey&&this.getMutationDefaults(r.mutationKey),...r,_defaulted:!0}}clear(){this.#r.clear(),this.#t.clear()}};var nt=new gr;var l={all:["workspaces"],discover:["workspaces","discover"],previews:["workspaces","previews"],layout:(r)=>["workspaces","layout",r],widgets:(r)=>["workspaces","widgets",r],appletThumbnails:(r)=>["workspaces","applet-thumbnails",r],views:(r)=>["workspaces","views",r],sessions:(r)=>["workspaces","sessions",r],events:(r,t)=>["workspaces","events",r,t],state:(r)=>["workspaces","state",r],mcp:(r)=>["workspaces","mcp",r],harness:(r)=>["workspaces","harness",r],skills:(r)=>["workspaces","skills",r],env:(r)=>["workspaces","env",r]};var ur=(r,t)=>t.getQueryData(l.layout(r));function zt(r,t=nt){return ur(r,t)?.isRemote??!1}function ie(r,t=nt){let a=ur(r,t)?.apiBase;if(!a)throw Error("Workspace identity is not loaded");return a}function vr(r,t=nt){let a=ur(r,t)?.apiBase;return a?decodeURIComponent(a.slice(16)):r}function mr(r){if(!Fe(r)||!Array.isArray(r.members)||!Array.isArray(r.invitations))throw Error("Invalid workspace members");let t=r.members.map((o)=>{let i=ot(o);if(Fe(o)&&o.membershipId!==void 0){if(typeof o.membershipId!=="string"||!o.membershipId||o.membershipId.length>240)throw Error("Invalid membership id");return{...i,membershipId:o.membershipId}}return i}),a=r.invitations.map((o)=>{if(!Fe(o)||typeof o.id!=="string"||!o.id||typeof o.email!=="string"||!o.email||typeof o.expiresAt!=="string"||!Number.isFinite(Date.parse(o.expiresAt)))throw Error("Invalid invitation");return{id:o.id,email:o.email,expiresAt:o.expiresAt}});if(new Set(t.map(Be)).size!==t.length||new Set(a.map((o)=>o.id)).size!==a.length)throw Error("Duplicate workspace member or invitation");return{members:t,invitations:a}}function G(r){if(!/^(?:[A-Za-z0-9_-]{1,64}:)?[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(r))throw Error("Invalid workspace id");return r}var fr;function x(){let r=ce();if(fr?.accountGeneration!==r)fr={accountGeneration:r,lists:new Map,complete:!1};return fr}var rt=0,br=new Set;function q(){rt++,br.forEach((r)=>r())}var tt=()=>rt,Gr=new WeakMap,Nt={members:[],invitations:[]},Zr=new WeakMap;function at(r){if(!x().complete)return;if(r.includes(":"))return Nt;let t=Te();if(t?.type!=="user"||t.isAnonymous)return;let a=Gr.get(t);if(!a)a={members:[t],invitations:[]},Gr.set(t,a);return a}function Z(r,t){let{lists:a}=x();a.set(r,Ue(a.get(r),t))}function et(r,t){Z(G(r),mr(t)),q()}function it(r){if(!Array.isArray(r))throw Error("Invalid workspace members");let t=r.map((i)=>[G(i.id),mr(i)]),a=new Set(t.map(([i])=>i));if(a.size!==t.length)throw Error("Duplicate workspace id");let{lists:o}=x();for(let i of o.keys())if(!a.has(i))o.delete(i);for(let[i,c]of t)Z(i,c);x().complete=!0,q()}function st(r){x().lists.delete(G(r)),q()}function ct(){x().lists.clear(),q()}function nn(r,t){let a=vr(r),o=x().lists.get(a)??at(a),i=o&&t(o);if(!i)return;Z(a,i),q()}function sn(r){let t=Be(r);for(let[a,o]of x().lists)Z(a,{...o,members:o.members.map((i)=>Be(i)===t?{...r,...i.membershipId&&{membershipId:i.membershipId}}:i)});q()}function Do(r){let t=vr(r);return x().lists.get(t)??at(t)}function an(r){let t=Do(r);if(!t)return;let a=Zr.get(t);if(!a)a=t.members.map((o)=>j({id:vt(o),name:o.name||void 0,avatar:o.avatar,email:o.type==="user"?o.email||void 0:void 0})),Zr.set(t,a);return a}function Ir(r){br.add(r);let t=nt.getQueryCache().subscribe((a)=>{let[o,i]=a.query.queryKey;if(o===l.all[0]&&i==="layout")r()});return()=>{br.delete(r),t()}}function lt(){if(typeof window>"u")return;let r=window;r.moi??={},r.moi.identity={set:wt,getRevision:wr},r.moi.workspaceMembers={set:et,setAll:it,remove:st,clear:ct,getRevision:tt}}lt();Mr();async function Wt(r){let[{mount:t},a,o]=await Promise.all([(Le("1tksq43z"),import("/chunk-1tksq43z.js")),(Le("w5h9grdr"),import("/chunk-w5h9grdr.js")).then((i)=>i.loadAppConfig()),(Le("a865c7x4"),import("/chunk-a865c7x4.js")).then((i)=>i.loadProxyUser())]);jr(a?.environment==="local"&&!a.demo,o),t(r)}globalThis.__init=Wt;export{e,C,Bt,tn,Le,Jr,rn,Fe,ot,Be,vt,Te,wr,ce,Qr,wt,pe,St,we,on,eo,ze,H,to,ro,U,er,He,Ue,It,Sr,tr,rr,ye,or,M,_o,Mo,nt,l,zt,ie,nn,sn,Do,an,Ir};
@@ -1,2 +0,0 @@
1
- import{e,C}from"/chunk-h3qag4a6.js";import{h}from"/chunk-f44cs6mw.js";var r=C(function(l,i){i.exports=globalThis.__esm.react});var p=e(r(),1);var f={environment:"local",demo:!1,demoInstallUrl:"https://moi.computer"},t=f,o=new Set;function s(n){return o.add(n),()=>{o.delete(n)}}async function c(){try{t=await h("/api/config");for(let n of o)n();return t}catch{}}async function ei(){return c()}function ne(){return t.demo?"/demo":"/"}function B(){return p.useSyncExternalStore(s,()=>t,()=>t)}
2
- export{r,ei,ne,B};
@@ -1 +0,0 @@
1
- import{ei,ne,B}from"/chunk-q2tpy0h7.js";export{ne as homePath,ei as loadAppConfig,B as useAppConfig};