tide-commander 1.40.2 → 1.40.3

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 (39) hide show
  1. package/dist/assets/{BossLogsModal-CaDrNfm1.js → BossLogsModal-5ehRTeGs.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-DLJInoVf.js → BossSpawnModal-DibwTCub.js} +1 -1
  3. package/dist/assets/{ControlsModal-Cnnhwfr_.js → ControlsModal-Bd5SZVzZ.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-D4CbWK3-.js → DockerLogsModal-DWzJq-fY.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-36YBGNE2.js → EmbeddedEditor-D0Yo-o66.js} +1 -1
  6. package/dist/assets/{GmailOAuthSetup-DI5j7wkF.js → GmailOAuthSetup-CdX36hAm.js} +1 -1
  7. package/dist/assets/{GoogleOAuthSetup-Bsj02mND.js → GoogleOAuthSetup-B3zA-0E7.js} +1 -1
  8. package/dist/assets/{IframeModal-BJ4oeDBn.js → IframeModal-Cz8quXPm.js} +1 -1
  9. package/dist/assets/{IntegrationsPanel-DLmIJEUy.js → IntegrationsPanel-C1ktSqvl.js} +2 -2
  10. package/dist/assets/{LogViewerModal-D7CXMmZf.js → LogViewerModal-De8tLix0.js} +1 -1
  11. package/dist/assets/{MonitoringModal-PnEKvezF.js → MonitoringModal-DOaMyrjA.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-EB_Au0iK.js → PM2LogsModal-D-Gq8l2H.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-C-X90Qxe.js → RestoreArchivedAreaModal-COSiM8Fi.js} +1 -1
  14. package/dist/assets/{SaveSnapshotModal-D6XAjL2T.js → SaveSnapshotModal-DxwK-i0L.js} +1 -1
  15. package/dist/assets/{Scene2DCanvas-DlVguRVM.js → Scene2DCanvas-4ByVcSoi.js} +1 -1
  16. package/dist/assets/{SceneManager-OOaJ_z8v.js → SceneManager-7WDKGyPC.js} +1 -1
  17. package/dist/assets/{SkillsPanel-D5wo2MHh.js → SkillsPanel-1Msh9dAe.js} +1 -1
  18. package/dist/assets/{SnapshotManager-BLjpctX_.js → SnapshotManager-DQ6jkxDW.js} +1 -1
  19. package/dist/assets/{SpawnModal-DQ4uUm1y.js → SpawnModal-CHALHOLz.js} +1 -1
  20. package/dist/assets/{SubordinateAssignmentModal-BDUDt6WC.js → SubordinateAssignmentModal-DBZsFe-S.js} +1 -1
  21. package/dist/assets/{SupervisorPanel-BZaBI9BA.js → SupervisorPanel-NYoLg7_B.js} +1 -1
  22. package/dist/assets/{TriggerManagerPanel-DuBiclsE.js → TriggerManagerPanel-CNhhmDvm.js} +1 -1
  23. package/dist/assets/{WorkflowEditorPanel-D49yDqth.js → WorkflowEditorPanel-BMpT0GGS.js} +1 -1
  24. package/dist/assets/{index-mQmnkGdF.js → index-BvYoT0dH.js} +1 -1
  25. package/dist/assets/{index-BxbFh16W.js → index-BzYz2FJi.js} +2 -2
  26. package/dist/assets/{index-BiGvhrCO.js → index-CDKrcnoB.js} +1 -1
  27. package/dist/assets/{index-BSl18-4e.js → index-CEZ1e3Of.js} +1 -1
  28. package/dist/assets/{index-DZ3f9mNd.js → index-CSOx3Jk0.js} +1 -1
  29. package/dist/assets/{index-Bxjd0N-j.js → index-CTINc_P-.js} +1 -1
  30. package/dist/assets/{index-DJdXbeWz.js → index-CqZxf78s.js} +3 -3
  31. package/dist/assets/{index-BwkNteiZ.js → index-DAOIgllP.js} +1 -1
  32. package/dist/assets/{main-DULfVodw.js → main-DSF4XPLl.js} +4 -4
  33. package/dist/assets/{web-DAqM9uoZ.js → web-2Scyvbzn.js} +1 -1
  34. package/dist/assets/{web-DQ10iSod.js → web-DXju9dHs.js} +1 -1
  35. package/dist/index.html +1 -1
  36. package/dist/src/packages/server/cli.js +17 -1
  37. package/dist/src/packages/server/data/builtin-skills/boss-instructions.js +2 -2
  38. package/dist/src/packages/server/websocket/handlers/boss-response-handler.js +5 -1
  39. package/package.json +1 -1
