crewly 1.4.76 → 1.4.78

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 (41) hide show
  1. package/dist/backend/backend/src/constants.d.ts +8 -8
  2. package/dist/backend/backend/src/constants.d.ts.map +1 -1
  3. package/dist/backend/backend/src/constants.js +8 -8
  4. package/dist/backend/backend/src/constants.js.map +1 -1
  5. package/dist/backend/backend/src/controllers/cloud/cloud.controller.d.ts.map +1 -1
  6. package/dist/backend/backend/src/controllers/cloud/cloud.controller.js +3 -2
  7. package/dist/backend/backend/src/controllers/cloud/cloud.controller.js.map +1 -1
  8. package/dist/backend/backend/src/controllers/cloud/relay.controller.d.ts +1 -1
  9. package/dist/backend/backend/src/controllers/cloud/relay.controller.d.ts.map +1 -1
  10. package/dist/backend/backend/src/controllers/cloud/relay.controller.js +13 -2
  11. package/dist/backend/backend/src/controllers/cloud/relay.controller.js.map +1 -1
  12. package/dist/backend/backend/src/controllers/team/team.controller.d.ts.map +1 -1
  13. package/dist/backend/backend/src/controllers/team/team.controller.js +34 -23
  14. package/dist/backend/backend/src/controllers/team/team.controller.js.map +1 -1
  15. package/dist/backend/backend/src/index.d.ts.map +1 -1
  16. package/dist/backend/backend/src/index.js +68 -4
  17. package/dist/backend/backend/src/index.js.map +1 -1
  18. package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.d.ts +18 -0
  19. package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.d.ts.map +1 -1
  20. package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.js +79 -5
  21. package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.js.map +1 -1
  22. package/dist/backend/backend/src/services/cloud/cloud-client.service.d.ts +1 -1
  23. package/dist/backend/backend/src/services/cloud/cloud-client.service.js +1 -1
  24. package/dist/backend/backend/src/services/cloud/cloud-sync.service.d.ts +1 -1
  25. package/dist/backend/backend/src/services/cloud/cloud-sync.service.js +2 -2
  26. package/dist/backend/backend/src/services/cloud/cloud-sync.service.js.map +1 -1
  27. package/dist/backend/backend/src/services/cloud/cloud-sync.types.d.ts +1 -1
  28. package/dist/backend/backend/src/services/slack/slack-orchestrator-bridge.d.ts.map +1 -1
  29. package/dist/backend/backend/src/services/slack/slack-orchestrator-bridge.js +35 -0
  30. package/dist/backend/backend/src/services/slack/slack-orchestrator-bridge.js.map +1 -1
  31. package/dist/backend/backend/src/services/workflow/cron-task.service.d.ts +30 -1
  32. package/dist/backend/backend/src/services/workflow/cron-task.service.d.ts.map +1 -1
  33. package/dist/backend/backend/src/services/workflow/cron-task.service.js +106 -5
  34. package/dist/backend/backend/src/services/workflow/cron-task.service.js.map +1 -1
  35. package/dist/cli/backend/src/constants.d.ts +8 -8
  36. package/dist/cli/backend/src/constants.d.ts.map +1 -1
  37. package/dist/cli/backend/src/constants.js +8 -8
  38. package/dist/cli/backend/src/constants.js.map +1 -1
  39. package/frontend/dist/assets/{index-3b33c6e8.js → index-0837baf4.js} +2 -2
  40. package/frontend/dist/index.html +1 -1
  41. package/package.json +1 -1
@@ -243,7 +243,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
243
243
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(n=>r.set(n)),r}static accessor(e){const r=(this[WL]=this[WL]={accessors:{}}).accessors,n=this.prototype;function o(a){const c=X1(a);r[c]||(vY(n,a),r[c]=!0)}return St.isArray(e)?e.forEach(o):o(e),this}}lA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);St.reduceDescriptors(lA.prototype,({value:s},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>s,set(r){this[t]=r}}});St.freezeMethods(lA);const ed=lA;function $3(s,e){const t=this||n5,r=e||t,n=ed.from(r.headers);let o=r.data;return St.forEach(s,function(c){o=c.call(t,o,n.normalize(),e?e.status:void 0)}),n.normalize(),o}function O9(s){return!!(s&&s.__CANCEL__)}function Tx(s,e,t){Ss.call(this,s??"canceled",Ss.ERR_CANCELED,e,t),this.name="CanceledError"}St.inherits(Tx,Ss,{__CANCEL__:!0});function B9(s,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?s(t):e(new Ss("Request failed with status code "+t.status,[Ss.ERR_BAD_REQUEST,Ss.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function wY(s){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(s);return e&&e[1]||""}function xY(s,e){s=s||10;const t=new Array(s),r=new Array(s);let n=0,o=0,a;return e=e!==void 0?e:1e3,function(u){const d=Date.now(),h=r[o];a||(a=d),t[n]=u,r[n]=d;let f=o,y=0;for(;f!==n;)y+=t[f++],f=f%s;if(n=(n+1)%s,n===o&&(o=(o+1)%s),d-a<e)return;const v=h&&d-h;return v?Math.round(y*1e3/v):void 0}}function NY(s,e){let t=0,r=1e3/e,n,o;const a=(d,h=Date.now())=>{t=h,n=null,o&&(clearTimeout(o),o=null),s(...d)};return[(...d)=>{const h=Date.now(),f=h-t;f>=r?a(d,h):(n=d,o||(o=setTimeout(()=>{o=null,a(n)},r-f)))},()=>n&&a(n)]}const Qk=(s,e,t=3)=>{let r=0;const n=xY(50,250);return NY(o=>{const a=o.loaded,c=o.lengthComputable?o.total:void 0,u=a-r,d=n(u),h=a<=c;r=a;const f={loaded:a,total:c,progress:c?a/c:void 0,bytes:u,rate:d||void 0,estimated:d&&c&&h?(c-a)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};s(f)},t)},KL=(s,e)=>{const t=s!=null;return[r=>e[0]({lengthComputable:t,total:s,loaded:r}),e[1]]},XL=s=>(...e)=>St.asap(()=>s(...e)),DY=Sa.hasStandardBrowserEnv?((s,e)=>t=>(t=new URL(t,Sa.origin),s.protocol===t.protocol&&s.host===t.host&&(e||s.port===t.port)))(new URL(Sa.origin),Sa.navigator&&/(msie|trident)/i.test(Sa.navigator.userAgent)):()=>!0,jY=Sa.hasStandardBrowserEnv?{write(s,e,t,r,n,o){const a=[s+"="+encodeURIComponent(e)];St.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),St.isString(r)&&a.push("path="+r),St.isString(n)&&a.push("domain="+n),o===!0&&a.push("secure"),document.cookie=a.join("; ")},read(s){const e=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(s){this.write(s,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function TY(s){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function SY(s,e){return e?s.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):s}function H9(s,e,t){let r=!TY(e);return s&&(r||t==!1)?SY(s,e):e}const qL=s=>s instanceof ed?{...s}:s;function Hb(s,e){e=e||{};const t={};function r(d,h,f,y){return St.isPlainObject(d)&&St.isPlainObject(h)?St.merge.call({caseless:y},d,h):St.isPlainObject(h)?St.merge({},h):St.isArray(h)?h.slice():h}function n(d,h,f,y){if(St.isUndefined(h)){if(!St.isUndefined(d))return r(void 0,d,f,y)}else return r(d,h,f,y)}function o(d,h){if(!St.isUndefined(h))return r(void 0,h)}function a(d,h){if(St.isUndefined(h)){if(!St.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function c(d,h,f){if(f in e)return r(d,h);if(f in s)return r(void 0,d)}const u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(d,h,f)=>n(qL(d),qL(h),f,!0)};return St.forEach(Object.keys({...s,...e}),function(h){const f=u[h]||n,y=f(s[h],e[h],h);St.isUndefined(y)&&f!==c||(t[h]=y)}),t}const z9=s=>{const e=Hb({},s);let{data:t,withXSRFToken:r,xsrfHeaderName:n,xsrfCookieName:o,headers:a,auth:c}=e;e.headers=a=ed.from(a),e.url=I9(H9(e.baseURL,e.url,e.allowAbsoluteUrls),s.params,s.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let u;if(St.isFormData(t)){if(Sa.hasStandardBrowserEnv||Sa.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[d,...h]=u?u.split(";").map(f=>f.trim()).filter(Boolean):[];a.setContentType([d||"multipart/form-data",...h].join("; "))}}if(Sa.hasStandardBrowserEnv&&(r&&St.isFunction(r)&&(r=r(e)),r||r!==!1&&DY(e.url))){const d=n&&o&&jY.read(o);d&&a.set(n,d)}return e},EY=typeof XMLHttpRequest<"u",_Y=EY&&function(s){return new Promise(function(t,r){const n=z9(s);let o=n.data;const a=ed.from(n.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:d}=n,h,f,y,v,N;function T(){v&&v(),N&&N(),n.cancelToken&&n.cancelToken.unsubscribe(h),n.signal&&n.signal.removeEventListener("abort",h)}let b=new XMLHttpRequest;b.open(n.method.toUpperCase(),n.url,!0),b.timeout=n.timeout;function x(){if(!b)return;const j=ed.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),k={data:!c||c==="text"||c==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:j,config:s,request:b};B9(function(F){t(F),T()},function(F){r(F),T()},k),b=null}"onloadend"in b?b.onloadend=x:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(x)},b.onabort=function(){b&&(r(new Ss("Request aborted",Ss.ECONNABORTED,s,b)),b=null)},b.onerror=function(){r(new Ss("Network Error",Ss.ERR_NETWORK,s,b)),b=null},b.ontimeout=function(){let S=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const k=n.transitional||L9;n.timeoutErrorMessage&&(S=n.timeoutErrorMessage),r(new Ss(S,k.clarifyTimeoutError?Ss.ETIMEDOUT:Ss.ECONNABORTED,s,b)),b=null},o===void 0&&a.setContentType(null),"setRequestHeader"in b&&St.forEach(a.toJSON(),function(S,k){b.setRequestHeader(k,S)}),St.isUndefined(n.withCredentials)||(b.withCredentials=!!n.withCredentials),c&&c!=="json"&&(b.responseType=n.responseType),d&&([y,N]=Qk(d,!0),b.addEventListener("progress",y)),u&&b.upload&&([f,v]=Qk(u),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",v)),(n.cancelToken||n.signal)&&(h=j=>{b&&(r(!j||j.type?new Tx(null,s,b):j),b.abort(),b=null)},n.cancelToken&&n.cancelToken.subscribe(h),n.signal&&(n.signal.aborted?h():n.signal.addEventListener("abort",h)));const D=wY(n.url);if(D&&Sa.protocols.indexOf(D)===-1){r(new Ss("Unsupported protocol "+D+":",Ss.ERR_BAD_REQUEST,s));return}b.send(o||null)})},kY=(s,e)=>{const{length:t}=s=s?s.filter(Boolean):[];if(e||t){let r=new AbortController,n;const o=function(d){if(!n){n=!0,c();const h=d instanceof Error?d:this.reason;r.abort(h instanceof Ss?h:new Tx(h instanceof Error?h.message:h))}};let a=e&&setTimeout(()=>{a=null,o(new Ss(`timeout ${e} of ms exceeded`,Ss.ETIMEDOUT))},e);const c=()=>{s&&(a&&clearTimeout(a),a=null,s.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),s=null)};s.forEach(d=>d.addEventListener("abort",o));const{signal:u}=r;return u.unsubscribe=()=>St.asap(c),u}},CY=kY,AY=function*(s,e){let t=s.byteLength;if(!e||t<e){yield s;return}let r=0,n;for(;r<t;)n=r+e,yield s.slice(r,n),r=n},MY=async function*(s,e){for await(const t of UY(s))yield*AY(t,e)},UY=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const e=s.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},YL=(s,e,t,r)=>{const n=MY(s,e);let o=0,a,c=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:d,value:h}=await n.next();if(d){c(),u.close();return}let f=h.byteLength;if(t){let y=o+=f;t(y)}u.enqueue(new Uint8Array(h))}catch(d){throw c(d),d}},cancel(u){return c(u),n.return()}},{highWaterMark:2})},cA=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",G9=cA&&typeof ReadableStream=="function",RY=cA&&(typeof TextEncoder=="function"?(s=>e=>s.encode(e))(new TextEncoder):async s=>new Uint8Array(await new Response(s).arrayBuffer())),W9=(s,...e)=>{try{return!!s(...e)}catch{return!1}},VY=G9&&W9(()=>{let s=!1;const e=new Request(Sa.origin,{body:new ReadableStream,method:"POST",get duplex(){return s=!0,"half"}}).headers.has("Content-Type");return s&&!e}),ZL=64*1024,qR=G9&&W9(()=>St.isReadableStream(new Response("").body)),eC={stream:qR&&(s=>s.body)};cA&&(s=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!eC[e]&&(eC[e]=St.isFunction(s[e])?t=>t[e]():(t,r)=>{throw new Ss(`Response type '${e}' is not supported`,Ss.ERR_NOT_SUPPORT,r)})})})(new Response);const FY=async s=>{if(s==null)return 0;if(St.isBlob(s))return s.size;if(St.isSpecCompliantForm(s))return(await new Request(Sa.origin,{method:"POST",body:s}).arrayBuffer()).byteLength;if(St.isArrayBufferView(s)||St.isArrayBuffer(s))return s.byteLength;if(St.isURLSearchParams(s)&&(s=s+""),St.isString(s))return(await RY(s)).byteLength},IY=async(s,e)=>{const t=St.toFiniteNumber(s.getContentLength());return t??FY(e)},LY=cA&&(async s=>{let{url:e,method:t,data:r,signal:n,cancelToken:o,timeout:a,onDownloadProgress:c,onUploadProgress:u,responseType:d,headers:h,withCredentials:f="same-origin",fetchOptions:y}=z9(s);d=d?(d+"").toLowerCase():"text";let v=CY([n,o&&o.toAbortSignal()],a),N;const T=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let b;try{if(u&&VY&&t!=="get"&&t!=="head"&&(b=await IY(h,r))!==0){let k=new Request(e,{method:"POST",body:r,duplex:"half"}),U;if(St.isFormData(r)&&(U=k.headers.get("content-type"))&&h.setContentType(U),k.body){const[F,M]=KL(b,Qk(XL(u)));r=YL(k.body,ZL,F,M)}}St.isString(f)||(f=f?"include":"omit");const x="credentials"in Request.prototype;N=new Request(e,{...y,signal:v,method:t.toUpperCase(),headers:h.normalize().toJSON(),body:r,duplex:"half",credentials:x?f:void 0});let D=await fetch(N,y);const j=qR&&(d==="stream"||d==="response");if(qR&&(c||j&&T)){const k={};["status","statusText","headers"].forEach(R=>{k[R]=D[R]});const U=St.toFiniteNumber(D.headers.get("content-length")),[F,M]=c&&KL(U,Qk(XL(c),!0))||[];D=new Response(YL(D.body,ZL,F,()=>{M&&M(),T&&T()}),k)}d=d||"text";let S=await eC[St.findKey(eC,d)||"text"](D,s);return!j&&T&&T(),await new Promise((k,U)=>{B9(k,U,{data:S,headers:ed.from(D.headers),status:D.status,statusText:D.statusText,config:s,request:N})})}catch(x){throw T&&T(),x&&x.name==="TypeError"&&/Load failed|fetch/i.test(x.message)?Object.assign(new Ss("Network Error",Ss.ERR_NETWORK,s,N),{cause:x.cause||x}):Ss.from(x,x&&x.code,s,N)}}),YR={http:$q,xhr:_Y,fetch:LY};St.forEach(YR,(s,e)=>{if(s){try{Object.defineProperty(s,"name",{value:e})}catch{}Object.defineProperty(s,"adapterName",{value:e})}});const $L=s=>`- ${s}`,PY=s=>St.isFunction(s)||s===null||s===!1,K9={getAdapter:s=>{s=St.isArray(s)?s:[s];const{length:e}=s;let t,r;const n={};for(let o=0;o<e;o++){t=s[o];let a;if(r=t,!PY(t)&&(r=YR[(a=String(t)).toLowerCase()],r===void 0))throw new Ss(`Unknown adapter '${a}'`);if(r)break;n[a||"#"+o]=r}if(!r){const o=Object.entries(n).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=e?o.length>1?`since :
244
244
  `+o.map($L).join(`
245
245
  `):" "+$L(o[0]):"as no adapter specified";throw new Ss("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:YR};function J3(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new Tx(null,s)}function JL(s){return J3(s),s.headers=ed.from(s.headers),s.data=$3.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),K9.getAdapter(s.adapter||n5.adapter)(s).then(function(r){return J3(s),r.data=$3.call(s,s.transformResponse,r),r.headers=ed.from(r.headers),r},function(r){return O9(r)||(J3(s),r&&r.response&&(r.response.data=$3.call(s,s.transformResponse,r.response),r.response.headers=ed.from(r.response.headers))),Promise.reject(r)})}const X9="1.11.0",uA={};["object","boolean","number","function","string","symbol"].forEach((s,e)=>{uA[s]=function(r){return typeof r===s||"a"+(e<1?"n ":" ")+s}});const QL={};uA.transitional=function(e,t,r){function n(o,a){return"[Axios v"+X9+"] Transitional option '"+o+"'"+a+(r?". "+r:"")}return(o,a,c)=>{if(e===!1)throw new Ss(n(a," has been removed"+(t?" in "+t:"")),Ss.ERR_DEPRECATED);return t&&!QL[a]&&(QL[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(o,a,c):!0}};uA.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function OY(s,e,t){if(typeof s!="object")throw new Ss("options must be an object",Ss.ERR_BAD_OPTION_VALUE);const r=Object.keys(s);let n=r.length;for(;n-- >0;){const o=r[n],a=e[o];if(a){const c=s[o],u=c===void 0||a(c,o,s);if(u!==!0)throw new Ss("option "+o+" must be "+u,Ss.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Ss("Unknown option "+o,Ss.ERR_BAD_OPTION)}}const kk={assertOptions:OY,validators:uA},lm=kk.validators;class tC{constructor(e){this.defaults=e||{},this.interceptors={request:new GL,response:new GL}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const o=n.stack?n.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
246
- `+o):r.stack=o}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Hb(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;r!==void 0&&kk.assertOptions(r,{silentJSONParsing:lm.transitional(lm.boolean),forcedJSONParsing:lm.transitional(lm.boolean),clarifyTimeoutError:lm.transitional(lm.boolean)},!1),n!=null&&(St.isFunction(n)?t.paramsSerializer={serialize:n}:kk.assertOptions(n,{encode:lm.function,serialize:lm.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),kk.assertOptions(t,{baseUrl:lm.spelling("baseURL"),withXsrfToken:lm.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=o&&St.merge(o.common,o[t.method]);o&&St.forEach(["delete","get","head","post","put","patch","common"],N=>{delete o[N]}),t.headers=ed.concat(a,o);const c=[];let u=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(t)===!1||(u=u&&T.synchronous,c.unshift(T.fulfilled,T.rejected))});const d=[];this.interceptors.response.forEach(function(T){d.push(T.fulfilled,T.rejected)});let h,f=0,y;if(!u){const N=[JL.bind(this),void 0];for(N.unshift(...c),N.push(...d),y=N.length,h=Promise.resolve(t);f<y;)h=h.then(N[f++],N[f++]);return h}y=c.length;let v=t;for(f=0;f<y;){const N=c[f++],T=c[f++];try{v=N(v)}catch(b){T.call(this,b);break}}try{h=JL.call(this,v)}catch(N){return Promise.reject(N)}for(f=0,y=d.length;f<y;)h=h.then(d[f++],d[f++]);return h}getUri(e){e=Hb(this.defaults,e);const t=H9(e.baseURL,e.url,e.allowAbsoluteUrls);return I9(t,e.params,e.paramsSerializer)}}St.forEach(["delete","get","head","options"],function(e){tC.prototype[e]=function(t,r){return this.request(Hb(r||{},{method:e,url:t,data:(r||{}).data}))}});St.forEach(["post","put","patch"],function(e){function t(r){return function(o,a,c){return this.request(Hb(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}tC.prototype[e]=t(),tC.prototype[e+"Form"]=t(!0)});const Ck=tC;class o5{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});const r=this;this.promise.then(n=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](n);r._listeners=null}),this.promise.then=n=>{let o;const a=new Promise(c=>{r.subscribe(c),o=c}).then(n);return a.cancel=function(){r.unsubscribe(o)},a},e(function(o,a,c){r.reason||(r.reason=new Tx(o,a,c),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new o5(function(n){e=n}),cancel:e}}}const BY=o5;function HY(s){return function(t){return s.apply(null,t)}}function zY(s){return St.isObject(s)&&s.isAxiosError===!0}const ZR={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ZR).forEach(([s,e])=>{ZR[e]=s});const GY=ZR;function q9(s){const e=new Ck(s),t=T9(Ck.prototype.request,e);return St.extend(t,Ck.prototype,e,{allOwnKeys:!0}),St.extend(t,e,null,{allOwnKeys:!0}),t.create=function(n){return q9(Hb(s,n))},t}const ti=q9(n5);ti.Axios=Ck;ti.CanceledError=Tx;ti.CancelToken=BY;ti.isCancel=O9;ti.VERSION=X9;ti.toFormData=aA;ti.AxiosError=Ss;ti.Cancel=ti.CanceledError;ti.all=function(e){return Promise.all(e)};ti.spread=HY;ti.isAxiosError=zY;ti.mergeConfig=Hb;ti.AxiosHeaders=ed;ti.formToJSON=s=>P9(St.isHTMLForm(s)?new FormData(s):s);ti.getAdapter=K9.getAdapter;ti.HttpStatusCode=GY;ti.default=ti;const ar=ti,WY=({isCollapsed:s})=>{const[e,t]=V.useState(!1),[r,n]=V.useState(null),[o,a]=V.useState(!1),[c,u]=V.useState(null),[d,h]=V.useState(!1),f=V.useCallback(async()=>{a(!0),u(null);try{const T=await ar.get("/api/system/local-ip");if(T.data.success&&T.data.data.ip){const b=window.location.port||"80",D=`http://${T.data.data.ip}:${b}`;n(D)}else u("Failed to get local IP address")}catch{u("Failed to connect to server")}finally{a(!1)}},[]),y=V.useCallback(()=>{t(!0),r||f()},[r,f]),v=V.useCallback(()=>{t(!1),h(!1)},[]),N=V.useCallback(async()=>{if(r)try{await navigator.clipboard.writeText(r),h(!0),setTimeout(()=>h(!1),2e3)}catch{const b=document.createElement("textarea");b.value=r,document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),h(!0),setTimeout(()=>h(!1),2e3)}},[r]);return V.useEffect(()=>{const T=b=>{b.key==="Escape"&&e&&v()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[e,v]),i.jsxDEV(i.Fragment,{children:[i.jsxDEV("button",{onClick:y,className:Zo("group flex items-center w-full px-4 py-2 text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark rounded-lg transition-colors text-sm",s?"md:justify-center":""),title:"Scan QR code for mobile access","aria-label":"Open QR code for mobile access",children:[i.jsxDEV(KV,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:127,columnNumber:9},globalThis),i.jsxDEV("span",{className:Zo("ml-3",s?"md:hidden":""),children:"Mobile Access"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:128,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:118,columnNumber:7},globalThis),e&&VB.createPortal(i.jsxDEV("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",onClick:v,children:i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-xl shadow-2xl max-w-sm w-full mx-4 overflow-hidden",onClick:T=>T.stopPropagation(),children:[i.jsxDEV("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-dark",children:[i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV("div",{className:"p-2 bg-primary/10 rounded-lg",children:i.jsxDEV(i9,{className:"h-5 w-5 text-primary"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:145,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:144,columnNumber:17},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("h3",{className:"text-lg font-semibold text-text-primary-dark",children:"Mobile Access"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:148,columnNumber:19},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark",children:"Scan with your phone"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:151,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:147,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:143,columnNumber:15},globalThis),i.jsxDEV("button",{onClick:v,className:"p-1 text-text-secondary-dark hover:text-text-primary-dark hover:bg-background-dark rounded-lg transition-colors","aria-label":"Close modal",children:i.jsxDEV(Tn,{className:"h-5 w-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:161,columnNumber:17},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:156,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:142,columnNumber:13},globalThis),i.jsxDEV("div",{className:"p-5",children:o?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsxDEV("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:169,columnNumber:19},globalThis),i.jsxDEV("p",{className:"mt-3 text-sm text-text-secondary-dark",children:"Getting network address..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:170,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:168,columnNumber:17},globalThis):c?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsxDEV("div",{className:"p-3 bg-red-500/10 rounded-full mb-3",children:i.jsxDEV(Tn,{className:"h-6 w-6 text-red-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:177,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:176,columnNumber:19},globalThis),i.jsxDEV("p",{className:"text-sm text-red-400",children:c},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:179,columnNumber:19},globalThis),i.jsxDEV("button",{onClick:f,className:"mt-4 px-4 py-2 bg-primary/10 text-primary rounded-lg hover:bg-primary/20 transition-colors text-sm",children:"Retry"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:180,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:175,columnNumber:17},globalThis):r?i.jsxDEV("div",{className:"flex flex-col items-center",children:[i.jsxDEV("div",{className:"bg-white p-4 rounded-xl",children:i.jsxDEV(QV,{value:r,size:200,level:"M",includeMargin:!1},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:191,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:190,columnNumber:19},globalThis),i.jsxDEV("div",{className:"flex items-center gap-2 mt-4 text-sm text-text-secondary-dark",children:[i.jsxDEV($V,{className:"h-4 w-4 text-green-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:201,columnNumber:21},globalThis),i.jsxDEV("span",{children:"Same WiFi network required"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:202,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:200,columnNumber:19},globalThis),i.jsxDEV("div",{className:"mt-4 w-full",children:i.jsxDEV("div",{className:"flex items-center gap-2 bg-background-dark rounded-lg p-3",children:[i.jsxDEV("code",{className:"flex-1 text-sm text-primary truncate",children:r},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:208,columnNumber:23},globalThis),i.jsxDEV("button",{onClick:N,className:Zo("p-2 rounded-md transition-colors",d?"bg-green-500/10 text-green-500":"hover:bg-surface-dark text-text-secondary-dark hover:text-text-primary-dark"),title:d?"Copied!":"Copy URL","aria-label":d?"URL copied":"Copy URL to clipboard",children:d?i.jsxDEV(Mi,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:223,columnNumber:27},globalThis):i.jsxDEV(PR,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:225,columnNumber:27},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:211,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:207,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:206,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:188,columnNumber:17},globalThis):null},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:166,columnNumber:13},globalThis),i.jsxDEV("div",{className:"px-5 py-4 bg-background-dark border-t border-border-dark",children:i.jsxDEV("p",{className:"text-xs text-text-secondary-dark text-center",children:"Make sure your phone is connected to the same WiFi network as this computer"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:236,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:235,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:137,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:133,columnNumber:9},globalThis),document.body)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:116,columnNumber:5},globalThis)},i5="crewly_access_token",a5="crewly_refresh_token";function KY(){return localStorage.getItem(i5)}function XY(){return localStorage.getItem(a5)}function qY(s,e){localStorage.setItem(i5,s),localStorage.setItem(a5,e)}function Q3(){localStorage.removeItem(i5),localStorage.removeItem(a5)}const Ds="/api",YY=2*60*1e3;class ZY{constructor(){Za(this,"teamsCache",null);Za(this,"teamsCachePromise",null);Za(this,"setupOrchestratorPromise",null)}async getProjects(){return(await ar.get(`${Ds}/projects`)).data.data||[]}async getProject(e){const t=await ar.get(`${Ds}/projects/${e}`);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Project not found");return t.data.data}async createProject(e,t,r){const n=await ar.post(`${Ds}/projects`,{path:e,name:t,description:r});if(!n.data.success||!n.data.data)throw new Error(n.data.error||"Failed to create project");return n.data.data}async startProject(e,t){const r=await ar.post(`${Ds}/projects/${e}/start`,{teamIds:t});if(!r.data.success)throw new Error(r.data.error||"Failed to start project");return{message:r.data.message||"Project started successfully"}}async assignTeamsToProject(e,t){const r=await this.getTeams(),n={};t.forEach(a=>{const c=r.find(u=>u.id===a);if(c&&c.members.length>0){const u=c.members[0].role;n[u]||(n[u]=[]),n[u].push(a)}});const o=await ar.post(`${Ds}/projects/${e}/assign-teams`,{teamAssignments:n});if(!o.data.success)throw new Error(o.data.error||"Failed to assign teams")}async getTeams(e=!1){return!e&&this.teamsCache&&Date.now()-this.teamsCache.timestamp<YY?this.teamsCache.data:this.teamsCachePromise?this.teamsCachePromise:(this.teamsCachePromise=(async()=>{try{const r=(await ar.get(`${Ds}/teams`,{timeout:15e3})).data.data||[];return this.teamsCache={data:r,timestamp:Date.now()},r}finally{this.teamsCachePromise=null}})(),this.teamsCachePromise)}invalidateTeamsCache(){this.teamsCache=null}async getTeam(e){const t=await ar.get(`${Ds}/teams/${e}`);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Team not found");return t.data.data}async createTeam(e){const t=await ar.post(`${Ds}/teams`,e);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to create team");return this.invalidateTeamsCache(),t.data.data}async deleteTeam(e){const t=await ar.delete(`${Ds}/teams/${e}`);if(!t.data.success)throw new Error(t.data.error||"Failed to delete team");this.invalidateTeamsCache()}async unassignTeamFromProject(e,t){const r=await ar.post(`${Ds}/projects/${e}/unassign-team`,{teamId:t});if(!r.data.success)throw new Error(r.data.error||"Failed to unassign team")}async startTeam(e){await ar.post(`${Ds}/teams/${e}/start`,{})}async setupOrchestrator(){if(this.setupOrchestratorPromise)return this.setupOrchestratorPromise;this.setupOrchestratorPromise=(async()=>{try{const e=await fetch(`${Ds}/orchestrator/setup`,{method:"POST",headers:{"Content-Type":"application/json"}}),t=await e.json();return{success:e.ok&&t.success,message:t.message,error:t.error}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Failed to setup orchestrator"}}})();try{return await this.setupOrchestratorPromise}finally{this.setupOrchestratorPromise=null}}async getProjectTickets(e){return(await ar.get(`${Ds}/projects/${e}/tickets`)).data.data||[]}async createTicket(e,t){const r=await ar.post(`${Ds}/projects/${e}/tickets`,t);if(!r.data.success||!r.data.data)throw new Error(r.data.error||"Failed to create ticket");return r.data.data}async updateTicket(e,t){const r=await ar.patch(`${Ds}/tickets/${e}`,t);if(!r.data.success||!r.data.data)throw new Error(r.data.error||"Failed to update ticket");return r.data.data}async deleteTicket(e,t){const r=await ar.delete(`${Ds}/projects/${e}/tickets/${t}`);if(!r.data.success)throw new Error(r.data.error||"Failed to delete ticket")}async getPreviousSessions(){return(await ar.get(`${Ds}/sessions/previous`)).data.data||{sessions:[]}}async dismissPreviousSessions(){await ar.post(`${Ds}/sessions/previous/dismiss`)}async getAllTasks(e){return(await ar.get(`${Ds}/projects/${e}/tasks`)).data.data||[]}async getMilestones(e){return(await ar.get(`${Ds}/projects/${e}/milestones`)).data.data||[]}async getTasksByStatus(e,t){return(await ar.get(`${Ds}/projects/${e}/tasks/status/${t}`)).data.data||[]}async getTasksByMilestone(e,t){return(await ar.get(`${Ds}/projects/${e}/tasks/milestone/${t}`)).data.data||[]}async getTeamsBackupStatus(){const e=await ar.get(`${Ds}/teams/backup/status`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get backup status");return e.data.data}async restoreTeamsFromBackup(){const e=await ar.post(`${Ds}/teams/backup/restore`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to restore from backup");return e.data.data}async getQueueStatus(){const e=await ar.get(`${Ds}/messaging/queue/status`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get queue status");return e.data.data}async getPendingMessages(){return(await ar.get(`${Ds}/messaging/queue/messages`)).data.data||[]}async cancelQueueMessage(e){const t=await ar.delete(`${Ds}/messaging/queue/messages/${e}`);if(!t.data.success)throw new Error(t.data.error||"Failed to cancel message")}async clearQueue(){const e=await ar.delete(`${Ds}/messaging/queue`);if(!e.data.success)throw new Error(e.data.error||"Failed to clear queue")}async getKnowledgeDocuments(e="global",t,r,n){const o={scope:e};return t&&(o.projectPath=t),r&&(o.category=r),n&&(o.search=n),(await ar.get(`${Ds}/knowledge/documents`,{params:o})).data.data||[]}async getKnowledgeDocument(e,t="global",r){const n={scope:t};r&&(n.projectPath=r);const o=await ar.get(`${Ds}/knowledge/documents/${e}`,{params:n});if(!o.data.success||!o.data.data)throw new Error(o.data.error||"Document not found");return o.data.data}async createKnowledgeDocument(e){const t=await ar.post(`${Ds}/knowledge/documents`,e);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to create document");return t.data.data.id}async updateKnowledgeDocument(e,t){const r=await ar.put(`${Ds}/knowledge/documents/${e}`,t);if(!r.data.success)throw new Error(r.data.error||"Failed to update document")}async deleteKnowledgeDocument(e,t="global",r){const n={scope:t};r&&(n.projectPath=r);const o=await ar.delete(`${Ds}/knowledge/documents/${e}`,{params:n});if(!o.data.success)throw new Error(o.data.error||"Failed to delete document")}async getKnowledgeCategories(e="global",t){const r={scope:e};return t&&(r.projectPath=t),(await ar.get(`${Ds}/knowledge/categories`,{params:r})).data.data||[]}async getCloudStatus(){const e=await ar.get(`${Ds}/cloud/status`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get cloud status");return e.data.data}async connectToCloud(e,t){const r={token:e};t&&(r.cloudUrl=t);const n=await ar.post(`${Ds}/cloud/connect`,r);if(!n.data.success||!n.data.data)throw new Error(n.data.error||"Failed to connect to cloud");return n.data.data}async disconnectFromCloud(){const e=await ar.post(`${Ds}/cloud/disconnect`);if(!e.data.success)throw new Error(e.data.error||"Failed to disconnect from cloud")}async authRefresh(e){const t=await ar.post(`${Ds}/auth/refresh`,{refreshToken:e});if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Token refresh failed");return t.data.data}async authGetProfile(e){const t=await ar.get(`${Ds}/auth/me`,{headers:{Authorization:`Bearer ${e}`}});if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to get profile");return t.data.data}async authUpdateProfile(e,t){const r=await ar.put(`${Ds}/auth/me`,t,{headers:{Authorization:`Bearer ${e}`}});if(!r.data.success||!r.data.data)throw new Error(r.data.error||"Failed to update profile");return r.data.data}async authGetLicense(e){const t=await ar.get(`${Ds}/auth/license`,{headers:{Authorization:`Bearer ${e}`}});if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to get license status");return t.data.data}async getRelayStatus(){const e=await ar.get(`${Ds}/relay/devices`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get relay status");return e.data.data.client}}const ss=new ZY,Y9=V.createContext(null),$Y=({children:s})=>{const[e,t]=V.useState(null),[r,n]=V.useState(null),[o,a]=V.useState(!0),[c,u]=V.useState(null),d=V.useRef(null),h=V.useCallback(async b=>{qY(b.accessToken,b.refreshToken),d.current=b.accessToken,t(b.user);try{const x=await ss.authGetLicense(b.accessToken);n(x)}catch{}},[]);V.useEffect(()=>{let b=!1;return(async()=>{const D=KY();if(!D){a(!1);return}try{const j=await ss.authGetProfile(D);if(b)return;d.current=D,t(j);try{const S=await ss.authGetLicense(D);b||n(S)}catch{}}catch{const j=XY();if(j&&!b)try{const S=await ss.authRefresh(j);b||await h(S)}catch{Q3()}else Q3()}finally{b||a(!1)}})(),()=>{b=!0}},[h]);const f=V.useCallback(async b=>{u(null);try{await h(b)}catch(x){const D=x instanceof Error?x.message:"Authentication failed";throw u(D),x}},[h]),y=V.useCallback(()=>{u(null),Q3(),d.current=null,t(null),n(null)},[]),v=V.useCallback(()=>d.current,[]),N=V.useCallback(b=>r?r.features.includes(b):!1,[r]),T={isAuthenticated:e!==null,user:e,license:r,isLoading:o,error:c,applyCloudAuth:f,logout:y,getAccessToken:v,hasFeature:N};return i.jsxDEV(Y9.Provider,{value:T,children:s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/contexts/AuthContext.tsx",lineNumber:185,columnNumber:5},globalThis)};function Z9(){const s=V.useContext(Y9);if(!s)throw new Error("useAuth must be used within an AuthProvider");return s}const JY={free:"default",pro:"primary",enterprise:"primary"},QY={free:"Free",pro:"Pro",enterprise:"Enterprise"},$9=({isCollapsed:s=!1})=>{const{isAuthenticated:e,user:t,isLoading:r,logout:n}=Z9();return r?i.jsxDEV("div",{className:"flex items-center px-4 py-2 text-text-secondary-dark",children:[i.jsxDEV(tf,{className:"h-5 w-5 animate-spin flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:63,columnNumber:9},globalThis),!s&&i.jsxDEV("span",{className:"ml-3 text-sm",children:"Loading..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:64,columnNumber:26},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:62,columnNumber:7},globalThis):e&&t?i.jsxDEV("div",{className:"px-2 py-1",children:i.jsxDEV("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-primary/5 border border-primary/20",children:[i.jsxDEV("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsxDEV(Pj,{className:"h-4 w-4 text-primary flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:74,columnNumber:13},globalThis),!s&&i.jsxDEV("div",{className:"min-w-0 flex-1",children:[i.jsxDEV("p",{className:"text-xs font-medium text-text-primary-dark truncate",children:t.displayName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:77,columnNumber:17},globalThis),i.jsxDEV("div",{className:"flex items-center gap-1",children:i.jsxDEV($k,{variant:JY[t.plan],size:"sm",children:QY[t.plan]},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:81,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:80,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:76,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:73,columnNumber:11},globalThis),!s&&i.jsxDEV("button",{onClick:n,className:"text-text-secondary-dark hover:text-red-400 transition-colors p-1",title:"Sign out","aria-label":"Sign out of CrewlyAI Cloud",children:i.jsxDEV(e9,{size:14},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:95,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:89,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:72,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:71,columnNumber:7},globalThis):null};$9.displayName="AuthStatusIndicator";const eZ=[{name:"Dashboard",href:"/",icon:QB},{name:"Chat",href:"/chat",icon:t9},{name:"Teams",href:"/teams",icon:ei},{name:"Projects",href:"/projects",icon:il},{name:"Marketplace",href:"/marketplace",icon:a9}],tZ=({isMobileOpen:s,onMobileClose:e})=>{const t=uf(),{isCollapsed:r,toggleSidebar:n}=JV(),o=()=>{e&&e()},a=t.pathname.match(/\/projects\/([^/]+)/),c=a?a[1]:null,u=(t.hash||"#detail").replace("#","");return i.jsxDEV("div",{className:Zo("flex flex-col h-screen max-h-screen bg-surface-dark/95 border-r border-border-dark overflow-hidden w-full"),children:[i.jsxDEV("div",{className:"flex items-center justify-between p-4 border-b border-border-dark",children:[i.jsxDEV("div",{className:"flex items-center",children:[i.jsxDEV("div",{className:"p-1",children:i.jsxDEV("img",{src:"/logo/crewly-icon.svg",alt:"Crewly",className:"h-8 w-8 invert"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:58,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:57,columnNumber:6},globalThis),(!r||s)&&i.jsxDEV("span",{className:"ml-3 text-2xl font-extrabold text-text-primary-dark font-logo",children:"CREWLY"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:61,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:56,columnNumber:5},globalThis),e&&i.jsxDEV(wc,{variant:"ghost",icon:Tn,onClick:e,className:"md:hidden -mr-2","aria-label":"Close menu"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:67,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:55,columnNumber:4},globalThis),i.jsxDEV("nav",{className:"flex-1 px-2 py-3 overflow-y-auto",children:i.jsxDEV("div",{className:"space-y-2",children:eZ.map(d=>{const h=t.pathname===d.href||d.href!=="/"&&t.pathname.startsWith(d.href);return i.jsxDEV("div",{children:[i.jsxDEV(fm,{to:d.href,onClick:o,className:Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r?"md:justify-center":"",h?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r?d.name:void 0,children:[i.jsxDEV(d.icon,{className:Zo("h-5 w-5 flex-shrink-0",h?"text-primary":"")},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:99,columnNumber:21},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r?"md:hidden":""),children:d.name},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:100,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:87,columnNumber:19},globalThis),(!r||s)&&d.href==="/projects"&&c&&i.jsxDEV("div",{className:"mt-2 ml-4 space-y-1 border-l border-border-dark pl-4",children:[i.jsxDEV(fm,{to:`/projects/${c}#detail`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="detail"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Overview"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:106,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/projects/${c}#editor`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="editor"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Editor"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:120,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/projects/${c}#tasks`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="tasks"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Tasks"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:134,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/projects/${c}#teams`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="teams"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Teams"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:148,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/knowledge?project=${c}`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors","text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Knowledge"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:162,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:105,columnNumber:21},globalThis)]},d.name,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:86,columnNumber:17},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:79,columnNumber:5},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:78,columnNumber:13},globalThis),i.jsxDEV("div",{className:"p-2 border-t border-border-dark space-y-1",children:[i.jsxDEV($9,{isCollapsed:r&&!s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:185,columnNumber:5},globalThis),i.jsxDEV(fm,{to:"/security",onClick:o,className:({isActive:d})=>Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r&&!s?"md:justify-center":"",d?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r&&!s?"Security":void 0,children:[i.jsxDEV(aT,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:202,columnNumber:6},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r&&!s?"md:hidden":""),children:"Security"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:203,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:188,columnNumber:5},globalThis),i.jsxDEV(fm,{to:"/scheduled-checkins",onClick:o,className:({isActive:d})=>Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r&&!s?"md:justify-center":"",d?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r&&!s?"Schedules":void 0,children:[i.jsxDEV(eu,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:221,columnNumber:6},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r&&!s?"md:hidden":""),children:"Schedules"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:222,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:207,columnNumber:5},globalThis),i.jsxDEV(fm,{to:"/settings",onClick:o,className:({isActive:d})=>Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r&&!s?"md:justify-center":"",d?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r&&!s?"Settings":void 0,children:[i.jsxDEV(o9,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:240,columnNumber:6},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r&&!s?"md:hidden":""),children:"Settings"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:241,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:226,columnNumber:5},globalThis),i.jsxDEV(WY,{isCollapsed:r&&!s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:245,columnNumber:5},globalThis),i.jsxDEV("button",{className:"flex items-center justify-center w-full p-2 text-text-secondary-dark hover:bg-background-dark/60 hover:text-text-primary-dark rounded-lg transition-colors",onClick:n,"aria-label":r?"Expand sidebar":"Collapse sidebar",children:r?i.jsxDEV(of,{className:"h-5 w-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:254,columnNumber:7},globalThis):i.jsxDEV(i.Fragment,{children:[i.jsxDEV(bX,{className:"h-5 w-5 mr-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:257,columnNumber:8},globalThis),i.jsxDEV("span",{className:"text-sm",children:"Collapse"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:258,columnNumber:8},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:256,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:248,columnNumber:5},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:183,columnNumber:4},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:51,columnNumber:5},globalThis)};var J9={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(self,()=>(()=>{var t={4567:function(a,c,u){var d=this&&this.__decorate||function(j,S,k,U){var F,M=arguments.length,R=M<3?S:U===null?U=Object.getOwnPropertyDescriptor(S,k):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(j,S,k,U);else for(var L=j.length-1;L>=0;L--)(F=j[L])&&(R=(M<3?F(R):M>3?F(S,k,R):F(S,k))||R);return M>3&&R&&Object.defineProperty(S,k,R),R},h=this&&this.__param||function(j,S){return function(k,U){S(k,U,j)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const f=u(9042),y=u(6114),v=u(9924),N=u(844),T=u(5596),b=u(4725),x=u(3656);let D=c.AccessibilityManager=class extends N.Disposable{constructor(j,S){super(),this._terminal=j,this._renderService=S,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let k=0;k<this._terminal.rows;k++)this._rowElements[k]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[k]);if(this._topBoundaryFocusListener=k=>this._handleBoundaryFocus(k,0),this._bottomBoundaryFocusListener=k=>this._handleBoundaryFocus(k,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(k=>this._handleResize(k.rows))),this.register(this._terminal.onRender(k=>this._refreshRows(k.start,k.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(k=>this._handleChar(k))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
246
+ `+o):r.stack=o}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Hb(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;r!==void 0&&kk.assertOptions(r,{silentJSONParsing:lm.transitional(lm.boolean),forcedJSONParsing:lm.transitional(lm.boolean),clarifyTimeoutError:lm.transitional(lm.boolean)},!1),n!=null&&(St.isFunction(n)?t.paramsSerializer={serialize:n}:kk.assertOptions(n,{encode:lm.function,serialize:lm.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),kk.assertOptions(t,{baseUrl:lm.spelling("baseURL"),withXsrfToken:lm.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=o&&St.merge(o.common,o[t.method]);o&&St.forEach(["delete","get","head","post","put","patch","common"],N=>{delete o[N]}),t.headers=ed.concat(a,o);const c=[];let u=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(t)===!1||(u=u&&T.synchronous,c.unshift(T.fulfilled,T.rejected))});const d=[];this.interceptors.response.forEach(function(T){d.push(T.fulfilled,T.rejected)});let h,f=0,y;if(!u){const N=[JL.bind(this),void 0];for(N.unshift(...c),N.push(...d),y=N.length,h=Promise.resolve(t);f<y;)h=h.then(N[f++],N[f++]);return h}y=c.length;let v=t;for(f=0;f<y;){const N=c[f++],T=c[f++];try{v=N(v)}catch(b){T.call(this,b);break}}try{h=JL.call(this,v)}catch(N){return Promise.reject(N)}for(f=0,y=d.length;f<y;)h=h.then(d[f++],d[f++]);return h}getUri(e){e=Hb(this.defaults,e);const t=H9(e.baseURL,e.url,e.allowAbsoluteUrls);return I9(t,e.params,e.paramsSerializer)}}St.forEach(["delete","get","head","options"],function(e){tC.prototype[e]=function(t,r){return this.request(Hb(r||{},{method:e,url:t,data:(r||{}).data}))}});St.forEach(["post","put","patch"],function(e){function t(r){return function(o,a,c){return this.request(Hb(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}tC.prototype[e]=t(),tC.prototype[e+"Form"]=t(!0)});const Ck=tC;class o5{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});const r=this;this.promise.then(n=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](n);r._listeners=null}),this.promise.then=n=>{let o;const a=new Promise(c=>{r.subscribe(c),o=c}).then(n);return a.cancel=function(){r.unsubscribe(o)},a},e(function(o,a,c){r.reason||(r.reason=new Tx(o,a,c),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new o5(function(n){e=n}),cancel:e}}}const BY=o5;function HY(s){return function(t){return s.apply(null,t)}}function zY(s){return St.isObject(s)&&s.isAxiosError===!0}const ZR={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ZR).forEach(([s,e])=>{ZR[e]=s});const GY=ZR;function q9(s){const e=new Ck(s),t=T9(Ck.prototype.request,e);return St.extend(t,Ck.prototype,e,{allOwnKeys:!0}),St.extend(t,e,null,{allOwnKeys:!0}),t.create=function(n){return q9(Hb(s,n))},t}const ti=q9(n5);ti.Axios=Ck;ti.CanceledError=Tx;ti.CancelToken=BY;ti.isCancel=O9;ti.VERSION=X9;ti.toFormData=aA;ti.AxiosError=Ss;ti.Cancel=ti.CanceledError;ti.all=function(e){return Promise.all(e)};ti.spread=HY;ti.isAxiosError=zY;ti.mergeConfig=Hb;ti.AxiosHeaders=ed;ti.formToJSON=s=>P9(St.isHTMLForm(s)?new FormData(s):s);ti.getAdapter=K9.getAdapter;ti.HttpStatusCode=GY;ti.default=ti;const ar=ti,WY=({isCollapsed:s})=>{const[e,t]=V.useState(!1),[r,n]=V.useState(null),[o,a]=V.useState(!1),[c,u]=V.useState(null),[d,h]=V.useState(!1),f=V.useCallback(async()=>{a(!0),u(null);try{const T=await ar.get("/api/system/local-ip");if(T.data.success&&T.data.data.ip){const b=window.location.port||"80",D=`http://${T.data.data.ip}:${b}`;n(D)}else u("Failed to get local IP address")}catch{u("Failed to connect to server")}finally{a(!1)}},[]),y=V.useCallback(()=>{t(!0),r||f()},[r,f]),v=V.useCallback(()=>{t(!1),h(!1)},[]),N=V.useCallback(async()=>{if(r)try{await navigator.clipboard.writeText(r),h(!0),setTimeout(()=>h(!1),2e3)}catch{const b=document.createElement("textarea");b.value=r,document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),h(!0),setTimeout(()=>h(!1),2e3)}},[r]);return V.useEffect(()=>{const T=b=>{b.key==="Escape"&&e&&v()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[e,v]),i.jsxDEV(i.Fragment,{children:[i.jsxDEV("button",{onClick:y,className:Zo("group flex items-center w-full px-4 py-2 text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark rounded-lg transition-colors text-sm",s?"md:justify-center":""),title:"Scan QR code for mobile access","aria-label":"Open QR code for mobile access",children:[i.jsxDEV(KV,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:127,columnNumber:9},globalThis),i.jsxDEV("span",{className:Zo("ml-3",s?"md:hidden":""),children:"Mobile Access"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:128,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:118,columnNumber:7},globalThis),e&&VB.createPortal(i.jsxDEV("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",onClick:v,children:i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-xl shadow-2xl max-w-sm w-full mx-4 overflow-hidden",onClick:T=>T.stopPropagation(),children:[i.jsxDEV("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-dark",children:[i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV("div",{className:"p-2 bg-primary/10 rounded-lg",children:i.jsxDEV(i9,{className:"h-5 w-5 text-primary"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:145,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:144,columnNumber:17},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("h3",{className:"text-lg font-semibold text-text-primary-dark",children:"Mobile Access"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:148,columnNumber:19},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark",children:"Scan with your phone"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:151,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:147,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:143,columnNumber:15},globalThis),i.jsxDEV("button",{onClick:v,className:"p-1 text-text-secondary-dark hover:text-text-primary-dark hover:bg-background-dark rounded-lg transition-colors","aria-label":"Close modal",children:i.jsxDEV(Tn,{className:"h-5 w-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:161,columnNumber:17},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:156,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:142,columnNumber:13},globalThis),i.jsxDEV("div",{className:"p-5",children:o?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsxDEV("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:169,columnNumber:19},globalThis),i.jsxDEV("p",{className:"mt-3 text-sm text-text-secondary-dark",children:"Getting network address..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:170,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:168,columnNumber:17},globalThis):c?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsxDEV("div",{className:"p-3 bg-red-500/10 rounded-full mb-3",children:i.jsxDEV(Tn,{className:"h-6 w-6 text-red-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:177,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:176,columnNumber:19},globalThis),i.jsxDEV("p",{className:"text-sm text-red-400",children:c},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:179,columnNumber:19},globalThis),i.jsxDEV("button",{onClick:f,className:"mt-4 px-4 py-2 bg-primary/10 text-primary rounded-lg hover:bg-primary/20 transition-colors text-sm",children:"Retry"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:180,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:175,columnNumber:17},globalThis):r?i.jsxDEV("div",{className:"flex flex-col items-center",children:[i.jsxDEV("div",{className:"bg-white p-4 rounded-xl",children:i.jsxDEV(QV,{value:r,size:200,level:"M",includeMargin:!1},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:191,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:190,columnNumber:19},globalThis),i.jsxDEV("div",{className:"flex items-center gap-2 mt-4 text-sm text-text-secondary-dark",children:[i.jsxDEV($V,{className:"h-4 w-4 text-green-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:201,columnNumber:21},globalThis),i.jsxDEV("span",{children:"Same WiFi network required"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:202,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:200,columnNumber:19},globalThis),i.jsxDEV("div",{className:"mt-4 w-full",children:i.jsxDEV("div",{className:"flex items-center gap-2 bg-background-dark rounded-lg p-3",children:[i.jsxDEV("code",{className:"flex-1 text-sm text-primary truncate",children:r},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:208,columnNumber:23},globalThis),i.jsxDEV("button",{onClick:N,className:Zo("p-2 rounded-md transition-colors",d?"bg-green-500/10 text-green-500":"hover:bg-surface-dark text-text-secondary-dark hover:text-text-primary-dark"),title:d?"Copied!":"Copy URL","aria-label":d?"URL copied":"Copy URL to clipboard",children:d?i.jsxDEV(Mi,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:223,columnNumber:27},globalThis):i.jsxDEV(PR,{className:"h-4 w-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:225,columnNumber:27},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:211,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:207,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:206,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:188,columnNumber:17},globalThis):null},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:166,columnNumber:13},globalThis),i.jsxDEV("div",{className:"px-5 py-4 bg-background-dark border-t border-border-dark",children:i.jsxDEV("p",{className:"text-xs text-text-secondary-dark text-center",children:"Make sure your phone is connected to the same WiFi network as this computer"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:236,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:235,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:137,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:133,columnNumber:9},globalThis),document.body)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/QRCodeDisplay.tsx",lineNumber:116,columnNumber:5},globalThis)},i5="crewly_access_token",a5="crewly_refresh_token";function KY(){return localStorage.getItem(i5)}function XY(){return localStorage.getItem(a5)}function qY(s,e){localStorage.setItem(i5,s),localStorage.setItem(a5,e)}function Q3(){localStorage.removeItem(i5),localStorage.removeItem(a5)}const Ds="/api",YY=2*60*1e3;class ZY{constructor(){Za(this,"teamsCache",null);Za(this,"teamsCachePromise",null);Za(this,"setupOrchestratorPromise",null)}async getProjects(){return(await ar.get(`${Ds}/projects`)).data.data||[]}async getProject(e){const t=await ar.get(`${Ds}/projects/${e}`);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Project not found");return t.data.data}async createProject(e,t,r){const n=await ar.post(`${Ds}/projects`,{path:e,name:t,description:r});if(!n.data.success||!n.data.data)throw new Error(n.data.error||"Failed to create project");return n.data.data}async startProject(e,t){const r=await ar.post(`${Ds}/projects/${e}/start`,{teamIds:t});if(!r.data.success)throw new Error(r.data.error||"Failed to start project");return{message:r.data.message||"Project started successfully"}}async assignTeamsToProject(e,t){const r=await this.getTeams(),n={};t.forEach(a=>{const c=r.find(u=>u.id===a);if(c&&c.members.length>0){const u=c.members[0].role;n[u]||(n[u]=[]),n[u].push(a)}});const o=await ar.post(`${Ds}/projects/${e}/assign-teams`,{teamAssignments:n});if(!o.data.success)throw new Error(o.data.error||"Failed to assign teams")}async getTeams(e=!1){return!e&&this.teamsCache&&Date.now()-this.teamsCache.timestamp<YY?this.teamsCache.data:this.teamsCachePromise?this.teamsCachePromise:(this.teamsCachePromise=(async()=>{try{const r=(await ar.get(`${Ds}/teams`,{timeout:15e3})).data.data||[];return this.teamsCache={data:r,timestamp:Date.now()},r}finally{this.teamsCachePromise=null}})(),this.teamsCachePromise)}invalidateTeamsCache(){this.teamsCache=null}async getTeam(e){const t=await ar.get(`${Ds}/teams/${e}`);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Team not found");return t.data.data}async createTeam(e){const t=await ar.post(`${Ds}/teams`,e);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to create team");return this.invalidateTeamsCache(),t.data.data}async deleteTeam(e){const t=await ar.delete(`${Ds}/teams/${e}`);if(!t.data.success)throw new Error(t.data.error||"Failed to delete team");this.invalidateTeamsCache()}async unassignTeamFromProject(e,t){const r=await ar.post(`${Ds}/projects/${e}/unassign-team`,{teamId:t});if(!r.data.success)throw new Error(r.data.error||"Failed to unassign team")}async startTeam(e){await ar.post(`${Ds}/teams/${e}/start`,{})}async setupOrchestrator(){if(this.setupOrchestratorPromise)return this.setupOrchestratorPromise;this.setupOrchestratorPromise=(async()=>{try{const e=await fetch(`${Ds}/orchestrator/setup`,{method:"POST",headers:{"Content-Type":"application/json"}}),t=await e.json();return{success:e.ok&&t.success,message:t.message,error:t.error}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Failed to setup orchestrator"}}})();try{return await this.setupOrchestratorPromise}finally{this.setupOrchestratorPromise=null}}async getProjectTickets(e){return(await ar.get(`${Ds}/projects/${e}/tickets`)).data.data||[]}async createTicket(e,t){const r=await ar.post(`${Ds}/projects/${e}/tickets`,t);if(!r.data.success||!r.data.data)throw new Error(r.data.error||"Failed to create ticket");return r.data.data}async updateTicket(e,t){const r=await ar.patch(`${Ds}/tickets/${e}`,t);if(!r.data.success||!r.data.data)throw new Error(r.data.error||"Failed to update ticket");return r.data.data}async deleteTicket(e,t){const r=await ar.delete(`${Ds}/projects/${e}/tickets/${t}`);if(!r.data.success)throw new Error(r.data.error||"Failed to delete ticket")}async getPreviousSessions(){return(await ar.get(`${Ds}/sessions/previous`)).data.data||{sessions:[]}}async dismissPreviousSessions(){await ar.post(`${Ds}/sessions/previous/dismiss`)}async getAllTasks(e){return(await ar.get(`${Ds}/projects/${e}/tasks`)).data.data||[]}async getMilestones(e){return(await ar.get(`${Ds}/projects/${e}/milestones`)).data.data||[]}async getTasksByStatus(e,t){return(await ar.get(`${Ds}/projects/${e}/tasks/status/${t}`)).data.data||[]}async getTasksByMilestone(e,t){return(await ar.get(`${Ds}/projects/${e}/tasks/milestone/${t}`)).data.data||[]}async getTeamsBackupStatus(){const e=await ar.get(`${Ds}/teams/backup/status`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get backup status");return e.data.data}async restoreTeamsFromBackup(){const e=await ar.post(`${Ds}/teams/backup/restore`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to restore from backup");return e.data.data}async getQueueStatus(){const e=await ar.get(`${Ds}/messaging/queue/status`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get queue status");return e.data.data}async getPendingMessages(){return(await ar.get(`${Ds}/messaging/queue/messages`)).data.data||[]}async cancelQueueMessage(e){const t=await ar.delete(`${Ds}/messaging/queue/messages/${e}`);if(!t.data.success)throw new Error(t.data.error||"Failed to cancel message")}async clearQueue(){const e=await ar.delete(`${Ds}/messaging/queue`);if(!e.data.success)throw new Error(e.data.error||"Failed to clear queue")}async getKnowledgeDocuments(e="global",t,r,n){const o={scope:e};return t&&(o.projectPath=t),r&&(o.category=r),n&&(o.search=n),(await ar.get(`${Ds}/knowledge/documents`,{params:o})).data.data||[]}async getKnowledgeDocument(e,t="global",r){const n={scope:t};r&&(n.projectPath=r);const o=await ar.get(`${Ds}/knowledge/documents/${e}`,{params:n});if(!o.data.success||!o.data.data)throw new Error(o.data.error||"Document not found");return o.data.data}async createKnowledgeDocument(e){const t=await ar.post(`${Ds}/knowledge/documents`,e);if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to create document");return t.data.data.id}async updateKnowledgeDocument(e,t){const r=await ar.put(`${Ds}/knowledge/documents/${e}`,t);if(!r.data.success)throw new Error(r.data.error||"Failed to update document")}async deleteKnowledgeDocument(e,t="global",r){const n={scope:t};r&&(n.projectPath=r);const o=await ar.delete(`${Ds}/knowledge/documents/${e}`,{params:n});if(!o.data.success)throw new Error(o.data.error||"Failed to delete document")}async getKnowledgeCategories(e="global",t){const r={scope:e};return t&&(r.projectPath=t),(await ar.get(`${Ds}/knowledge/categories`,{params:r})).data.data||[]}async getCloudStatus(){const e=await ar.get(`${Ds}/cloud/status`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get cloud status");return e.data.data}async connectToCloud(e,t,r){const n={token:e};t&&(n.cloudUrl=t),r&&(n.refreshToken=r);const o=await ar.post(`${Ds}/cloud/connect`,n);if(!o.data.success||!o.data.data)throw new Error(o.data.error||"Failed to connect to cloud");return o.data.data}async disconnectFromCloud(){const e=await ar.post(`${Ds}/cloud/disconnect`);if(!e.data.success)throw new Error(e.data.error||"Failed to disconnect from cloud")}async authRefresh(e){const t=await ar.post(`${Ds}/auth/refresh`,{refreshToken:e});if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Token refresh failed");return t.data.data}async authGetProfile(e){const t=await ar.get(`${Ds}/auth/me`,{headers:{Authorization:`Bearer ${e}`}});if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to get profile");return t.data.data}async authUpdateProfile(e,t){const r=await ar.put(`${Ds}/auth/me`,t,{headers:{Authorization:`Bearer ${e}`}});if(!r.data.success||!r.data.data)throw new Error(r.data.error||"Failed to update profile");return r.data.data}async authGetLicense(e){const t=await ar.get(`${Ds}/auth/license`,{headers:{Authorization:`Bearer ${e}`}});if(!t.data.success||!t.data.data)throw new Error(t.data.error||"Failed to get license status");return t.data.data}async getRelayStatus(){const e=await ar.get(`${Ds}/relay/devices`);if(!e.data.success||!e.data.data)throw new Error(e.data.error||"Failed to get relay status");return e.data.data.client}}const ss=new ZY,Y9=V.createContext(null),$Y=({children:s})=>{const[e,t]=V.useState(null),[r,n]=V.useState(null),[o,a]=V.useState(!0),[c,u]=V.useState(null),d=V.useRef(null),h=V.useCallback(async b=>{qY(b.accessToken,b.refreshToken),d.current=b.accessToken,t(b.user);try{const x=await ss.authGetLicense(b.accessToken);n(x)}catch{}},[]);V.useEffect(()=>{let b=!1;return(async()=>{const D=KY();if(!D){a(!1);return}try{const j=await ss.authGetProfile(D);if(b)return;d.current=D,t(j);try{const S=await ss.authGetLicense(D);b||n(S)}catch{}}catch{const j=XY();if(j&&!b)try{const S=await ss.authRefresh(j);b||await h(S)}catch{Q3()}else Q3()}finally{b||a(!1)}})(),()=>{b=!0}},[h]);const f=V.useCallback(async b=>{u(null);try{await h(b)}catch(x){const D=x instanceof Error?x.message:"Authentication failed";throw u(D),x}},[h]),y=V.useCallback(()=>{u(null),Q3(),d.current=null,t(null),n(null)},[]),v=V.useCallback(()=>d.current,[]),N=V.useCallback(b=>r?r.features.includes(b):!1,[r]),T={isAuthenticated:e!==null,user:e,license:r,isLoading:o,error:c,applyCloudAuth:f,logout:y,getAccessToken:v,hasFeature:N};return i.jsxDEV(Y9.Provider,{value:T,children:s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/contexts/AuthContext.tsx",lineNumber:185,columnNumber:5},globalThis)};function Z9(){const s=V.useContext(Y9);if(!s)throw new Error("useAuth must be used within an AuthProvider");return s}const JY={free:"default",pro:"primary",enterprise:"primary"},QY={free:"Free",pro:"Pro",enterprise:"Enterprise"},$9=({isCollapsed:s=!1})=>{const{isAuthenticated:e,user:t,isLoading:r,logout:n}=Z9();return r?i.jsxDEV("div",{className:"flex items-center px-4 py-2 text-text-secondary-dark",children:[i.jsxDEV(tf,{className:"h-5 w-5 animate-spin flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:63,columnNumber:9},globalThis),!s&&i.jsxDEV("span",{className:"ml-3 text-sm",children:"Loading..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:64,columnNumber:26},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:62,columnNumber:7},globalThis):e&&t?i.jsxDEV("div",{className:"px-2 py-1",children:i.jsxDEV("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-primary/5 border border-primary/20",children:[i.jsxDEV("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsxDEV(Pj,{className:"h-4 w-4 text-primary flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:74,columnNumber:13},globalThis),!s&&i.jsxDEV("div",{className:"min-w-0 flex-1",children:[i.jsxDEV("p",{className:"text-xs font-medium text-text-primary-dark truncate",children:t.displayName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:77,columnNumber:17},globalThis),i.jsxDEV("div",{className:"flex items-center gap-1",children:i.jsxDEV($k,{variant:JY[t.plan],size:"sm",children:QY[t.plan]},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:81,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:80,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:76,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:73,columnNumber:11},globalThis),!s&&i.jsxDEV("button",{onClick:n,className:"text-text-secondary-dark hover:text-red-400 transition-colors p-1",title:"Sign out","aria-label":"Sign out of CrewlyAI Cloud",children:i.jsxDEV(e9,{size:14},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:95,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:89,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:72,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Auth/AuthStatusIndicator.tsx",lineNumber:71,columnNumber:7},globalThis):null};$9.displayName="AuthStatusIndicator";const eZ=[{name:"Dashboard",href:"/",icon:QB},{name:"Chat",href:"/chat",icon:t9},{name:"Teams",href:"/teams",icon:ei},{name:"Projects",href:"/projects",icon:il},{name:"Marketplace",href:"/marketplace",icon:a9}],tZ=({isMobileOpen:s,onMobileClose:e})=>{const t=uf(),{isCollapsed:r,toggleSidebar:n}=JV(),o=()=>{e&&e()},a=t.pathname.match(/\/projects\/([^/]+)/),c=a?a[1]:null,u=(t.hash||"#detail").replace("#","");return i.jsxDEV("div",{className:Zo("flex flex-col h-screen max-h-screen bg-surface-dark/95 border-r border-border-dark overflow-hidden w-full"),children:[i.jsxDEV("div",{className:"flex items-center justify-between p-4 border-b border-border-dark",children:[i.jsxDEV("div",{className:"flex items-center",children:[i.jsxDEV("div",{className:"p-1",children:i.jsxDEV("img",{src:"/logo/crewly-icon.svg",alt:"Crewly",className:"h-8 w-8 invert"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:58,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:57,columnNumber:6},globalThis),(!r||s)&&i.jsxDEV("span",{className:"ml-3 text-2xl font-extrabold text-text-primary-dark font-logo",children:"CREWLY"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:61,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:56,columnNumber:5},globalThis),e&&i.jsxDEV(wc,{variant:"ghost",icon:Tn,onClick:e,className:"md:hidden -mr-2","aria-label":"Close menu"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:67,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:55,columnNumber:4},globalThis),i.jsxDEV("nav",{className:"flex-1 px-2 py-3 overflow-y-auto",children:i.jsxDEV("div",{className:"space-y-2",children:eZ.map(d=>{const h=t.pathname===d.href||d.href!=="/"&&t.pathname.startsWith(d.href);return i.jsxDEV("div",{children:[i.jsxDEV(fm,{to:d.href,onClick:o,className:Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r?"md:justify-center":"",h?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r?d.name:void 0,children:[i.jsxDEV(d.icon,{className:Zo("h-5 w-5 flex-shrink-0",h?"text-primary":"")},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:99,columnNumber:21},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r?"md:hidden":""),children:d.name},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:100,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:87,columnNumber:19},globalThis),(!r||s)&&d.href==="/projects"&&c&&i.jsxDEV("div",{className:"mt-2 ml-4 space-y-1 border-l border-border-dark pl-4",children:[i.jsxDEV(fm,{to:`/projects/${c}#detail`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="detail"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Overview"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:106,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/projects/${c}#editor`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="editor"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Editor"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:120,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/projects/${c}#tasks`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="tasks"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Tasks"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:134,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/projects/${c}#teams`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors",u==="teams"?"text-primary font-medium bg-primary/10":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Teams"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:148,columnNumber:23},globalThis),i.jsxDEV(fm,{to:`/knowledge?project=${c}`,onClick:o,className:()=>Zo("block px-4 py-2 text-sm rounded-lg transition-colors","text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),children:"Knowledge"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:162,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:105,columnNumber:21},globalThis)]},d.name,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:86,columnNumber:17},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:79,columnNumber:5},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:78,columnNumber:13},globalThis),i.jsxDEV("div",{className:"p-2 border-t border-border-dark space-y-1",children:[i.jsxDEV($9,{isCollapsed:r&&!s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:185,columnNumber:5},globalThis),i.jsxDEV(fm,{to:"/security",onClick:o,className:({isActive:d})=>Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r&&!s?"md:justify-center":"",d?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r&&!s?"Security":void 0,children:[i.jsxDEV(aT,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:202,columnNumber:6},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r&&!s?"md:hidden":""),children:"Security"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:203,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:188,columnNumber:5},globalThis),i.jsxDEV(fm,{to:"/scheduled-checkins",onClick:o,className:({isActive:d})=>Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r&&!s?"md:justify-center":"",d?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r&&!s?"Schedules":void 0,children:[i.jsxDEV(eu,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:221,columnNumber:6},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r&&!s?"md:hidden":""),children:"Schedules"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:222,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:207,columnNumber:5},globalThis),i.jsxDEV(fm,{to:"/settings",onClick:o,className:({isActive:d})=>Zo("group flex items-center px-4 py-2 rounded-lg text-sm transition-colors",r&&!s?"md:justify-center":"",d?"bg-primary/10 text-primary font-semibold":"text-text-secondary-dark hover:bg-background-dark hover:text-text-primary-dark"),title:r&&!s?"Settings":void 0,children:[i.jsxDEV(o9,{className:"h-5 w-5 flex-shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:240,columnNumber:6},globalThis),i.jsxDEV("span",{className:Zo("ml-3",r&&!s?"md:hidden":""),children:"Settings"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:241,columnNumber:6},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:226,columnNumber:5},globalThis),i.jsxDEV(WY,{isCollapsed:r&&!s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:245,columnNumber:5},globalThis),i.jsxDEV("button",{className:"flex items-center justify-center w-full p-2 text-text-secondary-dark hover:bg-background-dark/60 hover:text-text-primary-dark rounded-lg transition-colors",onClick:n,"aria-label":r?"Expand sidebar":"Collapse sidebar",children:r?i.jsxDEV(of,{className:"h-5 w-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:254,columnNumber:7},globalThis):i.jsxDEV(i.Fragment,{children:[i.jsxDEV(bX,{className:"h-5 w-5 mr-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:257,columnNumber:8},globalThis),i.jsxDEV("span",{className:"text-sm",children:"Collapse"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:258,columnNumber:8},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:256,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:248,columnNumber:5},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:183,columnNumber:4},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Layout/Navigation.tsx",lineNumber:51,columnNumber:5},globalThis)};var J9={exports:{}};(function(s,e){(function(t,r){s.exports=r()})(self,()=>(()=>{var t={4567:function(a,c,u){var d=this&&this.__decorate||function(j,S,k,U){var F,M=arguments.length,R=M<3?S:U===null?U=Object.getOwnPropertyDescriptor(S,k):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(j,S,k,U);else for(var L=j.length-1;L>=0;L--)(F=j[L])&&(R=(M<3?F(R):M>3?F(S,k,R):F(S,k))||R);return M>3&&R&&Object.defineProperty(S,k,R),R},h=this&&this.__param||function(j,S){return function(k,U){S(k,U,j)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const f=u(9042),y=u(6114),v=u(9924),N=u(844),T=u(5596),b=u(4725),x=u(3656);let D=c.AccessibilityManager=class extends N.Disposable{constructor(j,S){super(),this._terminal=j,this._renderService=S,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let k=0;k<this._terminal.rows;k++)this._rowElements[k]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[k]);if(this._topBoundaryFocusListener=k=>this._handleBoundaryFocus(k,0),this._bottomBoundaryFocusListener=k=>this._handleBoundaryFocus(k,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(k=>this._handleResize(k.rows))),this.register(this._terminal.onRender(k=>this._refreshRows(k.start,k.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(k=>this._handleChar(k))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
247
247
  `))),this.register(this._terminal.onA11yTab(k=>this._handleTab(k))),this.register(this._terminal.onKey(k=>this._handleKey(k.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new T.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,x.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,N.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(j){for(let S=0;S<j;S++)this._handleChar(" ")}_handleChar(j){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==j&&(this._charsToAnnounce+=j):this._charsToAnnounce+=j,j===`
248
248
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)),y.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityContainer.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,y.isMac&&this._liveRegion.remove()}_handleKey(j){this._clearLiveRegion(),/\p{Control}/u.test(j)||this._charsToConsume.push(j)}_refreshRows(j,S){this._liveRegionDebouncer.refresh(j,S,this._terminal.rows)}_renderRows(j,S){const k=this._terminal.buffer,U=k.lines.length.toString();for(let F=j;F<=S;F++){const M=k.translateBufferLineToString(k.ydisp+F,!0),R=(k.ydisp+F+1).toString(),L=this._rowElements[F];L&&(M.length===0?L.innerText=" ":L.textContent=M,L.setAttribute("aria-posinset",R),L.setAttribute("aria-setsize",U))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(j,S){const k=j.target,U=this._rowElements[S===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||j.relatedTarget!==U)return;let F,M;if(S===0?(F=k,M=this._rowElements.pop(),this._rowContainer.removeChild(M)):(F=this._rowElements.shift(),M=k,this._rowContainer.removeChild(F)),F.removeEventListener("focus",this._topBoundaryFocusListener),M.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const R=this._createAccessibilityTreeNode();this._rowElements.unshift(R),this._rowContainer.insertAdjacentElement("afterbegin",R)}else{const R=this._createAccessibilityTreeNode();this._rowElements.push(R),this._rowContainer.appendChild(R)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),j.preventDefault(),j.stopImmediatePropagation()}_handleResize(j){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>j;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const j=document.createElement("div");return j.setAttribute("role","listitem"),j.tabIndex=-1,this._refreshRowDimensions(j),j}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let j=0;j<this._terminal.rows;j++)this._refreshRowDimensions(this._rowElements[j])}}_refreshRowDimensions(j){j.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=D=d([h(1,b.IRenderService)],D)},3614:(a,c)=>{function u(y){return y.replace(/\r?\n/g,"\r")}function d(y,v){return v?"\x1B[200~"+y+"\x1B[201~":y}function h(y,v,N,T){y=d(y=u(y),N.decPrivateModes.bracketedPasteMode&&T.rawOptions.ignoreBracketedPasteMode!==!0),N.triggerDataEvent(y,!0),v.value=""}function f(y,v,N){const T=N.getBoundingClientRect(),b=y.clientX-T.left-10,x=y.clientY-T.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${b}px`,v.style.top=`${x}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=u,c.bracketTextForPaste=d,c.copyHandler=function(y,v){y.clipboardData&&y.clipboardData.setData("text/plain",v.selectionText),y.preventDefault()},c.handlePasteEvent=function(y,v,N,T){y.stopPropagation(),y.clipboardData&&h(y.clipboardData.getData("text/plain"),v,N,T)},c.paste=h,c.moveTextAreaUnderMouseCursor=f,c.rightClickHandler=function(y,v,N,T,b){f(y,v,N),b&&T.rightClickSelect(y),v.value=T.selectionText,v.select()}},7239:(a,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const d=u(1505);c.ColorContrastCache=class{constructor(){this._color=new d.TwoKeyMap,this._css=new d.TwoKeyMap}setCss(h,f,y){this._css.set(h,f,y)}getCss(h,f){return this._css.get(h,f)}setColor(h,f,y){this._color.set(h,f,y)}getColor(h,f){return this._color.get(h,f)}clear(){this._color.clear(),this._css.clear()}}},3656:(a,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(u,d,h,f){u.addEventListener(d,h,f);let y=!1;return{dispose:()=>{y||(y=!0,u.removeEventListener(d,h,f))}}}},6465:function(a,c,u){var d=this&&this.__decorate||function(b,x,D,j){var S,k=arguments.length,U=k<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,D):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(b,x,D,j);else for(var F=b.length-1;F>=0;F--)(S=b[F])&&(U=(k<3?S(U):k>3?S(x,D,U):S(x,D))||U);return k>3&&U&&Object.defineProperty(x,D,U),U},h=this&&this.__param||function(b,x){return function(D,j){x(D,j,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier2=void 0;const f=u(3656),y=u(8460),v=u(844),N=u(2585);let T=c.Linkifier2=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(b){super(),this._bufferService=b,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new y.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new y.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{this._lastMouseEvent=void 0})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0}))}registerLinkProvider(b){return this._linkProviders.push(b),{dispose:()=>{const x=this._linkProviders.indexOf(b);x!==-1&&this._linkProviders.splice(x,1)}}}attachToDom(b,x,D){this._element=b,this._mouseService=x,this._renderService=D,this.register((0,f.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,f.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){if(this._lastMouseEvent=b,!this._element||!this._mouseService)return;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const D=b.composedPath();for(let j=0;j<D.length;j++){const S=D[j];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,x){var D,j;this._activeProviderReplies&&x||((D=this._activeProviderReplies)===null||D===void 0||D.forEach(k=>{k==null||k.forEach(U=>{U.link.dispose&&U.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=b.y);let S=!1;for(const[k,U]of this._linkProviders.entries())x?!((j=this._activeProviderReplies)===null||j===void 0)&&j.get(k)&&(S=this._checkLinkProviderResult(k,b,S)):U.provideLinks(b.y,F=>{var M,R;if(this._isMouseOut)return;const L=F==null?void 0:F.map(B=>({link:B}));(M=this._activeProviderReplies)===null||M===void 0||M.set(k,L),S=this._checkLinkProviderResult(k,b,S),((R=this._activeProviderReplies)===null||R===void 0?void 0:R.size)===this._linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)})}_removeIntersectingLinks(b,x){const D=new Set;for(let j=0;j<x.size;j++){const S=x.get(j);if(S)for(let k=0;k<S.length;k++){const U=S[k],F=U.link.range.start.y<b?0:U.link.range.start.x,M=U.link.range.end.y>b?this._bufferService.cols:U.link.range.end.x;for(let R=F;R<=M;R++){if(D.has(R)){S.splice(k--,1);break}D.add(R)}}}}_checkLinkProviderResult(b,x,D){var j;if(!this._activeProviderReplies)return D;const S=this._activeProviderReplies.get(b);let k=!1;for(let U=0;U<b;U++)this._activeProviderReplies.has(U)&&!this._activeProviderReplies.get(U)||(k=!0);if(!k&&S){const U=S.find(F=>this._linkAtPosition(F.link,x));U&&(D=!0,this._handleNewLink(U))}if(this._activeProviderReplies.size===this._linkProviders.length&&!D)for(let U=0;U<this._activeProviderReplies.size;U++){const F=(j=this._activeProviderReplies.get(U))===null||j===void 0?void 0:j.find(M=>this._linkAtPosition(M.link,x));if(F){D=!0,this._handleNewLink(F);break}}return D}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._element||!this._mouseService||!this._currentLink)return;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,x){this._element&&this._currentLink&&this._lastMouseEvent&&(!b||!x||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(b.link,x)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var D,j;return(j=(D=this._currentLink)===null||D===void 0?void 0:D.state)===null||j===void 0?void 0:j.decorations.pointerCursor},set:D=>{var j,S;!((j=this._currentLink)===null||j===void 0)&&j.state&&this._currentLink.state.decorations.pointerCursor!==D&&(this._currentLink.state.decorations.pointerCursor=D,this._currentLink.state.isHovered&&((S=this._element)===null||S===void 0||S.classList.toggle("xterm-cursor-pointer",D)))}},underline:{get:()=>{var D,j;return(j=(D=this._currentLink)===null||D===void 0?void 0:D.state)===null||j===void 0?void 0:j.decorations.underline},set:D=>{var j,S,k;!((j=this._currentLink)===null||j===void 0)&&j.state&&((k=(S=this._currentLink)===null||S===void 0?void 0:S.state)===null||k===void 0?void 0:k.decorations.underline)!==D&&(this._currentLink.state.decorations.underline=D,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,D))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(D=>{if(!this._currentLink)return;const j=D.start===0?0:D.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+D.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(j,S),this._lastMouseEvent&&this._element)){const k=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);k&&this._askForLink(k,!1)}})))}_linkHover(b,x,D){var j;!((j=this._currentLink)===null||j===void 0)&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(D,x.text)}_fireUnderlineEvent(b,x){const D=b.range,j=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(D.start.x-1,D.start.y-j-1,D.end.x,D.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(b,x,D){var j;!((j=this._currentLink)===null||j===void 0)&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(D,x.text)}_linkAtPosition(b,x){const D=b.range.start.y*this._bufferService.cols+b.range.start.x,j=b.range.end.y*this._bufferService.cols+b.range.end.x,S=x.y*this._bufferService.cols+x.x;return D<=S&&S<=j}_positionFromMouseEvent(b,x,D){const j=D.getCoords(b,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,x,D,j,S){return{x1:b,y1:x,x2:D,y2:j,cols:this._bufferService.cols,fg:S}}};c.Linkifier2=T=d([h(0,N.IBufferService)],T)},9042:(a,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(a,c,u){var d=this&&this.__decorate||function(T,b,x,D){var j,S=arguments.length,k=S<3?b:D===null?D=Object.getOwnPropertyDescriptor(b,x):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(T,b,x,D);else for(var U=T.length-1;U>=0;U--)(j=T[U])&&(k=(S<3?j(k):S>3?j(b,x,k):j(b,x))||k);return S>3&&k&&Object.defineProperty(b,x,k),k},h=this&&this.__param||function(T,b){return function(x,D){b(x,D,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const f=u(511),y=u(2585);let v=c.OscLinkProvider=class{constructor(T,b,x){this._bufferService=T,this._optionsService=b,this._oscLinkService=x}provideLinks(T,b){var x;const D=this._bufferService.buffer.lines.get(T-1);if(!D)return void b(void 0);const j=[],S=this._optionsService.rawOptions.linkHandler,k=new f.CellData,U=D.getTrimmedLength();let F=-1,M=-1,R=!1;for(let L=0;L<U;L++)if(M!==-1||D.hasContent(L)){if(D.loadCell(L,k),k.hasExtendedAttrs()&&k.extended.urlId){if(M===-1){M=L,F=k.extended.urlId;continue}R=k.extended.urlId!==F}else M!==-1&&(R=!0);if(R||M!==-1&&L===U-1){const B=(x=this._oscLinkService.getLinkData(F))===null||x===void 0?void 0:x.uri;if(B){const O={start:{x:M+1,y:T},end:{x:L+(R||L!==U-1?0:1),y:T}};let H=!1;if(!(S!=null&&S.allowNonHttpProtocols))try{const Z=new URL(B);["http:","https:"].includes(Z.protocol)||(H=!0)}catch{H=!0}H||j.push({text:B,range:O,activate:(Z,le)=>S?S.activate(Z,le,O):N(0,le),hover:(Z,le)=>{var te;return(te=S==null?void 0:S.hover)===null||te===void 0?void 0:te.call(S,Z,le,O)},leave:(Z,le)=>{var te;return(te=S==null?void 0:S.leave)===null||te===void 0?void 0:te.call(S,Z,le,O)}})}R=!1,k.hasExtendedAttrs()&&k.extended.urlId?(M=L,F=k.extended.urlId):(M=-1,F=-1)}}b(j)}};function N(T,b){if(confirm(`Do you want to navigate to ${b}?
249
249
 
@@ -5212,4 +5212,4 @@ You are a...`,className:"font-mono text-sm"},void 0,!1,{fileName:"/Users/yellows
5212
5212
  Provide detailed instructions for this skill...`,rows:8,className:"font-mono text-sm"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:797,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:795,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:739,columnNumber:9},globalThis),i.jsxDEV("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-dark bg-background-dark",children:[i.jsxDEV(ur,{variant:"secondary",onClick:t,type:"button",children:"Cancel"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:810,columnNumber:11},globalThis),i.jsxDEV(ur,{type:"submit",onClick:h,disabled:a,loading:a,children:a?"Saving...":"Save Skill"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:813,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:809,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:702,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:698,columnNumber:5},globalThis)},ffe=({skillName:s,onConfirm:e,onCancel:t})=>{const r=n=>{n.target===n.currentTarget&&t()};return i.jsxDEV("div",{className:"fixed inset-0 bg-background-dark/80 backdrop-blur-sm flex items-center justify-center z-50",onClick:r,children:i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-xl shadow-lg w-full max-w-md m-4",onClick:n=>n.stopPropagation(),children:[i.jsxDEV("div",{className:"p-6 border-b border-border-dark",children:i.jsxDEV("h2",{className:"text-xl font-semibold text-text-primary-dark",children:"Delete Skill"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:873,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:872,columnNumber:9},globalThis),i.jsxDEV("div",{className:"p-6",children:i.jsxDEV("p",{className:"text-text-secondary-dark",children:["Are you sure you want to delete ",i.jsxDEV("strong",{className:"text-text-primary-dark",children:s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:879,columnNumber:45},globalThis),"? This action cannot be undone."]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:878,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:877,columnNumber:9},globalThis),i.jsxDEV("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-dark bg-background-dark rounded-b-xl",children:[i.jsxDEV(ur,{variant:"secondary",onClick:t,children:"Cancel"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:886,columnNumber:11},globalThis),i.jsxDEV(ur,{variant:"danger",onClick:e,children:"Delete"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:889,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:885,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:867,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SkillsTab.tsx",lineNumber:863,columnNumber:5},globalThis)},pfe=()=>{const[s,e]=V.useState({connected:!1}),[t,r]=V.useState(!0),[n,o]=V.useState(!1),[a,c]=V.useState(null),[u,d]=V.useState({botToken:"",appToken:"",signingSecret:"",defaultChannel:""}),h=V.useCallback(async()=>{var N,T,b,x,D,j,S;try{c(null);const U=await(await fetch("/api/slack/status")).json();U.success?e({connected:((N=U.data)==null?void 0:N.isConfigured)||!1,workspaceName:(T=U.data)==null?void 0:T.workspaceName,botName:(b=U.data)==null?void 0:b.botName,channels:(x=U.data)==null?void 0:x.channels,lastMessageAt:(D=U.data)==null?void 0:D.lastMessageAt,messagesSent:(j=U.data)==null?void 0:j.messagesSent,messagesReceived:(S=U.data)==null?void 0:S.messagesReceived}):e({connected:!1,error:U.error})}catch{e({connected:!1,error:"Failed to fetch status"})}finally{r(!1)}},[]);V.useEffect(()=>{h()},[h]);const f=N=>{const{name:T,value:b}=N.target;d(x=>({...x,[T]:b}))},y=async N=>{N.preventDefault(),o(!0),c(null);try{const T=await fetch("/api/slack/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:u.botToken,appToken:u.appToken,signingSecret:u.signingSecret,defaultChannelId:u.defaultChannel||void 0})}),b=await T.json();if(!T.ok||!b.success)throw new Error(b.error||"Connection failed");d({botToken:"",appToken:"",signingSecret:"",defaultChannel:""}),await h()}catch(T){c(T instanceof Error?T.message:"Failed to connect to Slack")}finally{o(!1)}},v=async()=>{if(window.confirm("Are you sure you want to disconnect from Slack?"))try{c(null);const N=await fetch("/api/slack/disconnect",{method:"POST"}),T=await N.json();if(!N.ok||!T.success)throw new Error(T.error||"Disconnect failed");await h()}catch(N){c(N instanceof Error?N.message:"Failed to disconnect")}};return t?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-16",children:[i.jsxDEV("div",{className:"w-10 h-10 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:168,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-text-secondary-dark",children:"Loading Slack status..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:169,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:167,columnNumber:7},globalThis):i.jsxDEV("div",{className:"space-y-6 max-w-3xl",children:[i.jsxDEV("div",{children:[i.jsxDEV("h2",{className:"text-xl font-semibold",children:"Slack Integration"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:178,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-1",children:"Connect Slack to communicate with the orchestrator from your phone or desktop Slack app."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:179,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:177,columnNumber:7},globalThis),a&&i.jsxDEV("div",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 px-4 py-3 rounded-lg flex items-center justify-between",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV(vc,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:188,columnNumber:13},globalThis),i.jsxDEV("span",{children:a},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:189,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:187,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:()=>c(null),className:"text-rose-400 hover:text-rose-300 p-1",children:i.jsxDEV(Tn,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:195,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:191,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:186,columnNumber:9},globalThis),s.connected?i.jsxDEV("div",{className:"space-y-6",children:[i.jsxDEV("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(Vl,{className:"w-5 h-5 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:205,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-emerald-400 font-medium",children:"Connected to Slack"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:206,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:204,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-6",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Connection Details"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:211,columnNumber:13},globalThis),i.jsxDEV("div",{className:"space-y-3",children:[s.workspaceName&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Workspace"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:217,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.workspaceName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:218,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:216,columnNumber:17},globalThis),s.botName&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Bot Name"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:223,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.botName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:224,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:222,columnNumber:17},globalThis),s.channels&&s.channels.length>0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Channels"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:229,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.channels.join(", ")},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:230,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:228,columnNumber:17},globalThis),s.messagesSent!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Sent"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:235,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesSent},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:236,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:234,columnNumber:17},globalThis),s.messagesReceived!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Received"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:241,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesReceived},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:242,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:240,columnNumber:17},globalThis),s.lastMessageAt&&i.jsxDEV("div",{className:"flex items-center justify-between py-2",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Last Activity"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:247,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:new Date(s.lastMessageAt).toLocaleString()},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:248,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:246,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:214,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:210,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV(ur,{variant:"secondary",onClick:h,icon:Ca,children:"Refresh Status"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:258,columnNumber:13},globalThis),i.jsxDEV(ur,{variant:"danger",onClick:v,icon:cT,children:"Disconnect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:261,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:257,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:202,columnNumber:9},globalThis):i.jsxDEV("div",{className:"space-y-6",children:[i.jsxDEV("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(vc,{className:"w-5 h-5 text-amber-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:271,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-amber-400 font-medium",children:"Not connected to Slack"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:272,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:270,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-6",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Setup Instructions"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:277,columnNumber:13},globalThis),i.jsxDEV("ol",{className:"list-decimal list-inside space-y-3 text-sm text-text-secondary-dark",children:[i.jsxDEV("li",{children:["Create a Slack App at"," ",i.jsxDEV("a",{href:"https://api.slack.com/apps",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-1",children:["api.slack.com/apps",i.jsxDEV(Nx,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:290,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:283,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:281,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Enable Socket Mode in your app settings and create an App Token (starts with xapp-)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:293,columnNumber:15},globalThis),i.jsxDEV("li",{children:["Add Bot Token Scopes under OAuth & Permissions:",i.jsxDEV("ul",{className:"list-disc list-inside ml-4 mt-1.5 space-y-1",children:[i.jsxDEV("li",{children:[i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"chat:write"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:297,columnNumber:23},globalThis)," - Send messages"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:297,columnNumber:19},globalThis),i.jsxDEV("li",{children:[i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"channels:read"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:298,columnNumber:23},globalThis)," - View channels"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:298,columnNumber:19},globalThis),i.jsxDEV("li",{children:[i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"app_mentions:read"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:299,columnNumber:23},globalThis)," - Respond to mentions"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:299,columnNumber:19},globalThis),i.jsxDEV("li",{children:[i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"im:read"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:300,columnNumber:23},globalThis),", ",i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"im:write"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:300,columnNumber:106},globalThis)," - Direct messages"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:300,columnNumber:19},globalThis),i.jsxDEV("li",{children:[i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"files:read"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:301,columnNumber:23},globalThis)," - Receive images from Slack"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:301,columnNumber:19},globalThis),i.jsxDEV("li",{children:[i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"files:write"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:302,columnNumber:23},globalThis)," - Upload images to Slack"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:302,columnNumber:19},globalThis),i.jsxDEV("li",{children:[i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"reactions:write"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:303,columnNumber:23},globalThis)," - Typing/completion indicators (optional)"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:303,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:296,columnNumber:17},globalThis),i.jsxDEV("p",{className:"text-xs text-amber-400/80 mt-1.5 ml-4",children:["Note: Adding ",i.jsxDEV("code",{className:"text-xs bg-background-dark px-1 py-0.5 rounded",children:"files:read"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:306,columnNumber:32},globalThis)," and ",i.jsxDEV("code",{className:"text-xs bg-background-dark px-1 py-0.5 rounded",children:"files:write"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:306,columnNumber:119},globalThis)," scopes requires reinstalling the app to your workspace."]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:305,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:294,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Install the app to your workspace"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:309,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Copy the Bot Token (xoxb-...), App Token (xapp-...), and Signing Secret"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:310,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:280,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:276,columnNumber:11},globalThis),i.jsxDEV("form",{onSubmit:y,className:"bg-surface-dark border border-border-dark rounded-lg p-6 space-y-4",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Connect to Slack"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:316,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"botToken",required:!0,children:"Bot Token (xoxb-...)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:321,columnNumber:15},globalThis),i.jsxDEV(en,{id:"botToken",name:"botToken",type:"password",value:u.botToken,onChange:f,placeholder:"xoxb-your-bot-token",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:322,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:320,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"appToken",required:!0,children:"App Token (xapp-...)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:335,columnNumber:15},globalThis),i.jsxDEV(en,{id:"appToken",name:"appToken",type:"password",value:u.appToken,onChange:f,placeholder:"xapp-your-app-token",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:336,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:334,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"signingSecret",required:!0,children:"Signing Secret"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:349,columnNumber:15},globalThis),i.jsxDEV(en,{id:"signingSecret",name:"signingSecret",type:"password",value:u.signingSecret,onChange:f,placeholder:"Your signing secret",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:350,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:348,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"defaultChannel",children:"Default Channel (optional)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:363,columnNumber:15},globalThis),i.jsxDEV(en,{id:"defaultChannel",name:"defaultChannel",type:"text",value:u.defaultChannel,onChange:f,placeholder:"C1234567890 or #crewly"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:364,columnNumber:15},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mt-1",children:"Channel ID or name where notifications will be sent by default"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:372,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:362,columnNumber:13},globalThis),i.jsxDEV("div",{className:"pt-2",children:i.jsxDEV(ur,{type:"submit",disabled:n||!u.botToken||!u.appToken||!u.signingSecret,loading:n,fullWidth:!0,children:n?"Connecting...":"Connect to Slack"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:378,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:377,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:315,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:268,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/SlackTab.tsx",lineNumber:175,columnNumber:5},globalThis)},yfe=()=>{const[s,e]=V.useState({connected:!1}),[t,r]=V.useState(!0),[n,o]=V.useState(!1),[a,c]=V.useState(null),u=V.useCallback(async()=>{var f,y,v,N,T,b;try{c(null);const D=await(await fetch("/api/whatsapp/status")).json();D.success?e({connected:((f=D.data)==null?void 0:f.isConfigured)||((y=D.data)==null?void 0:y.connected)||!1,phoneNumber:(v=D.data)==null?void 0:v.phoneNumber,qrCode:(N=D.data)==null?void 0:N.qrCode,messagesSent:(T=D.data)==null?void 0:T.messagesSent,messagesReceived:(b=D.data)==null?void 0:b.messagesReceived}):e({connected:!1,error:D.error})}catch{e({connected:!1,error:"Failed to fetch WhatsApp status"})}finally{r(!1)}},[]);V.useEffect(()=>{u()},[u]);const d=async()=>{var f;o(!0),c(null);try{const y=await fetch("/api/whatsapp/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),v=await y.json();if(!y.ok||!v.success)throw new Error(v.error||"Connection failed");(f=v.data)!=null&&f.qrCode&&e(N=>({...N,qrCode:v.data.qrCode})),await u()}catch(y){c(y instanceof Error?y.message:"Failed to connect WhatsApp")}finally{o(!1)}},h=async()=>{if(window.confirm("Are you sure you want to disconnect from WhatsApp?"))try{c(null);const f=await fetch("/api/whatsapp/disconnect",{method:"POST"}),y=await f.json();if(!f.ok||!y.success)throw new Error(y.error||"Disconnect failed");await u()}catch(f){c(f instanceof Error?f.message:"Failed to disconnect")}};return t?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsxDEV("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:142,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark",children:"Loading WhatsApp status..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:143,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:141,columnNumber:7},globalThis):i.jsxDEV("div",{className:"space-y-5",children:[a&&i.jsxDEV("div",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 px-4 py-3 rounded-lg flex items-center justify-between",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV(vc,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:154,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-sm",children:a},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:155,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:153,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:()=>c(null),className:"text-rose-400 hover:text-rose-300 p-1",children:i.jsxDEV(Tn,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:161,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:157,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:152,columnNumber:9},globalThis),s.connected?i.jsxDEV("div",{className:"space-y-5",children:[i.jsxDEV("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(Vl,{className:"w-5 h-5 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:171,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-emerald-400 font-medium text-sm",children:"Connected to WhatsApp"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:172,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:170,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-background-dark border border-border-dark rounded-lg p-5",children:[i.jsxDEV("h3",{className:"text-xs font-semibold text-text-secondary-dark uppercase tracking-wide mb-3",children:"Connection Details"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:177,columnNumber:13},globalThis),i.jsxDEV("div",{className:"space-y-2",children:[s.phoneNumber&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Phone Number"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:183,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.phoneNumber},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:184,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:182,columnNumber:17},globalThis),s.messagesSent!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Sent"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:189,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesSent},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:190,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:188,columnNumber:17},globalThis),s.messagesReceived!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Received"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:195,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesReceived},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:196,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:194,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:180,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:176,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV(ur,{variant:"secondary",onClick:u,icon:Ca,children:"Refresh Status"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:204,columnNumber:13},globalThis),i.jsxDEV(ur,{variant:"danger",onClick:h,icon:cT,children:"Disconnect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:207,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:203,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:168,columnNumber:9},globalThis):i.jsxDEV("div",{className:"space-y-5",children:s.qrCode?i.jsxDEV("div",{className:"bg-background-dark border border-border-dark rounded-lg p-6 flex flex-col items-center gap-4",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide",children:"Scan QR Code"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:218,columnNumber:15},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark text-center max-w-sm",children:"Open WhatsApp on your phone, go to Settings > Linked Devices > Link a Device, then scan this QR code."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:221,columnNumber:15},globalThis),i.jsxDEV("div",{className:"bg-white p-4 rounded-lg",children:i.jsxDEV("img",{src:`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(s.qrCode)}`,alt:"WhatsApp QR Code",className:"w-48 h-48","data-testid":"whatsapp-qr-code"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:225,columnNumber:17},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:224,columnNumber:15},globalThis),i.jsxDEV(ur,{variant:"secondary",onClick:u,icon:Ca,children:"Refresh QR Code"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:232,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:217,columnNumber:13},globalThis):i.jsxDEV("div",{className:"space-y-4",children:[i.jsxDEV("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(vc,{className:"w-5 h-5 text-amber-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:240,columnNumber:17},globalThis),i.jsxDEV("span",{className:"text-amber-400 font-medium text-sm",children:"Not connected to WhatsApp"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:241,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:239,columnNumber:15},globalThis),i.jsxDEV("div",{className:"bg-background-dark border border-border-dark rounded-lg p-5",children:[i.jsxDEV("h3",{className:"text-xs font-semibold text-text-secondary-dark uppercase tracking-wide mb-3",children:"How to Connect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:246,columnNumber:17},globalThis),i.jsxDEV("ol",{className:"list-decimal list-inside space-y-2 text-sm text-text-secondary-dark",children:[i.jsxDEV("li",{children:'Click "Connect WhatsApp" below to generate a QR code'},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:250,columnNumber:19},globalThis),i.jsxDEV("li",{children:"Open WhatsApp on your phone"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:251,columnNumber:19},globalThis),i.jsxDEV("li",{children:["Go to ",i.jsxDEV("strong",{children:"Settings"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:252,columnNumber:29},globalThis)," > ",i.jsxDEV("strong",{children:"Linked Devices"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:252,columnNumber:60},globalThis)," > ",i.jsxDEV("strong",{children:"Link a Device"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:252,columnNumber:97},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:252,columnNumber:19},globalThis),i.jsxDEV("li",{children:"Scan the QR code displayed here"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:253,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:249,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:245,columnNumber:15},globalThis),i.jsxDEV(ur,{onClick:d,disabled:n,loading:n,icon:KV,fullWidth:!0,children:n?"Initializing...":"Connect WhatsApp"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:257,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:238,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:214,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/WhatsAppTab.tsx",lineNumber:149,columnNumber:5},globalThis)},gfe=()=>{const[s,e]=V.useState({connected:!1}),[t,r]=V.useState(!0),[n,o]=V.useState(!1),[a,c]=V.useState(null),[u,d]=V.useState("pubsub"),[h,f]=V.useState("service_account"),[y,v]=V.useState(""),[N,T]=V.useState(""),[b,x]=V.useState(""),[D,j]=V.useState(""),[S,k]=V.useState(!1),[U,F]=V.useState(null),[M,R]=V.useState(!1),[L,B]=V.useState(null),[O,H]=V.useState(""),[Z,le]=V.useState(""),te=V.useRef(null),ne=V.useCallback(async()=>{var ee;try{c(null);const G=await(await fetch("/api/messengers/status")).json();if(G.success&&Array.isArray(G.data)){const ie=G.data.find(De=>De.platform==="google-chat");if(ie){let De=ie.details||{};if(ie.connected&&((ee=ie.details)==null?void 0:ee.mode)==="pubsub")try{const Re=await(await fetch("/api/messengers/google-chat/status")).json();Re.success&&(De={...De,...Re.data})}catch{}e({connected:ie.connected,mode:De.mode,authMode:De.authMode,serviceAccountEmail:De.serviceAccountEmail,pullActive:De.pullActive,pullPaused:De.pullPaused,subscriptionName:De.subscriptionName,projectId:De.projectId,consecutiveFailures:De.consecutiveFailures,lastPullAt:De.lastPullAt})}}}catch{e({connected:!1,error:"Failed to fetch status"})}finally{r(!1)}},[]);V.useEffect(()=>{ne()},[ne]),V.useEffect(()=>(s.connected&&s.mode==="pubsub"&&(te.current=setInterval(()=>{ne()},1e4)),()=>{te.current&&(clearInterval(te.current),te.current=null)}),[s.connected,s.mode,ne]);const q=async ee=>{ee.preventDefault(),o(!0),c(null);try{let ce;u==="webhook"?ce={webhookUrl:y}:h==="adc"?(ce={authMode:"adc"},u==="pubsub"&&(ce.projectId=b,ce.subscriptionName=D),Z.trim()&&(ce.serviceAccountEmail=Z.trim())):u==="service-account"?ce={serviceAccountKey:N}:ce={serviceAccountKey:N,projectId:b,subscriptionName:D};const G=await fetch("/api/messengers/google-chat/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce)}),ie=await G.json();if(!G.ok||!ie.success)throw new Error(ie.error||"Connection failed");v(""),T(""),x(""),j(""),le(""),await ne()}catch(ce){c(ce instanceof Error?ce.message:"Failed to connect")}finally{o(!1)}},Y=async()=>{if(window.confirm("Are you sure you want to disconnect from Google Chat?"))try{c(null);const ee=await fetch("/api/messengers/google-chat/disconnect",{method:"POST"}),ce=await ee.json();if(!ee.ok||!ce.success)throw new Error(ce.error||"Disconnect failed");await ne()}catch(ee){c(ee instanceof Error?ee.message:"Failed to disconnect")}},X=async()=>{k(!0),F(null);try{const ee=await fetch("/api/messengers/google-chat/pull",{method:"POST"}),ce=await ee.json();if(!ee.ok||!ce.success)throw new Error(ce.error||"Pull failed");const G=ce.messagesReceived||0;F(G>0?`Pulled ${G} message${G!==1?"s":""}`:"No new messages"),await ne()}catch(ee){F(ee instanceof Error?ee.message:"Pull failed")}finally{k(!1)}},z=async()=>{if(O.trim()){R(!0),B(null);try{const ee=await fetch("/api/messengers/google-chat/test-send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({space:O.trim(),text:"Test message from Crewly"})}),ce=await ee.json();if(!ee.ok||!ce.success)throw new Error(ce.error||"Test send failed");B("Message sent successfully")}catch(ee){B(ee instanceof Error?ee.message:"Test send failed")}finally{R(!1)}}},se=ee=>{switch(ee){case"webhook":return"Webhook";case"service-account":return"Service Account";case"pubsub":return"Pub/Sub (Bidirectional)";default:return"Unknown"}},ae=ee=>ee==="adc"?"Application Default Credentials":"Service Account Key",fe=()=>u==="webhook"?!!y:h==="adc"?u==="pubsub"?!!(b&&D):!0:u==="service-account"?!!N:!!(N&&b&&D);return t?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-8",children:[i.jsxDEV("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:305,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark",children:"Loading Google Chat status..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:306,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:304,columnNumber:7},globalThis):i.jsxDEV("div",{className:"space-y-5",children:[a&&i.jsxDEV("div",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 px-4 py-3 rounded-lg flex items-center justify-between",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV(vc,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:317,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-sm",children:a},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:318,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:316,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:()=>c(null),className:"text-rose-400 hover:text-rose-300 p-1",children:i.jsxDEV(Tn,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:321,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:320,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:315,columnNumber:9},globalThis),s.connected?i.jsxDEV("div",{className:"space-y-5",children:[i.jsxDEV("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(Vl,{className:"w-5 h-5 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:330,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-emerald-400 font-medium text-sm",children:"Connected to Google Chat"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:331,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:329,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-background-dark border border-border-dark rounded-lg p-5",children:[i.jsxDEV("h3",{className:"text-xs font-semibold text-text-secondary-dark uppercase tracking-wide mb-3",children:"Connection Details"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:335,columnNumber:13},globalThis),i.jsxDEV("div",{className:"space-y-2",children:[i.jsxDEV("div",{className:"flex items-center justify-between py-2",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Mode"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:340,columnNumber:17},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:se(s.mode)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:341,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:339,columnNumber:15},globalThis),(s.mode==="pubsub"||s.mode==="service-account")&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-t border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Auth"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:345,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:ae(s.authMode)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:346,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:344,columnNumber:17},globalThis),s.serviceAccountEmail&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-t border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Impersonating"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:351,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-mono truncate max-w-[280px]","data-testid":"sa-email-display",children:s.serviceAccountEmail},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:352,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:350,columnNumber:17},globalThis),s.mode==="pubsub"&&i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-t border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Project ID"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:358,columnNumber:21},globalThis),i.jsxDEV("span",{className:"text-sm font-mono",children:s.projectId},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:359,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:357,columnNumber:19},globalThis),i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-t border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Subscription"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:362,columnNumber:21},globalThis),i.jsxDEV("span",{className:"text-sm font-mono text-text-secondary-dark/80 truncate max-w-[240px]",children:s.subscriptionName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:363,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:361,columnNumber:19},globalThis),i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-t border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Pull Loop"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:366,columnNumber:21},globalThis),i.jsxDEV("span",{className:"flex items-center gap-2",children:[i.jsxDEV("span",{className:`w-2 h-2 rounded-full ${s.pullPaused?"bg-amber-400":s.pullActive?"bg-emerald-400 animate-pulse":"bg-gray-500"}`},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:368,columnNumber:23},globalThis),i.jsxDEV("span",{className:`text-sm font-medium ${s.pullPaused?"text-amber-400":s.pullActive?"text-emerald-400":"text-text-secondary-dark"}`,children:s.pullPaused?"Paused (errors)":s.pullActive?"Running":"Stopped"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:369,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:367,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:365,columnNumber:19},globalThis),i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-t border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Last Pull"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:375,columnNumber:21},globalThis),i.jsxDEV("span",{className:"text-sm font-mono","data-testid":"last-pull-at",children:s.lastPullAt?new Date(s.lastPullAt).toLocaleTimeString():"Never"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:376,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:374,columnNumber:19},globalThis),(s.consecutiveFailures??0)>0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-t border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Consecutive Failures"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:382,columnNumber:23},globalThis),i.jsxDEV("span",{className:"text-sm font-medium text-amber-400","data-testid":"consecutive-failures",children:s.consecutiveFailures},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:383,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:381,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:356,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:338,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:334,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex items-center gap-3 flex-wrap",children:[s.mode==="pubsub"&&i.jsxDEV(ur,{variant:"primary",onClick:X,disabled:S,loading:S,icon:WV,"data-testid":"pull-now-btn",children:S?"Pulling...":"Pull Now"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:393,columnNumber:15},globalThis),i.jsxDEV(ur,{variant:"secondary",onClick:ne,icon:Ca,children:"Refresh Status"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:404,columnNumber:13},globalThis),i.jsxDEV(ur,{variant:"danger",onClick:Y,icon:cT,children:"Disconnect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:407,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:391,columnNumber:11},globalThis),U&&i.jsxDEV("div",{className:`text-sm px-3 py-2 rounded-lg ${U.startsWith("Pulled")?"bg-emerald-500/10 text-emerald-400":U==="No new messages"?"bg-blue-500/10 text-blue-400":"bg-rose-500/10 text-rose-400"}`,"data-testid":"pull-result",children:U},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:414,columnNumber:13},globalThis),(s.mode==="pubsub"||s.mode==="service-account")&&i.jsxDEV("div",{className:"bg-background-dark border border-border-dark rounded-lg p-4 space-y-3",children:[i.jsxDEV("h3",{className:"text-xs font-semibold text-text-secondary-dark uppercase tracking-wide",children:"Test Send"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:426,columnNumber:15},globalThis),i.jsxDEV("div",{className:"flex items-end gap-2",children:[i.jsxDEV("div",{className:"flex-1",children:[i.jsxDEV(Ur,{htmlFor:"test-send-space",children:"Space Name"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:429,columnNumber:19},globalThis),i.jsxDEV(en,{id:"test-send-space",name:"testSendSpace",type:"text",value:O,onChange:ee=>H(ee.target.value),placeholder:"spaces/AAAA...",autoComplete:"off","data-testid":"test-send-space"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:430,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:428,columnNumber:17},globalThis),i.jsxDEV(ur,{variant:"primary",onClick:z,disabled:M||!O.trim(),loading:M,icon:n9,"data-testid":"test-send-btn",children:M?"Sending...":"Test Send"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:441,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:427,columnNumber:15},globalThis),L&&i.jsxDEV("div",{className:`text-sm px-3 py-2 rounded-lg ${L==="Message sent successfully"?"bg-emerald-500/10 text-emerald-400":"bg-rose-500/10 text-rose-400"}`,"data-testid":"test-send-result",children:L},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:453,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:425,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:328,columnNumber:9},globalThis):i.jsxDEV("div",{className:"space-y-5",children:[i.jsxDEV("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(vc,{className:"w-5 h-5 text-amber-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:467,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-amber-400 font-medium text-sm",children:"Not connected to Google Chat"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:468,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:466,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex gap-2",children:[i.jsxDEV("button",{className:`px-4 py-2 text-sm rounded-lg border transition-colors ${u==="pubsub"?"bg-primary/10 border-primary text-primary":"bg-surface-dark border-border-dark text-text-secondary-dark hover:text-text-primary-dark"}`,onClick:()=>d("pubsub"),"data-testid":"mode-pubsub",children:"Pub/Sub (Recommended)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:473,columnNumber:13},globalThis),i.jsxDEV("button",{className:`px-4 py-2 text-sm rounded-lg border transition-colors ${u==="webhook"?"bg-primary/10 border-primary text-primary":"bg-surface-dark border-border-dark text-text-secondary-dark hover:text-text-primary-dark"}`,onClick:()=>d("webhook"),"data-testid":"mode-webhook",children:"Webhook"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:484,columnNumber:13},globalThis),i.jsxDEV("button",{className:`px-4 py-2 text-sm rounded-lg border transition-colors ${u==="service-account"?"bg-primary/10 border-primary text-primary":"bg-surface-dark border-border-dark text-text-secondary-dark hover:text-text-primary-dark"}`,onClick:()=>d("service-account"),"data-testid":"mode-service-account",children:"Service Account"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:495,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:472,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-background-dark border border-border-dark rounded-lg p-5",children:[i.jsxDEV("h3",{className:"text-xs font-semibold text-text-secondary-dark uppercase tracking-wide mb-3",children:u==="pubsub"?"Pub/Sub Setup (Bidirectional)":u==="webhook"?"Webhook Setup (Send-only)":"Service Account Setup (Send-only)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:510,columnNumber:13},globalThis),u==="pubsub"?i.jsxDEV("ol",{className:"list-decimal list-inside space-y-2 text-sm text-text-secondary-dark",children:[i.jsxDEV("li",{children:["Go to ",i.jsxDEV("strong",{children:"Google Cloud Console"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:517,columnNumber:27},globalThis)," > ",i.jsxDEV("strong",{children:"APIs & Services"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:517,columnNumber:70},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:517,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Enable the ",i.jsxDEV("strong",{children:"Google Chat API"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:518,columnNumber:32},globalThis)," and ",i.jsxDEV("strong",{children:"Cloud Pub/Sub API"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:518,columnNumber:69},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:518,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Create a ",i.jsxDEV("strong",{children:"Service Account"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:519,columnNumber:30},globalThis)," and download the JSON key"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:519,columnNumber:17},globalThis),i.jsxDEV("li",{children:["In the Chat API settings, create a ",i.jsxDEV("strong",{children:"Chat App"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:520,columnNumber:56},globalThis)," and select ",i.jsxDEV("strong",{children:"Cloud Pub/Sub"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:520,columnNumber:93},globalThis)," as the connection type"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:520,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Enter a ",i.jsxDEV("strong",{children:"Pub/Sub topic name"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:521,columnNumber:29},globalThis)," (e.g., ",i.jsxDEV("code",{className:"bg-surface-dark px-1 rounded",children:"projects/my-project/topics/google-chat-events"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:521,columnNumber:72},globalThis),")"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:521,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Create a ",i.jsxDEV("strong",{children:"Pub/Sub subscription"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:522,columnNumber:30},globalThis)," for that topic (pull mode)"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:522,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Grant the service account ",i.jsxDEV("strong",{children:"Pub/Sub Subscriber"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:523,columnNumber:47},globalThis)," role on the subscription"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:523,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Fill in the details below"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:524,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:516,columnNumber:15},globalThis):u==="webhook"?i.jsxDEV("ol",{className:"list-decimal list-inside space-y-2 text-sm text-text-secondary-dark",children:[i.jsxDEV("li",{children:"Open your Google Chat space"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:528,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Click the space name > ",i.jsxDEV("strong",{children:"Apps & integrations"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:529,columnNumber:47},globalThis)," > ",i.jsxDEV("strong",{children:"Manage webhooks"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:529,columnNumber:89},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:529,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Create a new webhook and copy the URL"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:530,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Paste the webhook URL below"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:531,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:527,columnNumber:15},globalThis):i.jsxDEV("ol",{className:"list-decimal list-inside space-y-2 text-sm text-text-secondary-dark",children:[i.jsxDEV("li",{children:["Go to the ",i.jsxDEV("strong",{children:"Google Cloud Console"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:535,columnNumber:31},globalThis)," > ",i.jsxDEV("strong",{children:"APIs & Services"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:535,columnNumber:74},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:535,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Enable the ",i.jsxDEV("strong",{children:"Google Chat API"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:536,columnNumber:32},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:536,columnNumber:17},globalThis),i.jsxDEV("li",{children:["Create a ",i.jsxDEV("strong",{children:"Service Account"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:537,columnNumber:30},globalThis)," and download the JSON key"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:537,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Grant the service account access to your Chat space"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:538,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Paste the JSON key contents below"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:539,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:534,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:509,columnNumber:11},globalThis),i.jsxDEV("form",{onSubmit:q,className:"space-y-4",children:[u==="webhook"?i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"gchat-webhook",required:!0,children:"Webhook URL"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:548,columnNumber:17},globalThis),i.jsxDEV(en,{id:"gchat-webhook",name:"webhookUrl",type:"url",value:y,onChange:ee=>v(ee.target.value),placeholder:"https://chat.googleapis.com/v1/spaces/...",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:549,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:547,columnNumber:15},globalThis):i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{children:[i.jsxDEV(Ur,{children:"Authentication Method"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:564,columnNumber:19},globalThis),i.jsxDEV("div",{className:"flex gap-2 mt-1",children:[i.jsxDEV("button",{type:"button",className:`px-3 py-1.5 text-xs rounded-lg border transition-colors ${h==="service_account"?"bg-primary/10 border-primary text-primary":"bg-surface-dark border-border-dark text-text-secondary-dark hover:text-text-primary-dark"}`,onClick:()=>f("service_account"),"data-testid":"auth-service-account",children:"Service Account Key"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:566,columnNumber:21},globalThis),i.jsxDEV("button",{type:"button",className:`px-3 py-1.5 text-xs rounded-lg border transition-colors ${h==="adc"?"bg-primary/10 border-primary text-primary":"bg-surface-dark border-border-dark text-text-secondary-dark hover:text-text-primary-dark"}`,onClick:()=>f("adc"),"data-testid":"auth-adc",children:"Application Default Credentials"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:578,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:565,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:563,columnNumber:17},globalThis),u==="pubsub"&&i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"gchat-project-id",required:!0,children:"GCP Project ID"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:596,columnNumber:23},globalThis),i.jsxDEV(en,{id:"gchat-project-id",name:"projectId",type:"text",value:b,onChange:ee=>x(ee.target.value),placeholder:"my-gcp-project-id",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:597,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:595,columnNumber:21},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"gchat-subscription",required:!0,children:"Pub/Sub Subscription Name"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:609,columnNumber:23},globalThis),i.jsxDEV(en,{id:"gchat-subscription",name:"subscriptionName",type:"text",value:D,onChange:ee=>j(ee.target.value),placeholder:"google-chat-events-sub",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:610,columnNumber:23},globalThis),i.jsxDEV("p",{className:"mt-1 text-xs text-text-secondary-dark/70",children:"Just the subscription name, not the full resource path"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:620,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:608,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:594,columnNumber:19},globalThis),h==="adc"?i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{className:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-4",children:[i.jsxDEV("p",{className:"text-sm text-blue-300 mb-2",children:"Using Application Default Credentials from your local gcloud CLI."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:630,columnNumber:23},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mb-2",children:"Run this command if you haven't already:"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:633,columnNumber:23},globalThis),i.jsxDEV("code",{className:"block bg-background-dark px-3 py-2 rounded text-xs text-text-primary-dark font-mono break-all",children:"gcloud auth application-default login --scopes=https://www.googleapis.com/auth/chat.bot,https://www.googleapis.com/auth/pubsub,https://www.googleapis.com/auth/cloud-platform"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:636,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:629,columnNumber:21},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"gchat-sa-email",children:"Service Account Email (for impersonation)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:641,columnNumber:23},globalThis),i.jsxDEV(en,{id:"gchat-sa-email",name:"serviceAccountEmail",type:"email",value:Z,onChange:ee=>le(ee.target.value),placeholder:"chatbot@project.iam.gserviceaccount.com",autoComplete:"off","data-testid":"sa-email-input"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:642,columnNumber:23},globalThis),i.jsxDEV("p",{className:"mt-1 text-xs text-text-secondary-dark/70",children:"Required for sending messages. Your user needs the Service Account Token Creator IAM role."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:652,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:640,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:628,columnNumber:19},globalThis):i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"gchat-sa-key",required:!0,children:"Service Account Key (JSON)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:659,columnNumber:21},globalThis),i.jsxDEV("textarea",{id:"gchat-sa-key",name:"serviceAccountKey",value:N,onChange:ee=>T(ee.target.value),placeholder:'{"type": "service_account", "project_id": "...", ...}',required:!0,rows:6,className:"w-full px-3 py-2 bg-background-dark border border-border-dark rounded-lg text-sm text-text-primary-dark placeholder:text-text-secondary-dark/50 focus:outline-none focus:ring-2 focus:ring-primary/50 font-mono"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:660,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:658,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:561,columnNumber:15},globalThis),i.jsxDEV(ur,{type:"submit",disabled:n||!fe(),loading:n,fullWidth:!0,children:n?"Connecting...":"Connect Google Chat"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:675,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:545,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:465,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/GoogleChatTab.tsx",lineNumber:312,columnNumber:5},globalThis)},bfe="/api/messengers/status",vfe="/api/messengers/telegram/connect",wfe="/api/messengers/telegram/disconnect",xfe=()=>{const[s,e]=V.useState({connected:!1}),[t,r]=V.useState(!0),[n,o]=V.useState(!1),[a,c]=V.useState(null),[u,d]=V.useState({botToken:"",allowedChats:""}),h=V.useCallback(async()=>{var N,T,b,x;try{c(null);const j=await(await fetch(bfe)).json();if(j.success&&Array.isArray(j.data)){const S=j.data.find(k=>k.platform==="telegram");e(S?{connected:S.connected,botName:(N=S.details)==null?void 0:N.botName,botId:(T=S.details)==null?void 0:T.botId,messagesSent:(b=S.details)==null?void 0:b.messagesSent,messagesReceived:(x=S.details)==null?void 0:x.messagesReceived}:{connected:!1})}else e({connected:!1,error:j.error||"Failed to fetch status"})}catch{e({connected:!1,error:"Failed to fetch status"})}finally{r(!1)}},[]);V.useEffect(()=>{h()},[h]);const f=N=>{const{name:T,value:b}=N.target;d(x=>({...x,[T]:b}))},y=async N=>{N.preventDefault(),o(!0),c(null);try{const T={token:u.botToken};u.allowedChats.trim()&&(T.allowedChats=u.allowedChats.split(",").map(D=>D.trim()).filter(Boolean));const b=await fetch(vfe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),x=await b.json();if(!b.ok||!x.success)throw new Error(x.error||"Connection failed");d({botToken:"",allowedChats:""}),await h()}catch(T){c(T instanceof Error?T.message:"Failed to connect to Telegram")}finally{o(!1)}},v=async()=>{if(window.confirm("Are you sure you want to disconnect from Telegram?"))try{c(null);const N=await fetch(wfe,{method:"POST"}),T=await N.json();if(!N.ok||!T.success)throw new Error(T.error||"Disconnect failed");await h()}catch(N){c(N instanceof Error?N.message:"Failed to disconnect")}};return t?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-16",children:[i.jsxDEV("div",{className:"w-10 h-10 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:184,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-text-secondary-dark",children:"Loading Telegram status..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:185,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:183,columnNumber:7},globalThis):i.jsxDEV("div",{className:"space-y-6 max-w-3xl",children:[i.jsxDEV("div",{children:[i.jsxDEV("h2",{className:"text-xl font-semibold",children:"Telegram Integration"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:194,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-1",children:"Connect a Telegram bot to communicate with the orchestrator via Telegram."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:195,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:193,columnNumber:7},globalThis),a&&i.jsxDEV("div",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 px-4 py-3 rounded-lg flex items-center justify-between",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV(vc,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:204,columnNumber:13},globalThis),i.jsxDEV("span",{children:a},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:205,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:203,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:()=>c(null),className:"text-rose-400 hover:text-rose-300 p-1","aria-label":"×",children:i.jsxDEV(Tn,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:208,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:207,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:202,columnNumber:9},globalThis),s.connected?i.jsxDEV("div",{className:"space-y-6",children:[i.jsxDEV("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(Vl,{className:"w-5 h-5 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:217,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-emerald-400 font-medium",children:"Connected to Telegram"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:218,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:216,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-6",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Connection Details"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:222,columnNumber:13},globalThis),i.jsxDEV("div",{className:"space-y-3",children:[s.botName&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Bot Name"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:228,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.botName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:229,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:227,columnNumber:17},globalThis),s.botId&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Bot ID"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:234,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.botId},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:235,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:233,columnNumber:17},globalThis),s.messagesSent!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Sent"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:240,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesSent},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:241,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:239,columnNumber:17},globalThis),s.messagesReceived!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Received"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:246,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesReceived},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:247,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:245,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:225,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:221,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV(ur,{variant:"secondary",onClick:h,icon:Ca,children:"Refresh Status"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:254,columnNumber:13},globalThis),i.jsxDEV(ur,{variant:"danger",onClick:v,icon:cT,children:"Disconnect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:257,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:253,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:215,columnNumber:9},globalThis):i.jsxDEV("div",{className:"space-y-6",children:[i.jsxDEV("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(vc,{className:"w-5 h-5 text-amber-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:266,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-amber-400 font-medium",children:"Not connected to Telegram"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:267,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:265,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-6",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Setup Instructions"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:271,columnNumber:13},globalThis),i.jsxDEV("ol",{className:"list-decimal list-inside space-y-3 text-sm text-text-secondary-dark",children:[i.jsxDEV("li",{children:["Open Telegram and search for"," ",i.jsxDEV("a",{href:"https://t.me/BotFather",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-1",children:["@BotFather",i.jsxDEV(Nx,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:284,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:277,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:275,columnNumber:15},globalThis),i.jsxDEV("li",{children:["Send ",i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"/newbot"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:288,columnNumber:22},globalThis)," and follow the prompts to create a bot"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:287,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Copy the HTTP API token provided by BotFather"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:290,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Paste the token below and click Connect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:291,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:274,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:270,columnNumber:11},globalThis),i.jsxDEV("form",{onSubmit:y,className:"bg-surface-dark border border-border-dark rounded-lg p-6 space-y-4",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Connect to Telegram"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:296,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"botToken",required:!0,children:"Bot Token"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:301,columnNumber:15},globalThis),i.jsxDEV(en,{id:"botToken",name:"botToken",type:"password",value:u.botToken,onChange:f,placeholder:"123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:302,columnNumber:15},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mt-1",children:"The HTTP API token from @BotFather"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:312,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:300,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"allowedChats",children:"Allowed Chats (optional)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:318,columnNumber:15},globalThis),i.jsxDEV(en,{id:"allowedChats",name:"allowedChats",type:"text",value:u.allowedChats,onChange:f,placeholder:"-1001234567890, -1009876543210"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:319,columnNumber:15},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mt-1",children:"Comma-separated chat IDs to restrict the bot to specific groups"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:327,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:317,columnNumber:13},globalThis),i.jsxDEV("div",{className:"pt-2",children:i.jsxDEV(ur,{type:"submit",disabled:n||!u.botToken,loading:n,fullWidth:!0,children:n?"Connecting...":"Connect to Telegram"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:333,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:332,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:295,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:264,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/TelegramTab.tsx",lineNumber:191,columnNumber:5},globalThis)},Nfe="/api/messengers/status",Dfe="/api/messengers/discord/connect",jfe="/api/messengers/discord/disconnect",Tfe=()=>{const[s,e]=V.useState({connected:!1}),[t,r]=V.useState(!0),[n,o]=V.useState(!1),[a,c]=V.useState(null),[u,d]=V.useState({token:"",allowedChannels:""}),h=V.useCallback(async()=>{var N,T,b,x;try{c(null);const j=await(await fetch(Nfe)).json();if(j.success&&Array.isArray(j.data)){const S=j.data.find(k=>k.platform==="discord");e(S?{connected:S.connected,botName:(N=S.details)==null?void 0:N.botName,botId:(T=S.details)==null?void 0:T.botId,messagesSent:(b=S.details)==null?void 0:b.messagesSent,messagesReceived:(x=S.details)==null?void 0:x.messagesReceived}:{connected:!1})}else e({connected:!1,error:j.error||"Failed to fetch status"})}catch{e({connected:!1,error:"Failed to fetch status"})}finally{r(!1)}},[]);V.useEffect(()=>{h()},[h]);const f=N=>{const{name:T,value:b}=N.target;d(x=>({...x,[T]:b}))},y=async N=>{N.preventDefault(),o(!0),c(null);try{const T={token:u.token};u.allowedChannels.trim()&&(T.allowedChannels=u.allowedChannels.split(",").map(D=>D.trim()).filter(Boolean));const b=await fetch(Dfe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),x=await b.json();if(!b.ok||!x.success)throw new Error(x.error||"Connection failed");d({token:"",allowedChannels:""}),await h()}catch(T){c(T instanceof Error?T.message:"Failed to connect to Discord")}finally{o(!1)}},v=async()=>{if(window.confirm("Are you sure you want to disconnect from Discord?"))try{c(null);const N=await fetch(jfe,{method:"POST"}),T=await N.json();if(!N.ok||!T.success)throw new Error(T.error||"Disconnect failed");await h()}catch(N){c(N instanceof Error?N.message:"Failed to disconnect")}};return t?i.jsxDEV("div",{className:"flex flex-col items-center justify-center py-16",children:[i.jsxDEV("div",{className:"w-10 h-10 border-4 border-primary/20 border-t-primary rounded-full animate-spin mb-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:184,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-text-secondary-dark",children:"Loading Discord status..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:185,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:183,columnNumber:7},globalThis):i.jsxDEV("div",{className:"space-y-6 max-w-3xl",children:[i.jsxDEV("div",{children:[i.jsxDEV("h2",{className:"text-xl font-semibold",children:"Discord Integration"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:194,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-1",children:"Connect a Discord bot to communicate with the orchestrator via your Discord server."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:195,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:193,columnNumber:7},globalThis),a&&i.jsxDEV("div",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 px-4 py-3 rounded-lg flex items-center justify-between",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV(vc,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:204,columnNumber:13},globalThis),i.jsxDEV("span",{children:a},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:205,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:203,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:()=>c(null),className:"text-rose-400 hover:text-rose-300 p-1","aria-label":"×",children:i.jsxDEV(Tn,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:208,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:207,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:202,columnNumber:9},globalThis),s.connected?i.jsxDEV("div",{className:"space-y-6",children:[i.jsxDEV("div",{className:"bg-emerald-500/10 border border-emerald-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(Vl,{className:"w-5 h-5 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:217,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-emerald-400 font-medium",children:"Connected to Discord"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:218,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:216,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-6",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Connection Details"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:222,columnNumber:13},globalThis),i.jsxDEV("div",{className:"space-y-3",children:[s.botName&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Bot Name"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:228,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.botName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:229,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:227,columnNumber:17},globalThis),s.botId&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Bot ID"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:234,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.botId},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:235,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:233,columnNumber:17},globalThis),s.messagesSent!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2 border-b border-border-dark",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Sent"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:240,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesSent},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:241,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:239,columnNumber:17},globalThis),s.messagesReceived!==void 0&&i.jsxDEV("div",{className:"flex items-center justify-between py-2",children:[i.jsxDEV("span",{className:"text-sm text-text-secondary-dark",children:"Messages Received"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:246,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-sm font-medium",children:s.messagesReceived},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:247,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:245,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:225,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:221,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV(ur,{variant:"secondary",onClick:h,icon:Ca,children:"Refresh Status"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:254,columnNumber:13},globalThis),i.jsxDEV(ur,{variant:"danger",onClick:v,icon:cT,children:"Disconnect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:257,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:253,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:215,columnNumber:9},globalThis):i.jsxDEV("div",{className:"space-y-6",children:[i.jsxDEV("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsxDEV(vc,{className:"w-5 h-5 text-amber-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:266,columnNumber:13},globalThis),i.jsxDEV("span",{className:"text-amber-400 font-medium",children:"Not connected to Discord"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:267,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:265,columnNumber:11},globalThis),i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-6",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Setup Instructions"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:271,columnNumber:13},globalThis),i.jsxDEV("ol",{className:"list-decimal list-inside space-y-3 text-sm text-text-secondary-dark",children:[i.jsxDEV("li",{children:["Go to the"," ",i.jsxDEV("a",{href:"https://discord.com/developers/applications",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-1",children:["Discord Developer Portal",i.jsxDEV(Nx,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:284,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:277,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:275,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Create a New Application and navigate to the Bot section"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:287,columnNumber:15},globalThis),i.jsxDEV("li",{children:'Click "Reset Token" to generate a bot token and copy it'},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:288,columnNumber:15},globalThis),i.jsxDEV("li",{children:["Under OAuth2 → URL Generator, select the"," ",i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"bot"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:291,columnNumber:17},globalThis)," scope and grant permissions:",i.jsxDEV("ul",{className:"list-disc list-inside ml-4 mt-1.5 space-y-1",children:[i.jsxDEV("li",{children:i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"Send Messages"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:293,columnNumber:23},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:293,columnNumber:19},globalThis),i.jsxDEV("li",{children:i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"Read Message History"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:294,columnNumber:23},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:294,columnNumber:19},globalThis),i.jsxDEV("li",{children:i.jsxDEV("code",{className:"text-xs bg-background-dark px-1.5 py-0.5 rounded",children:"Add Reactions"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:295,columnNumber:23},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:295,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:292,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:289,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Use the generated URL to invite the bot to your server"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:298,columnNumber:15},globalThis),i.jsxDEV("li",{children:"Paste the bot token below and click Connect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:299,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:274,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:270,columnNumber:11},globalThis),i.jsxDEV("form",{onSubmit:y,className:"bg-surface-dark border border-border-dark rounded-lg p-6 space-y-4",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-secondary-dark uppercase tracking-wide mb-4",children:"Connect to Discord"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:304,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"token",required:!0,children:"Bot Token"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:309,columnNumber:15},globalThis),i.jsxDEV(en,{id:"token",name:"token",type:"password",value:u.token,onChange:f,placeholder:"MTEyMzQ1Njc4OTAxMjM0NTY3OC...",required:!0,autoComplete:"off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:310,columnNumber:15},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mt-1",children:"The bot token from Discord Developer Portal"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:320,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:308,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV(Ur,{htmlFor:"allowedChannels",children:"Allowed Channels (optional)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:326,columnNumber:15},globalThis),i.jsxDEV(en,{id:"allowedChannels",name:"allowedChannels",type:"text",value:u.allowedChannels,onChange:f,placeholder:"1234567890123456789, 9876543210987654321"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:327,columnNumber:15},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mt-1",children:"Comma-separated channel IDs to restrict the bot to specific channels"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:335,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:325,columnNumber:13},globalThis),i.jsxDEV("div",{className:"pt-2",children:i.jsxDEV(ur,{type:"submit",disabled:n||!u.token,loading:n,fullWidth:!0,children:n?"Connecting...":"Connect to Discord"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:341,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:340,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:303,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:264,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/DiscordTab.tsx",lineNumber:191,columnNumber:5},globalThis)},Sfe=[{id:"slack",name:"Slack",description:"Connect your Slack workspace for team communication with the orchestrator.",icon:TX,available:!0,component:pfe},{id:"whatsapp",name:"WhatsApp",description:"Connect via WhatsApp Web to communicate with the orchestrator from your phone.",icon:IX,available:!0,component:yfe},{id:"discord",name:"Discord",description:"Connect a Discord bot to communicate with the orchestrator via Discord server.",icon:kX,available:!0,component:Tfe},{id:"telegram",name:"Telegram",description:"Connect a Telegram bot for messaging the orchestrator via Telegram.",icon:n9,available:!0,component:xfe},{id:"google-chat",name:"Google Chat",description:"Connect Google Chat for workspace communication with the orchestrator.",icon:t9,available:!0,component:gfe}],Efe=()=>{const[s,e]=V.useState(null),t=r=>{e(n=>n===r?null:r)};return i.jsxDEV("div",{className:"space-y-6 max-w-3xl",children:[i.jsxDEV("div",{children:[i.jsxDEV("h2",{className:"text-xl font-semibold",children:"Messaging Integrations"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:123,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-1",children:"Connect messaging platforms to communicate with the orchestrator from anywhere."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:124,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:122,columnNumber:7},globalThis),i.jsxDEV("div",{className:"space-y-3",children:Sfe.map(r=>{const n=s===r.id,o=r.icon;return i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg overflow-hidden","data-testid":`platform-card-${r.id}`,children:[i.jsxDEV("button",{className:`w-full flex items-center gap-4 p-4 text-left transition-colors ${r.available?"hover:bg-background-dark cursor-pointer":"opacity-60 cursor-default"}`,onClick:()=>r.available&&t(r.id),disabled:!r.available,"data-testid":`platform-toggle-${r.id}`,children:[i.jsxDEV("div",{className:"flex items-center justify-center w-10 h-10 rounded-lg bg-background-dark border border-border-dark",children:i.jsxDEV(o,{className:"w-5 h-5 text-text-secondary-dark"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:153,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:152,columnNumber:17},globalThis),i.jsxDEV("div",{className:"flex-1 min-w-0",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("span",{className:"text-sm font-semibold",children:r.name},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:158,columnNumber:21},globalThis),!r.available&&i.jsxDEV("span",{className:"text-xs px-2 py-0.5 rounded-full bg-background-dark text-text-secondary-dark border border-border-dark",children:"Coming Soon"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:160,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:157,columnNumber:19},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mt-0.5 truncate",children:r.description},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:165,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:156,columnNumber:17},globalThis),r.available&&i.jsxDEV("div",{className:"text-text-secondary-dark",children:n?i.jsxDEV(df,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:173,columnNumber:23},globalThis):i.jsxDEV(of,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:175,columnNumber:23},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:171,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:142,columnNumber:15},globalThis),n&&r.component&&i.jsxDEV("div",{className:"border-t border-border-dark p-6","data-testid":`platform-content-${r.id}`,children:i.jsxDEV(r.component,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:184,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:183,columnNumber:17},globalThis)]},r.id,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:136,columnNumber:13},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:130,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/IntegrationsTab.tsx",lineNumber:120,columnNumber:5},globalThis)},CR={gemini:"Google Gemini",anthropic:"Anthropic",openai:"OpenAI"},xB={gemini:"GOOGLE_GENERATIVE_AI_API_KEY",anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY"},_fe=2e3,kfe=()=>{const{settings:s,updateSettings:e,isLoading:t,error:r}=kF(),[n,o]=V.useState({global:{},runtimeOverrides:{},skillOverrides:{}}),[a,c]=V.useState(!1),[u,d]=V.useState("idle"),[h,f]=V.useState(null),[y,v]=V.useState({}),[N,T]=V.useState({}),[b,x]=V.useState({}),[D,j]=V.useState({});V.useEffect(()=>{s!=null&&s.apiKeys&&(o(s.apiKeys),c(!1))},[s]);const S=V.useCallback((B,O)=>{o(H=>({...H,global:{...H.global,[B]:O}})),c(!0),d("idle"),T(H=>({...H,[`global-${B}`]:"idle"}))},[]),k=V.useCallback((B,O,H,Z)=>{o(le=>{var q,Y,X;const ne={...((Y=(q=le.runtimeOverrides)==null?void 0:q[B])==null?void 0:Y[O])??{key:"",source:"global"},[H]:Z};return{...le,runtimeOverrides:{...le.runtimeOverrides,[B]:{...(X=le.runtimeOverrides)==null?void 0:X[B],[O]:ne}}}}),c(!0),d("idle")},[]),U=async()=>{d("saving"),f(null);try{await e({apiKeys:n}),d("saved"),c(!1),setTimeout(()=>d("idle"),_fe)}catch(B){d("error"),f(B instanceof Error?B.message:"Failed to save")}},F=async(B,O,H)=>{if(!(!O||O.startsWith("••••"))){T(Z=>({...Z,[H]:"testing"})),x(Z=>({...Z,[H]:""}));try{const Z=await Y0.testApiKey(B,O);T(le=>({...le,[H]:Z.valid?"valid":"invalid"})),!Z.valid&&Z.error&&x(le=>({...le,[H]:Z.error}))}catch{T(Z=>({...Z,[H]:"invalid"})),x(Z=>({...Z,[H]:"Connection failed"}))}}},M=B=>{v(O=>({...O,[B]:!O[B]}))},R=B=>{j(O=>({...O,[B]:!O[B]}))},L=(B,O)=>{const H=N[O];return H==="testing"?i.jsxDEV("span",{className:"text-xs text-text-secondary-dark animate-pulse",children:"Testing..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:176,columnNumber:14},globalThis):H==="valid"?i.jsxDEV("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[i.jsxDEV(Mi,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:179,columnNumber:79},globalThis)," Valid"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:179,columnNumber:14},globalThis):H==="invalid"?i.jsxDEV("span",{className:"flex items-center gap-1 text-xs text-red-400",children:[i.jsxDEV(Rl,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:182,columnNumber:77},globalThis)," ",b[O]||"Invalid"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:182,columnNumber:14},globalThis):B&&!B.startsWith("••••")?i.jsxDEV("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[i.jsxDEV(Mi,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:185,columnNumber:79},globalThis)," Configured"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:185,columnNumber:14},globalThis):B&&B.startsWith("••••")?i.jsxDEV("span",{className:"flex items-center gap-1 text-xs text-blue-400",children:[i.jsxDEV(BR,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:188,columnNumber:78},globalThis)," Saved"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:188,columnNumber:14},globalThis):i.jsxDEV("span",{className:"flex items-center gap-1 text-xs text-text-secondary-dark",children:[i.jsxDEV(Rl,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:190,columnNumber:87},globalThis)," Not set"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:190,columnNumber:12},globalThis)};return t?i.jsxDEV("div",{className:"text-text-secondary-dark",children:"Loading settings..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:194,columnNumber:12},globalThis):r?i.jsxDEV("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-4",children:i.jsxDEV("p",{className:"text-red-400",children:r},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:200,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:199,columnNumber:7},globalThis):i.jsxDEV("div",{className:"space-y-8",children:[i.jsxDEV("div",{className:"flex items-center justify-between",children:[i.jsxDEV("div",{children:[i.jsxDEV("h2",{className:"text-xl font-semibold",children:"API Keys"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:210,columnNumber:11},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-1",children:"Configure AI provider API keys. Keys are encrypted at rest and never logged."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:211,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:209,columnNumber:9},globalThis),i.jsxDEV("div",{className:"flex gap-2",children:i.jsxDEV(ur,{variant:"secondary",size:"sm",onClick:U,disabled:!a||u==="saving",children:u==="saving"?i.jsxDEV(i.Fragment,{children:[i.jsxDEV(XV,{className:"w-4 h-4 animate-spin"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:223,columnNumber:17},globalThis)," Saving..."]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:223,columnNumber:15},globalThis):u==="saved"?i.jsxDEV(i.Fragment,{children:[i.jsxDEV(Mi,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:225,columnNumber:17},globalThis)," Saved"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:225,columnNumber:15},globalThis):i.jsxDEV(i.Fragment,{children:[i.jsxDEV(iT,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:227,columnNumber:17},globalThis)," Save Changes"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:227,columnNumber:15},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:216,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:215,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:208,columnNumber:7},globalThis),u==="error"&&h&&i.jsxDEV("div",{className:"bg-red-900/20 border border-red-800 rounded-lg p-3",children:i.jsxDEV("p",{className:"text-sm text-red-400",children:h},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:235,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:234,columnNumber:9},globalThis),i.jsxDEV("section",{className:"bg-surface-dark rounded-lg border border-border-dark p-6",children:[i.jsxDEV("div",{className:"flex items-center gap-2 mb-4",children:[i.jsxDEV(BR,{className:"w-5 h-5 text-primary"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:242,columnNumber:11},globalThis),i.jsxDEV("h3",{className:"text-lg font-medium",children:"Global API Keys"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:243,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:241,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mb-6",children:"These keys are used system-wide as defaults. Runtimes and skills can override them with their own keys."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:245,columnNumber:9},globalThis),i.jsxDEV("div",{className:"space-y-5",children:vP.map(B=>{const O=n.global[B]||"",H=`global-${B}`,Z=y[H];return i.jsxDEV("div",{className:"space-y-1",children:[i.jsxDEV("div",{className:"flex items-center justify-between",children:[i.jsxDEV(Ur,{htmlFor:`global-${B}`,children:CR[B]},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:258,columnNumber:19},globalThis),L(O,H)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:257,columnNumber:17},globalThis),i.jsxDEV("div",{className:"flex gap-2",children:[i.jsxDEV("div",{className:"relative flex-1",children:[i.jsxDEV(en,{id:`global-${B}`,type:Z?"text":"password",value:O,onChange:le=>S(B,le.target.value),placeholder:`Enter ${xB[B]}`,className:"pr-10 font-mono text-sm"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:265,columnNumber:21},globalThis),i.jsxDEV("button",{type:"button",onClick:()=>M(H),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary-dark hover:text-text-primary-dark","aria-label":Z?"Hide key":"Show key",children:Z?i.jsxDEV(IL,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:279,columnNumber:36},globalThis):i.jsxDEV(OR,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:279,columnNumber:69},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:273,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:264,columnNumber:19},globalThis),i.jsxDEV(ur,{variant:"secondary",size:"sm",onClick:()=>F(B,O,H),disabled:!O||O.startsWith("••••")||N[H]==="testing",children:[i.jsxDEV(Nj,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:288,columnNumber:21},globalThis),"Test"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:282,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:263,columnNumber:17},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark",children:["Env var: ",i.jsxDEV("code",{className:"bg-surface-dark px-1 rounded",children:xB[B]},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:293,columnNumber:28},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:292,columnNumber:17},globalThis)]},B,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:256,columnNumber:15},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:249,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:240,columnNumber:7},globalThis),i.jsxDEV("section",{className:"bg-surface-dark rounded-lg border border-border-dark p-6",children:[i.jsxDEV("div",{className:"flex items-center gap-2 mb-4",children:[i.jsxDEV(Nj,{className:"w-5 h-5 text-primary"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:304,columnNumber:11},globalThis),i.jsxDEV("h3",{className:"text-lg font-medium",children:"Runtime Overrides"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:305,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:303,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mb-4",children:"Override global keys for specific AI runtimes. By default, runtimes use the global key."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:307,columnNumber:9},globalThis),i.jsxDEV("div",{className:"space-y-2",children:R6.map(B=>{const O=D[B];return i.jsxDEV("div",{className:"border border-border-dark rounded-lg",children:[i.jsxDEV("button",{type:"button",onClick:()=>R(B),className:"w-full flex items-center justify-between px-4 py-3 text-sm font-medium hover:bg-surface-dark/50 rounded-lg",children:[i.jsxDEV("span",{children:Dj[B]},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:322,columnNumber:19},globalThis),O?i.jsxDEV(df,{className:"w-4 h-4 text-text-secondary-dark"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:324,columnNumber:21},globalThis):i.jsxDEV(of,{className:"w-4 h-4 text-text-secondary-dark"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:326,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:317,columnNumber:17},globalThis),O&&i.jsxDEV("div",{className:"px-4 pb-4 space-y-4 border-t border-border-dark pt-4",children:vP.map(H=>{var q,Y;const Z=(Y=(q=n.runtimeOverrides)==null?void 0:q[B])==null?void 0:Y[H],le=(Z==null?void 0:Z.source)==="custom",te=le&&(Z==null?void 0:Z.key)||"",ne=`runtime-${B}-${H}`;return i.jsxDEV("div",{className:"space-y-2",children:[i.jsxDEV("div",{className:"flex items-center justify-between",children:[i.jsxDEV(Ur,{htmlFor:`${B}-${H}-toggle`,children:CR[H]},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:341,columnNumber:29},globalThis),i.jsxDEV("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[i.jsxDEV("input",{id:`${B}-${H}-toggle`,type:"checkbox",checked:le,onChange:X=>k(B,H,"source",X.target.checked?"custom":"global"),className:"form-checkbox rounded border-border-dark bg-surface-dark"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:345,columnNumber:31},globalThis),i.jsxDEV("span",{className:"text-text-secondary-dark",children:le?"Custom key":"Use global"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:355,columnNumber:31},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:344,columnNumber:29},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:340,columnNumber:27},globalThis),le&&i.jsxDEV("div",{className:"flex gap-2",children:[i.jsxDEV("div",{className:"relative flex-1",children:[i.jsxDEV(en,{type:y[ne]?"text":"password",value:te,onChange:X=>k(B,H,"key",X.target.value),placeholder:`Custom ${CR[H]} key for ${Dj[B]}`,className:"pr-10 font-mono text-sm"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:364,columnNumber:33},globalThis),i.jsxDEV("button",{type:"button",onClick:()=>M(ne),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary-dark hover:text-text-primary-dark",children:y[ne]?i.jsxDEV(IL,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:378,columnNumber:58},globalThis):i.jsxDEV(OR,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:378,columnNumber:91},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:373,columnNumber:33},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:363,columnNumber:31},globalThis),i.jsxDEV(ur,{variant:"secondary",size:"sm",onClick:()=>F(H,te,ne),disabled:!te||te.startsWith("••••")||N[ne]==="testing",children:[i.jsxDEV(Nj,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:387,columnNumber:33},globalThis),"Test"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:381,columnNumber:31},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:362,columnNumber:29},globalThis)]},H,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:339,columnNumber:25},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:331,columnNumber:19},globalThis)]},B,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:316,columnNumber:15},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:311,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:302,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/ApiKeysTab.tsx",lineNumber:206,columnNumber:5},globalThis)},Cfe=6,Afe=32,Mfe="https://api.crewlyai.com",Ufe="/api/relay/connect";function Rfe(s=Cfe){const e="ABCDEFGHJKLMNPQRSTUVWXYZ23456789",t=new Uint8Array(s);return crypto.getRandomValues(t),Array.from(t,r=>e[r%e.length]).join("")}function Vfe(s=Afe){const e=new Uint8Array(s);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}const Ffe=({isOpen:s,onClose:e})=>{const[t,r]=V.useState(""),[n,o]=V.useState(""),[a,c]=V.useState("idle"),[u,d]=V.useState(""),[h,f]=V.useState(null),[y,v]=V.useState(!1);V.useEffect(()=>{if(!s){c("idle"),d(""),f(null),v(!1);return}const b=Rfe(),x=Vfe();r(b),o(x),(async()=>{c("connecting"),d("");const j=localStorage.getItem(Db)||"";try{const S=await fetch(Ufe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiUrl:Mfe,pairingCode:b,role:"orchestrator",token:j,sharedSecret:x})}),k=await S.json();S.ok&&k.success?c("success"):(c("error"),d(k.error||"Failed to register with relay"))}catch{c("error"),d("Could not reach the server")}})()},[s]);const N=V.useCallback(async(b,x)=>{try{await navigator.clipboard.writeText(b),f(x),setTimeout(()=>f(null),2e3)}catch{}},[]);if(!s)return null;const T=JSON.stringify({pairingCode:t,sharedSecret:n});return i.jsxDEV("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:b=>{b.target===b.currentTarget&&e()},role:"dialog","aria-modal":"true","aria-label":"Invite Device","data-testid":"invite-device-modal",children:i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-md mx-4",onClick:b=>b.stopPropagation(),children:[i.jsxDEV("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-dark",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-primary-dark",children:"Invite Device"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:189,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:e,className:"p-1 text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors","aria-label":"Close","data-testid":"invite-modal-close",children:i.jsxDEV(Tn,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:196,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:190,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:188,columnNumber:9},globalThis),i.jsxDEV("div",{className:"px-5 py-4 space-y-4",children:[a==="connecting"&&i.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-text-secondary-dark","data-testid":"invite-connecting",children:[i.jsxDEV(tf,{className:"w-3.5 h-3.5 animate-spin"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:205,columnNumber:15},globalThis),"Registering with relay..."]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:204,columnNumber:13},globalThis),a==="error"&&i.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-rose-400 bg-rose-500/10 border border-rose-500/20 rounded px-3 py-2","data-testid":"invite-error",children:[i.jsxDEV(Rl,{className:"w-3.5 h-3.5 shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:212,columnNumber:15},globalThis),u]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:211,columnNumber:13},globalThis),a==="success"&&i.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 rounded px-3 py-2","data-testid":"invite-success",children:[i.jsxDEV(Mi,{className:"w-3.5 h-3.5 shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:219,columnNumber:15},globalThis),"Waiting for device to join..."]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:218,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("label",{className:"block text-xs font-medium text-text-secondary-dark mb-1.5",children:"Pairing Code"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:226,columnNumber:13},globalThis),i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("code",{className:"flex-1 px-3 py-2 text-lg font-mono font-bold tracking-widest text-text-primary-dark bg-background-dark border border-border-dark rounded-lg text-center select-all","data-testid":"invite-pairing-code",children:t},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:228,columnNumber:15},globalThis),i.jsxDEV("button",{onClick:()=>N(t,"code"),className:"p-2 text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors","aria-label":"Copy pairing code","data-testid":"copy-pairing-code",children:h==="code"?i.jsxDEV(Mi,{className:"w-4 h-4 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:240,columnNumber:43},globalThis):i.jsxDEV(PR,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:240,columnNumber:92},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:234,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:227,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:225,columnNumber:11},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("label",{className:"block text-xs font-medium text-text-secondary-dark mb-1.5",children:"Shared Secret"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:247,columnNumber:13},globalThis),i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("code",{className:"flex-1 px-3 py-2 text-[11px] font-mono text-text-primary-dark bg-background-dark border border-border-dark rounded-lg break-all select-all","data-testid":"invite-shared-secret",children:n},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:249,columnNumber:15},globalThis),i.jsxDEV("button",{onClick:()=>N(n,"secret"),className:"p-2 text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors shrink-0","aria-label":"Copy shared secret","data-testid":"copy-shared-secret",children:h==="secret"?i.jsxDEV(Mi,{className:"w-4 h-4 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:261,columnNumber:45},globalThis):i.jsxDEV(PR,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:261,columnNumber:94},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:255,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:248,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:246,columnNumber:11},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("button",{onClick:()=>v(!y),className:"flex items-center gap-1.5 text-xs text-primary hover:text-primary/80 transition-colors","data-testid":"toggle-qr-code",children:[i.jsxDEV(KV,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:273,columnNumber:15},globalThis),y?"Hide QR Code":"Show QR Code"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:268,columnNumber:13},globalThis),y&&i.jsxDEV("div",{className:"mt-3 flex justify-center","data-testid":"qr-code-container",children:i.jsxDEV("div",{className:"p-3 bg-white rounded-lg",children:i.jsxDEV(QV,{value:T,size:160,level:"M"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:280,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:279,columnNumber:17},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:278,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:267,columnNumber:11},globalThis),i.jsxDEV("p",{className:"text-[11px] text-text-secondary-dark leading-relaxed",children:["Share the pairing code and secret with the device you want to connect. On the other device, click ",i.jsxDEV("strong",{children:"Join Relay"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:289,columnNumber:40},globalThis)," and enter these values."]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:287,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:201,columnNumber:9},globalThis),i.jsxDEV("div",{className:"px-5 py-3 border-t border-border-dark flex justify-end",children:i.jsxDEV("button",{onClick:e,className:"px-4 py-1.5 text-xs font-medium text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors",children:"Done"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:295,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:294,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:183,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/InviteDeviceModal.tsx",lineNumber:175,columnNumber:5},globalThis)},Ife="https://api.crewlyai.com",Lfe="/api/relay/connect",Pfe=({isOpen:s,onClose:e})=>{const[t,r]=V.useState(""),[n,o]=V.useState(""),[a,c]=V.useState("idle"),[u,d]=V.useState(""),h=V.useCallback(()=>{r(""),o(""),c("idle"),d(""),e()},[e]),f=V.useCallback(async v=>{v.preventDefault();const N=t.trim(),T=n.trim();if(!N||!T){c("error"),d("Both pairing code and shared secret are required");return}c("connecting"),d("");const b=localStorage.getItem(Db)||"";try{const x=await fetch(Lfe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiUrl:Ife,pairingCode:N,role:"agent",token:b,sharedSecret:T})}),D=await x.json();x.ok&&D.success?c("success"):(c("error"),d(D.error||"Failed to join relay"))}catch{c("error"),d("Could not reach the server")}},[t,n]);if(!s)return null;const y=a==="connecting";return i.jsxDEV("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:v=>{v.target===v.currentTarget&&h()},role:"dialog","aria-modal":"true","aria-label":"Join Relay","data-testid":"join-relay-modal",children:i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-xl shadow-2xl w-full max-w-md mx-4",onClick:v=>v.stopPropagation(),children:[i.jsxDEV("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-dark",children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-primary-dark",children:"Join Relay"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:134,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:h,className:"p-1 text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors","aria-label":"Close","data-testid":"join-modal-close",children:i.jsxDEV(Tn,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:141,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:135,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:133,columnNumber:9},globalThis),i.jsxDEV("form",{onSubmit:f,className:"px-5 py-4 space-y-4",children:[a==="error"&&i.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-rose-400 bg-rose-500/10 border border-rose-500/20 rounded px-3 py-2","data-testid":"join-error",children:[i.jsxDEV(Rl,{className:"w-3.5 h-3.5 shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:150,columnNumber:15},globalThis),u]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:149,columnNumber:13},globalThis),a==="success"&&i.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 rounded px-3 py-2","data-testid":"join-success",children:[i.jsxDEV(Mi,{className:"w-3.5 h-3.5 shrink-0"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:157,columnNumber:15},globalThis),"Connected to relay successfully!"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:156,columnNumber:13},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("label",{htmlFor:"join-pairing-code",className:"block text-xs font-medium text-text-secondary-dark mb-1.5",children:"Pairing Code"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:164,columnNumber:13},globalThis),i.jsxDEV("input",{id:"join-pairing-code",type:"text",value:t,onChange:v=>r(v.target.value.toUpperCase()),placeholder:"e.g. A3BK7P",disabled:y||a==="success",className:"w-full px-3 py-2 text-sm font-mono tracking-wider text-text-primary-dark bg-background-dark border border-border-dark rounded-lg placeholder:text-text-secondary-dark/40 focus:outline-none focus:ring-1 focus:ring-primary/50 focus:border-primary/50 disabled:opacity-50",autoComplete:"off","data-testid":"join-pairing-code-input"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:167,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:163,columnNumber:11},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("label",{htmlFor:"join-shared-secret",className:"block text-xs font-medium text-text-secondary-dark mb-1.5",children:"Shared Secret"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:182,columnNumber:13},globalThis),i.jsxDEV("input",{id:"join-shared-secret",type:"text",value:n,onChange:v=>o(v.target.value),placeholder:"64-character hex string",disabled:y||a==="success",className:"w-full px-3 py-2 text-xs font-mono text-text-primary-dark bg-background-dark border border-border-dark rounded-lg placeholder:text-text-secondary-dark/40 focus:outline-none focus:ring-1 focus:ring-primary/50 focus:border-primary/50 disabled:opacity-50",autoComplete:"off","data-testid":"join-shared-secret-input"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:185,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:181,columnNumber:11},globalThis),i.jsxDEV("p",{className:"text-[11px] text-text-secondary-dark leading-relaxed",children:"Enter the pairing code and shared secret from the device that sent the invitation."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:199,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex justify-end gap-2 pt-2 border-t border-border-dark",children:[i.jsxDEV("button",{type:"button",onClick:h,className:"px-4 py-1.5 text-xs font-medium text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors",children:a==="success"?"Done":"Cancel"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:205,columnNumber:13},globalThis),a!=="success"&&i.jsxDEV("button",{type:"submit",disabled:y||!t.trim()||!n.trim(),className:"flex items-center gap-1.5 px-4 py-1.5 text-xs font-medium text-white bg-primary rounded-md hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"join-submit-button",children:[y&&i.jsxDEV(tf,{className:"w-3.5 h-3.5 animate-spin"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:219,columnNumber:34},globalThis),y?"Connecting...":"Join"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:213,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:204,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:146,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:128,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/JoinRelayModal.tsx",lineNumber:120,columnNumber:5},globalThis)},Ofe="/api/cloud/validate",Bfe="/api/cloud/status",Hfe="/api/cloud/devices",zfe="/api/relay/cloud-devices";function NB(s){const e=Date.now()-new Date(s).getTime(),t=Math.floor(e/1e3);return t<5?"Just now":t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}const Gfe={waiting:"Connecting",paired:"Connected",disconnected:"Offline",online:"Online",offline:"Offline"},Wfe={waiting:"bg-yellow-400",paired:"bg-emerald-400",disconnected:"bg-gray-500",online:"bg-emerald-400",offline:"bg-gray-500"};function Kfe(s){const e=new Map;for(const t of s){const r=t.deviceId||t.sessionId;if(!r){e.set(`__unkeyed_${e.size}`,t);continue}const n=e.get(r);if(!n)e.set(r,t);else{const o=new Date(n.lastHeartbeatAt||n.registeredAt||"0").getTime(),a=new Date(t.lastHeartbeatAt||t.registeredAt||"0").getTime(),c=n.status==="online"||n.state==="paired"||n.state==="waiting",u=t.status==="online"||t.state==="paired"||t.state==="waiting";(a>o||u&&!c)&&e.set(r,t)}}return Array.from(e.values())}const Xfe=({device:s})=>{const e=s.role==="orchestrator"?Em:GV,t=s.status||s.state||"disconnected",r=Wfe[t]??"bg-gray-500",n=Gfe[t]??t,o=s.name||s.deviceName||(s.sessionId?`${s.role||"device"} (${s.sessionId.slice(0,8)}...)`:s.deviceId||"Unknown");return i.jsxDEV("div",{"data-testid":`cloud-device-${s.sessionId||s.deviceId}`,className:`flex items-center justify-between p-3 rounded-lg border transition-colors ${s.isLocal?"border-primary/30 bg-primary/5":"border-border-dark bg-background-dark hover:border-border-dark/80"}`,children:[i.jsxDEV("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsxDEV("div",{className:`p-1.5 rounded-md ${s.isLocal?"bg-primary/10":"bg-surface-dark"}`,children:i.jsxDEV(e,{className:`w-4 h-4 ${s.isLocal?"text-primary":"text-text-secondary-dark"}`},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:173,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:172,columnNumber:9},globalThis),i.jsxDEV("div",{className:"min-w-0",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("span",{className:"text-sm font-medium text-text-primary-dark truncate",children:o},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:177,columnNumber:13},globalThis),s.isLocal&&i.jsxDEV("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-primary/10 text-primary whitespace-nowrap",children:"This machine"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:181,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:176,columnNumber:11},globalThis),i.jsxDEV("span",{className:"text-xs text-text-secondary-dark",children:s.lastHeartbeatAt?`Last seen: ${NB(s.lastHeartbeatAt)}`:`Registered: ${NB(s.registeredAt)}`},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:186,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:175,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:171,columnNumber:7},globalThis),i.jsxDEV("div",{className:"flex items-center gap-1.5 ml-3 whitespace-nowrap",children:[i.jsxDEV("span",{className:`h-2 w-2 rounded-full ${r}`},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:193,columnNumber:9},globalThis),i.jsxDEV("span",{className:"text-xs text-text-secondary-dark",children:n},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:194,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:192,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:163,columnNumber:5},globalThis)},qfe=()=>{const[s,e]=V.useState([]),[t,r]=V.useState(!0),[n,o]=V.useState(null),[a,c]=V.useState(!1),[u,d]=V.useState(null),h=V.useCallback(async()=>{var y;try{r(!0),o(null),c(!1),d(null);const v=await fetch(Hfe),N=await v.json();if(v.ok&&N.success&&N.data){if(N.data.syncState&&d(N.data.syncState),N.data.devices&&N.data.devices.length>0){e(N.data.devices),N.data.tokenExpired&&c(!0);return}if(!N.data.syncState||N.data.syncState==="stopped")try{const T=await fetch(zfe),b=await T.json();if(T.ok&&b.success&&((y=b.data)!=null&&y.devices)){e(b.data.devices),b.data.tokenExpired&&c(!0);return}}catch{}e(N.data.devices||[]),N.data.tokenExpired&&c(!0)}else o(N.error||"Failed to load devices")}catch{o("Could not reach the server")}finally{r(!1)}},[]);V.useEffect(()=>{h()},[h]);const f=V.useMemo(()=>Kfe(s),[s]);return i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-5 space-y-3","data-testid":"cloud-device-list-section",children:[i.jsxDEV("div",{className:"flex items-center justify-between",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV($V,{className:"w-4 h-4 text-text-secondary-dark"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:280,columnNumber:11},globalThis),i.jsxDEV("h3",{className:"text-sm font-semibold text-text-primary-dark",children:"Connected Devices"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:281,columnNumber:11},globalThis),i.jsxDEV("span",{className:"text-xs text-text-secondary-dark",children:["(",f.length,")"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:282,columnNumber:11},globalThis),u&&i.jsxDEV("span",{"data-testid":"sync-state-badge",className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${u==="syncing"?"bg-emerald-500/10 text-emerald-400":u==="error"?"bg-rose-500/10 text-rose-400":"bg-gray-500/10 text-gray-400"}`,children:u==="syncing"?"Sync Active":u==="error"?"Sync Error":"Sync Off"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:286,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:279,columnNumber:9},globalThis),i.jsxDEV("button",{onClick:h,disabled:t,className:"p-1.5 text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors disabled:opacity-50","aria-label":"Refresh devices","data-testid":"refresh-devices-button",children:i.jsxDEV(Ca,{className:`w-3.5 h-3.5 ${t?"animate-spin":""}`},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:307,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:300,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:278,columnNumber:7},globalThis),n&&i.jsxDEV("div",{className:"text-xs text-rose-400 bg-rose-500/10 border border-rose-500/20 rounded px-3 py-2",children:n},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:312,columnNumber:9},globalThis),a&&!n&&i.jsxDEV("div",{className:"text-xs text-amber-400 bg-amber-500/10 border border-amber-500/20 rounded px-3 py-2","data-testid":"token-expired-warning",children:"Cloud session expired. Please disconnect and sign in again to refresh your token."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:318,columnNumber:9},globalThis),!t&&!n&&!a&&f.length===0&&i.jsxDEV("div",{className:"text-center py-6",children:[i.jsxDEV(Em,{className:"w-8 h-8 text-text-secondary-dark/30 mx-auto mb-2"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:325,columnNumber:11},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark",children:"No devices connected yet"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:326,columnNumber:11},globalThis),i.jsxDEV("p",{className:"text-[11px] text-text-secondary-dark/60 mt-0.5",children:["Connect from another machine using ",i.jsxDEV("code",{className:"text-primary/80",children:"crewly cloud connect"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:328,columnNumber:48},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:327,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:324,columnNumber:9},globalThis),f.length>0&&i.jsxDEV("div",{className:"space-y-2",children:f.map(y=>i.jsxDEV(Xfe,{device:y},y.deviceId||y.sessionId||y.name||y.deviceName,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:336,columnNumber:13},globalThis))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:334,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:277,columnNumber:5},globalThis)},Yfe=()=>{const[s,e]=V.useState(null),[t,r]=V.useState(!1),[n,o]=V.useState(null),[a,c]=V.useState(!0),[u,d]=V.useState(null),[h,f]=V.useState(!1),[y,v]=V.useState(!1),N=V.useCallback(async()=>{try{const S=await fetch(Bfe),k=await S.json();if(S.ok&&k.success&&k.data){const U=k.data,F=U.connectionStatus==="connected";return r(F),F&&o(U.tier??null),F}}catch{}return r(!1),o(null),!1},[]),T=V.useCallback(async()=>{const S=localStorage.getItem(Db);if(!S){c(!1);return}try{const k=await fetch(Ofe,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${S}`}}),U=await k.json();k.ok&&U.success&&U.data?(e({id:U.data.id,email:U.data.email,plan:U.data.plan,name:U.data.name,avatar:U.data.avatar}),d(null)):(localStorage.removeItem(Db),e(null))}catch{d("Could not reach CrewlyAI Cloud. Check your internet connection.")}finally{c(!1)}},[]);V.useEffect(()=>{(async()=>{await N(),await T()})()},[N,T]);const b=()=>{const S=`${window.location.origin}/auth/callback`;window.location.href=LJ(S)},x=V.useCallback(async S=>{try{const k=localStorage.getItem("crewly_refresh_token")||void 0;await fetch("/api/cloud/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:S,...k&&{refreshToken:k}})})}catch{}},[]);V.useEffect(()=>{const S=localStorage.getItem(Db);S&&s&&x(S)},[s,x]);const D=async()=>{localStorage.removeItem(Db),e(null),r(!1),o(null),d(null);try{await fetch("/api/cloud/disconnect",{method:"POST"})}catch{}},j=S=>{switch(S){case"pro":return"bg-indigo-500/10 text-indigo-400 border-indigo-500/30";case"enterprise":return"bg-amber-500/10 text-amber-400 border-amber-500/30";default:return"bg-gray-500/10 text-gray-400 border-gray-500/30"}};return a?i.jsxDEV("div",{className:"flex items-center justify-center py-12",children:i.jsxDEV("div",{className:"w-6 h-6 border-2 border-primary/20 border-t-primary rounded-full animate-spin"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:523,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:522,columnNumber:7},globalThis):i.jsxDEV("div",{className:"space-y-6",children:[i.jsxDEV("div",{children:[i.jsxDEV("h2",{className:"text-lg font-semibold text-text-primary-dark flex items-center gap-2",children:[i.jsxDEV(Pj,{className:"w-5 h-5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:533,columnNumber:11},globalThis),"CrewlyAI Cloud"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:532,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-1",children:"Connect to CrewlyAI Cloud for device sync, remote access, and Pro features."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:536,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:531,columnNumber:7},globalThis),u&&i.jsxDEV("div",{className:"bg-rose-500/10 border border-rose-500/30 text-rose-400 px-4 py-3 rounded-lg text-sm",children:u},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:542,columnNumber:9},globalThis),s||t?i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-5 space-y-4",children:[i.jsxDEV("div",{className:"flex items-center justify-between",children:[i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV("div",{className:"w-10 h-10 bg-primary/10 rounded-full flex items-center justify-center",children:s!=null&&s.avatar?i.jsxDEV("img",{src:s.avatar,alt:s.name||s.email,className:"w-10 h-10 rounded-full"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:555,columnNumber:21},globalThis):i.jsxDEV(Pj,{className:"w-5 h-5 text-primary"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:561,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:553,columnNumber:17},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("span",{className:"text-sm font-medium text-text-primary-dark",children:s?s.name||s.email:"CrewlyAI Cloud"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:566,columnNumber:21},globalThis),i.jsxDEV(Mi,{className:"w-4 h-4 text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:569,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:565,columnNumber:19},globalThis),i.jsxDEV("span",{className:"text-xs text-text-secondary-dark",children:s?s.email:"Connected via backend"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:571,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:564,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:552,columnNumber:15},globalThis),i.jsxDEV("span",{className:`px-2 py-0.5 text-xs font-medium rounded border ${j((s==null?void 0:s.plan)??n??"free")}`,children:((s==null?void 0:s.plan)??n??"free").charAt(0).toUpperCase()+((s==null?void 0:s.plan)??n??"free").slice(1)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:577,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:551,columnNumber:13},globalThis),i.jsxDEV("div",{className:"flex items-center gap-2 pt-2 border-t border-border-dark",children:[i.jsxDEV("button",{onClick:async()=>{await N(),await T()},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-text-secondary-dark hover:text-text-primary-dark rounded-md hover:bg-background-dark transition-colors",children:[i.jsxDEV(Ca,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:587,columnNumber:17},globalThis),"Refresh"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:583,columnNumber:15},globalThis),i.jsxDEV("button",{onClick:D,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-text-secondary-dark hover:text-rose-400 rounded-md hover:bg-background-dark transition-colors",children:[i.jsxDEV(e9,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:594,columnNumber:17},globalThis),"Disconnect"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:590,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:582,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:550,columnNumber:11},globalThis),i.jsxDEV("div",{className:"flex items-center gap-2","data-testid":"relay-pairing-buttons",children:[i.jsxDEV("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-text-primary-dark bg-primary/10 border border-primary/20 rounded-lg hover:bg-primary/20 transition-colors","data-testid":"invite-device-button",children:[i.jsxDEV(ZV,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:607,columnNumber:15},globalThis),"Invite Device"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:602,columnNumber:13},globalThis),i.jsxDEV("button",{onClick:()=>v(!0),className:"flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-text-primary-dark bg-surface-dark border border-border-dark rounded-lg hover:bg-background-dark transition-colors","data-testid":"join-relay-button",children:[i.jsxDEV(sA,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:615,columnNumber:15},globalThis),"Join Relay"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:610,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:601,columnNumber:11},globalThis),i.jsxDEV(qfe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:621,columnNumber:11},globalThis),i.jsxDEV(Ffe,{isOpen:h,onClose:()=>f(!1)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:624,columnNumber:11},globalThis),i.jsxDEV(Pfe,{isOpen:y,onClose:()=>v(!1)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:625,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:549,columnNumber:9},globalThis):i.jsxDEV("div",{className:"bg-surface-dark border border-border-dark rounded-lg p-6 text-center space-y-4",children:[i.jsxDEV("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-xl bg-primary/10",children:i.jsxDEV(Nj,{className:"w-6 h-6 text-primary"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:631,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:630,columnNumber:11},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("h3",{className:"text-sm font-semibold text-text-primary-dark",children:"Connect to CrewlyAI Cloud"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:635,columnNumber:13},globalThis),i.jsxDEV("p",{className:"text-xs text-text-secondary-dark mt-1 max-w-sm mx-auto",children:"Sign in with your CrewlyAI account to enable device sync, remote team access, and Pro features."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:638,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:634,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:b,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-primary text-white rounded-lg font-medium text-sm hover:bg-primary/90 transition-colors","data-testid":"cloud-sign-in-button",children:[i.jsxDEV(Nx,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:649,columnNumber:13},globalThis),"Sign in with CrewlyAI"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:644,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:629,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Settings/CloudTab.tsx",lineNumber:529,columnNumber:5},globalThis)},Zfe=new Set(["general","roles","skills","integrations","api-keys","cloud"]),$fe=()=>{const[s]=tA(),e=s.get("tab"),t=e&&Zfe.has(e)?e:"general",[r,n]=V.useState(t),o=[{id:"general",label:"General",icon:o9},{id:"roles",label:"Roles",icon:Dx},{id:"skills",label:"Skills",icon:u9},{id:"integrations",label:"Integrations",icon:sA},{id:"api-keys",label:"API Keys",icon:BR},{id:"cloud",label:"Cloud",icon:Pj}],a=()=>{switch(r){case"general":return i.jsxDEV(Qhe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:62,columnNumber:16},globalThis);case"roles":return i.jsxDEV(nfe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:64,columnNumber:16},globalThis);case"skills":return i.jsxDEV(lfe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:66,columnNumber:16},globalThis);case"integrations":return i.jsxDEV(Efe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:68,columnNumber:16},globalThis);case"api-keys":return i.jsxDEV(kfe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:70,columnNumber:16},globalThis);case"cloud":return i.jsxDEV(Yfe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:72,columnNumber:16},globalThis);default:return null}};return i.jsxDEV("div",{className:"max-w-7xl mx-auto",children:[i.jsxDEV("div",{className:"mb-8",children:[i.jsxDEV("h1",{className:"text-3xl font-bold tracking-tight",children:"Settings"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:82,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-1",children:"Configure Crewly behavior and manage roles and skills"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:83,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:81,columnNumber:7},globalThis),i.jsxDEV("nav",{className:"flex gap-1 border-b border-border-dark mb-6",role:"tablist",children:o.map(c=>i.jsxDEV("button",{className:`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 transition-colors -mb-px ${r===c.id?"border-primary text-primary":"border-transparent text-text-secondary-dark hover:text-text-primary-dark hover:bg-surface-dark"}`,onClick:()=>n(c.id),"aria-selected":r===c.id,role:"tab",id:`tab-${c.id}`,"aria-controls":`panel-${c.id}`,children:[i.jsxDEV(c.icon,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:104,columnNumber:13},globalThis),i.jsxDEV("span",{children:c.label},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:105,columnNumber:13},globalThis)]},c.id,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:91,columnNumber:11},globalThis))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:89,columnNumber:7},globalThis),i.jsxDEV("main",{role:"tabpanel",id:`panel-${r}`,"aria-labelledby":`tab-${r}`,children:a()},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:111,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Settings.tsx",lineNumber:79,columnNumber:5},globalThis)},Kh="/api/chat";class Jfe{async parseResponse(e,t){const r=await e.text();if(!r)throw new Error(t);try{return JSON.parse(r)}catch{throw new Error(t)}}async sendMessage(e){const t=await fetch(`${Kh}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await this.parseResponse(t,"Failed to send message");if(!r.success)throw new Error(r.error||"Failed to send message");return r.data}async getMessages(e,t,r){return(await this.getMessagesWithMeta(e,t,r)).messages}async getMessagesWithMeta(e,t,r){const n=new URLSearchParams({conversationId:e});t&&n.set("limit",t.toString()),r&&n.set("before",r);const o=await fetch(`${Kh}/messages?${n.toString()}`),a=await this.parseResponse(o,"Failed to load messages");if(!a.success)throw new Error(a.error||"Failed to load messages");return{messages:a.data,hasMore:a.hasMore??!1,totalCount:a.totalCount??a.data.length}}async getConversations(e=!1,t){const r=new URLSearchParams;e&&r.set("includeArchived","true"),t&&r.set("channelType",t);const n=r.toString(),o=await fetch(`${Kh}/conversations${n?"?"+n:""}`),a=await this.parseResponse(o,"Failed to load conversations");if(!a.success)throw new Error(a.error||"Failed to load conversations");return a.data}async getCurrentConversation(){const e=await fetch(`${Kh}/conversations/current`),t=await this.parseResponse(e,"Failed to load current conversation");if(!t.success)throw new Error(t.error||"Failed to load current conversation");return t.data}async createConversation(e){const t=await fetch(`${Kh}/conversations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e})}),r=await this.parseResponse(t,"Request failed");if(!r.success)throw new Error(r.error||"Failed to create conversation");return r.data}async updateConversation(e,t){const r=await fetch(`${Kh}/conversations/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await this.parseResponse(r,"Request failed");if(!n.success)throw new Error(n.error||"Failed to update conversation");return n.data}async deleteConversation(e){const t=await fetch(`${Kh}/conversations/${e}`,{method:"DELETE"}),r=await this.parseResponse(t,"Request failed");if(!r.success)throw new Error(r.error||"Failed to delete conversation")}async archiveConversation(e){const t=await fetch(`${Kh}/conversations/${e}/archive`,{method:"PUT"}),r=await this.parseResponse(t,"Request failed");if(!r.success)throw new Error(r.error||"Failed to archive conversation")}async clearConversation(e){const t=await fetch(`${Kh}/conversations/${e}/clear`,{method:"POST"}),r=await this.parseResponse(t,"Request failed");if(!r.success)throw new Error(r.error||"Failed to clear conversation")}}const qu=new Jfe,CH=V.createContext(null),Qfe=({children:s})=>{const[e,t]=V.useState([]),[r,n]=V.useState(null),[o,a]=V.useState([]),[c,u]=V.useState(!0),[d,h]=V.useState(!1),[f,y]=V.useState(null),[v,N]=V.useState(!1),[T,b]=V.useState(null),[x,D]=V.useState(!1),[j,S]=V.useState(!1),k=V.useRef(null);V.useEffect(()=>{k.current=r},[r]);const U=V.useCallback(Y=>{let X;const z=Y;if(z&&typeof z=="object"&&("data"in z&&z.data&&typeof z.data=="object"?X=z.data:"id"in z&&(X=z)),!X||!X.id)return;const se=k.current;X.conversationId===(se==null?void 0:se.id)&&(a(ae=>ae.some(fe=>fe.id===X.id)?ae:[...ae,X]),N(!1)),t(ae=>ae.map(fe=>fe.id===X.conversationId?{...fe,lastMessage:{content:X.content.slice(0,100),timestamp:X.timestamp,from:X.from},messageCount:fe.messageCount+1,updatedAt:X.timestamp}:fe))},[]),F=V.useCallback(Y=>{const X=Y,z=X.data||X,se=k.current;z.conversationId===(se==null?void 0:se.id)&&N(z.isTyping??!1)},[]),M=V.useCallback(Y=>{let X;const z=Y;if(z&&typeof z=="object"&&("data"in z&&z.data&&typeof z.data=="object"?X=z.data:"id"in z&&(X=z)),!X||!X.id)return;t(ae=>{const fe=ae.findIndex(ee=>ee.id===X.id);if(fe>=0){const ee=[...ae];return ee[fe]=X,ee}return[X,...ae]});const se=k.current;(se==null?void 0:se.id)===X.id&&n(X)},[]);V.useEffect(()=>(or.on("chat_message",U),or.on("chat_typing",F),or.on("conversation_updated",M),or.subscribeToChat(),()=>{or.off("chat_message",U),or.off("chat_typing",F),or.off("conversation_updated",M),or.unsubscribeFromChat()}),[U,F,M]),V.useEffect(()=>{(async()=>{u(!0);try{const[X,z]=await Promise.all([qu.getConversations(),qu.getCurrentConversation()]);if(t(X),z){n(z);const se=await qu.getMessagesWithMeta(z.id);a(se.messages),D(se.hasMore)}}catch(X){y(X instanceof Error?X.message:"Failed to load chat")}finally{u(!1)}})()},[]);const R=V.useCallback(async Y=>{if(!(!Y.trim()||d)){h(!0),y(null);try{const X=await qu.sendMessage({content:Y,conversationId:r==null?void 0:r.id});a(z=>z.some(se=>se.id===X.message.id)?z:[...z,X.message]),r||(n(X.conversation),t(z=>[X.conversation,...z])),X.orchestrator&&!X.orchestrator.forwarded&&X.orchestrator.error&&y(X.orchestrator.error)}catch(X){y(X instanceof Error?X.message:"Failed to send message")}finally{h(!1)}}},[d,r]),L=V.useCallback(async Y=>{const X=e.find(z=>z.id===Y);if(X){n(X),u(!0),y(null);try{const z=await qu.getMessagesWithMeta(Y);a(z.messages),D(z.hasMore)}catch(z){y(z instanceof Error?z.message:"Failed to load messages")}finally{u(!1)}}},[e]),B=V.useCallback(async Y=>{const X=await qu.createConversation(Y);return t(z=>[X,...z]),n(X),a([]),X},[]),O=V.useCallback(async Y=>{if(await qu.deleteConversation(Y),t(X=>X.filter(z=>z.id!==Y)),(r==null?void 0:r.id)===Y){const X=e.filter(z=>z.id!==Y);X.length>0?await L(X[0].id):(n(null),a([]))}},[r,e,L]),H=V.useCallback(async Y=>{if(await qu.archiveConversation(Y),t(X=>X.filter(z=>z.id!==Y)),(r==null?void 0:r.id)===Y){const X=e.filter(z=>z.id!==Y);X.length>0?await L(X[0].id):(n(null),a([]))}},[r,e,L]),Z=V.useCallback(async Y=>{await qu.clearConversation(Y),(r==null?void 0:r.id)===Y&&a([])},[r]),le=V.useCallback(async()=>{if(!r)return;const Y=await qu.getMessagesWithMeta(r.id);a(Y.messages),D(Y.hasMore)},[r]),te=V.useCallback(async()=>{if(!(!r||!x||j)){S(!0);try{const Y=o[0];if(!Y)return;const X=await qu.getMessagesWithMeta(r.id,50,Y.timestamp);X.messages.length>0&&a(z=>{const se=new Set(z.map(fe=>fe.id));return[...X.messages.filter(fe=>!se.has(fe.id)),...z]}),D(X.hasMore)}catch(Y){y(Y instanceof Error?Y.message:"Failed to load older messages")}finally{S(!1)}}},[r,x,j,o]),ne=V.useCallback(()=>{y(null)},[]),q={conversations:e,currentConversation:r,messages:o,isLoading:c,isSending:d,error:f,isTyping:v,channelFilter:T,hasMoreMessages:x,isLoadingMore:j,sendMessage:R,selectConversation:L,createConversation:B,deleteConversation:O,archiveConversation:H,clearConversation:Z,refreshMessages:le,loadOlderMessages:te,clearError:ne,setChannelFilter:b};return i.jsxDEV(CH.Provider,{value:q,children:s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/contexts/ChatContext.tsx",lineNumber:486,columnNumber:10},globalThis)},CF=()=>{const s=V.useContext(CH);if(!s)throw new Error("useChat must be used within a ChatProvider");return s},FV={slack:{icon:"🔷",label:"Slack",className:"channel-slack"},crewly_chat:{icon:"💬",label:"Crewly",className:"channel-crewly"},telegram:{icon:"✉️",label:"Telegram",className:"channel-telegram"},api:{icon:"🔌",label:"API",className:"channel-api"}};const epe=[{key:null,label:"All"},...Object.entries(FV).map(([s,{icon:e,label:t}])=>({key:s,label:t,icon:e}))],tpe=({activeFilter:s,onFilterChange:e,conversations:t})=>{const r=new Map;r.set(null,t.length);for(const o of t){const a=o.channelType??"crewly_chat";r.set(a,(r.get(a)??0)+1)}const n=epe.filter(o=>o.key===null||(r.get(o.key)??0)>0);return i.jsxDEV("div",{className:"channel-filter-bar","data-testid":"channel-filter-bar",children:n.map(o=>{const a=r.get(o.key)??0,c=s===o.key;return i.jsxDEV("button",{className:`filter-chip ${c?"active":""}`,onClick:()=>e(o.key),"data-testid":`filter-chip-${o.key??"all"}`,"aria-pressed":c,children:[o.icon&&i.jsxDEV("span",{className:"filter-chip-icon","aria-hidden":"true",children:o.icon},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelFilterBar.tsx",lineNumber:93,columnNumber:15},globalThis),i.jsxDEV("span",{className:"filter-chip-label",children:o.label},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelFilterBar.tsx",lineNumber:97,columnNumber:13},globalThis),i.jsxDEV("span",{className:"filter-chip-count",children:a},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelFilterBar.tsx",lineNumber:98,columnNumber:13},globalThis)]},o.key??"all",!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelFilterBar.tsx",lineNumber:85,columnNumber:11},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelFilterBar.tsx",lineNumber:79,columnNumber:5},globalThis)};const AH=({channelType:s,showLabel:e=!0})=>{const t=FV[s]??FV.crewly_chat;return i.jsxDEV("span",{className:`channel-badge ${t.className}`,"data-testid":"channel-badge",title:t.label,children:[i.jsxDEV("span",{className:"channel-badge-icon","aria-hidden":"true",children:t.icon},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelBadge.tsx",lineNumber:47,columnNumber:7},globalThis),e&&i.jsxDEV("span",{className:"channel-badge-label",children:t.label},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelBadge.tsx",lineNumber:50,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChannelBadge.tsx",lineNumber:42,columnNumber:5},globalThis)},hi={MINUTE:60*1e3,HOUR:60*60*1e3,DAY:24*60*60*1e3,WEEK:7*24*60*60*1e3,MONTH:30*24*60*60*1e3,YEAR:365*24*60*60*1e3};function MH(s,e=new Date){const t=typeof s=="string"?new Date(s):s,r=e.getTime()-t.getTime();if(r<0)return rpe(Math.abs(r));if(r<hi.MINUTE)return"just now";if(r<hi.HOUR){const n=Math.floor(r/hi.MINUTE);return`${n} ${n===1?"minute":"minutes"} ago`}if(r<hi.DAY){const n=Math.floor(r/hi.HOUR);return`${n} ${n===1?"hour":"hours"} ago`}if(r<hi.DAY*2)return"Yesterday";if(r<hi.WEEK)return`${Math.floor(r/hi.DAY)} days ago`;if(r<hi.MONTH){const n=Math.floor(r/hi.WEEK);return`${n} ${n===1?"week":"weeks"} ago`}if(r<hi.YEAR){const n=Math.floor(r/hi.MONTH);return`${n} ${n===1?"month":"months"} ago`}return spe(t)}function rpe(s){if(s<hi.MINUTE)return"in a moment";if(s<hi.HOUR){const t=Math.floor(s/hi.MINUTE);return`in ${t} ${t===1?"minute":"minutes"}`}if(s<hi.DAY){const t=Math.floor(s/hi.HOUR);return`in ${t} ${t===1?"hour":"hours"}`}return s<hi.DAY*2?"Tomorrow":`in ${Math.floor(s/hi.DAY)} days`}function spe(s,e={}){const t={month:"short",day:"numeric",year:"numeric",...e};return s.toLocaleDateString(void 0,t)}const npe=({conversation:s,isActive:e,onClick:t})=>{var c,u,d,h,f,y,v;const r=s.channelType??"crewly_chat",n=s.title||((u=(c=s.lastMessage)==null?void 0:c.content)==null?void 0:u.slice(0,60))||"New conversation",o=((d=s.lastMessage)==null?void 0:d.content)??"",a=((f=(h=s.lastMessage)==null?void 0:h.from)==null?void 0:f.name)??((v=(y=s.lastMessage)==null?void 0:y.from)==null?void 0:v.type)??"";return i.jsxDEV("button",{className:`thread-preview ${e?"active":""}`,onClick:t,"data-testid":"thread-preview","aria-pressed":e,children:[i.jsxDEV("div",{className:"thread-preview-header",children:[i.jsxDEV(AH,{channelType:r,showLabel:!1},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:56,columnNumber:9},globalThis),i.jsxDEV("span",{className:"thread-preview-title",children:n},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:57,columnNumber:9},globalThis),i.jsxDEV("span",{className:"thread-preview-time",children:MH(s.updatedAt)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:58,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:55,columnNumber:7},globalThis),i.jsxDEV("div",{className:"thread-preview-body",children:[a&&i.jsxDEV("span",{className:"thread-preview-sender",children:[a,": "]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:65,columnNumber:11},globalThis),i.jsxDEV("span",{className:"thread-preview-content",children:o.length>80?o.slice(0,77)+"...":o},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:67,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:63,columnNumber:7},globalThis),i.jsxDEV("div",{className:"thread-preview-footer",children:i.jsxDEV("span",{className:"thread-preview-count",children:[s.messageCount," ",s.messageCount===1?"message":"messages"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:73,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:72,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadPreview.tsx",lineNumber:49,columnNumber:5},globalThis)};const ope=({conversations:s,selectedConversationId:e,onSelectThread:t,channelFilter:r,onChannelFilterChange:n})=>{const a=[...r?s.filter(c=>(c.channelType??"crewly_chat")===r):s].sort((c,u)=>u.updatedAt.localeCompare(c.updatedAt));return i.jsxDEV("div",{className:"thread-list-panel","data-testid":"thread-list-panel",children:[i.jsxDEV(tpe,{activeFilter:r,onFilterChange:n,conversations:s},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadListPanel.tsx",lineNumber:63,columnNumber:7},globalThis),i.jsxDEV("div",{className:"thread-list-scroll",children:a.length===0?i.jsxDEV("div",{className:"thread-list-empty","data-testid":"thread-list-empty",children:i.jsxDEV("p",{children:r?"No conversations for this channel.":"No conversations yet."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadListPanel.tsx",lineNumber:72,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadListPanel.tsx",lineNumber:71,columnNumber:11},globalThis):a.map(c=>i.jsxDEV(npe,{conversation:c,isActive:c.id===e,onClick:()=>t(c.id)},c.id,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadListPanel.tsx",lineNumber:80,columnNumber:13},globalThis))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadListPanel.tsx",lineNumber:69,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadListPanel.tsx",lineNumber:62,columnNumber:5},globalThis)};function ipe(s){if(s.from.name)return s.from.name;switch(s.from.type){case"user":return"You";case"orchestrator":return"Orchestrator";case"agent":return s.from.role??"Agent";case"system":return"System";default:return"Unknown"}}function ape(s){switch(s.from.type){case"user":return"👤";case"orchestrator":return"🤖";case"agent":return"🔧";case"system":return"ℹ️";default:return"💬"}}function lpe(s){return s.split(/(```[\s\S]*?```)/g).map((t,r)=>{if(t.startsWith("```")&&t.endsWith("```")){const n=t.slice(3,-3),o=n.indexOf(`
5213
5213
  `),a=o>0?n.slice(0,o).trim():"",c=o>0?n.slice(o+1):n;return i.jsxDEV("pre",{className:"code-block","data-language":a,children:i.jsxDEV("code",{children:c},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:83,columnNumber:11},this)},r,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:82,columnNumber:9},this)}return i.jsxDEV("span",{children:cpe(t)},r,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:90,columnNumber:7},this)})}function cpe(s){return s.split(/(`[^`]+`)/g).map((t,r)=>{if(t.startsWith("`")&&t.endsWith("`"))return i.jsxDEV("code",{className:"inline-code",children:t.slice(1,-1)},r,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:107,columnNumber:9},this);let n=t;const o=/\*\*([^*]+)\*\*/g,a=t.split(o);return a.length>1&&(n=a.map((c,u)=>u%2===1?i.jsxDEV("strong",{children:c},`bold-${r}-${u}`,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:122,columnNumber:11},this):c)),i.jsxDEV(pn.Fragment,{children:n},r,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:129,columnNumber:12},this)})}const upe=({message:s})=>{var u,d,h;const[e,t]=V.useState(!1),r=s.from.type==="user",n=s.from.type==="system",o=!!((u=s.metadata)!=null&&u.rawOutput),a=()=>{var f;return e&&((f=s.metadata)!=null&&f.rawOutput)?i.jsxDEV("pre",{className:"raw-output","data-testid":"raw-output",children:s.metadata.rawOutput},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:159,columnNumber:9},globalThis):s.contentType==="code"||s.contentType==="markdown"||s.contentType==="text"?i.jsxDEV("div",{className:"formatted-content",children:lpe(s.content)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:170,columnNumber:14},globalThis):i.jsxDEV("p",{children:s.content},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:173,columnNumber:12},globalThis)},c=["chat-message",s.from.type,r?"user-message":"",n?"system-message":"",s.status==="error"?"error-status":""].filter(Boolean).join(" ");return i.jsxDEV("div",{className:c,"data-testid":"chat-message",children:[i.jsxDEV("div",{className:"message-header",children:[i.jsxDEV("span",{className:"sender-icon","aria-hidden":"true",children:ape(s)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:189,columnNumber:9},globalThis),i.jsxDEV("span",{className:"sender-name",children:ipe(s)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:192,columnNumber:9},globalThis),i.jsxDEV("span",{className:"message-time",children:MH(s.timestamp)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:193,columnNumber:9},globalThis),o&&i.jsxDEV("button",{className:"toggle-raw-btn",onClick:()=>t(!e),title:e?"Show formatted":"Show raw output","aria-label":e?"Show formatted":"Show raw output","data-testid":"toggle-raw-button",children:e?"📝":"🔍"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:195,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:188,columnNumber:7},globalThis),i.jsxDEV("div",{className:"message-content",children:a()},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:207,columnNumber:7},globalThis),((d=s.metadata)==null?void 0:d.skillUsed)&&i.jsxDEV("div",{className:"message-metadata",children:i.jsxDEV("span",{className:"skill-badge",children:["Skill: ",s.metadata.skillUsed]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:211,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:210,columnNumber:9},globalThis),((h=s.metadata)==null?void 0:h.taskCreated)&&i.jsxDEV("div",{className:"message-metadata",children:i.jsxDEV("span",{className:"task-badge",children:["Task created: ",s.metadata.taskCreated]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:217,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:216,columnNumber:9},globalThis),s.status==="error"&&i.jsxDEV("div",{className:"message-error",role:"alert",children:"Failed to deliver"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:224,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatMessage.tsx",lineNumber:187,columnNumber:5},globalThis)};const dpe=({disabled:s=!1,disabledPlaceholder:e,placeholder:t})=>{const{sendMessage:r,isSending:n,error:o,clearError:a}=CF(),[c,u]=V.useState(""),d=V.useRef(null);V.useEffect(()=>{const N=d.current;N&&(N.style.height="auto",N.style.height=`${Math.min(N.scrollHeight,200)}px`)},[c]);const h=s||n,f=async()=>{if(!c.trim()||h)return;const N=c.trim();u(""),a(),d.current&&(d.current.style.height="auto"),await r(N)},y=N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),f())},v=N=>{u(N.target.value),o&&a()};return i.jsxDEV("div",{className:"chat-input-container","data-testid":"chat-input-container",children:[o&&i.jsxDEV("div",{className:"input-error",role:"alert","data-testid":"chat-input-error",children:[i.jsxDEV("span",{children:["Error: ",o]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:109,columnNumber:11},globalThis),i.jsxDEV("button",{className:"dismiss-error",onClick:a,"aria-label":"Dismiss error",children:"×"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:110,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:108,columnNumber:9},globalThis),i.jsxDEV("div",{className:"input-wrapper",children:[i.jsxDEV("textarea",{ref:d,value:c,onChange:v,onKeyDown:y,placeholder:s&&e?e:t??"Type a message... (Enter to send, Shift+Enter for new line)",disabled:h,rows:1,className:`message-input ${s?"disabled-offline":""}`,"data-testid":"chat-message-input","aria-label":"Message input"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:121,columnNumber:9},globalThis),i.jsxDEV("button",{onClick:f,disabled:!c.trim()||h,className:"send-button",title:s?"Orchestrator offline":"Send message","data-testid":"chat-send-button","aria-label":n?"Sending message":s?"Orchestrator offline":"Send message",children:n?i.jsxDEV("span",{className:"sending-indicator","aria-hidden":"true",children:"⏳"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:147,columnNumber:13},globalThis):i.jsxDEV("span",{className:"send-icon","aria-hidden":"true",children:"➤"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:151,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:138,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:120,columnNumber:7},globalThis),i.jsxDEV("div",{className:"input-hints",children:[i.jsxDEV("span",{children:["Press ",i.jsxDEV("kbd",{children:"Enter"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:160,columnNumber:17},globalThis)," to send"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:159,columnNumber:9},globalThis),i.jsxDEV("span",{children:[i.jsxDEV("kbd",{children:"Shift"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:163,columnNumber:11},globalThis)," + ",i.jsxDEV("kbd",{children:"Enter"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:163,columnNumber:30},globalThis)," for new line"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:162,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:158,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ChatInput.tsx",lineNumber:106,columnNumber:5},globalThis)};const mpe=()=>i.jsxDEV("div",{className:"typing-indicator","data-testid":"typing-indicator",children:[i.jsxDEV("span",{className:"sender-icon","aria-hidden":"true",children:"🤖"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/TypingIndicator.tsx",lineNumber:26,columnNumber:7},globalThis),i.jsxDEV("span",{className:"sender-name",children:"Orchestrator"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/TypingIndicator.tsx",lineNumber:29,columnNumber:7},globalThis),i.jsxDEV("div",{className:"typing-dots","aria-label":"Orchestrator is typing",children:[i.jsxDEV("span",{className:"dot"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/TypingIndicator.tsx",lineNumber:31,columnNumber:9},globalThis),i.jsxDEV("span",{className:"dot"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/TypingIndicator.tsx",lineNumber:32,columnNumber:9},globalThis),i.jsxDEV("span",{className:"dot"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/TypingIndicator.tsx",lineNumber:33,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/TypingIndicator.tsx",lineNumber:30,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/TypingIndicator.tsx",lineNumber:25,columnNumber:5},globalThis);const hpe=60;function fpe(s,e){return s.length<=e?s:s.slice(0,e)+"..."}function ppe(s){const e=Date.now()-new Date(s).getTime(),t=Math.floor(e/1e3);if(t<60)return"just now";const r=Math.floor(t/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}const ype=()=>{const[s,e]=V.useState(null),[t,r]=V.useState([]),[n,o]=V.useState(!1),[a,c]=V.useState(new Set);V.useEffect(()=>{let U=!1;async function F(){try{const[M,R]=await Promise.all([ss.getQueueStatus(),ss.getPendingMessages()]);U||(e(M),r(R))}catch{}}return F(),()=>{U=!0}},[]);const u=V.useCallback(U=>{e(U)},[]),d=V.useCallback(U=>{r(F=>F.some(M=>M.id===U.id)?F:[...F,U])},[]),h=V.useCallback(U=>{r(F=>F.map(M=>M.id===U.id?{...M,status:"processing",processingStartedAt:U.processingStartedAt}:M))},[]),f=V.useCallback(U=>{r(F=>F.filter(M=>M.id!==U.id))},[]),y=V.useCallback(U=>{r(F=>F.filter(M=>M.id!==U.id))},[]),v=V.useCallback(U=>{r(F=>F.filter(M=>M.id!==U.id)),c(F=>{const M=new Set(F);return M.delete(U.id),M})},[]);V.useEffect(()=>(or.on("queue:status_update",u),or.on("queue:message_enqueued",d),or.on("queue:message_processing",h),or.on("queue:message_completed",f),or.on("queue:message_failed",y),or.on("queue:message_cancelled",v),()=>{or.off("queue:status_update",u),or.off("queue:message_enqueued",d),or.off("queue:message_processing",h),or.off("queue:message_completed",f),or.off("queue:message_failed",y),or.off("queue:message_cancelled",v)}),[u,d,h,f,y,v]);const N=async U=>{c(F=>new Set(F).add(U));try{await ss.cancelQueueMessage(U)}catch{c(F=>{const M=new Set(F);return M.delete(U),M})}},[T,b]=V.useState(!1),x=async()=>{b(!0);try{await ss.clearQueue(),r([]),e(null)}catch{}finally{b(!1)}},D=(s==null?void 0:s.pendingCount)??t.filter(U=>U.status==="pending").length,j=(s==null?void 0:s.isProcessing)??t.some(U=>U.status==="processing");if(D===0&&!j&&t.length===0)return null;const S=[];D>0&&S.push(`${D} queued`),j&&S.push("1 processing");const k=S.join(" · ");return i.jsxDEV("div",{className:"queue-status-bar","data-testid":"queue-status-bar",children:[i.jsxDEV("div",{className:"queue-status-summary",onClick:()=>o(!n),"data-testid":"queue-status-summary",role:"button",tabIndex:0,onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),o(!n))},children:[j&&i.jsxDEV("div",{className:"queue-spinner","data-testid":"queue-spinner"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:248,columnNumber:26},globalThis),i.jsxDEV("span",{className:"queue-status-text",children:k},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:249,columnNumber:9},globalThis),i.jsxDEV("button",{className:"queue-clear-all-btn",onClick:U=>{U.stopPropagation(),x()},disabled:T,"data-testid":"queue-clear-all-btn",title:"Clear all queued messages",children:T?"Clearing...":"Clear All"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:250,columnNumber:9},globalThis),i.jsxDEV("button",{className:`queue-toggle-btn${n?" expanded":""}`,"aria-label":n?"Collapse queue":"Expand queue",tabIndex:-1,children:"▼"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:262,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:235,columnNumber:7},globalThis),i.jsxDEV("div",{className:`queue-message-list${n?" expanded":""}`,"data-testid":"queue-message-list",children:t.map(U=>i.jsxDEV("div",{className:`queue-message-item${U.status==="processing"?" processing":""}`,"data-testid":"queue-message-item",children:[i.jsxDEV("div",{className:"queue-item-status",children:U.status==="processing"?i.jsxDEV("div",{className:"queue-spinner"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:283,columnNumber:17},globalThis):i.jsxDEV("span",{"aria-label":"pending",children:"🕑"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:285,columnNumber:17},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:281,columnNumber:13},globalThis),i.jsxDEV("div",{className:"queue-item-content",children:[i.jsxDEV("p",{className:"queue-item-preview",children:fpe(U.content,hpe)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:290,columnNumber:15},globalThis),i.jsxDEV("div",{className:"queue-item-meta",children:[i.jsxDEV("span",{className:"queue-source-badge",children:U.source==="slack"?"slack":"web"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:292,columnNumber:17},globalThis),i.jsxDEV("span",{className:"queue-item-time",children:ppe(U.enqueuedAt)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:293,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:291,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:289,columnNumber:13},globalThis),i.jsxDEV("button",{className:"queue-cancel-btn",onClick:()=>U.status==="processing"?x():N(U.id),disabled:a.has(U.id)||T,"data-testid":"queue-cancel-btn",children:a.has(U.id)||T?"Cancelling...":"Cancel"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:297,columnNumber:13},globalThis)]},U.id,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:276,columnNumber:11},globalThis))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:271,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/QueueStatusBar.tsx",lineNumber:234,columnNumber:5},globalThis)};const gpe=[/^[\s⏺❯▸▶►›»─━┄┅┈┉╌╍═│┃┆┇┊┋╎╏║┌┐└┘├┤┬┴┼╔╗╚╝╠╣╦╩╬╭╮╰╯\s]*$/,/bypass permissions on/i,/shift\+tab to cycle/i,/esc to interrupt/i,/^\s*▸▸\s/];function bpe(s){const e=s.trim();return e?gpe.some(t=>t.test(e)):!0}function vpe(s){return s.filter(e=>!(e.from.type!=="user"&&e.from.type!=="orchestrator"||bpe(e.content)))}const wpe=({conversation:s,onBack:e})=>{const{messages:t,isLoading:r,error:n,isTyping:o,hasMoreMessages:a,isLoadingMore:c,loadOlderMessages:u}=CF(),d=vpe(t),{status:h,isLoading:f}=y6(),y=V.useRef(null),v=V.useRef(null),[N,T]=V.useState(!1),b=V.useCallback(()=>{requestAnimationFrame(()=>{var S;(S=v.current)==null||S.scrollIntoView({behavior:"auto"})})},[]);V.useEffect(()=>{b()},[d,o,b]);const x=V.useCallback(()=>{const S=y.current;if(!S)return;const k=S.scrollHeight-S.scrollTop-S.clientHeight;if(T(k>100),S.scrollTop<50&&a&&!c){const U=S.scrollHeight;u().then(()=>{requestAnimationFrame(()=>{const F=S.scrollHeight;S.scrollTop=F-U})})}},[a,c,u]),D=!f&&h&&!h.isActive,j=(s==null?void 0:s.channelType)??"crewly_chat";return s?r&&d.length===0?i.jsxDEV("div",{className:"thread-detail-panel loading","data-testid":"thread-detail-loading",children:i.jsxDEV("div",{className:"loading-spinner",children:[i.jsxDEV("div",{className:"spinner"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:169,columnNumber:11},globalThis),i.jsxDEV("span",{children:"Loading messages..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:170,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:168,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:167,columnNumber:7},globalThis):n&&d.length===0?i.jsxDEV("div",{className:"thread-detail-panel error","data-testid":"thread-detail-error",children:i.jsxDEV("div",{className:"error-message",children:[i.jsxDEV("span",{className:"error-icon",children:"⚠️"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:181,columnNumber:11},globalThis),i.jsxDEV("p",{children:["Error: ",n]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:182,columnNumber:11},globalThis),i.jsxDEV("button",{onClick:()=>window.location.reload(),className:"retry-button",children:"Retry"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:183,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:180,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:179,columnNumber:7},globalThis):i.jsxDEV("div",{className:"thread-detail-panel","data-testid":"thread-detail-panel",children:[i.jsxDEV("header",{className:"thread-detail-header",children:[e&&i.jsxDEV("button",{className:"thread-detail-back",onClick:e,"aria-label":"Back to thread list","data-testid":"thread-detail-back",children:"←"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:198,columnNumber:11},globalThis),i.jsxDEV("div",{className:"thread-detail-header-info",children:[i.jsxDEV("h2",{children:s.title??"Chat with Orchestrator"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:208,columnNumber:11},globalThis),i.jsxDEV("div",{className:"thread-detail-header-meta",children:i.jsxDEV(AH,{channelType:j},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:210,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:209,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:207,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:196,columnNumber:7},globalThis),i.jsxDEV(ype,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:215,columnNumber:7},globalThis),D&&i.jsxDEV("div",{className:"orchestrator-offline-banner","data-testid":"orchestrator-offline-banner",children:[i.jsxDEV("span",{className:"offline-icon","aria-hidden":"true",children:"⚠️"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:219,columnNumber:11},globalThis),i.jsxDEV("div",{className:"offline-content",children:[i.jsxDEV("strong",{children:"Orchestrator Offline"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:221,columnNumber:13},globalThis),i.jsxDEV("p",{children:(h==null?void 0:h.offlineMessage)||(h==null?void 0:h.message)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:222,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:220,columnNumber:11},globalThis),i.jsxDEV(Ob,{to:"/",className:"dashboard-link",children:"Go to Dashboard"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:224,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:218,columnNumber:9},globalThis),i.jsxDEV("div",{className:"messages-container",ref:y,onScroll:x,"data-testid":"messages-container",children:[c&&i.jsxDEV("div",{className:"load-more-spinner","data-testid":"load-more-spinner",children:[i.jsxDEV("div",{className:"spinner spinner-sm"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:238,columnNumber:13},globalThis),i.jsxDEV("span",{children:"Loading older messages..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:239,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:237,columnNumber:11},globalThis),d.length===0?i.jsxDEV("div",{className:"empty-chat","data-testid":"empty-chat",children:i.jsxDEV("div",{className:"welcome-message",children:[i.jsxDEV("h3",{children:"Welcome to Crewly"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:246,columnNumber:15},globalThis),i.jsxDEV("p",{children:"Start a conversation with the Orchestrator."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:247,columnNumber:15},globalThis),i.jsxDEV("p",{children:"Try asking to:"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:248,columnNumber:15},globalThis),i.jsxDEV("ul",{children:[i.jsxDEV("li",{children:"Create a new project"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:250,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Assign a task to an agent"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:251,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Check project status"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:252,columnNumber:17},globalThis),i.jsxDEV("li",{children:"Configure a team"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:253,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:249,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:245,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:244,columnNumber:11},globalThis):i.jsxDEV(i.Fragment,{children:d.map(S=>i.jsxDEV(upe,{message:S},S.id,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:260,columnNumber:15},globalThis))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:258,columnNumber:11},globalThis),o&&i.jsxDEV(mpe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:265,columnNumber:22},globalThis),i.jsxDEV("div",{ref:v,className:"messages-end"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:267,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:230,columnNumber:7},globalThis),N&&i.jsxDEV("button",{className:"scroll-to-bottom-btn",onClick:b,"aria-label":"Scroll to bottom","data-testid":"scroll-to-bottom",children:"↓"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:271,columnNumber:9},globalThis),i.jsxDEV(dpe,{disabled:D,disabledPlaceholder:"Orchestrator is offline. Start it from the Dashboard to chat.",placeholder:"Reply in thread..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:281,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:195,columnNumber:5},globalThis):i.jsxDEV("div",{className:"thread-detail-panel empty","data-testid":"thread-detail-empty",children:i.jsxDEV("div",{className:"thread-detail-empty-state",children:[i.jsxDEV("h3",{children:"Select a thread"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:157,columnNumber:11},globalThis),i.jsxDEV("p",{children:"Choose a conversation from the list to view messages."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:158,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:156,columnNumber:9},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Chat/ThreadDetailPanel.tsx",lineNumber:155,columnNumber:7},globalThis)};const xpe=()=>{const{conversations:s,currentConversation:e,selectConversation:t,channelFilter:r,setChannelFilter:n}=CF(),[o,a]=V.useState("list"),c=V.useCallback(async d=>{await t(d),a("detail")},[t]),u=V.useCallback(()=>{a("list")},[]);return i.jsxDEV("div",{className:"chat-page thread-layout",children:[i.jsxDEV("header",{className:"chat-page-header",children:[i.jsxDEV("h1",{children:"Chat with Orchestrator"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:56,columnNumber:9},globalThis),i.jsxDEV("p",{children:"Communicate with the Crewly orchestrator to manage projects and teams"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:57,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:55,columnNumber:7},globalThis),i.jsxDEV("div",{className:"chat-page-content",children:[i.jsxDEV("aside",{className:`chat-page-sidebar ${o==="list"?"mobile-visible":"mobile-hidden"}`,children:i.jsxDEV(ope,{conversations:s,selectedConversationId:(e==null?void 0:e.id)??null,onSelectThread:c,channelFilter:r,onChannelFilterChange:n},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:64,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:61,columnNumber:9},globalThis),i.jsxDEV("main",{className:`chat-page-main ${o==="detail"?"mobile-visible":"mobile-hidden"}`,children:i.jsxDEV(wpe,{conversation:e,onBack:u},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:76,columnNumber:11},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:73,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:60,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Chat.tsx",lineNumber:54,columnNumber:5},globalThis)},ev="/api/marketplace";async function Npe(s){const e=new URLSearchParams;s!=null&&s.type&&e.set("type",s.type),s!=null&&s.search&&e.set("search",s.search),s!=null&&s.sort&&e.set("sort",s.sort);const t=e.toString(),r=`${ev}${t?`?${t}`:""}`;return(await ar.get(r)).data.data}async function Dpe(s){return(await ar.post(`${ev}/${s}/install`)).data}async function jpe(s){return(await ar.post(`${ev}/${s}/uninstall`)).data}async function Tpe(s){return(await ar.post(`${ev}/${s}/update`)).data}async function DB(){await ar.post(`${ev}/refresh`)}async function Spe(s){const e=s?`?status=${s}`:"";return(await ar.get(`${ev}/submissions${e}`)).data.data}async function Epe(s,e,t){return(await ar.post(`${ev}/submissions/${s}/review`,{action:e,notes:t})).data}const _pe=4e3;function kpe(){const[s,e]=V.useState([]),t=V.useRef(0),r=V.useCallback((o,a="info")=>{const c=`toast-${++t.current}`,u={id:c,message:o,type:a};e(d=>[...d,u]),setTimeout(()=>{e(d=>d.filter(h=>h.id!==c))},_pe)},[]),n=V.useCallback(o=>{e(a=>a.filter(c=>c.id!==o))},[]);return{toasts:s,addToast:r,dismissToast:n}}const Cpe={success:"border-green-500 bg-green-500/10 text-green-300",error:"border-red-500 bg-red-500/10 text-red-300",info:"border-blue-500 bg-blue-500/10 text-blue-300"};function Ape({toasts:s,onDismiss:e}){return s.length===0?null:i.jsxDEV("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm",role:"log","aria-live":"polite",children:s.map(t=>i.jsxDEV("div",{"data-testid":`toast-${t.type}`,className:`flex items-center gap-3 px-4 py-3 rounded-lg border text-sm shadow-lg backdrop-blur-sm ${Cpe[t.type]}`,children:[i.jsxDEV("span",{className:"flex-1",children:t.message},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Toast.tsx",lineNumber:50,columnNumber:11},this),i.jsxDEV("button",{onClick:()=>e(t.id),className:"text-gray-400 hover:text-white transition-colors shrink-0","aria-label":"Dismiss notification",children:i.jsxDEV(Tn,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Toast.tsx",lineNumber:56,columnNumber:13},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Toast.tsx",lineNumber:51,columnNumber:11},this)]},t.id,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Toast.tsx",lineNumber:45,columnNumber:9},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Toast.tsx",lineNumber:43,columnNumber:5},this)}const Mpe=[{label:"All",value:"all"},{label:"Skills",value:"skill"},{label:"3D Models",value:"model"},{label:"Roles",value:"role"},{label:"MCP Tools",value:"mcp_tool"}],Upe=[{label:"Popular",value:"popular"},{label:"Highest Rated",value:"rating"},{label:"Newest",value:"newest"}];function Rpe(s){return s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}const Vpe={skill:"bg-blue-500/20 text-blue-400",model:"bg-purple-500/20 text-purple-400",role:"bg-emerald-500/20 text-emerald-400",mcp_tool:"bg-orange-500/20 text-orange-400"};function Fpe(){const[s,e]=V.useState("browse"),[t,r]=V.useState([]),[n,o]=V.useState([]),[a,c]=V.useState(!0),[u,d]=V.useState("all"),[h,f]=V.useState(""),[y,v]=V.useState("popular"),[N,T]=V.useState(null),[b,x]=V.useState(null),{toasts:D,addToast:j,dismissToast:S}=kpe(),k=V.useCallback(async()=>{try{c(!0),x(null);const O=await Npe({type:u==="all"?void 0:u,search:h||void 0,sort:y});r(O)}catch{x("Failed to load marketplace items")}finally{c(!1)}},[u,h,y]);V.useEffect(()=>{k()},[k]);const U=async O=>{T(O);try{const H=await Dpe(O);j(H.message||`Installed ${O}`,H.success?"success":"error"),await k()}catch(H){const Z=H instanceof Error?H.message:"Install failed";j(Z,"error")}T(null)},F=async O=>{T(O);try{const H=await jpe(O);j(H.message||`Uninstalled ${O}`,H.success?"success":"error"),await k()}catch(H){const Z=H instanceof Error?H.message:"Uninstall failed";j(Z,"error")}T(null)},M=async O=>{T(O);try{const H=await Tpe(O);j(H.message||`Updated ${O}`,H.success?"success":"error"),await k()}catch(H){const Z=H instanceof Error?H.message:"Update failed";j(Z,"error")}T(null)},R=async()=>{try{await DB(),j("Registry refreshed","success"),await k()}catch{j("Failed to refresh registry","error")}},L=V.useCallback(async()=>{try{c(!0),x(null);const O=await Spe();o(O)}catch{x("Failed to load submissions")}finally{c(!1)}},[]);V.useEffect(()=>{s==="submissions"&&L()},[s,L]);const B=async(O,H)=>{T(O);try{const Z=await Epe(O,H);j(Z.message||`${H==="approve"?"Approved":"Rejected"}`,Z.success?"success":"error"),await L(),H==="approve"&&await DB()}catch(Z){const le=Z instanceof Error?Z.message:"Review failed";j(le,"error")}T(null)};return i.jsxDEV("div",{className:"p-6 max-w-7xl mx-auto",children:[i.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV(a9,{className:"w-6 h-6 text-indigo-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:225,columnNumber:11},this),i.jsxDEV("h1",{className:"text-2xl font-bold text-white",children:"Marketplace"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:226,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:224,columnNumber:9},this),i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("div",{className:"flex gap-1 bg-gray-900 rounded-lg p-1",role:"tablist","aria-label":"View mode",children:[i.jsxDEV("button",{onClick:()=>e("browse"),role:"tab","aria-selected":s==="browse",className:`flex items-center gap-1 px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${s==="browse"?"bg-gray-800 text-white":"text-gray-400 hover:text-white"}`,children:[i.jsxDEV(PL,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:238,columnNumber:15},this),"Browse"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:230,columnNumber:13},this),i.jsxDEV("button",{onClick:()=>e("submissions"),role:"tab","aria-selected":s==="submissions",className:`flex items-center gap-1 px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${s==="submissions"?"bg-gray-800 text-white":"text-gray-400 hover:text-white"}`,children:[i.jsxDEV(HX,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:249,columnNumber:15},this),"Submissions"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:241,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:229,columnNumber:11},this),i.jsxDEV("button",{onClick:R,className:"flex items-center gap-2 px-3 py-1.5 text-sm bg-gray-800 hover:bg-gray-700 text-gray-300 rounded-lg transition-colors","aria-label":"Refresh marketplace",children:[i.jsxDEV(Ca,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:258,columnNumber:13},this),"Refresh"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:253,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:228,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:223,columnNumber:7},this),s==="browse"&&i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6",children:[i.jsxDEV("div",{className:"flex gap-1 bg-gray-900 rounded-lg p-1",role:"tablist","aria-label":"Filter by type",children:Mpe.map(O=>i.jsxDEV("button",{onClick:()=>d(O.value),role:"tab","aria-selected":u===O.value,className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${u===O.value?"bg-gray-800 text-white":"text-gray-400 hover:text-white"}`,children:O.label},O.value,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:270,columnNumber:17},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:268,columnNumber:13},this),i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV("div",{className:"relative",children:[i.jsxDEV(qV,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:286,columnNumber:17},this),i.jsxDEV("input",{type:"text",placeholder:"Search...",value:h,onChange:O=>f(O.target.value),"aria-label":"Search marketplace",className:"bg-gray-900 border border-gray-700 rounded-lg pl-9 pr-3 py-1.5 text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-indigo-500 w-48"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:287,columnNumber:17},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:285,columnNumber:15},this),i.jsxDEV("select",{value:y,onChange:O=>v(O.target.value),"aria-label":"Sort by",className:"bg-gray-900 border border-gray-700 rounded-lg px-3 py-1.5 text-sm text-gray-200 focus:outline-none focus:border-indigo-500",children:Upe.map(O=>i.jsxDEV("option",{value:O.value,children:O.label},O.value,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:303,columnNumber:19},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:296,columnNumber:15},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:284,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:267,columnNumber:11},this),a?i.jsxDEV("div",{className:"text-center py-16 text-gray-400",role:"status",children:"Loading marketplace..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:311,columnNumber:13},this):b?i.jsxDEV("div",{className:"text-center py-16 text-red-400",role:"alert",children:b},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:313,columnNumber:13},this):t.length===0?i.jsxDEV("div",{className:"text-center py-16 text-gray-400",children:"No items found."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:315,columnNumber:13},this):i.jsxDEV("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.map(O=>i.jsxDEV("div",{className:"bg-gray-900 border border-gray-800 rounded-xl p-5 hover:border-gray-700 transition-colors","data-testid":`marketplace-item-${O.id}`,children:[i.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${Vpe[O.type]}`,children:O.type},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:327,columnNumber:23},this),i.jsxDEV("span",{className:"text-xs text-gray-500",children:["v",O.version]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:330,columnNumber:23},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:326,columnNumber:21},this),O.installStatus==="installed"&&i.jsxDEV(Mi,{className:"w-4 h-4 text-green-400","aria-label":"Installed"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:333,columnNumber:23},this),O.installStatus==="update_available"&&i.jsxDEV(RL,{className:"w-4 h-4 text-yellow-400","aria-label":"Update available"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:336,columnNumber:23},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:325,columnNumber:19},this),i.jsxDEV("h3",{className:"text-base font-semibold text-white mb-1",children:O.name},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:341,columnNumber:19},this),i.jsxDEV("p",{className:"text-sm text-gray-400 mb-3 line-clamp-2",children:O.description},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:342,columnNumber:19},this),i.jsxDEV("div",{className:"flex items-center justify-between text-xs text-gray-500 mb-4",children:[i.jsxDEV("span",{children:["by ",O.author]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:346,columnNumber:21},this),i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV("span",{className:"flex items-center gap-1",children:[i.jsxDEV(LX,{className:"w-3 h-3 text-yellow-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:349,columnNumber:25},this),O.rating.toFixed(1)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:348,columnNumber:23},this),i.jsxDEV("span",{className:"flex items-center gap-1",children:[i.jsxDEV(WV,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:353,columnNumber:25},this),Rpe(O.downloads)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:352,columnNumber:23},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:347,columnNumber:21},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:345,columnNumber:19},this),i.jsxDEV("div",{className:"flex gap-2",children:[O.installStatus==="not_installed"&&i.jsxDEV("button",{onClick:()=>U(O.id),disabled:N===O.id,className:"flex-1 flex items-center justify-center gap-1 px-3 py-1.5 text-sm bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[i.jsxDEV(PL,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:367,columnNumber:25},this),N===O.id?"Installing...":"Install"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:362,columnNumber:23},this),O.installStatus==="installed"&&i.jsxDEV("button",{onClick:()=>F(O.id),disabled:N===O.id,className:"flex-1 px-3 py-1.5 text-sm bg-gray-800 hover:bg-red-900/50 text-gray-300 hover:text-red-300 rounded-lg disabled:opacity-50 transition-colors",children:N===O.id?"Removing...":"Uninstall"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:372,columnNumber:23},this),O.installStatus==="update_available"&&i.jsxDEV(i.Fragment,{children:[i.jsxDEV("button",{onClick:()=>M(O.id),disabled:N===O.id,className:"flex-1 flex items-center justify-center gap-1 px-3 py-1.5 text-sm bg-yellow-600 hover:bg-yellow-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[i.jsxDEV(RL,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:387,columnNumber:27},this),N===O.id?"Updating...":"Update"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:382,columnNumber:25},this),i.jsxDEV("button",{onClick:()=>F(O.id),disabled:N===O.id,className:"px-3 py-1.5 text-sm bg-gray-800 hover:bg-red-900/50 text-gray-300 hover:text-red-300 rounded-lg disabled:opacity-50 transition-colors",children:"Remove"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:390,columnNumber:25},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:381,columnNumber:23},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:360,columnNumber:19},this)]},O.id,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:319,columnNumber:17},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:317,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:265,columnNumber:9},this),s==="submissions"&&i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{className:"mb-6",children:i.jsxDEV("p",{className:"text-sm text-gray-400",children:["Submit skills via CLI: ",i.jsxDEV("code",{className:"bg-gray-800 px-2 py-0.5 rounded text-xs text-gray-300",children:"crewly publish path/to/skill --submit"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:412,columnNumber:38},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:411,columnNumber:13},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:410,columnNumber:11},this),a?i.jsxDEV("div",{className:"text-center py-16 text-gray-400",role:"status",children:"Loading submissions..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:418,columnNumber:13},this):b?i.jsxDEV("div",{className:"text-center py-16 text-red-400",role:"alert",children:b},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:420,columnNumber:13},this):n.length===0?i.jsxDEV("div",{className:"text-center py-16 text-gray-400",children:"No submissions yet."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:422,columnNumber:13},this):i.jsxDEV("div",{className:"space-y-3",children:n.map(O=>i.jsxDEV("div",{className:"bg-gray-900 border border-gray-800 rounded-xl p-5 hover:border-gray-700 transition-colors","data-testid":`submission-${O.id}`,children:i.jsxDEV("div",{className:"flex items-start justify-between",children:[i.jsxDEV("div",{className:"flex-1",children:[i.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[i.jsxDEV("h3",{className:"text-base font-semibold text-white",children:O.name},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:434,columnNumber:25},this),i.jsxDEV("span",{className:"text-xs text-gray-500",children:["v",O.version]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:435,columnNumber:25},this),i.jsxDEV("span",{className:`flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${O.status==="pending"?"bg-yellow-500/20 text-yellow-400":O.status==="approved"?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:[O.status==="pending"&&i.jsxDEV(eu,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:441,columnNumber:56},this),O.status==="approved"&&i.jsxDEV(Vl,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:442,columnNumber:57},this),O.status==="rejected"&&i.jsxDEV(Zk,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:443,columnNumber:57},this),O.status]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:436,columnNumber:25},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:433,columnNumber:23},this),i.jsxDEV("p",{className:"text-sm text-gray-400 mb-2",children:O.description},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:447,columnNumber:23},this),i.jsxDEV("div",{className:"flex items-center gap-4 text-xs text-gray-500",children:[i.jsxDEV("span",{children:["by ",O.author]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:449,columnNumber:25},this),i.jsxDEV("span",{children:O.category},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:450,columnNumber:25},this),i.jsxDEV("span",{children:new Date(O.submittedAt).toLocaleDateString()},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:451,columnNumber:25},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:448,columnNumber:23},this),O.reviewNotes&&i.jsxDEV("p",{className:"mt-2 text-xs text-gray-400 italic",children:["Review: ",O.reviewNotes]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:454,columnNumber:25},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:432,columnNumber:21},this),O.status==="pending"&&i.jsxDEV("div",{className:"flex gap-2 ml-4",children:[i.jsxDEV("button",{onClick:()=>B(O.id,"approve"),disabled:N===O.id,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-green-600 hover:bg-green-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[i.jsxDEV(Vl,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:464,columnNumber:27},this),N===O.id?"...":"Approve"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:459,columnNumber:25},this),i.jsxDEV("button",{onClick:()=>B(O.id,"reject"),disabled:N===O.id,className:"px-3 py-1.5 text-sm bg-gray-800 hover:bg-red-900/50 text-gray-300 hover:text-red-300 rounded-lg disabled:opacity-50 transition-colors",children:"Reject"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:467,columnNumber:25},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:458,columnNumber:23},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:431,columnNumber:19},this)},O.id,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:426,columnNumber:17},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:424,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:408,columnNumber:9},this),i.jsxDEV(Ape,{toasts:D,onDismiss:S},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:484,columnNumber:7},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Marketplace.tsx",lineNumber:221,columnNumber:5},this)}function Ipe({scope:s,onScopeChange:e,projects:t,selectedProjectPath:r,onProjectChange:n}){return i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV("div",{className:"flex gap-1 bg-gray-900 rounded-lg p-1",role:"tablist","aria-label":"Document scope",children:[i.jsxDEV("button",{role:"tab","aria-selected":s==="global",onClick:()=>e("global"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${s==="global"?"bg-gray-800 text-white":"text-gray-400 hover:text-white"}`,children:[i.jsxDEV(JB,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:50,columnNumber:11},this),"Global"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:42,columnNumber:9},this),i.jsxDEV("button",{role:"tab","aria-selected":s==="project",onClick:()=>e("project"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${s==="project"?"bg-gray-800 text-white":"text-gray-400 hover:text-white"}`,children:[i.jsxDEV(il,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:61,columnNumber:11},this),"Project"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:53,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:41,columnNumber:7},this),s==="project"&&i.jsxDEV("select",{value:r||"",onChange:o=>n(o.target.value),"aria-label":"Select project",className:"bg-gray-900 border border-gray-700 rounded-lg px-3 py-1.5 text-sm text-gray-200 focus:outline-none focus:border-indigo-500",children:[i.jsxDEV("option",{value:"",disabled:!0,children:"Select a project..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:73,columnNumber:11},this),t.map(o=>i.jsxDEV("option",{value:o.path,children:o.name},o.id,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:75,columnNumber:13},this))]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:67,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeScopeToggle.tsx",lineNumber:40,columnNumber:5},this)}function Lpe({categories:s,selectedCategory:e,onCategoryChange:t}){return i.jsxDEV("div",{className:"space-y-1",role:"listbox","aria-label":"Filter by category",children:[i.jsxDEV("button",{role:"option","aria-selected":e==="",onClick:()=>t(""),className:`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors ${e===""?"bg-indigo-600/20 text-indigo-400 font-medium":"text-gray-400 hover:bg-gray-800 hover:text-gray-200"}`,children:"All"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeCategoryFilter.tsx",lineNumber:32,columnNumber:7},this),s.map(r=>i.jsxDEV("button",{role:"option","aria-selected":e===r,onClick:()=>t(r),className:`w-full text-left px-3 py-2 rounded-lg text-sm transition-colors ${e===r?"bg-indigo-600/20 text-indigo-400 font-medium":"text-gray-400 hover:bg-gray-800 hover:text-gray-200"}`,children:r},r,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeCategoryFilter.tsx",lineNumber:45,columnNumber:9},this))]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeCategoryFilter.tsx",lineNumber:31,columnNumber:5},this)}function Ppe(s){try{return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return s}}function Ope({documents:s,loading:e,searchQuery:t,onSearchChange:r,selectedDocId:n,onSelectDocument:o}){return i.jsxDEV("div",{className:"flex flex-col h-full",children:[i.jsxDEV("div",{className:"relative mb-4",children:[i.jsxDEV(qV,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:64,columnNumber:9},this),i.jsxDEV("input",{type:"text",placeholder:"Search documents...",value:t,onChange:a=>r(a.target.value),"aria-label":"Search documents",className:"w-full bg-gray-900 border border-gray-700 rounded-lg pl-9 pr-3 py-2 text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-indigo-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:65,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:63,columnNumber:7},this),e?i.jsxDEV("div",{className:"text-center py-8 text-gray-400",role:"status",children:"Loading documents..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:77,columnNumber:9},this):s.length===0?i.jsxDEV("div",{className:"text-center py-8 text-gray-500",children:[i.jsxDEV(X0,{className:"w-8 h-8 mx-auto mb-2 opacity-50"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:80,columnNumber:11},this),i.jsxDEV("p",{children:"No documents found"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:81,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:79,columnNumber:9},this):i.jsxDEV("div",{className:"space-y-1 overflow-y-auto flex-1",children:s.map(a=>i.jsxDEV("button",{onClick:()=>o(a.id),className:`w-full text-left px-3 py-3 rounded-lg transition-colors ${n===a.id?"bg-indigo-600/20 border border-indigo-500/30":"hover:bg-gray-800 border border-transparent"}`,children:[i.jsxDEV("div",{className:"flex items-start justify-between gap-2",children:[i.jsxDEV("div",{className:"min-w-0 flex-1",children:[i.jsxDEV("h4",{className:"text-sm font-medium text-gray-200 truncate",children:a.title},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:97,columnNumber:19},this),i.jsxDEV("p",{className:"text-xs text-gray-500 mt-0.5 line-clamp-1",children:a.preview},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:98,columnNumber:19},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:96,columnNumber:17},this),i.jsxDEV("div",{className:"flex flex-col items-end flex-shrink-0",children:[i.jsxDEV("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-800 text-gray-400",children:a.category},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:101,columnNumber:19},this),i.jsxDEV("span",{className:"text-xs text-gray-600 mt-1",children:Ppe(a.updatedAt)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:104,columnNumber:19},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:100,columnNumber:17},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:95,columnNumber:15},this),a.tags.length>0&&i.jsxDEV("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:[a.tags.slice(0,3).map(c=>i.jsxDEV("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-900 text-gray-500",children:c},c,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:110,columnNumber:21},this)),a.tags.length>3&&i.jsxDEV("span",{className:"text-xs text-gray-600",children:["+",a.tags.length-3]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:115,columnNumber:21},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:108,columnNumber:17},this)]},a.id,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:86,columnNumber:13},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:84,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentList.tsx",lineNumber:61,columnNumber:5},this)}function Bpe(s){try{return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return s}}function Hpe({document:s,onEdit:e,onDelete:t}){return i.jsxDEV("div",{className:"h-full overflow-y-auto",children:[i.jsxDEV("div",{className:"flex items-start justify-between mb-4",children:[i.jsxDEV("div",{className:"flex-1 min-w-0",children:[i.jsxDEV("h2",{className:"text-xl font-bold text-white mb-2",children:s.title},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:58,columnNumber:11},this),i.jsxDEV("div",{className:"flex items-center gap-4 text-xs text-gray-500",children:[i.jsxDEV("span",{className:"px-2 py-0.5 rounded bg-gray-800 text-gray-300",children:s.category},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:60,columnNumber:13},this),i.jsxDEV("span",{className:"flex items-center gap-1",children:[i.jsxDEV(Dx,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:62,columnNumber:15},this),s.createdBy]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:61,columnNumber:13},this),i.jsxDEV("span",{className:"flex items-center gap-1",children:[i.jsxDEV(eu,{className:"w-3 h-3"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:66,columnNumber:15},this),Bpe(s.updatedAt)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:65,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:59,columnNumber:11},this),s.tags.length>0&&i.jsxDEV("div",{className:"flex gap-1.5 mt-2 flex-wrap",children:s.tags.map(r=>i.jsxDEV("span",{className:"text-xs px-2 py-0.5 rounded-full bg-indigo-500/10 text-indigo-400",children:r},r,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:73,columnNumber:17},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:71,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:57,columnNumber:9},this),i.jsxDEV("div",{className:"flex gap-2 ml-4",children:[i.jsxDEV("button",{onClick:e,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-gray-800 hover:bg-gray-700 text-gray-300 rounded-lg transition-colors","aria-label":"Edit document",children:[i.jsxDEV(r9,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:86,columnNumber:13},this),"Edit"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:81,columnNumber:11},this),i.jsxDEV("button",{onClick:t,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-gray-800 hover:bg-red-900/50 text-gray-300 hover:text-red-300 rounded-lg transition-colors","aria-label":"Delete document",children:[i.jsxDEV(lT,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:94,columnNumber:13},this),"Delete"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:89,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:80,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:56,columnNumber:7},this),i.jsxDEV("div",{className:"border-t border-gray-800 pt-4",children:i.jsxDEV("div",{className:"prose prose-invert prose-sm max-w-none whitespace-pre-wrap text-gray-300 leading-relaxed",children:s.content},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:102,columnNumber:9},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:101,columnNumber:7},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentViewer.tsx",lineNumber:54,columnNumber:5},this)}const zpe=["SOPs","Team Norms","Architecture","Onboarding","Runbooks","General"];function jB({document:s,categories:e,saving:t,onSave:r,onCancel:n}){const[o,a]=V.useState((s==null?void 0:s.title)||""),[c,u]=V.useState((s==null?void 0:s.content)||""),[d,h]=V.useState((s==null?void 0:s.category)||"General"),[f,y]=V.useState((s==null?void 0:s.tags.join(", "))||""),v=[...new Set([...zpe,...e])].sort(),N=b=>{b.preventDefault();const x=f.split(",").map(D=>D.trim()).filter(Boolean);r({title:o,content:c,category:d,tags:x})},T=o.trim().length>0&&c.trim().length>0;return i.jsxDEV("form",{onSubmit:N,className:"h-full flex flex-col",children:[i.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[i.jsxDEV("h2",{className:"text-lg font-bold text-white",children:s?"Edit Document":"New Document"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:64,columnNumber:9},this),i.jsxDEV("div",{className:"flex gap-2",children:[i.jsxDEV("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-gray-800 hover:bg-gray-700 text-gray-300 rounded-lg transition-colors",children:[i.jsxDEV(Tn,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:73,columnNumber:13},this),"Cancel"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:68,columnNumber:11},this),i.jsxDEV("button",{type:"submit",disabled:!T||t,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[i.jsxDEV(iT,{className:"w-3.5 h-3.5"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:81,columnNumber:13},this),t?"Saving...":"Save"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:76,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:67,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:63,columnNumber:7},this),i.jsxDEV("div",{className:"space-y-4 flex-1 flex flex-col",children:[i.jsxDEV("div",{children:[i.jsxDEV("label",{htmlFor:"doc-title",className:"block text-sm font-medium text-gray-300 mb-1",children:"Title"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:90,columnNumber:11},this),i.jsxDEV("input",{id:"doc-title",type:"text",value:o,onChange:b=>a(b.target.value),placeholder:"Document title",className:"w-full bg-gray-900 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-indigo-500",maxLength:200},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:91,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:89,columnNumber:9},this),i.jsxDEV("div",{className:"flex gap-4",children:[i.jsxDEV("div",{className:"flex-1",children:[i.jsxDEV("label",{htmlFor:"doc-category",className:"block text-sm font-medium text-gray-300 mb-1",children:"Category"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:105,columnNumber:13},this),i.jsxDEV("select",{id:"doc-category",value:d,onChange:b=>h(b.target.value),className:"w-full bg-gray-900 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 focus:outline-none focus:border-indigo-500",children:v.map(b=>i.jsxDEV("option",{value:b,children:b},b,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:113,columnNumber:17},this))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:106,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:104,columnNumber:11},this),i.jsxDEV("div",{className:"flex-1",children:[i.jsxDEV("label",{htmlFor:"doc-tags",className:"block text-sm font-medium text-gray-300 mb-1",children:"Tags (comma-separated)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:118,columnNumber:13},this),i.jsxDEV("input",{id:"doc-tags",type:"text",value:f,onChange:b=>y(b.target.value),placeholder:"api, backend, auth",className:"w-full bg-gray-900 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-indigo-500"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:119,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:117,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:103,columnNumber:9},this),i.jsxDEV("div",{className:"flex-1 flex flex-col",children:[i.jsxDEV("label",{htmlFor:"doc-content",className:"block text-sm font-medium text-gray-300 mb-1",children:"Content (Markdown)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:132,columnNumber:11},this),i.jsxDEV("textarea",{id:"doc-content",value:c,onChange:b=>u(b.target.value),placeholder:"Write your document content in Markdown...",className:"flex-1 min-h-[200px] w-full bg-gray-900 border border-gray-700 rounded-lg px-3 py-2 text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-indigo-500 font-mono resize-none"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:133,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:131,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:87,columnNumber:7},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Knowledge/KnowledgeDocumentEditor.tsx",lineNumber:62,columnNumber:5},this)}function Gpe(){const[s,e]=tA(),[t,r]=V.useState(s.get("project")?"project":"global"),[n,o]=V.useState([]),[a,c]=V.useState(""),[u,d]=V.useState([]),[h,f]=V.useState([]),[y,v]=V.useState(""),[N,T]=V.useState(""),[b,x]=V.useState(!0),[D,j]=V.useState("list"),[S,k]=V.useState(),[U,F]=V.useState(null),[M,R]=V.useState(!1),[L,B]=V.useState(null);V.useEffect(()=>{ss.getProjects().then(o).catch(()=>{})},[]),V.useEffect(()=>{const Y=s.get("project");if(Y&&n.length>0){const X=n.find(z=>z.id===Y);X&&(r("project"),c(X.path))}},[s,n]);const O=V.useCallback(async()=>{try{if(x(!0),B(null),t==="project"&&!a){d([]),f([]),x(!1);return}const[Y,X]=await Promise.all([ss.getKnowledgeDocuments(t,a||void 0,y||void 0,N||void 0),ss.getKnowledgeCategories(t,a||void 0)]);d(Y),f(X)}catch{B("Failed to load documents")}finally{x(!1)}},[t,a,y,N]);V.useEffect(()=>{O()},[O]);const H=Y=>{r(Y),k(void 0),F(null),j("list"),Y==="global"&&(c(""),e({}))},Z=Y=>{c(Y),k(void 0),F(null),j("list");const X=n.find(z=>z.path===Y);X&&e({project:X.id})},le=async Y=>{k(Y);try{const X=await ss.getKnowledgeDocument(Y,t,a||void 0);F(X),j("view")}catch{B("Failed to load document")}},te=()=>{k(void 0),F(null),j("create")},ne=async Y=>{R(!0);try{if(D==="create"){const X=await ss.createKnowledgeDocument({...Y,scope:t,projectPath:a||void 0});await O(),await le(X)}else U&&(await ss.updateKnowledgeDocument(U.id,{...Y,scope:t,projectPath:a||void 0}),await O(),await le(U.id))}catch{B("Failed to save document")}finally{R(!1)}},q=async()=>{if(U)try{await ss.deleteKnowledgeDocument(U.id,t,a||void 0),F(null),k(void 0),j("list"),await O()}catch{B("Failed to delete document")}};return i.jsxDEV("div",{className:"p-6 max-w-7xl mx-auto h-full flex flex-col",children:[i.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV(VL,{className:"w-6 h-6 text-indigo-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:207,columnNumber:11},this),i.jsxDEV("h1",{className:"text-2xl font-bold text-white",children:"Knowledge"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:208,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:206,columnNumber:9},this),i.jsxDEV(Ipe,{scope:t,onScopeChange:H,projects:n,selectedProjectPath:a,onProjectChange:Z},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:210,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:205,columnNumber:7},this),L&&i.jsxDEV("div",{className:"mb-4 px-4 py-2 bg-red-900/20 border border-red-500/30 rounded-lg text-sm text-red-400",role:"alert",children:[L,i.jsxDEV("button",{onClick:()=>B(null),className:"ml-2 underline",children:"dismiss"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:222,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:220,columnNumber:9},this),i.jsxDEV("div",{className:"flex gap-6 flex-1 min-h-0",children:[i.jsxDEV("div",{className:"w-44 flex-shrink-0",children:[i.jsxDEV("div",{className:"mb-4",children:i.jsxDEV("button",{onClick:te,className:"w-full flex items-center justify-center gap-1.5 px-3 py-2 text-sm bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg transition-colors",children:[i.jsxDEV(rl,{className:"w-4 h-4"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:235,columnNumber:15},this),"New Document"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:231,columnNumber:13},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:230,columnNumber:11},this),i.jsxDEV(Lpe,{categories:h,selectedCategory:y,onCategoryChange:v},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:239,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:229,columnNumber:9},this),i.jsxDEV("div",{className:"flex-1 min-w-0 flex gap-6",children:[i.jsxDEV("div",{className:`w-80 flex-shrink-0 ${D==="create"||D==="edit"?"hidden lg:block":""}`,children:i.jsxDEV(Ope,{documents:u,loading:b,searchQuery:N,onSearchChange:T,selectedDocId:S,onSelectDocument:le},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:250,columnNumber:13},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:249,columnNumber:11},this),i.jsxDEV("div",{className:"flex-1 min-w-0",children:[D==="view"&&U&&i.jsxDEV(Hpe,{document:U,onEdit:()=>j("edit"),onDelete:q},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:263,columnNumber:15},this),D==="edit"&&U&&i.jsxDEV(jB,{document:U,categories:h,saving:M,onSave:ne,onCancel:()=>j("view")},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:270,columnNumber:15},this),D==="create"&&i.jsxDEV(jB,{document:null,categories:h,saving:M,onSave:ne,onCancel:()=>j("list")},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:279,columnNumber:15},this),D==="list"&&!b&&i.jsxDEV("div",{className:"flex items-center justify-center h-full text-gray-500",children:i.jsxDEV("div",{className:"text-center",children:[i.jsxDEV(VL,{className:"w-12 h-12 mx-auto mb-3 opacity-30"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:290,columnNumber:19},this),i.jsxDEV("p",{children:"Select a document to view"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:291,columnNumber:19},this),i.jsxDEV("p",{className:"text-sm mt-1",children:"or create a new one"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:292,columnNumber:19},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:289,columnNumber:17},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:288,columnNumber:15},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:261,columnNumber:11},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:247,columnNumber:9},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:227,columnNumber:7},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/Knowledge.tsx",lineNumber:203,columnNumber:5},this)}const Wpe="/api",Kpe=5e3;function Xpe(){const[s,e]=V.useState([]),[t,r]=V.useState(!0),[n,o]=V.useState(null),a=V.useRef(!0),c=V.useCallback(async()=>{try{const h=await ar.get(`${Wpe}/monitoring/pty-status`);if(!a.current)return;if(h.data.success&&Array.isArray(h.data.data)){const f=h.data.data.map(y=>({sessionName:y.sessionName||y.id||"unknown",agentName:y.agentName||y.name||y.sessionName||"Unknown Agent",role:y.role||"agent",agentStatus:y.agentStatus||y.status||"inactive",workingStatus:y.workingStatus||"idle",ptyPid:y.ptyPid??y.pid??null,memoryUsage:y.memoryUsage??null,uptimeSeconds:y.uptimeSeconds??null,fsScope:y.fsScope||"sandboxed",netScope:y.netScope||"localhost"}));e(f),o(null)}else e([])}catch{a.current&&(o("Failed to fetch PTY sessions"),e([]))}},[]);V.useEffect(()=>{a.current=!0,(async()=>{await c(),a.current&&r(!1)})();const f=setInterval(c,Kpe);return()=>{a.current=!1,clearInterval(f)}},[c]);const u={totalAgents:s.length,isolatedCount:s.length,sharedCount:0,status:(s.length>0,"healthy")},d=V.useCallback(async()=>{await c()},[c]);return{sessions:s,summary:u,loading:t,error:n,refresh:d}}const qpe="/api",TB=[{id:"mock-1",timestamp:new Date(Date.now()-1e3*60*5).toISOString(),sessionName:"agent-sam",agentName:"Sam",toolName:"git push origin feat/auth",outcome:"approved",riskLevel:"medium"},{id:"mock-2",timestamp:new Date(Date.now()-1e3*60*10).toISOString(),sessionName:"agent-sam",agentName:"Sam",toolName:"npm install jsonwebtoken",outcome:"auto",riskLevel:"low"},{id:"mock-3",timestamp:new Date(Date.now()-1e3*60*15).toISOString(),sessionName:"agent-leo",agentName:"Leo",toolName:"rm -rf dist/",outcome:"denied",riskLevel:"high",reason:"Destructive operation on build directory"},{id:"mock-4",timestamp:new Date(Date.now()-1e3*60*20).toISOString(),sessionName:"agent-sam",agentName:"Sam",toolName:"git push --force main",outcome:"denied",riskLevel:"high",reason:"Force push to protected branch"},{id:"mock-5",timestamp:new Date(Date.now()-1e3*60*25).toISOString(),sessionName:"agent-ava",agentName:"Ava",toolName:"npx tailwindcss build",outcome:"auto",riskLevel:"low"},{id:"mock-6",timestamp:new Date(Date.now()-1e3*60*30).toISOString(),sessionName:"agent-leo",agentName:"Leo",toolName:'git commit -m "feat: ..."',outcome:"sop_block",riskLevel:"medium",reason:"Commit does not follow project SOP"}];function Ype(s){switch(s){case"approved":return"approved";case"rejected":return"denied";case"denied":return"denied";case"auto":return"auto";case"sop_block":return"sop_block";default:return"auto"}}function Zpe(){const[s,e]=V.useState([]),[t,r]=V.useState({}),[n,o]=V.useState(!0),[a,c]=V.useState(null),u=V.useCallback(async y=>{try{const v=await ar.get(`${qpe}/approvals/audit`,{signal:y});if(v.data.success&&Array.isArray(v.data.data)){const N=v.data.data.map(T=>({id:T.approvalId||T.id||`audit-${Date.now()}-${Math.random()}`,timestamp:T.timestamp,sessionName:T.sessionName||"",agentName:T.resolvedBy||T.agentName||T.sessionName||"Unknown",toolName:T.toolName||"",outcome:Ype(T.action||T.outcome),riskLevel:T.riskLevel||"medium",reason:T.reason}));e(N),c(null)}else e(TB)}catch(v){if(ar.isCancel(v))return;e(TB),c(null)}finally{o(!1)}},[]);V.useEffect(()=>{const y=new AbortController;return u(y.signal),()=>y.abort()},[u]);const d=V.useMemo(()=>s.filter(y=>!(t.agent&&y.agentName.toLowerCase()!==t.agent.toLowerCase()||t.outcome&&y.outcome!==t.outcome)),[s,t]),h=V.useMemo(()=>{const y=new Date().toDateString(),v=s.filter(N=>new Date(N.timestamp).toDateString()===y);return{totalToday:v.length,deniedToday:v.filter(N=>N.outcome==="denied").length,bypassedToday:0,status:"enforced"}},[s]),f=V.useCallback(async()=>{o(!0),await u()},[u]);return{events:s,filteredEvents:d,summary:h,filter:t,setFilter:r,loading:n,error:a,refresh:f}}const $pe="/api",SB=[{path:"~/.crewly/memory/",type:"Agent Memory",sizeBytes:12.4*1024*1024,isExternal:!1},{path:"~/.crewly/knowledge/",type:"Vector Store",sizeBytes:28.1*1024*1024,isExternal:!1},{path:"~/.crewly/sessions/",type:"PTY Logs",sizeBytes:7.7*1024*1024,isExternal:!1},{path:"~/.crewly/teams/",type:"Config",sizeBytes:.3*1024*1024,isExternal:!1},{path:"~/.crewly/projects/",type:"Metadata",sizeBytes:.1*1024*1024,isExternal:!1}];function IV(s){if(s===0)return"0 B";const e=["B","KB","MB","GB"],t=Math.floor(Math.log(s)/Math.log(1024));return`${(s/Math.pow(1024,t)).toFixed(1)} ${e[t]}`}function Jpe(){const[s,e]=V.useState([]),[t,r]=V.useState(!0),[n,o]=V.useState(null),a=V.useCallback(async d=>{try{const h=await ar.get(`${$pe}/system/storage`,{signal:d});h.data.success&&Array.isArray(h.data.data)?(e(h.data.data),o(null)):e(SB)}catch(h){if(ar.isCancel(h))return;e(SB),o(null)}finally{r(!1)}},[]);V.useEffect(()=>{const d=new AbortController;return a(d.signal),()=>d.abort()},[a]);const c=V.useMemo(()=>({totalLocalBytes:s.filter(h=>!h.isExternal).reduce((h,f)=>h+f.sizeBytes,0),externalConnections:s.filter(h=>h.isExternal).length,cloudSync:"disabled",status:"secure",lastScan:new Date().toISOString()}),[s]),u=V.useCallback(async()=>{r(!0),await a()},[a]);return{entries:s,summary:c,loading:t,error:n,refresh:u}}const EB=["border-blue-500","border-purple-500","border-pink-500","border-cyan-500","border-amber-500"];function Qpe(s){if(s===null)return"N/A";const e=Math.floor(s/3600),t=Math.floor(s%3600/60);return`${e}h${t.toString().padStart(2,"0")}m`}function _B(s){return s===null?"N/A":`${Math.round(s/(1024*1024))}MB`}const UH=({sessions:s,loading:e})=>{const[t,r]=V.useState(!0),[n,o]=V.useState(null),a=()=>r(d=>!d),c=d=>{o(h=>h===d?null:d)},u=(d,h)=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),c(h))};return i.jsxDEV("section",{"aria-labelledby":"pty-map-heading",className:"border border-border-dark rounded-lg bg-surface-dark",children:[i.jsxDEV("button",{type:"button",onClick:a,className:"flex items-center justify-between w-full px-6 py-4 text-left","aria-expanded":t,"aria-controls":"pty-map-content",children:[i.jsxDEV("h2",{id:"pty-map-heading",className:"text-lg font-semibold text-text-primary-dark flex items-center gap-2",children:[i.jsxDEV(Em,{size:20,"aria-hidden":"true",className:"text-blue-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:91,columnNumber:11},globalThis),"PTY Isolation Map"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:90,columnNumber:9},globalThis),t?i.jsxDEV(rA,{size:20,className:"text-text-secondary-dark","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:95,columnNumber:11},globalThis):i.jsxDEV(df,{size:20,className:"text-text-secondary-dark","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:97,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:83,columnNumber:7},globalThis),t&&i.jsxDEV("div",{id:"pty-map-content",className:"px-6 pb-6",children:e?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm py-4",role:"status",children:"Loading PTY sessions..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:105,columnNumber:13},globalThis):s.length===0?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm py-4",children:"No active agent sessions"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:107,columnNumber:13},globalThis):i.jsxDEV("div",{role:"img","aria-label":`PTY isolation map showing ${s.length} isolated agent sessions with no lateral access between them`,children:[s.map((d,h)=>i.jsxDEV("div",{children:[i.jsxDEV("div",{role:"button",tabIndex:0,onClick:()=>c(d.sessionName),onKeyDown:f=>u(f,d.sessionName),className:`flex items-start gap-4 p-4 rounded-lg border-l-4 bg-zinc-900/50 cursor-pointer hover:bg-zinc-800/50 transition-colors ${EB[h%EB.length]}`,"aria-expanded":n===d.sessionName,"data-testid":`pty-node-${d.sessionName}`,children:[i.jsxDEV("div",{className:"flex-1 min-w-0",children:[i.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[i.jsxDEV("span",{className:"font-semibold text-text-primary-dark text-sm",children:d.agentName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:128,columnNumber:25},globalThis),i.jsxDEV("span",{className:"text-xs text-text-secondary-dark",children:["(",d.role,")"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:131,columnNumber:25},globalThis),i.jsxDEV("span",{className:`inline-flex items-center gap-1 text-xs ${d.agentStatus==="active"?"text-emerald-400":"text-text-secondary-dark"}`,children:[i.jsxDEV("span",{className:`w-1.5 h-1.5 rounded-full ${d.agentStatus==="active"?"bg-emerald-400 animate-pulse":"bg-zinc-500"}`,"aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:137,columnNumber:27},globalThis),d.agentStatus==="active"?"Active":d.agentStatus]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:132,columnNumber:25},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:127,columnNumber:23},globalThis),i.jsxDEV("div",{className:"text-xs text-text-secondary-dark",children:["working: ",d.workingStatus]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:146,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:126,columnNumber:21},globalThis),i.jsxDEV("div",{className:"text-xs text-text-secondary-dark font-mono space-y-0.5 text-right flex-shrink-0",children:[i.jsxDEV("div",{children:["PTY pid:",d.ptyPid??"N/A"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:153,columnNumber:23},globalThis),i.jsxDEV("div",{children:["mem: ",_B(d.memoryUsage)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:154,columnNumber:23},globalThis),i.jsxDEV("div",{children:["uptime: ",Qpe(d.uptimeSeconds)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:155,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:152,columnNumber:21},globalThis),i.jsxDEV("div",{className:"text-xs text-text-secondary-dark font-mono space-y-0.5 text-right flex-shrink-0",children:[i.jsxDEV("div",{children:["fs: ",d.fsScope]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:160,columnNumber:23},globalThis),i.jsxDEV("div",{children:["net: ",d.netScope]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:161,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:159,columnNumber:21},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:116,columnNumber:19},globalThis),n===d.sessionName&&i.jsxDEV("div",{className:"ml-4 p-3 bg-zinc-900/30 rounded-b-lg border-l border-border-dark text-xs text-text-secondary-dark font-mono",children:[i.jsxDEV("div",{children:["Session: ",d.sessionName]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:168,columnNumber:23},globalThis),i.jsxDEV("div",{children:["Process ID: ",d.ptyPid??"Not available"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:169,columnNumber:23},globalThis),i.jsxDEV("div",{children:["Memory: ",_B(d.memoryUsage)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:170,columnNumber:23},globalThis),i.jsxDEV("div",{children:["Filesystem: ",d.fsScope," (sandboxed)"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:171,columnNumber:23},globalThis),i.jsxDEV("div",{children:["Network: ",d.netScope," only"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:172,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:167,columnNumber:21},globalThis),h<s.length-1&&i.jsxDEV("div",{className:"flex items-center gap-2 py-2 pl-6","aria-hidden":"true",children:[i.jsxDEV("div",{className:"w-px h-4 bg-border-dark"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:179,columnNumber:23},globalThis),i.jsxDEV(Tn,{size:12,className:"text-red-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:180,columnNumber:23},globalThis),i.jsxDEV("span",{className:"text-xs text-text-secondary-dark",children:"(no lateral access)"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:181,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:178,columnNumber:21},globalThis)]},d.sessionName,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:114,columnNumber:17},globalThis)),i.jsxDEV("div",{className:"flex items-center gap-4 mt-4 pt-3 border-t border-border-dark text-xs text-text-secondary-dark",children:[i.jsxDEV("span",{className:"flex items-center gap-1",children:[i.jsxDEV("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:190,columnNumber:19},globalThis),"Active"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:189,columnNumber:17},globalThis),i.jsxDEV("span",{className:"flex items-center gap-1",children:[i.jsxDEV("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-500","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:194,columnNumber:19},globalThis),"Inactive"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:193,columnNumber:17},globalThis),i.jsxDEV("span",{className:"flex items-center gap-1",children:[i.jsxDEV(Tn,{size:10,className:"text-red-400","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:198,columnNumber:19},globalThis),"No cross-session access"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:197,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:188,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:109,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:103,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/PtyIsolationMap.tsx",lineNumber:81,columnNumber:5},globalThis)};UH.displayName="PtyIsolationMap";const jk={auto:{label:"Auto",className:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",icon:"✅"},approved:{label:"Approved",className:"bg-emerald-500/10 text-emerald-300 border-emerald-500/30",icon:"✅"},denied:{label:"Denied",className:"bg-red-500/10 text-red-400 border-red-500/20",icon:"🔴"},sop_block:{label:"SOP Block",className:"bg-amber-500/10 text-amber-400 border-amber-500/20",icon:"⚠️"}},kB=10;function eye(s){return new Date(s).toLocaleTimeString("en-US",{hour12:!1})}function tye(s){const e=["Timestamp","Agent","Tool/Command","Outcome","Risk Level","Reason"],t=s.map(c=>[c.timestamp,c.agentName,c.toolName,c.outcome,c.riskLevel,c.reason||""]),r=[e.join(","),...t.map(c=>c.map(u=>`"${u}"`).join(","))].join(`
5214
5214
  `),n=new Blob([r],{type:"text/csv"}),o=URL.createObjectURL(n),a=document.createElement("a");a.href=o,a.download=`approval-audit-${new Date().toISOString().split("T")[0]}.csv`,a.click(),URL.revokeObjectURL(o)}const RH=({events:s,filter:e,onFilterChange:t,loading:r})=>{const[n,o]=V.useState(!0),[a,c]=V.useState(!1),[u,d]=V.useState(kB),h=V.useMemo(()=>s.slice(0,u),[s,u]),f=V.useMemo(()=>Array.from(new Set(s.map(x=>x.agentName))),[s]),y=()=>o(x=>!x),v=x=>{t({...e,agent:x}),c(!1)},N=x=>{t({...e,outcome:x}),c(!1)},T=()=>{tye(s)},b=()=>{d(x=>x+kB)};return i.jsxDEV("section",{"aria-labelledby":"audit-log-heading",className:"border border-border-dark rounded-lg bg-surface-dark",children:[i.jsxDEV("div",{className:"flex items-center justify-between px-6 py-4",children:[i.jsxDEV("button",{type:"button",onClick:y,className:"flex items-center gap-2 text-left flex-1","aria-expanded":n,"aria-controls":"audit-log-content",children:[i.jsxDEV("h2",{id:"audit-log-heading",className:"text-lg font-semibold text-text-primary-dark flex items-center gap-2",children:[i.jsxDEV(ZB,{size:20,"aria-hidden":"true",className:"text-emerald-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:138,columnNumber:13},globalThis),"Approval Audit Log"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:137,columnNumber:11},globalThis),n?i.jsxDEV(rA,{size:20,className:"text-text-secondary-dark","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:142,columnNumber:13},globalThis):i.jsxDEV(df,{size:20,className:"text-text-secondary-dark","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:144,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:130,columnNumber:9},globalThis),n&&i.jsxDEV("div",{className:"flex items-center gap-2",children:[i.jsxDEV("div",{className:"relative",children:[i.jsxDEV("button",{type:"button",onClick:()=>c(x=>!x),className:"flex items-center gap-1 px-3 py-1.5 text-xs text-text-secondary-dark border border-border-dark rounded-md hover:bg-zinc-800 transition-colors","aria-label":"Filter events","data-testid":"filter-button",children:[i.jsxDEV(xX,{size:14,"aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:159,columnNumber:17},globalThis),"Filter",(e.agent||e.outcome)&&i.jsxDEV("span",{className:"ml-1 w-1.5 h-1.5 rounded-full bg-primary","aria-label":"Filter active"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:162,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:152,columnNumber:15},globalThis),a&&i.jsxDEV("div",{className:"absolute right-0 top-full mt-1 w-48 bg-zinc-800 border border-border-dark rounded-md shadow-lg z-10",role:"menu","data-testid":"filter-menu",children:[i.jsxDEV("div",{className:"p-2",children:[i.jsxDEV("div",{className:"text-xs font-semibold text-text-secondary-dark mb-1 px-2",children:"By Agent"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:174,columnNumber:21},globalThis),i.jsxDEV("button",{type:"button",onClick:()=>v(void 0),className:"w-full text-left px-2 py-1 text-xs text-text-primary-dark hover:bg-zinc-700 rounded",role:"menuitem",children:"All Agents"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:175,columnNumber:21},globalThis),f.map(x=>i.jsxDEV("button",{type:"button",onClick:()=>v(x),className:`w-full text-left px-2 py-1 text-xs hover:bg-zinc-700 rounded ${e.agent===x?"text-primary":"text-text-primary-dark"}`,role:"menuitem",children:x},x,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:184,columnNumber:23},globalThis))]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:173,columnNumber:19},globalThis),i.jsxDEV("div",{className:"border-t border-border-dark p-2",children:[i.jsxDEV("div",{className:"text-xs font-semibold text-text-secondary-dark mb-1 px-2",children:"By Outcome"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:198,columnNumber:21},globalThis),i.jsxDEV("button",{type:"button",onClick:()=>N(void 0),className:"w-full text-left px-2 py-1 text-xs text-text-primary-dark hover:bg-zinc-700 rounded",role:"menuitem",children:"All Outcomes"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:199,columnNumber:21},globalThis),Object.keys(jk).map(x=>i.jsxDEV("button",{type:"button",onClick:()=>N(x),className:`w-full text-left px-2 py-1 text-xs hover:bg-zinc-700 rounded ${e.outcome===x?"text-primary":"text-text-primary-dark"}`,role:"menuitem",children:[jk[x].icon," ",jk[x].label]},x,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:208,columnNumber:23},globalThis))]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:197,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:168,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:151,columnNumber:13},globalThis),i.jsxDEV("button",{type:"button",onClick:T,className:"flex items-center gap-1 px-3 py-1.5 text-xs text-text-secondary-dark border border-border-dark rounded-md hover:bg-zinc-800 transition-colors","aria-label":"Export as CSV","data-testid":"export-button",children:[i.jsxDEV(WV,{size:14,"aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:233,columnNumber:15},globalThis),"Export"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:226,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:149,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:129,columnNumber:7},globalThis),n&&i.jsxDEV("div",{id:"audit-log-content",className:"px-6 pb-6",children:r?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm py-4",role:"status",children:"Loading audit events..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:244,columnNumber:13},globalThis):s.length===0?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm py-4",children:"No approval events recorded"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:246,columnNumber:13},globalThis):i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{className:"overflow-x-auto",children:i.jsxDEV("table",{className:"w-full text-sm",role:"table",children:[i.jsxDEV("thead",{children:i.jsxDEV("tr",{className:"border-b border-border-dark",children:[i.jsxDEV("th",{scope:"col",className:"text-left py-2 pr-4 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"Time"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:254,columnNumber:23},globalThis),i.jsxDEV("th",{scope:"col",className:"text-left py-2 pr-4 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"Agent"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:255,columnNumber:23},globalThis),i.jsxDEV("th",{scope:"col",className:"text-left py-2 pr-4 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"Tool / Command"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:256,columnNumber:23},globalThis),i.jsxDEV("th",{scope:"col",className:"text-right py-2 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"Outcome"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:257,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:253,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:252,columnNumber:19},globalThis),i.jsxDEV("tbody",{children:h.map(x=>{const D=jk[x.outcome];return i.jsxDEV("tr",{className:"border-b border-border-dark/50 hover:bg-zinc-800/30 transition-colors","data-testid":`audit-row-${x.id}`,children:[i.jsxDEV("td",{className:"py-2.5 pr-4 font-mono text-xs text-text-secondary-dark whitespace-nowrap",children:eye(x.timestamp)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:269,columnNumber:27},globalThis),i.jsxDEV("td",{className:"py-2.5 pr-4 text-text-primary-dark whitespace-nowrap",children:x.agentName},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:272,columnNumber:27},globalThis),i.jsxDEV("td",{className:"py-2.5 pr-4 font-mono text-xs text-text-secondary-dark",children:[x.toolName,x.reason&&i.jsxDEV("span",{className:"block text-xs text-zinc-500 mt-0.5",title:x.reason,children:x.reason},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:278,columnNumber:31},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:275,columnNumber:27},globalThis),i.jsxDEV("td",{className:"py-2.5 text-right",children:i.jsxDEV("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${D.className}`,children:[i.jsxDEV("span",{"aria-hidden":"true",children:D.icon},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:287,columnNumber:31},globalThis),D.label]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:284,columnNumber:29},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:283,columnNumber:27},globalThis)]},x.id,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:264,columnNumber:25},globalThis)})},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:260,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:251,columnNumber:17},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:250,columnNumber:15},globalThis),s.length>u&&i.jsxDEV("div",{className:"mt-3 text-center",children:i.jsxDEV("button",{type:"button",onClick:b,className:"text-xs text-primary hover:text-primary/80 transition-colors","data-testid":"load-more-button",children:["Showing ",u," of ",s.length," events — Load more"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:301,columnNumber:19},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:300,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:248,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:242,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/ApprovalAuditLog.tsx",lineNumber:127,columnNumber:5},globalThis)};RH.displayName="ApprovalAuditLog";const VH=({entries:s,summary:e,loading:t})=>{const[r,n]=V.useState(!0),o=()=>n(u=>!u),a=e.status==="secure"?"text-emerald-400":"text-amber-400",c=e.status==="secure"?"SECURE":"WARNING";return i.jsxDEV("section",{"aria-labelledby":"sovereignty-heading",className:"border border-border-dark rounded-lg bg-surface-dark",children:[i.jsxDEV("div",{className:"flex items-center justify-between px-6 py-4",children:[i.jsxDEV("button",{type:"button",onClick:o,className:"flex items-center gap-2 text-left flex-1","aria-expanded":r,"aria-controls":"sovereignty-content",children:[i.jsxDEV("h2",{id:"sovereignty-heading",className:"text-lg font-semibold text-text-primary-dark flex items-center gap-2",children:[i.jsxDEV(wX,{size:20,"aria-hidden":"true",className:"text-purple-400"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:56,columnNumber:13},globalThis),"Data Sovereignty Report"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:55,columnNumber:11},globalThis),r?i.jsxDEV(rA,{size:20,className:"text-text-secondary-dark","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:60,columnNumber:13},globalThis):i.jsxDEV(df,{size:20,className:"text-text-secondary-dark","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:62,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:48,columnNumber:9},globalThis),i.jsxDEV("span",{className:`text-xs font-medium uppercase tracking-wide ${a}`,"data-testid":"sovereignty-status",children:c},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:67,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:47,columnNumber:7},globalThis),r&&i.jsxDEV("div",{id:"sovereignty-content",className:"px-6 pb-6",children:t?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm py-4",role:"status",children:"Loading storage data..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:76,columnNumber:13},globalThis):i.jsxDEV(i.Fragment,{children:[i.jsxDEV("div",{className:"overflow-x-auto",children:i.jsxDEV("table",{className:"w-full text-sm",role:"table",children:[i.jsxDEV("thead",{children:i.jsxDEV("tr",{className:"border-b border-border-dark",children:[i.jsxDEV("th",{scope:"col",className:"text-left py-2 pr-4 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"Storage Location"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:84,columnNumber:23},globalThis),i.jsxDEV("th",{scope:"col",className:"text-left py-2 pr-4 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"Type"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:87,columnNumber:23},globalThis),i.jsxDEV("th",{scope:"col",className:"text-right py-2 pr-4 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"Size"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:90,columnNumber:23},globalThis),i.jsxDEV("th",{scope:"col",className:"text-center py-2 text-xs font-medium text-text-secondary-dark uppercase tracking-wide",children:"External?"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:93,columnNumber:23},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:83,columnNumber:21},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:82,columnNumber:19},globalThis),i.jsxDEV("tbody",{children:s.map(u=>i.jsxDEV("tr",{className:"border-b border-border-dark/50","data-testid":`storage-row-${u.type.toLowerCase().replace(/\s+/g,"-")}`,children:[i.jsxDEV("td",{className:"py-2.5 pr-4 font-mono text-xs text-text-secondary-dark",children:u.path},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:105,columnNumber:25},globalThis),i.jsxDEV("td",{className:"py-2.5 pr-4 text-text-primary-dark",children:u.type},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:108,columnNumber:25},globalThis),i.jsxDEV("td",{className:"py-2.5 pr-4 text-right font-mono text-xs text-text-secondary-dark",children:IV(u.sizeBytes)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:111,columnNumber:25},globalThis),i.jsxDEV("td",{className:"py-2.5 text-center",children:u.isExternal?i.jsxDEV("span",{className:"text-red-400 text-xs font-medium","aria-label":"External: Yes",children:"Yes ❌"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:116,columnNumber:29},globalThis):i.jsxDEV("span",{className:"text-emerald-400 text-xs font-medium","aria-label":"External: No",children:"No ✅"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:118,columnNumber:29},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:114,columnNumber:25},globalThis)]},u.path,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:100,columnNumber:23},globalThis))},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:98,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:81,columnNumber:17},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:80,columnNumber:15},globalThis),i.jsxDEV("div",{className:"mt-4 pt-3 border-t border-border-dark space-y-1 text-sm text-text-secondary-dark",children:[i.jsxDEV("div",{children:["Total local storage:"," ",i.jsxDEV("span",{className:"text-text-primary-dark font-medium",children:IV(e.totalLocalBytes)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:131,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:129,columnNumber:17},globalThis),i.jsxDEV("div",{children:["External connections:"," ",i.jsxDEV("span",{className:"text-text-primary-dark font-medium",children:e.externalConnections},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:137,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:135,columnNumber:17},globalThis),i.jsxDEV("div",{children:["Cloud sync:"," ",i.jsxDEV("span",{className:"text-text-primary-dark font-medium capitalize",children:e.cloudSync},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:143,columnNumber:19},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:141,columnNumber:17},globalThis),i.jsxDEV("div",{className:"text-xs text-zinc-500",children:["Last scan: ",new Date(e.lastScan).toLocaleString()]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:147,columnNumber:17},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:128,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:78,columnNumber:13},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:74,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/components/Security/DataSovereigntyReport.tsx",lineNumber:45,columnNumber:5},globalThis)};VH.displayName="DataSovereigntyReport";const AR={healthy:"text-emerald-400",secure:"text-emerald-400",enforced:"text-emerald-400",warning:"text-amber-400",partial:"text-amber-400",error:"text-red-400",disabled:"text-red-400",compromised:"text-red-400"},MR={healthy:"HEALTHY",secure:"SECURE",enforced:"ENFORCED",warning:"WARNING",partial:"PARTIAL",error:"ERROR",disabled:"DISABLED",compromised:"COMPROMISED"},FH=()=>{const{sessions:s,summary:e,loading:t}=Xpe(),{filteredEvents:r,summary:n,filter:o,setFilter:a,loading:c}=Zpe(),{entries:u,summary:d,loading:h}=Jpe();return i.jsxDEV("div",{className:"max-w-7xl mx-auto px-4 py-6 space-y-6",children:[i.jsxDEV("div",{className:"flex items-center gap-3",children:[i.jsxDEV(aT,{size:28,className:"text-emerald-400","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:73,columnNumber:9},globalThis),i.jsxDEV("div",{children:[i.jsxDEV("h1",{className:"text-2xl font-bold text-text-primary-dark",children:"Security Overview"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:75,columnNumber:11},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark",children:"Your instance security posture at a glance"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:76,columnNumber:11},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:74,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:72,columnNumber:7},globalThis),i.jsxDEV("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4","data-testid":"summary-cards",children:[i.jsxDEV("div",{className:"border border-border-dark rounded-lg bg-surface-dark p-6","data-testid":"card-pty",children:[i.jsxDEV("div",{className:"flex items-center gap-2 mb-3",children:[i.jsxDEV(Em,{size:18,className:"text-blue-400","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:87,columnNumber:13},globalThis),i.jsxDEV("h3",{className:"text-sm font-semibold text-text-primary-dark",children:"PTY Status"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:88,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:86,columnNumber:11},globalThis),t?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm",role:"status",children:"Loading..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:91,columnNumber:13},globalThis):i.jsxDEV("div",{className:"space-y-1 text-sm",children:[i.jsxDEV("div",{className:"text-text-secondary-dark",children:[e.totalAgents," agents"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:94,columnNumber:15},globalThis),i.jsxDEV("div",{className:"text-text-secondary-dark",children:[e.isolatedCount," isolated"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:97,columnNumber:15},globalThis),i.jsxDEV("div",{className:"text-text-secondary-dark",children:[e.sharedCount," shared"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:100,columnNumber:15},globalThis),i.jsxDEV("div",{className:`text-xs font-medium uppercase tracking-wide mt-2 flex items-center gap-1 ${AR[e.status]}`,children:[i.jsxDEV("span",{className:`w-1.5 h-1.5 rounded-full animate-pulse ${e.status==="healthy"?"bg-emerald-400":"bg-amber-400"}`,"aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:104,columnNumber:17},globalThis),MR[e.status]]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:103,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:93,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:85,columnNumber:9},globalThis),i.jsxDEV("div",{className:"border border-border-dark rounded-lg bg-surface-dark p-6","data-testid":"card-storage",children:[i.jsxDEV("div",{className:"flex items-center gap-2 mb-3",children:[i.jsxDEV(jX,{size:18,className:"text-purple-400","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:114,columnNumber:13},globalThis),i.jsxDEV("h3",{className:"text-sm font-semibold text-text-primary-dark",children:"Storage"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:115,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:113,columnNumber:11},globalThis),h?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm",role:"status",children:"Loading..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:118,columnNumber:13},globalThis):i.jsxDEV("div",{className:"space-y-1 text-sm",children:[i.jsxDEV("div",{className:"text-text-secondary-dark",children:"Local DB"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:121,columnNumber:15},globalThis),i.jsxDEV("div",{className:"text-text-secondary-dark",children:IV(d.totalLocalBytes)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:122,columnNumber:15},globalThis),i.jsxDEV("div",{className:"text-text-secondary-dark",children:[d.externalConnections," cloud"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:125,columnNumber:15},globalThis),i.jsxDEV("div",{className:`text-xs font-medium uppercase tracking-wide mt-2 flex items-center gap-1 ${AR[d.status]}`,children:[i.jsxDEV("span",{className:`w-1.5 h-1.5 rounded-full animate-pulse ${d.status==="secure"?"bg-emerald-400":"bg-amber-400"}`,"aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:129,columnNumber:17},globalThis),MR[d.status]]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:128,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:120,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:112,columnNumber:9},globalThis),i.jsxDEV("div",{className:"border border-border-dark rounded-lg bg-surface-dark p-6","data-testid":"card-approvals",children:[i.jsxDEV("div",{className:"flex items-center gap-2 mb-3",children:[i.jsxDEV(ZB,{size:18,className:"text-emerald-400","aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:139,columnNumber:13},globalThis),i.jsxDEV("h3",{className:"text-sm font-semibold text-text-primary-dark",children:"Approvals"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:140,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:138,columnNumber:11},globalThis),c?i.jsxDEV("div",{className:"text-text-secondary-dark text-sm",role:"status",children:"Loading..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:143,columnNumber:13},globalThis):i.jsxDEV("div",{className:"space-y-1 text-sm",children:[i.jsxDEV("div",{className:"text-text-secondary-dark",children:[n.totalToday," today"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:146,columnNumber:15},globalThis),i.jsxDEV("div",{className:"text-text-secondary-dark",children:[n.deniedToday," denied"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:149,columnNumber:15},globalThis),i.jsxDEV("div",{className:"text-text-secondary-dark",children:[n.bypassedToday," bypassed"]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:152,columnNumber:15},globalThis),i.jsxDEV("div",{className:`text-xs font-medium uppercase tracking-wide mt-2 flex items-center gap-1 ${AR[n.status]}`,children:[i.jsxDEV("span",{className:`w-1.5 h-1.5 rounded-full animate-pulse ${n.status==="enforced"?"bg-emerald-400":"bg-amber-400"}`,"aria-hidden":"true"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:156,columnNumber:17},globalThis),MR[n.status]]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:155,columnNumber:15},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:145,columnNumber:13},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:137,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:83,columnNumber:7},globalThis),i.jsxDEV(UH,{sessions:s,loading:t},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:165,columnNumber:7},globalThis),i.jsxDEV(RH,{events:r,filter:o,onFilterChange:a,loading:c},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:168,columnNumber:7},globalThis),i.jsxDEV(VH,{entries:u,summary:d,loading:h},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:176,columnNumber:7},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/SecurityOverview.tsx",lineNumber:70,columnNumber:5},globalThis)};FH.displayName="SecurityOverview";const rye=()=>{const[s]=tA(),e=Sm();return V.useEffect(()=>{(async()=>{const r=s.get("token"),n=s.get("refreshToken"),o=s.get("error");if(r){localStorage.setItem(Db,r),n&&localStorage.setItem("crewly_refresh_token",n);try{await fetch("/api/cloud/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r,refreshToken:n})})}catch{}}o?e("/settings?tab=cloud&error="+encodeURIComponent(o),{replace:!0}):e("/settings?tab=cloud",{replace:!0})})()},[s,e]),i.jsxDEV("div",{className:"min-h-screen flex items-center justify-center bg-background-dark",children:i.jsxDEV("div",{className:"text-center",children:[i.jsxDEV("div",{className:"w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin mx-auto"},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/AuthCallback.tsx",lineNumber:63,columnNumber:9},globalThis),i.jsxDEV("p",{className:"text-sm text-text-secondary-dark mt-4",children:"Completing sign-in..."},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/AuthCallback.tsx",lineNumber:64,columnNumber:9},globalThis)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/AuthCallback.tsx",lineNumber:62,columnNumber:7},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/pages/AuthCallback.tsx",lineNumber:61,columnNumber:5},globalThis)};function sye(){return i.jsxDEV($Y,{children:i.jsxDEV(oZ,{children:i.jsxDEV(zX,{children:i.jsxDEV(JK,{children:i.jsxDEV(FK,{children:[i.jsxDEV(Ta,{path:"/auth/callback",element:i.jsxDEV(rye,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:30,columnNumber:51},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:30,columnNumber:13},this),i.jsxDEV(Ta,{path:"/",element:i.jsxDEV(g$,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:33,columnNumber:38},this),children:[i.jsxDEV(Ta,{index:!0,element:i.jsxDEV(_$,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:34,columnNumber:37},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:34,columnNumber:15},this),i.jsxDEV(Ta,{path:"projects",element:i.jsxDEV(A$,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:35,columnNumber:47},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:35,columnNumber:15},this),i.jsxDEV(Ta,{path:"projects/:id",element:i.jsxDEV(xJ,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:36,columnNumber:51},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:36,columnNumber:15},this),i.jsxDEV(Ta,{path:"teams",element:i.jsxDEV(zJ,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:37,columnNumber:44},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:37,columnNumber:15},this),i.jsxDEV(Ta,{path:"teams/:id",element:i.jsxDEV(oQ,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:38,columnNumber:48},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:38,columnNumber:15},this),i.jsxDEV(Ta,{path:"assignments",element:i.jsxDEV(mQ,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:39,columnNumber:50},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:39,columnNumber:15},this),i.jsxDEV(Ta,{path:"scheduled-checkins",element:i.jsxDEV(bQ,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:40,columnNumber:57},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:40,columnNumber:15},this),i.jsxDEV(Ta,{path:"factory",element:i.jsxDEV(Jhe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:41,columnNumber:46},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:41,columnNumber:15},this),i.jsxDEV(Ta,{path:"marketplace",element:i.jsxDEV(Fpe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:42,columnNumber:50},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:42,columnNumber:15},this),i.jsxDEV(Ta,{path:"knowledge",element:i.jsxDEV(Gpe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:43,columnNumber:48},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:43,columnNumber:15},this),i.jsxDEV(Ta,{path:"security",element:i.jsxDEV(FH,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:44,columnNumber:47},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:44,columnNumber:15},this),i.jsxDEV(Ta,{path:"settings",element:i.jsxDEV($fe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:45,columnNumber:47},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:45,columnNumber:15},this),i.jsxDEV(Ta,{path:"chat",element:i.jsxDEV(Qfe,{children:i.jsxDEV(xpe,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:50,columnNumber:21},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:49,columnNumber:19},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:46,columnNumber:15},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:33,columnNumber:13},this)]},void 0,!0,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:28,columnNumber:11},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:27,columnNumber:9},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:26,columnNumber:7},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:25,columnNumber:5},this)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/App.tsx",lineNumber:24,columnNumber:5},this)}RR.createRoot(document.getElementById("root")).render(i.jsxDEV(pn.StrictMode,{children:i.jsxDEV(sye,{},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/main.tsx",lineNumber:13,columnNumber:5},globalThis)},void 0,!1,{fileName:"/Users/yellowsunhy/Desktop/projects/crewly-projects/crewly/frontend/src/main.tsx",lineNumber:12,columnNumber:3},globalThis));
5215
- //# sourceMappingURL=index-3b33c6e8.js.map
5215
+ //# sourceMappingURL=index-0837baf4.js.map