@@ -1 +1 @@
1
- import{a2 as se,H as ne,J as ie,I as re,b7 as ce,r as g,s as O,b8 as bt,z as pt,u as Mt,j as m}from"./main-DULfVodw.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function et(e){return Array.isArray?Array.isArray(e):zt(e)==="[object Array]"}function oe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function ae(e){return e==null?"":oe(e)}function X(e){return typeof e=="string"}function Qt(e){return typeof e=="number"}function ue(e){return e===!0||e===!1||le(e)&&zt(e)=="[object Boolean]"}function Wt(e){return typeof e=="object"}function le(e){return Wt(e)&&e!==null}function H(e){return e!=null}function gt(e){return!e.trim().length}function zt(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const he="Incorrect 'index' type",de=e=>`Invalid value for key ${e}`,fe=e=>`Pattern length exceeds max of ${e}.`,me=e=>`Missing ${e} property in key`,pe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Rt=Object.prototype.hasOwnProperty;class ge{constructor(t){this._keys=[],this._keyMap={};let s=0;t.forEach(n=>{let i=Vt(n);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(n=>{n.weight/=s})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Vt(e){let t=null,s=null,n=null,i=1,c=null;if(X(e)||et(e))n=e,t=_t(e),s=yt(e);else{if(!Rt.call(e,"name"))throw new Error(me("name"));const o=e.name;if(n=o,Rt.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(pe(o));t=_t(o),s=yt(o),c=e.getFn}return{path:t,id:s,weight:i,src:n,getFn:c}}function _t(e){return et(e)?e:e.split(".")}function yt(e){return et(e)?e.join("."):e}function ye(e,t){let s=[],n=!1;const i=(c,o,a)=>{if(H(c))if(!o[a])s.push(c);else{let u=o[a];const l=c[u];if(!H(l))return;if(a===o.length-1&&(X(l)||Qt(l)||ue(l)))s.push(ae(l));else if(et(l)){n=!0;for(let d=0,h=l.length;d<h;d+=1)i(l[d],o,a+1)}else o.length&&i(l,o,a+1)}};return i(e,X(t)?t.split("."):t,0),n?s:s[0]}const Ae={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},xe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Ee={location:0,threshold:.6,distance:100},Ce={useExtendedSearch:!1,getFn:ye,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...xe,...Ae,...Ee,...Ce};const Fe=/[^ ]+/g;function Me(e=1,t=3){const s=new Map,n=Math.pow(10,t);return{get(i){const c=i.match(Fe).length;if(s.has(c))return s.get(c);const o=1/Math.pow(c,.5*e),a=parseFloat(Math.round(o*n)/n);return s.set(c,a),a},clear(){s.clear()}}}class wt{constructor({getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=Me(s,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,X(this.docs[0])?this.docs.forEach((t,s)=>{this._addString(t,s)}):this.docs.forEach((t,s)=>{this._addObject(t,s)}),this.norm.clear())}add(t){const s=this.size();X(t)?this._addString(t,s):this._addObject(t,s)}removeAt(t){this.records.splice(t,1);for(let s=t,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(t,s){return t[this._keysMap[s]]}size(){return this.records.length}_addString(t,s){if(!H(t)||gt(t))return;let n={v:t,i:s,n:this.norm.get(t)};this.records.push(n)}_addObject(t,s){let n={i:s,$:{}};this.keys.forEach((i,c)=>{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(H(o)){if(et(o)){let a=[];const u=[{nestedArrIndex:-1,value:o}];for(;u.length;){const{nestedArrIndex:l,value:d}=u.pop();if(H(d))if(X(d)&&!gt(d)){let h={v:d,i:l,n:this.norm.get(d)};a.push(h)}else et(d)&&d.forEach((h,f)=>{u.push({nestedArrIndex:f,value:h})})}n.$[c]=a}else if(X(o)&&!gt(o)){let a={v:o,n:this.norm.get(o)};n.$[c]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ut(e,t,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const i=new wt({getFn:s,fieldNormWeight:n});return i.setKeys(e.map(Vt)),i.setSources(t),i.create(),i}function we(e,{getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:i}=e,c=new wt({getFn:t,fieldNormWeight:s});return c.setKeys(n),c.setIndexRecords(i),c}function ht(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:i=p.distance,ignoreLocation:c=p.ignoreLocation}={}){const o=t/e.length;if(c)return o;const a=Math.abs(n-s);return i?o+a/i:a?1:o}function ve(e=[],t=p.minMatchCharLength){let s=[],n=-1,i=-1,c=0;for(let o=e.length;c<o;c+=1){let a=e[c];a&&n===-1?n=c:!a&&n!==-1&&(i=c-1,i-n+1>=t&&s.push([n,i]),n=-1)}return e[c-1]&&c-n>=t&&s.push([n,c-1]),s}const ot=32;function De(e,t,s,{location:n=p.location,distance:i=p.distance,threshold:c=p.threshold,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(t.length>ot)throw new Error(fe(ot));const d=t.length,h=e.length,f=Math.max(0,Math.min(n,h));let y=c,C=f;const k=a>1||u,D=k?Array(h):[];let b;for(;(b=e.indexOf(t,C))>-1;){let S=ht(t,{currentLocation:b,expectedLocation:f,distance:i,ignoreLocation:l});if(y=Math.min(S,y),C=b+d,k){let v=0;for(;v<d;)D[b+v]=1,v+=1}}C=-1;let N=[],z=1,Q=d+h;const at=1<<d-1;for(let S=0;S<d;S+=1){let v=0,j=Q;for(;v<j;)ht(t,{errors:S,currentLocation:f+j,expectedLocation:f,distance:i,ignoreLocation:l})<=y?v=j:Q=j,j=Math.floor((Q-v)/2+v);Q=j;let _=Math.max(1,f-j+1),W=o?h:Math.min(f+j,h)+d,K=Array(W+2);K[W+1]=(1<<S)-1;for(let T=W;T>=_;T-=1){let Z=T-1,ct=s[e.charAt(Z)];if(k&&(D[Z]=+!!ct),K[T]=(K[T+1]<<1|1)&ct,S&&(K[T]|=(N[T+1]|N[T])<<1|1|N[T+1]),K[T]&at&&(z=ht(t,{errors:S,currentLocation:Z,expectedLocation:f,distance:i,ignoreLocation:l}),z<=y)){if(y=z,C=Z,C<=f)break;_=Math.max(1,2*f-C)}}if(ht(t,{errors:S+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:l})>y)break;N=K}const st={isMatch:C>=0,score:Math.max(.001,z)};if(k){const S=ve(D,a);S.length?u&&(st.indices=S):st.isMatch=!1}return st}function Se(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const i=e.charAt(s);t[i]=(t[i]||0)|1<<n-s-1}return t}const dt=String.prototype.normalize?(e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(e=>e);class Gt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d},t=u?t:t.toLowerCase(),t=l?dt(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const h=(y,C)=>{this.chunks.push({pattern:y,alphabet:Se(y),startIndex:C})},f=this.pattern.length;if(f>ot){let y=0;const C=f%ot,k=f-C;for(;y<k;)h(this.pattern.substr(y,ot),y),y+=ot;if(C){const D=f-ot;h(this.pattern.substr(D),D)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern===t){let k={isMatch:!0,score:0};return i&&(k.indices=[[0,t.length-1]]),k}const{location:c,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:d}=this.options;let h=[],f=0,y=!1;this.chunks.forEach(({pattern:k,alphabet:D,startIndex:b})=>{const{isMatch:N,score:z,indices:Q}=De(t,k,D,{location:c+b,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:i,ignoreLocation:d});N&&(y=!0),f+=z,N&&Q&&(h=[...h,...Q])});let C={isMatch:y,score:y?f/this.chunks.length:1};return y&&i&&(C.indices=h),C}}class rt{constructor(t){this.pattern=t}static isMultiMatch(t){return Lt(t,this.multiRegex)}static isSingleMatch(t){return Lt(t,this.singleRegex)}search(){}}function Lt(e,t){const s=e.match(t);return s?s[1]:null}class Be extends rt{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const s=t===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Ie extends rt{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class ke extends rt{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const s=t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class $e extends rt{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const s=!t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class be extends rt{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const s=t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Re extends rt{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const s=!t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Yt extends rt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){super(t),this._bitapSearch=new Gt(t,{location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Jt extends rt{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let s=0,n;const i=[],c=this.pattern.length;for(;(n=t.indexOf(this.pattern,s))>-1;)s=n+c,i.push([n,s-1]);const o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}const At=[Be,Jt,ke,$e,Re,be,Ie,Yt],Nt=At.length,_e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Le="|";function Ne(e,t={}){return e.split(Le).map(s=>{let n=s.trim().split(_e).filter(c=>c&&!!c.trim()),i=[];for(let c=0,o=n.length;c<o;c+=1){const a=n[c];let u=!1,l=-1;for(;!u&&++l<Nt;){const d=At[l];let h=d.isMultiMatch(a);h&&(i.push(new d(h,t)),u=!0)}if(!u)for(l=-1;++l<Nt;){const d=At[l];let h=d.isSingleMatch(a);if(h){i.push(new d(h,t));break}}}return i})}const je=new Set([Yt.type,Jt.type]);class Te{constructor(t,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:i=p.includeMatches,minMatchCharLength:c=p.minMatchCharLength,ignoreLocation:o=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:d=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:c,findAllMatches:a,ignoreLocation:o,location:u,threshold:l,distance:d},t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern=t,this.query=Ne(this.pattern,this.options)}static condition(t,s){return s.useExtendedSearch}searchIn(t){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:c}=this.options;t=i?t:t.toLowerCase(),t=c?dt(t):t;let o=0,a=[],u=0;for(let l=0,d=s.length;l<d;l+=1){const h=s[l];a.length=0,o=0;for(let f=0,y=h.length;f<y;f+=1){const C=h[f],{isMatch:k,indices:D,score:b}=C.search(t);if(k){if(o+=1,u+=b,n){const N=C.constructor.type;je.has(N)?a=[...a,...D]:a.push(D)}}else{u=0,o=0,a.length=0;break}}if(o){let f={isMatch:!0,score:u/o};return n&&(f.indices=a),f}}return{isMatch:!1,score:1}}}const xt=[];function Pe(...e){xt.push(...e)}function Et(e,t){for(let s=0,n=xt.length;s<n;s+=1){let i=xt[s];if(i.condition(e,t))return new i(e,t)}return new Gt(e,t)}const ft={AND:"$and",OR:"$or"},Ct={PATH:"$path",PATTERN:"$val"},Ft=e=>!!(e[ft.AND]||e[ft.OR]),Ke=e=>!!e[Ct.PATH],Oe=e=>!et(e)&&Wt(e)&&!Ft(e),jt=e=>({[ft.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Xt(e,t,{auto:s=!0}={}){const n=i=>{let c=Object.keys(i);const o=Ke(i);if(!o&&c.length>1&&!Ft(i))return n(jt(i));if(Oe(i)){const u=o?i[Ct.PATH]:c[0],l=o?i[Ct.PATTERN]:i[u];if(!X(l))throw new Error(de(u));const d={keyId:yt(u),pattern:l};return s&&(d.searcher=Et(l,t)),d}let a={children:[],operator:c[0]};return c.forEach(u=>{const l=i[u];et(l)&&l.forEach(d=>{a.children.push(n(d))})}),a};return Ft(e)||(e=jt(e)),n(e)}function He(e,{ignoreFieldNorm:t=p.ignoreFieldNorm}){e.forEach(s=>{let n=1;s.matches.forEach(({key:i,norm:c,score:o})=>{const a=i?i.weight:null;n*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(t?1:c))}),s.score=n})}function Qe(e,t){const s=e.matches;t.matches=[],H(s)&&s.forEach(n=>{if(!H(n.indices)||!n.indices.length)return;const{indices:i,value:c}=n;let o={indices:i,value:c};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function We(e,t){t.score=e.score}function ze(e,t,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const i=[];return s&&i.push(Qe),n&&i.push(We),e.map(c=>{const{idx:o}=c,a={item:t[o],refIndex:o};return i.length&&i.forEach(u=>{u(c,a)}),a})}class G{constructor(t,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ge(this.options.keys),this.setCollection(t,n)}setCollection(t,s){if(this._docs=t,s&&!(s instanceof wt))throw new Error(he);this._myIndex=s||Ut(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){H(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const s=[];for(let n=0,i=this._docs.length;n<i;n+=1){const c=this._docs[n];t(c,n)&&(this.removeAt(n),n-=1,i-=1,s.push(c))}return s}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:s=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:c,sortFn:o,ignoreFieldNorm:a}=this.options;let u=X(t)?X(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return He(u,{ignoreFieldNorm:a}),c&&u.sort(o),Qt(s)&&s>-1&&(u=u.slice(0,s)),ze(u,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){const s=Et(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=s.searchIn(c);u&&i.push({item:c,idx:o,matches:[{score:l,value:c,norm:a,indices:d}]})}),i}_searchLogical(t){const s=Xt(t,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:h,searcher:f}=a,y=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(u,h),searcher:f});return y&&y.length?[{idx:l,item:u,matches:y}]:[]}const d=[];for(let h=0,f=a.children.length;h<f;h+=1){const y=a.children[h],C=n(y,u,l);if(C.length)d.push(...C);else if(a.operator===ft.AND)return[]}return d},i=this._myIndex.records,c={},o=[];return i.forEach(({$:a,i:u})=>{if(H(a)){let l=n(s,a,u);l.length&&(c[u]||(c[u]={idx:u,item:a,matches:[]},o.push(c[u])),l.forEach(({matches:d})=>{c[u].matches.push(...d)}))}}),o}_searchObjectList(t){const s=Et(t,this.options),{keys:n,records:i}=this._myIndex,c=[];return i.forEach(({$:o,i:a})=>{if(!H(o))return;let u=[];n.forEach((l,d)=>{u.push(...this._findMatches({key:l,value:o[d],searcher:s}))}),u.length&&c.push({idx:a,item:o,matches:u})}),c}_findMatches({key:t,value:s,searcher:n}){if(!H(s))return[];let i=[];if(et(s))s.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=n.searchIn(c);u&&i.push({score:l,key:t,value:c,idx:o,norm:a,indices:d})});else{const{v:c,n:o}=s,{isMatch:a,score:u,indices:l}=n.searchIn(c);a&&i.push({score:u,key:t,value:c,norm:o,indices:l})}return i}}G.version="7.1.0";G.createIndex=Ut;G.parseIndex=we;G.config=p;G.parseQuery=Xt;Pe(Te);const Tt={".ts":"📘",".tsx":"⚛️",".js":"📒",".jsx":"⚛️",".py":"🐍",".rs":"🦀",".go":"🔷",".md":"📝",".json":"📋",".yaml":"⚙️",".yml":"⚙️",".css":"🎨",".scss":"🎨",".html":"🌐",".sql":"🗃️",".sh":"💻",".env":"🔐",".toml":"⚙️",".lock":"🔒",default:"📄"};function Ve(e){var s;const t="."+((s=e.split(".").pop())==null?void 0:s.toLowerCase());return Tt[t]||Tt.default}function Pt(e){const t=se[e];return(t==null?void 0:t.icon)||"🤖"}function Zt(e){const t=Math.floor(e/1e3),s=Math.floor(t/60),n=Math.floor(s/60),i=Math.floor(n/24);return i>0?`${i}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Kt(e){const s=Date.now()-e;return Zt(s)}function Ot(e){switch(e){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"activity":return"Activity";case"modified-file":return"Changed";case"building":return"Server";default:return e}}const Ht=["command","agent","building","area","modified-file","activity"];function Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=ne(),f=ie(),y=re(),C=ce(),k=g.useMemo(()=>{const r=O.getState().supervisor.agentHistories;let A="";for(const[F,M]of r)A+=`${F}:${M.length},`;return A},[h]),D=g.useRef(t);D.current=t;const b=g.useRef(s);b.current=s;const N=g.useRef(n);N.current=n;const z=g.useRef(i);z.current=i;const Q=g.useRef(c);Q.current=c;const at=g.useRef(o);at.current=o;const st=g.useRef(a);st.current=a;const S=g.useRef(u);S.current=u;const v=g.useRef(l);v.current=l;const j=g.useRef(d);j.current=d;const[_,W]=g.useState(""),[K,nt]=g.useState(0);g.useEffect(()=>{if(e){W(""),nt(0);const r=Array.from(h.values());for(const A of r)!O.hasHistoryBeenFetched(A.id)&&!O.isLoadingHistoryForAgent(A.id)&&O.requestAgentSupervisorHistory(A.id)}},[e,h]);const T=O.getShortcuts(),Z=g.useMemo(()=>{if(!e)return[];const r=T.find(F=>F.id==="spawn-agent"),A=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:r?bt(r):"Alt+N",icon:"➕",action:()=>{D.current(),b.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:A?bt(A):"Ctrl+K",icon:"📊",action:()=>{D.current(),N.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:"⚙️",action:()=>{D.current(),z.current()}},{id:"cmd-supervisor",type:"command",title:"Supervisor Overview",subtitle:"View agent analysis",icon:"🎖️",action:()=>{D.current(),Q.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:"📊",action:()=>{var F;D.current(),(F=j.current)==null||F.call(j)}}]},[e,T]),ct=g.useMemo(()=>e?Array.from(h.values()).map(r=>{const A=O.getAgentSupervisorHistory(r.id),F=A.length>0?A[0]:null,M=A.map(x=>({text:`${x.analysis.statusDescription} ${x.analysis.recentWorkSummary}`,timestamp:x.timestamp})),$=(C||[]).filter(x=>x.agentId===r.id).map(x=>x.filePath),I=[...new Set($)],R=I.map(x=>x.split("/").pop()||x),B=[];r.lastAssignedTask&&B.push(r.lastAssignedTask);const Y=`${r.class} • ${r.status} • ${r.cwd}`;let J=`${r.name} ${Y}`,L,ut,E;for(const x of M)J+=` ${x.text}`;F&&(L=F.analysis.recentWorkSummary,ut=F.analysis.statusDescription,E=F.timestamp),R.length>0&&(J+=` ${R.join(" ")} ${I.join(" ")}`),B.length>0&&(J+=` ${B.join(" ")}`);const w=Date.now()-r.lastActivity;let U;return r.lastAssignedTask&&(r.lastAssignedTask.length>150?U=r.lastAssignedTask.slice(0,150)+"...":U=r.lastAssignedTask),{id:`agent-${r.id}`,type:"agent",title:r.name,subtitle:Y,lastUserInput:U,statusDescription:ut,activityText:L,matchedText:L,timeAway:w,lastStatusTime:E,icon:Pt(r.class),_searchText:J,_modifiedFiles:I,_userQueries:B,_historyEntries:M,action:()=>{D.current(),O.selectAgent(r.id)}}}):[],[e,h,k,C]),lt=g.useMemo(()=>e?Array.from(f.values()).map(r=>{var A;return{id:`area-${r.id}`,type:"area",title:r.name,subtitle:`${r.assignedAgentIds.length} agents • ${((A=r.directories)==null?void 0:A.length)||0} folders`,icon:"🗺️",action:()=>{D.current(),O.selectArea(r.id)}}}):[],[e,f]),mt=g.useMemo(()=>e?Array.from(y.values()).filter(r=>r.type==="server"||r.type==="boss"||r.type==="database").map(r=>{var R,B,Y,J;const A=r.status==="running"?"🟢":r.status==="stopped"?"🔴":"🟡",F=r.type==="boss"?"👑":r.type==="database"?"🗄️":"🖥️";let $=`${r.type==="boss"?"Boss":r.type==="database"?"Database":"Server"} • ${r.status}`;if(r.type==="database"&&((B=(R=r.database)==null?void 0:R.connections)!=null&&B.length)){const L=r.database.connections[0];$+=` • ${L.engine} @ ${L.host}`}else r.cwd&&($+=` • ${r.cwd}`);let I=`${r.name} ${r.type} ${r.status} ${r.cwd||""} ${((Y=r.pm2)==null?void 0:Y.name)||""}`;if(r.type==="database"&&((J=r.database)!=null&&J.connections))for(const L of r.database.connections)I+=` ${L.name} ${L.engine} ${L.host} ${L.database||""} mysql postgresql sql`;return{id:`building-${r.id}`,type:"building",title:r.name,subtitle:$,icon:`${A} ${F}`,_searchText:I,action:()=>{var L;D.current(),r.type==="boss"?S.current(r.id):r.type==="database"?v.current(r.id):(L=r.pm2)!=null&&L.enabled&&st.current(r.id)}}}):[],[e,y]),vt=g.useMemo(()=>{if(!e)return[];const r=C||[],A=new Set,F=[];for(const M of r){if(A.has(M.filePath))continue;A.add(M.filePath);const $=M.filePath.split("/").pop()||M.filePath,I=M.action==="created"?"Created":M.action==="modified"?"Modified":M.action==="deleted"?"Deleted":"Read";if(F.push({id:`modified-${M.filePath}-${M.timestamp}`,type:"modified-file",title:$,subtitle:`${I} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?"🗑️":Ve(M.filePath),action:()=>{D.current();const R=Array.from(O.getState().areas.values());for(const B of R)for(const Y of B.directories||[])if(M.filePath.startsWith(Y)){O.setFileViewerPath(M.filePath),at.current(B.id);return}O.selectAgent(M.agentId)}}),F.length>=50)break}return F},[e,C]),Dt=g.useMemo(()=>{if(!e)return[];const r=[],A=Array.from(h.values());for(const F of A){const M=O.getAgentSupervisorHistory(F.id);if(M.length>0){const $=M[0],I=$.analysis;r.push({id:`activity-${F.id}-${$.timestamp}`,type:"activity",title:F.name,subtitle:I.statusDescription,activityText:I.recentWorkSummary,matchedText:I.recentWorkSummary,icon:Pt(F.class),action:()=>{D.current(),O.selectAgent(F.id)}})}}return r},[e,h,k]),St=g.useMemo(()=>new G(ct,{keys:["title","subtitle","_searchText","activityText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ct]),Bt=g.useMemo(()=>new G(Z,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Z]),It=g.useMemo(()=>new G(lt,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[lt]),kt=g.useMemo(()=>new G(vt,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[vt]),$t=g.useMemo(()=>new G(Dt,{keys:["title","subtitle","matchedText","activityText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Dt]),qt=g.useMemo(()=>new G(mt,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[mt]),V=g.useMemo(()=>{if(!_.trim()){const E=[];E.push(...mt);const w=[...ct].sort((x,P)=>{const q=x.timeAway??0,tt=P.timeAway??0;return q-tt});E.push(...w),E.push(...Z.slice(0,2)),E.push(...lt.slice(0,2));const U={};return Ht.forEach((x,P)=>{U[x]=P}),E.sort((x,P)=>(U[x.type]??999)-(U[P.type]??999)),E}const r=_.toLowerCase(),A=St.search(_).slice(0,8),F=Bt.search(_).slice(0,3),M=It.search(_).slice(0,2),$=kt.search(_).slice(0,3),I=$t.search(_).slice(0,3),R=qt.search(_).filter(E=>{const w=E.score??1;return`${E.item.title} ${E.item.subtitle||""} ${E.item._searchText||""}`.toLowerCase().includes(r)||w<=.2}).slice(0,4),B=[],Y=[],J=[];for(const E of A){const w={...E.item};if(w._modifiedFiles&&w._modifiedFiles.length>0){const x=w._modifiedFiles.filter(P=>{var it;const q=((it=P.split("/").pop())==null?void 0:it.toLowerCase())||"",tt=P.toLowerCase();return q.includes(r)||tt.includes(r)});x.length>0&&(w.matchedFiles=x)}if(w._userQueries&&w._userQueries.length>0){const x=w._userQueries.find(P=>P.toLowerCase().includes(r));if(x)if(x.length>200){const q=x.toLowerCase().indexOf(r),tt=Math.max(0,q-60),it=Math.min(x.length,q+r.length+100);w.matchedQuery=(tt>0?"...":"")+x.slice(tt,it)+(it<x.length?"...":"")}else w.matchedQuery=x}if(w._historyEntries&&w._historyEntries.length>0){const x=w._historyEntries.find(P=>P.text.toLowerCase().includes(r));if(x)if(x.text.length>250){const q=x.text.toLowerCase().indexOf(r),tt=Math.max(0,q-80),it=Math.min(x.text.length,q+r.length+120);w.matchedHistory={text:(tt>0?"...":"")+x.text.slice(tt,it)+(it<x.text.length?"...":""),timestamp:x.timestamp}}else w.matchedHistory=x}const U=w.title.toLowerCase();U===r||U.startsWith(r)?Y.push(w):J.push(w)}for(const E of Y)B.push(E);for(const E of R)B.push(E.item);for(const E of J)B.push(E);for(const E of F)B.push(E.item);for(const E of M)B.push(E.item);for(const E of $)B.push(E.item);const L=new Set(A.map(E=>E.item.id));for(const E of I){const w=E.item.id.replace("activity-","").split("-")[0];L.has(`agent-${w}`)||B.push(E.item)}const ut={};return Ht.forEach((E,w)=>{ut[E]=w}),B.sort((E,w)=>(ut[E.type]??999)-(ut[w.type]??999)),B},[_,St,Bt,It,kt,$t,Z,ct,lt]);g.useEffect(()=>{K>=V.length&&nt(Math.max(0,V.length-1))},[V.length,K]);const te=g.useCallback(r=>{if(r.altKey&&!r.ctrlKey&&!r.metaKey&&(r.key==="p"||r.key==="n"||r.key==="P"||r.key==="N")){r.preventDefault(),r.stopPropagation(),r.nativeEvent.stopImmediatePropagation();const A=r.key.toLowerCase();nt(A==="p"?F=>F>0?F-1:V.length-1:F=>F<V.length-1?F+1:0);return}switch(r.key){case"Escape":r.preventDefault(),D.current();break;case"ArrowUp":r.preventDefault(),nt(A=>A>0?A-1:V.length-1);break;case"ArrowDown":r.preventDefault(),nt(A=>A<V.length-1?A+1:0);break;case"Enter":r.preventDefault(),V[K]&&V[K].action();break}},[V,K]),ee=g.useCallback((r,A)=>{if(!A||!r)return r;const F=r.toLowerCase(),M=A.toLowerCase(),$=[];let I=0,R=F.indexOf(M),B=0;for(;R!==-1;)R>I&&$.push(r.slice(I,R)),$.push(pt.createElement("mark",{key:B++,className:"spotlight-highlight"},r.slice(R,R+A.length))),I=R+A.length,R=F.indexOf(M,I);return I<r.length&&$.push(r.slice(I)),$.length>0?pt.createElement(pt.Fragment,null,...$):r},[]);return{query:_,setQuery:W,selectedIndex:K,setSelectedIndex:nt,results:V,handleKeyDown:te,highlightMatch:ee}}const Ge=g.forwardRef(function({query:t,onQueryChange:s,onKeyDown:n,onResetSelection:i},c){const{t:o}=Mt(["common"]);return m.jsxs("div",{className:"spotlight-input-wrapper",children:[m.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),m.jsx("input",{ref:c,type:"text",className:"spotlight-input",placeholder:o("common:search.spotlightPlaceholder"),value:t,onChange:a=>{s(a.target.value),i()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),m.jsxs("div",{className:"spotlight-input-hints",children:[m.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Ye=g.memo(function({result:t,isSelected:s,query:n,highlightMatch:i,onClick:c,onMouseEnter:o}){const a=t.activityText||t.statusDescription||t.matchedFiles&&t.matchedFiles.length>0||t.matchedQuery||t.matchedHistory;return m.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${t.activityText?"has-activity":""}`,onClick:c,onMouseEnter:o,role:"option","aria-selected":s,children:[m.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:t.icon}),m.jsxs("div",{className:"spotlight-item-content",children:[m.jsxs("div",{className:"spotlight-item-header",children:[m.jsx("span",{className:"spotlight-item-title",children:i(t.title,n)}),m.jsx("span",{className:`spotlight-item-type ${t.type}`,"aria-label":Ot(t.type),children:Ot(t.type)})]}),t.subtitle&&m.jsx("span",{className:"spotlight-item-subtitle",children:i(t.subtitle,n)}),t.statusDescription&&m.jsx("span",{className:"spotlight-item-status",children:i(t.statusDescription,n)}),t.activityText&&m.jsx("span",{className:"spotlight-item-activity",children:i(t.activityText,n)}),a&&m.jsxs("div",{className:"spotlight-item-details",children:[t.matchedFiles&&t.matchedFiles.length>0&&m.jsx("span",{className:"spotlight-item-files",children:t.matchedFiles.map((u,l)=>m.jsxs("span",{className:"file-badge",children:[l>0&&m.jsx("span",{className:"file-separator",children:"•"}),i(u.split("/").pop()||u,n)]},u))}),t.matchedQuery&&m.jsx("span",{className:"spotlight-item-query",children:i(t.matchedQuery,n)}),t.matchedHistory&&m.jsxs("span",{className:"spotlight-item-history",children:[i(t.matchedHistory.text,n),m.jsx("span",{className:"spotlight-history-time",children:Kt(t.matchedHistory.timestamp)})]})]}),(t.timeAway!==void 0||t.lastStatusTime!==void 0)&&m.jsxs("span",{className:"spotlight-item-time",children:[t.timeAway!==void 0&&m.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Zt(t.timeAway)]}),t.lastStatusTime!==void 0&&m.jsxs("span",{className:"spotlight-status-time",children:["Updated ",Kt(t.lastStatusTime)]})]}),t.lastUserInput&&!t.matchedQuery&&m.jsxs("span",{className:"spotlight-item-last-input",children:['"',i(t.lastUserInput,n),'"']})]})]})}),Je=g.forwardRef(function({results:t,selectedIndex:s,query:n,highlightMatch:i,onSelectIndex:c},o){const{t:a}=Mt(["terminal"]),u=g.useRef(!1);g.useEffect(()=>{u.current=!1},[t]),g.useEffect(()=>{const h=typeof o=="function"?null:o==null?void 0:o.current;if(!h)return;const f=()=>{u.current=!0};return h.addEventListener("mousemove",f),()=>{h.removeEventListener("mousemove",f)}},[o,t]);const l={command:a("terminal:spotlight.categories.commands"),agent:a("terminal:spotlight.categories.agents"),building:a("terminal:spotlight.categories.infrastructure"),area:a("terminal:spotlight.categories.areas"),"modified-file":a("terminal:spotlight.categories.modifiedFiles"),activity:a("terminal:spotlight.categories.recentActivity")},d=g.useMemo(()=>{const h=[];let f=null,y=[];return t.forEach((C,k)=>{C.type!==f&&(f!==null&&y.length>0&&h.push([f,y]),f=C.type,y=[]),y.push({result:C,index:k})}),f!==null&&y.length>0&&h.push([f,y]),h},[t]);return g.useEffect(()=>{if(!o||typeof o=="function")return;const h=o.current;if(!h)return;const f=h.querySelector(".spotlight-item.selected");f&&f.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,o]),t.length===0?m.jsx("div",{className:"spotlight-results",ref:o,children:m.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):m.jsx("div",{className:"spotlight-results",ref:o,children:d.map(([h,f])=>m.jsxs("div",{children:[d.length>1&&m.jsx("div",{className:"spotlight-category-header",children:l[h]||h}),f.map(({result:y,index:C})=>m.jsx(Ye,{result:y,isSelected:C===s,query:n,highlightMatch:i,onClick:()=>y.action(),onMouseEnter:()=>{u.current&&c(C)}},y.id))]},h))})}),Xe=g.memo(function(){const{t}=Mt(["terminal"]);return m.jsxs("div",{className:"spotlight-footer",children:[m.jsxs("div",{className:"spotlight-footer-left",children:[m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"↑"}),m.jsx("kbd",{children:"↓"})," ",m.jsx("kbd",{children:"Alt+N"}),m.jsx("kbd",{children:"Alt+P"})," ",t("terminal:spotlight.navigate")]}),m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Enter"})," ",t("terminal:spotlight.select")]})]}),m.jsx("div",{className:"spotlight-footer-right",children:m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Esc"})," ",t("common:buttons.close")]})})]})});function ss({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=g.useRef(null),f=g.useRef(null),y=g.useRef(0),{query:C,setQuery:k,selectedIndex:D,setSelectedIndex:b,results:N,handleKeyDown:z,highlightMatch:Q}=Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d});y.current=N.length,g.useEffect(()=>{e&&setTimeout(()=>{var S;(S=h.current)==null||S.focus()},50)},[e]),g.useEffect(()=>{if(!e)return;const S=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),t();return}if(v.altKey&&!v.ctrlKey&&!v.metaKey&&(v.key==="n"||v.key==="p"||v.key==="N"||v.key==="P")){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();const j=v.key.toLowerCase(),_=y.current;b(j==="p"?W=>W>0?W-1:_-1:W=>W<_-1?W+1:0);return}};return window.addEventListener("keydown",S,{capture:!0}),()=>{window.removeEventListener("keydown",S,{capture:!0})}},[e,t]);const at=g.useCallback(S=>{S.target===S.currentTarget&&t()},[t]),st=g.useCallback(()=>{b(0)},[b]);return e?m.jsx("div",{className:"spotlight-overlay",onClick:at,children:m.jsxs("div",{className:"spotlight-modal",children:[m.jsx(Ge,{ref:h,query:C,onQueryChange:k,onKeyDown:z,onResetSelection:st}),m.jsx(Je,{ref:f,results:N,selectedIndex:D,query:C,highlightMatch:Q,onSelectIndex:b}),m.jsx(Xe,{})]})}):null}export{Tt as FILE_ICONS,ss as Spotlight,Xe as SpotlightFooter,Ge as SpotlightInput,Ye as SpotlightItem,Je as SpotlightResults,Zt as formatDuration,Kt as formatRelativeTime,Pt as getAgentIcon,Ve as getFileIconFromPath,Ot as getTypeLabel,Ue as useSpotlightSearch};
1
+ import{a2 as se,H as ne,J as ie,I as re,b7 as ce,r as g,s as O,b8 as bt,z as pt,u as Mt,j as m}from"./main-DSF4XPLl.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function et(e){return Array.isArray?Array.isArray(e):zt(e)==="[object Array]"}function oe(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function ae(e){return e==null?"":oe(e)}function X(e){return typeof e=="string"}function Qt(e){return typeof e=="number"}function ue(e){return e===!0||e===!1||le(e)&&zt(e)=="[object Boolean]"}function Wt(e){return typeof e=="object"}function le(e){return Wt(e)&&e!==null}function H(e){return e!=null}function gt(e){return!e.trim().length}function zt(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const he="Incorrect 'index' type",de=e=>`Invalid value for key ${e}`,fe=e=>`Pattern length exceeds max of ${e}.`,me=e=>`Missing ${e} property in key`,pe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Rt=Object.prototype.hasOwnProperty;class ge{constructor(t){this._keys=[],this._keyMap={};let s=0;t.forEach(n=>{let i=Vt(n);this._keys.push(i),this._keyMap[i.id]=i,s+=i.weight}),this._keys.forEach(n=>{n.weight/=s})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Vt(e){let t=null,s=null,n=null,i=1,c=null;if(X(e)||et(e))n=e,t=_t(e),s=yt(e);else{if(!Rt.call(e,"name"))throw new Error(me("name"));const o=e.name;if(n=o,Rt.call(e,"weight")&&(i=e.weight,i<=0))throw new Error(pe(o));t=_t(o),s=yt(o),c=e.getFn}return{path:t,id:s,weight:i,src:n,getFn:c}}function _t(e){return et(e)?e:e.split(".")}function yt(e){return et(e)?e.join("."):e}function ye(e,t){let s=[],n=!1;const i=(c,o,a)=>{if(H(c))if(!o[a])s.push(c);else{let u=o[a];const l=c[u];if(!H(l))return;if(a===o.length-1&&(X(l)||Qt(l)||ue(l)))s.push(ae(l));else if(et(l)){n=!0;for(let d=0,h=l.length;d<h;d+=1)i(l[d],o,a+1)}else o.length&&i(l,o,a+1)}};return i(e,X(t)?t.split("."):t,0),n?s:s[0]}const Ae={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},xe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Ee={location:0,threshold:.6,distance:100},Ce={useExtendedSearch:!1,getFn:ye,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...xe,...Ae,...Ee,...Ce};const Fe=/[^ ]+/g;function Me(e=1,t=3){const s=new Map,n=Math.pow(10,t);return{get(i){const c=i.match(Fe).length;if(s.has(c))return s.get(c);const o=1/Math.pow(c,.5*e),a=parseFloat(Math.round(o*n)/n);return s.set(c,a),a},clear(){s.clear()}}}class wt{constructor({getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=Me(s,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,X(this.docs[0])?this.docs.forEach((t,s)=>{this._addString(t,s)}):this.docs.forEach((t,s)=>{this._addObject(t,s)}),this.norm.clear())}add(t){const s=this.size();X(t)?this._addString(t,s):this._addObject(t,s)}removeAt(t){this.records.splice(t,1);for(let s=t,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(t,s){return t[this._keysMap[s]]}size(){return this.records.length}_addString(t,s){if(!H(t)||gt(t))return;let n={v:t,i:s,n:this.norm.get(t)};this.records.push(n)}_addObject(t,s){let n={i:s,$:{}};this.keys.forEach((i,c)=>{let o=i.getFn?i.getFn(t):this.getFn(t,i.path);if(H(o)){if(et(o)){let a=[];const u=[{nestedArrIndex:-1,value:o}];for(;u.length;){const{nestedArrIndex:l,value:d}=u.pop();if(H(d))if(X(d)&&!gt(d)){let h={v:d,i:l,n:this.norm.get(d)};a.push(h)}else et(d)&&d.forEach((h,f)=>{u.push({nestedArrIndex:f,value:h})})}n.$[c]=a}else if(X(o)&&!gt(o)){let a={v:o,n:this.norm.get(o)};n.$[c]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ut(e,t,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const i=new wt({getFn:s,fieldNormWeight:n});return i.setKeys(e.map(Vt)),i.setSources(t),i.create(),i}function we(e,{getFn:t=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:i}=e,c=new wt({getFn:t,fieldNormWeight:s});return c.setKeys(n),c.setIndexRecords(i),c}function ht(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:i=p.distance,ignoreLocation:c=p.ignoreLocation}={}){const o=t/e.length;if(c)return o;const a=Math.abs(n-s);return i?o+a/i:a?1:o}function ve(e=[],t=p.minMatchCharLength){let s=[],n=-1,i=-1,c=0;for(let o=e.length;c<o;c+=1){let a=e[c];a&&n===-1?n=c:!a&&n!==-1&&(i=c-1,i-n+1>=t&&s.push([n,i]),n=-1)}return e[c-1]&&c-n>=t&&s.push([n,c-1]),s}const ot=32;function De(e,t,s,{location:n=p.location,distance:i=p.distance,threshold:c=p.threshold,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(t.length>ot)throw new Error(fe(ot));const d=t.length,h=e.length,f=Math.max(0,Math.min(n,h));let y=c,C=f;const k=a>1||u,D=k?Array(h):[];let b;for(;(b=e.indexOf(t,C))>-1;){let S=ht(t,{currentLocation:b,expectedLocation:f,distance:i,ignoreLocation:l});if(y=Math.min(S,y),C=b+d,k){let v=0;for(;v<d;)D[b+v]=1,v+=1}}C=-1;let N=[],z=1,Q=d+h;const at=1<<d-1;for(let S=0;S<d;S+=1){let v=0,j=Q;for(;v<j;)ht(t,{errors:S,currentLocation:f+j,expectedLocation:f,distance:i,ignoreLocation:l})<=y?v=j:Q=j,j=Math.floor((Q-v)/2+v);Q=j;let _=Math.max(1,f-j+1),W=o?h:Math.min(f+j,h)+d,K=Array(W+2);K[W+1]=(1<<S)-1;for(let T=W;T>=_;T-=1){let Z=T-1,ct=s[e.charAt(Z)];if(k&&(D[Z]=+!!ct),K[T]=(K[T+1]<<1|1)&ct,S&&(K[T]|=(N[T+1]|N[T])<<1|1|N[T+1]),K[T]&at&&(z=ht(t,{errors:S,currentLocation:Z,expectedLocation:f,distance:i,ignoreLocation:l}),z<=y)){if(y=z,C=Z,C<=f)break;_=Math.max(1,2*f-C)}}if(ht(t,{errors:S+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:l})>y)break;N=K}const st={isMatch:C>=0,score:Math.max(.001,z)};if(k){const S=ve(D,a);S.length?u&&(st.indices=S):st.isMatch=!1}return st}function Se(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const i=e.charAt(s);t[i]=(t[i]||0)|1<<n-s-1}return t}const dt=String.prototype.normalize?(e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(e=>e);class Gt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d},t=u?t:t.toLowerCase(),t=l?dt(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const h=(y,C)=>{this.chunks.push({pattern:y,alphabet:Se(y),startIndex:C})},f=this.pattern.length;if(f>ot){let y=0;const C=f%ot,k=f-C;for(;y<k;)h(this.pattern.substr(y,ot),y),y+=ot;if(C){const D=f-ot;h(this.pattern.substr(D),D)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern===t){let k={isMatch:!0,score:0};return i&&(k.indices=[[0,t.length-1]]),k}const{location:c,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:d}=this.options;let h=[],f=0,y=!1;this.chunks.forEach(({pattern:k,alphabet:D,startIndex:b})=>{const{isMatch:N,score:z,indices:Q}=De(t,k,D,{location:c+b,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:i,ignoreLocation:d});N&&(y=!0),f+=z,N&&Q&&(h=[...h,...Q])});let C={isMatch:y,score:y?f/this.chunks.length:1};return y&&i&&(C.indices=h),C}}class rt{constructor(t){this.pattern=t}static isMultiMatch(t){return Lt(t,this.multiRegex)}static isSingleMatch(t){return Lt(t,this.singleRegex)}search(){}}function Lt(e,t){const s=e.match(t);return s?s[1]:null}class Be extends rt{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const s=t===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Ie extends rt{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class ke extends rt{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const s=t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class $e extends rt{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const s=!t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class be extends rt{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const s=t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Re extends rt{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const s=!t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Yt extends rt{constructor(t,{location:s=p.location,threshold:n=p.threshold,distance:i=p.distance,includeMatches:c=p.includeMatches,findAllMatches:o=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:d=p.ignoreLocation}={}){super(t),this._bitapSearch=new Gt(t,{location:s,threshold:n,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Jt extends rt{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let s=0,n;const i=[],c=this.pattern.length;for(;(n=t.indexOf(this.pattern,s))>-1;)s=n+c,i.push([n,s-1]);const o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}const At=[Be,Jt,ke,$e,Re,be,Ie,Yt],Nt=At.length,_e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Le="|";function Ne(e,t={}){return e.split(Le).map(s=>{let n=s.trim().split(_e).filter(c=>c&&!!c.trim()),i=[];for(let c=0,o=n.length;c<o;c+=1){const a=n[c];let u=!1,l=-1;for(;!u&&++l<Nt;){const d=At[l];let h=d.isMultiMatch(a);h&&(i.push(new d(h,t)),u=!0)}if(!u)for(l=-1;++l<Nt;){const d=At[l];let h=d.isSingleMatch(a);if(h){i.push(new d(h,t));break}}}return i})}const je=new Set([Yt.type,Jt.type]);class Te{constructor(t,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:i=p.includeMatches,minMatchCharLength:c=p.minMatchCharLength,ignoreLocation:o=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:d=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:c,findAllMatches:a,ignoreLocation:o,location:u,threshold:l,distance:d},t=s?t:t.toLowerCase(),t=n?dt(t):t,this.pattern=t,this.query=Ne(this.pattern,this.options)}static condition(t,s){return s.useExtendedSearch}searchIn(t){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:c}=this.options;t=i?t:t.toLowerCase(),t=c?dt(t):t;let o=0,a=[],u=0;for(let l=0,d=s.length;l<d;l+=1){const h=s[l];a.length=0,o=0;for(let f=0,y=h.length;f<y;f+=1){const C=h[f],{isMatch:k,indices:D,score:b}=C.search(t);if(k){if(o+=1,u+=b,n){const N=C.constructor.type;je.has(N)?a=[...a,...D]:a.push(D)}}else{u=0,o=0,a.length=0;break}}if(o){let f={isMatch:!0,score:u/o};return n&&(f.indices=a),f}}return{isMatch:!1,score:1}}}const xt=[];function Pe(...e){xt.push(...e)}function Et(e,t){for(let s=0,n=xt.length;s<n;s+=1){let i=xt[s];if(i.condition(e,t))return new i(e,t)}return new Gt(e,t)}const ft={AND:"$and",OR:"$or"},Ct={PATH:"$path",PATTERN:"$val"},Ft=e=>!!(e[ft.AND]||e[ft.OR]),Ke=e=>!!e[Ct.PATH],Oe=e=>!et(e)&&Wt(e)&&!Ft(e),jt=e=>({[ft.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Xt(e,t,{auto:s=!0}={}){const n=i=>{let c=Object.keys(i);const o=Ke(i);if(!o&&c.length>1&&!Ft(i))return n(jt(i));if(Oe(i)){const u=o?i[Ct.PATH]:c[0],l=o?i[Ct.PATTERN]:i[u];if(!X(l))throw new Error(de(u));const d={keyId:yt(u),pattern:l};return s&&(d.searcher=Et(l,t)),d}let a={children:[],operator:c[0]};return c.forEach(u=>{const l=i[u];et(l)&&l.forEach(d=>{a.children.push(n(d))})}),a};return Ft(e)||(e=jt(e)),n(e)}function He(e,{ignoreFieldNorm:t=p.ignoreFieldNorm}){e.forEach(s=>{let n=1;s.matches.forEach(({key:i,norm:c,score:o})=>{const a=i?i.weight:null;n*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(t?1:c))}),s.score=n})}function Qe(e,t){const s=e.matches;t.matches=[],H(s)&&s.forEach(n=>{if(!H(n.indices)||!n.indices.length)return;const{indices:i,value:c}=n;let o={indices:i,value:c};n.key&&(o.key=n.key.src),n.idx>-1&&(o.refIndex=n.idx),t.matches.push(o)})}function We(e,t){t.score=e.score}function ze(e,t,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const i=[];return s&&i.push(Qe),n&&i.push(We),e.map(c=>{const{idx:o}=c,a={item:t[o],refIndex:o};return i.length&&i.forEach(u=>{u(c,a)}),a})}class G{constructor(t,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ge(this.options.keys),this.setCollection(t,n)}setCollection(t,s){if(this._docs=t,s&&!(s instanceof wt))throw new Error(he);this._myIndex=s||Ut(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){H(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const s=[];for(let n=0,i=this._docs.length;n<i;n+=1){const c=this._docs[n];t(c,n)&&(this.removeAt(n),n-=1,i-=1,s.push(c))}return s}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:s=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:c,sortFn:o,ignoreFieldNorm:a}=this.options;let u=X(t)?X(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return He(u,{ignoreFieldNorm:a}),c&&u.sort(o),Qt(s)&&s>-1&&(u=u.slice(0,s)),ze(u,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(t){const s=Et(t,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=s.searchIn(c);u&&i.push({item:c,idx:o,matches:[{score:l,value:c,norm:a,indices:d}]})}),i}_searchLogical(t){const s=Xt(t,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:h,searcher:f}=a,y=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(u,h),searcher:f});return y&&y.length?[{idx:l,item:u,matches:y}]:[]}const d=[];for(let h=0,f=a.children.length;h<f;h+=1){const y=a.children[h],C=n(y,u,l);if(C.length)d.push(...C);else if(a.operator===ft.AND)return[]}return d},i=this._myIndex.records,c={},o=[];return i.forEach(({$:a,i:u})=>{if(H(a)){let l=n(s,a,u);l.length&&(c[u]||(c[u]={idx:u,item:a,matches:[]},o.push(c[u])),l.forEach(({matches:d})=>{c[u].matches.push(...d)}))}}),o}_searchObjectList(t){const s=Et(t,this.options),{keys:n,records:i}=this._myIndex,c=[];return i.forEach(({$:o,i:a})=>{if(!H(o))return;let u=[];n.forEach((l,d)=>{u.push(...this._findMatches({key:l,value:o[d],searcher:s}))}),u.length&&c.push({idx:a,item:o,matches:u})}),c}_findMatches({key:t,value:s,searcher:n}){if(!H(s))return[];let i=[];if(et(s))s.forEach(({v:c,i:o,n:a})=>{if(!H(c))return;const{isMatch:u,score:l,indices:d}=n.searchIn(c);u&&i.push({score:l,key:t,value:c,idx:o,norm:a,indices:d})});else{const{v:c,n:o}=s,{isMatch:a,score:u,indices:l}=n.searchIn(c);a&&i.push({score:u,key:t,value:c,norm:o,indices:l})}return i}}G.version="7.1.0";G.createIndex=Ut;G.parseIndex=we;G.config=p;G.parseQuery=Xt;Pe(Te);const Tt={".ts":"📘",".tsx":"⚛️",".js":"📒",".jsx":"⚛️",".py":"🐍",".rs":"🦀",".go":"🔷",".md":"📝",".json":"📋",".yaml":"⚙️",".yml":"⚙️",".css":"🎨",".scss":"🎨",".html":"🌐",".sql":"🗃️",".sh":"💻",".env":"🔐",".toml":"⚙️",".lock":"🔒",default:"📄"};function Ve(e){var s;const t="."+((s=e.split(".").pop())==null?void 0:s.toLowerCase());return Tt[t]||Tt.default}function Pt(e){const t=se[e];return(t==null?void 0:t.icon)||"🤖"}function Zt(e){const t=Math.floor(e/1e3),s=Math.floor(t/60),n=Math.floor(s/60),i=Math.floor(n/24);return i>0?`${i}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Kt(e){const s=Date.now()-e;return Zt(s)}function Ot(e){switch(e){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"activity":return"Activity";case"modified-file":return"Changed";case"building":return"Server";default:return e}}const Ht=["command","agent","building","area","modified-file","activity"];function Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=ne(),f=ie(),y=re(),C=ce(),k=g.useMemo(()=>{const r=O.getState().supervisor.agentHistories;let A="";for(const[F,M]of r)A+=`${F}:${M.length},`;return A},[h]),D=g.useRef(t);D.current=t;const b=g.useRef(s);b.current=s;const N=g.useRef(n);N.current=n;const z=g.useRef(i);z.current=i;const Q=g.useRef(c);Q.current=c;const at=g.useRef(o);at.current=o;const st=g.useRef(a);st.current=a;const S=g.useRef(u);S.current=u;const v=g.useRef(l);v.current=l;const j=g.useRef(d);j.current=d;const[_,W]=g.useState(""),[K,nt]=g.useState(0);g.useEffect(()=>{if(e){W(""),nt(0);const r=Array.from(h.values());for(const A of r)!O.hasHistoryBeenFetched(A.id)&&!O.isLoadingHistoryForAgent(A.id)&&O.requestAgentSupervisorHistory(A.id)}},[e,h]);const T=O.getShortcuts(),Z=g.useMemo(()=>{if(!e)return[];const r=T.find(F=>F.id==="spawn-agent"),A=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:r?bt(r):"Alt+N",icon:"➕",action:()=>{D.current(),b.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:A?bt(A):"Ctrl+K",icon:"📊",action:()=>{D.current(),N.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:"⚙️",action:()=>{D.current(),z.current()}},{id:"cmd-supervisor",type:"command",title:"Supervisor Overview",subtitle:"View agent analysis",icon:"🎖️",action:()=>{D.current(),Q.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:"📊",action:()=>{var F;D.current(),(F=j.current)==null||F.call(j)}}]},[e,T]),ct=g.useMemo(()=>e?Array.from(h.values()).map(r=>{const A=O.getAgentSupervisorHistory(r.id),F=A.length>0?A[0]:null,M=A.map(x=>({text:`${x.analysis.statusDescription} ${x.analysis.recentWorkSummary}`,timestamp:x.timestamp})),$=(C||[]).filter(x=>x.agentId===r.id).map(x=>x.filePath),I=[...new Set($)],R=I.map(x=>x.split("/").pop()||x),B=[];r.lastAssignedTask&&B.push(r.lastAssignedTask);const Y=`${r.class} • ${r.status} • ${r.cwd}`;let J=`${r.name} ${Y}`,L,ut,E;for(const x of M)J+=` ${x.text}`;F&&(L=F.analysis.recentWorkSummary,ut=F.analysis.statusDescription,E=F.timestamp),R.length>0&&(J+=` ${R.join(" ")} ${I.join(" ")}`),B.length>0&&(J+=` ${B.join(" ")}`);const w=Date.now()-r.lastActivity;let U;return r.lastAssignedTask&&(r.lastAssignedTask.length>150?U=r.lastAssignedTask.slice(0,150)+"...":U=r.lastAssignedTask),{id:`agent-${r.id}`,type:"agent",title:r.name,subtitle:Y,lastUserInput:U,statusDescription:ut,activityText:L,matchedText:L,timeAway:w,lastStatusTime:E,icon:Pt(r.class),_searchText:J,_modifiedFiles:I,_userQueries:B,_historyEntries:M,action:()=>{D.current(),O.selectAgent(r.id)}}}):[],[e,h,k,C]),lt=g.useMemo(()=>e?Array.from(f.values()).map(r=>{var A;return{id:`area-${r.id}`,type:"area",title:r.name,subtitle:`${r.assignedAgentIds.length} agents • ${((A=r.directories)==null?void 0:A.length)||0} folders`,icon:"🗺️",action:()=>{D.current(),O.selectArea(r.id)}}}):[],[e,f]),mt=g.useMemo(()=>e?Array.from(y.values()).filter(r=>r.type==="server"||r.type==="boss"||r.type==="database").map(r=>{var R,B,Y,J;const A=r.status==="running"?"🟢":r.status==="stopped"?"🔴":"🟡",F=r.type==="boss"?"👑":r.type==="database"?"🗄️":"🖥️";let $=`${r.type==="boss"?"Boss":r.type==="database"?"Database":"Server"} • ${r.status}`;if(r.type==="database"&&((B=(R=r.database)==null?void 0:R.connections)!=null&&B.length)){const L=r.database.connections[0];$+=` • ${L.engine} @ ${L.host}`}else r.cwd&&($+=` • ${r.cwd}`);let I=`${r.name} ${r.type} ${r.status} ${r.cwd||""} ${((Y=r.pm2)==null?void 0:Y.name)||""}`;if(r.type==="database"&&((J=r.database)!=null&&J.connections))for(const L of r.database.connections)I+=` ${L.name} ${L.engine} ${L.host} ${L.database||""} mysql postgresql sql`;return{id:`building-${r.id}`,type:"building",title:r.name,subtitle:$,icon:`${A} ${F}`,_searchText:I,action:()=>{var L;D.current(),r.type==="boss"?S.current(r.id):r.type==="database"?v.current(r.id):(L=r.pm2)!=null&&L.enabled&&st.current(r.id)}}}):[],[e,y]),vt=g.useMemo(()=>{if(!e)return[];const r=C||[],A=new Set,F=[];for(const M of r){if(A.has(M.filePath))continue;A.add(M.filePath);const $=M.filePath.split("/").pop()||M.filePath,I=M.action==="created"?"Created":M.action==="modified"?"Modified":M.action==="deleted"?"Deleted":"Read";if(F.push({id:`modified-${M.filePath}-${M.timestamp}`,type:"modified-file",title:$,subtitle:`${I} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?"🗑️":Ve(M.filePath),action:()=>{D.current();const R=Array.from(O.getState().areas.values());for(const B of R)for(const Y of B.directories||[])if(M.filePath.startsWith(Y)){O.setFileViewerPath(M.filePath),at.current(B.id);return}O.selectAgent(M.agentId)}}),F.length>=50)break}return F},[e,C]),Dt=g.useMemo(()=>{if(!e)return[];const r=[],A=Array.from(h.values());for(const F of A){const M=O.getAgentSupervisorHistory(F.id);if(M.length>0){const $=M[0],I=$.analysis;r.push({id:`activity-${F.id}-${$.timestamp}`,type:"activity",title:F.name,subtitle:I.statusDescription,activityText:I.recentWorkSummary,matchedText:I.recentWorkSummary,icon:Pt(F.class),action:()=>{D.current(),O.selectAgent(F.id)}})}}return r},[e,h,k]),St=g.useMemo(()=>new G(ct,{keys:["title","subtitle","_searchText","activityText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ct]),Bt=g.useMemo(()=>new G(Z,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Z]),It=g.useMemo(()=>new G(lt,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[lt]),kt=g.useMemo(()=>new G(vt,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[vt]),$t=g.useMemo(()=>new G(Dt,{keys:["title","subtitle","matchedText","activityText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Dt]),qt=g.useMemo(()=>new G(mt,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[mt]),V=g.useMemo(()=>{if(!_.trim()){const E=[];E.push(...mt);const w=[...ct].sort((x,P)=>{const q=x.timeAway??0,tt=P.timeAway??0;return q-tt});E.push(...w),E.push(...Z.slice(0,2)),E.push(...lt.slice(0,2));const U={};return Ht.forEach((x,P)=>{U[x]=P}),E.sort((x,P)=>(U[x.type]??999)-(U[P.type]??999)),E}const r=_.toLowerCase(),A=St.search(_).slice(0,8),F=Bt.search(_).slice(0,3),M=It.search(_).slice(0,2),$=kt.search(_).slice(0,3),I=$t.search(_).slice(0,3),R=qt.search(_).filter(E=>{const w=E.score??1;return`${E.item.title} ${E.item.subtitle||""} ${E.item._searchText||""}`.toLowerCase().includes(r)||w<=.2}).slice(0,4),B=[],Y=[],J=[];for(const E of A){const w={...E.item};if(w._modifiedFiles&&w._modifiedFiles.length>0){const x=w._modifiedFiles.filter(P=>{var it;const q=((it=P.split("/").pop())==null?void 0:it.toLowerCase())||"",tt=P.toLowerCase();return q.includes(r)||tt.includes(r)});x.length>0&&(w.matchedFiles=x)}if(w._userQueries&&w._userQueries.length>0){const x=w._userQueries.find(P=>P.toLowerCase().includes(r));if(x)if(x.length>200){const q=x.toLowerCase().indexOf(r),tt=Math.max(0,q-60),it=Math.min(x.length,q+r.length+100);w.matchedQuery=(tt>0?"...":"")+x.slice(tt,it)+(it<x.length?"...":"")}else w.matchedQuery=x}if(w._historyEntries&&w._historyEntries.length>0){const x=w._historyEntries.find(P=>P.text.toLowerCase().includes(r));if(x)if(x.text.length>250){const q=x.text.toLowerCase().indexOf(r),tt=Math.max(0,q-80),it=Math.min(x.text.length,q+r.length+120);w.matchedHistory={text:(tt>0?"...":"")+x.text.slice(tt,it)+(it<x.text.length?"...":""),timestamp:x.timestamp}}else w.matchedHistory=x}const U=w.title.toLowerCase();U===r||U.startsWith(r)?Y.push(w):J.push(w)}for(const E of Y)B.push(E);for(const E of R)B.push(E.item);for(const E of J)B.push(E);for(const E of F)B.push(E.item);for(const E of M)B.push(E.item);for(const E of $)B.push(E.item);const L=new Set(A.map(E=>E.item.id));for(const E of I){const w=E.item.id.replace("activity-","").split("-")[0];L.has(`agent-${w}`)||B.push(E.item)}const ut={};return Ht.forEach((E,w)=>{ut[E]=w}),B.sort((E,w)=>(ut[E.type]??999)-(ut[w.type]??999)),B},[_,St,Bt,It,kt,$t,Z,ct,lt]);g.useEffect(()=>{K>=V.length&&nt(Math.max(0,V.length-1))},[V.length,K]);const te=g.useCallback(r=>{if(r.altKey&&!r.ctrlKey&&!r.metaKey&&(r.key==="p"||r.key==="n"||r.key==="P"||r.key==="N")){r.preventDefault(),r.stopPropagation(),r.nativeEvent.stopImmediatePropagation();const A=r.key.toLowerCase();nt(A==="p"?F=>F>0?F-1:V.length-1:F=>F<V.length-1?F+1:0);return}switch(r.key){case"Escape":r.preventDefault(),D.current();break;case"ArrowUp":r.preventDefault(),nt(A=>A>0?A-1:V.length-1);break;case"ArrowDown":r.preventDefault(),nt(A=>A<V.length-1?A+1:0);break;case"Enter":r.preventDefault(),V[K]&&V[K].action();break}},[V,K]),ee=g.useCallback((r,A)=>{if(!A||!r)return r;const F=r.toLowerCase(),M=A.toLowerCase(),$=[];let I=0,R=F.indexOf(M),B=0;for(;R!==-1;)R>I&&$.push(r.slice(I,R)),$.push(pt.createElement("mark",{key:B++,className:"spotlight-highlight"},r.slice(R,R+A.length))),I=R+A.length,R=F.indexOf(M,I);return I<r.length&&$.push(r.slice(I)),$.length>0?pt.createElement(pt.Fragment,null,...$):r},[]);return{query:_,setQuery:W,selectedIndex:K,setSelectedIndex:nt,results:V,handleKeyDown:te,highlightMatch:ee}}const Ge=g.forwardRef(function({query:t,onQueryChange:s,onKeyDown:n,onResetSelection:i},c){const{t:o}=Mt(["common"]);return m.jsxs("div",{className:"spotlight-input-wrapper",children:[m.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),m.jsx("input",{ref:c,type:"text",className:"spotlight-input",placeholder:o("common:search.spotlightPlaceholder"),value:t,onChange:a=>{s(a.target.value),i()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),m.jsxs("div",{className:"spotlight-input-hints",children:[m.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),m.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Ye=g.memo(function({result:t,isSelected:s,query:n,highlightMatch:i,onClick:c,onMouseEnter:o}){const a=t.activityText||t.statusDescription||t.matchedFiles&&t.matchedFiles.length>0||t.matchedQuery||t.matchedHistory;return m.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${t.activityText?"has-activity":""}`,onClick:c,onMouseEnter:o,role:"option","aria-selected":s,children:[m.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:t.icon}),m.jsxs("div",{className:"spotlight-item-content",children:[m.jsxs("div",{className:"spotlight-item-header",children:[m.jsx("span",{className:"spotlight-item-title",children:i(t.title,n)}),m.jsx("span",{className:`spotlight-item-type ${t.type}`,"aria-label":Ot(t.type),children:Ot(t.type)})]}),t.subtitle&&m.jsx("span",{className:"spotlight-item-subtitle",children:i(t.subtitle,n)}),t.statusDescription&&m.jsx("span",{className:"spotlight-item-status",children:i(t.statusDescription,n)}),t.activityText&&m.jsx("span",{className:"spotlight-item-activity",children:i(t.activityText,n)}),a&&m.jsxs("div",{className:"spotlight-item-details",children:[t.matchedFiles&&t.matchedFiles.length>0&&m.jsx("span",{className:"spotlight-item-files",children:t.matchedFiles.map((u,l)=>m.jsxs("span",{className:"file-badge",children:[l>0&&m.jsx("span",{className:"file-separator",children:"•"}),i(u.split("/").pop()||u,n)]},u))}),t.matchedQuery&&m.jsx("span",{className:"spotlight-item-query",children:i(t.matchedQuery,n)}),t.matchedHistory&&m.jsxs("span",{className:"spotlight-item-history",children:[i(t.matchedHistory.text,n),m.jsx("span",{className:"spotlight-history-time",children:Kt(t.matchedHistory.timestamp)})]})]}),(t.timeAway!==void 0||t.lastStatusTime!==void 0)&&m.jsxs("span",{className:"spotlight-item-time",children:[t.timeAway!==void 0&&m.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Zt(t.timeAway)]}),t.lastStatusTime!==void 0&&m.jsxs("span",{className:"spotlight-status-time",children:["Updated ",Kt(t.lastStatusTime)]})]}),t.lastUserInput&&!t.matchedQuery&&m.jsxs("span",{className:"spotlight-item-last-input",children:['"',i(t.lastUserInput,n),'"']})]})]})}),Je=g.forwardRef(function({results:t,selectedIndex:s,query:n,highlightMatch:i,onSelectIndex:c},o){const{t:a}=Mt(["terminal"]),u=g.useRef(!1);g.useEffect(()=>{u.current=!1},[t]),g.useEffect(()=>{const h=typeof o=="function"?null:o==null?void 0:o.current;if(!h)return;const f=()=>{u.current=!0};return h.addEventListener("mousemove",f),()=>{h.removeEventListener("mousemove",f)}},[o,t]);const l={command:a("terminal:spotlight.categories.commands"),agent:a("terminal:spotlight.categories.agents"),building:a("terminal:spotlight.categories.infrastructure"),area:a("terminal:spotlight.categories.areas"),"modified-file":a("terminal:spotlight.categories.modifiedFiles"),activity:a("terminal:spotlight.categories.recentActivity")},d=g.useMemo(()=>{const h=[];let f=null,y=[];return t.forEach((C,k)=>{C.type!==f&&(f!==null&&y.length>0&&h.push([f,y]),f=C.type,y=[]),y.push({result:C,index:k})}),f!==null&&y.length>0&&h.push([f,y]),h},[t]);return g.useEffect(()=>{if(!o||typeof o=="function")return;const h=o.current;if(!h)return;const f=h.querySelector(".spotlight-item.selected");f&&f.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,o]),t.length===0?m.jsx("div",{className:"spotlight-results",ref:o,children:m.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):m.jsx("div",{className:"spotlight-results",ref:o,children:d.map(([h,f])=>m.jsxs("div",{children:[d.length>1&&m.jsx("div",{className:"spotlight-category-header",children:l[h]||h}),f.map(({result:y,index:C})=>m.jsx(Ye,{result:y,isSelected:C===s,query:n,highlightMatch:i,onClick:()=>y.action(),onMouseEnter:()=>{u.current&&c(C)}},y.id))]},h))})}),Xe=g.memo(function(){const{t}=Mt(["terminal"]);return m.jsxs("div",{className:"spotlight-footer",children:[m.jsxs("div",{className:"spotlight-footer-left",children:[m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"↑"}),m.jsx("kbd",{children:"↓"})," ",m.jsx("kbd",{children:"Alt+N"}),m.jsx("kbd",{children:"Alt+P"})," ",t("terminal:spotlight.navigate")]}),m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Enter"})," ",t("terminal:spotlight.select")]})]}),m.jsx("div",{className:"spotlight-footer-right",children:m.jsxs("span",{className:"spotlight-footer-hint",children:[m.jsx("kbd",{children:"Esc"})," ",t("common:buttons.close")]})})]})});function ss({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d}){const h=g.useRef(null),f=g.useRef(null),y=g.useRef(0),{query:C,setQuery:k,selectedIndex:D,setSelectedIndex:b,results:N,handleKeyDown:z,highlightMatch:Q}=Ue({isOpen:e,onClose:t,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:i,onOpenSupervisor:c,onOpenFileExplorer:o,onOpenPM2LogsModal:a,onOpenBossLogsModal:u,onOpenDatabasePanel:l,onOpenMonitoringModal:d});y.current=N.length,g.useEffect(()=>{e&&setTimeout(()=>{var S;(S=h.current)==null||S.focus()},50)},[e]),g.useEffect(()=>{if(!e)return;const S=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),t();return}if(v.altKey&&!v.ctrlKey&&!v.metaKey&&(v.key==="n"||v.key==="p"||v.key==="N"||v.key==="P")){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();const j=v.key.toLowerCase(),_=y.current;b(j==="p"?W=>W>0?W-1:_-1:W=>W<_-1?W+1:0);return}};return window.addEventListener("keydown",S,{capture:!0}),()=>{window.removeEventListener("keydown",S,{capture:!0})}},[e,t]);const at=g.useCallback(S=>{S.target===S.currentTarget&&t()},[t]),st=g.useCallback(()=>{b(0)},[b]);return e?m.jsx("div",{className:"spotlight-overlay",onClick:at,children:m.jsxs("div",{className:"spotlight-modal",children:[m.jsx(Ge,{ref:h,query:C,onQueryChange:k,onKeyDown:z,onResetSelection:st}),m.jsx(Je,{ref:f,results:N,selectedIndex:D,query:C,highlightMatch:Q,onSelectIndex:b}),m.jsx(Xe,{})]})}):null}export{Tt as FILE_ICONS,ss as Spotlight,Xe as SpotlightFooter,Ge as SpotlightInput,Ye as SpotlightItem,Je as SpotlightResults,Zt as formatDuration,Kt as formatRelativeTime,Pt as getAgentIcon,Ve as getFileIconFromPath,Ot as getTypeLabel,Ue as useSpotlightSearch};