tide-commander 1.84.2 → 1.84.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.
- package/dist/assets/{BossLogsModal-CbPseg-c.js → BossLogsModal-AChwUNMW.js} +1 -1
- package/dist/assets/{BossSpawnModal-CXcaXAij.js → BossSpawnModal-CD-7tjgm.js} +1 -1
- package/dist/assets/{ControlsModal-BYUbRQcz.js → ControlsModal-CH-Q4q3O.js} +1 -1
- package/dist/assets/{DockerLogsModal-BxlBxk13.js → DockerLogsModal-BLDQ616U.js} +1 -1
- package/dist/assets/{EmbeddedEditor--JOJfC7s.js → EmbeddedEditor-LAmZJWtP.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-DF8Frc6X.js → GmailOAuthSetup-C22bjUss.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-DxZLW8IT.js → GoogleOAuthSetup-CWXUVT3D.js} +1 -1
- package/dist/assets/{IframeModal-DmnSRljV.js → IframeModal-CKRhuKkv.js} +1 -1
- package/dist/assets/{IntegrationsPanel-iiKDU2g_.js → IntegrationsPanel-_mQKdqyz.js} +2 -2
- package/dist/assets/{LogViewerModal-DoxVD2wb.js → LogViewerModal-BidPtpLY.js} +1 -1
- package/dist/assets/{MonitoringModal-HwuPAK8z.js → MonitoringModal-BAEO1sSK.js} +1 -1
- package/dist/assets/{PM2LogsModal-Chx1wmpC.js → PM2LogsModal-CSnd5VTs.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-DGTRZ7H7.js → RestoreArchivedAreaModal-CosgdjEy.js} +1 -1
- package/dist/assets/{Scene2DCanvas-NCptTu5l.js → Scene2DCanvas-uDyUWA_h.js} +1 -1
- package/dist/assets/{SceneManager-CwvQOFBU.js → SceneManager-CqX9oyfB.js} +1 -1
- package/dist/assets/{SkillsPanel-CNbLb0Fu.js → SkillsPanel-BSuHxISi.js} +2 -2
- package/dist/assets/{SpawnModal-DAjrIVss.js → SpawnModal-C3dwTSV0.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-5HP1CzQT.js → SubordinateAssignmentModal-RZJUO92_.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-VSxCT-cD.js → TriggerManagerPanel-DEkOU2da.js} +2 -2
- package/dist/assets/{WorkflowEditorPanel-DfXfdv46.js → WorkflowEditorPanel-C43Kawid.js} +2 -2
- package/dist/assets/index-BCPAV-9V.js +1 -0
- package/dist/assets/{index-BfWMRkdP.js → index-BKFJ5pOR.js} +1 -1
- package/dist/assets/index-BQgCNQRi.css +1 -0
- package/dist/assets/index-BkwJ2ByJ.js +1 -0
- package/dist/assets/{index-BiAN1sxE.js → index-CMOZpYNj.js} +5 -5
- package/dist/assets/{index-CdSYWPJD.js → index-CUgMzqD-.js} +3 -3
- package/dist/assets/{index-DYml8LTk.js → index-DLn-MFiJ.js} +1 -1
- package/dist/assets/{index-BEmul9y0.js → index-DMhivE9i.js} +4 -4
- package/dist/assets/index-DYBLXfaK.js +2 -0
- package/dist/assets/{index-0eWL2WB3.js → index-Djj0po5C.js} +2 -2
- package/dist/assets/{main-BlnQCHb9.js → main-BxStxFko.js} +4 -4
- package/dist/assets/{web-C-VeqfnM.js → web-COTfP2Su.js} +1 -1
- package/dist/assets/{web-W5mpcw2a.js → web-dETXjReH.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/index-BR9_mEVJ.css +0 -1
- package/dist/assets/index-Bwtfr8vQ.js +0 -1
- package/dist/assets/index-DRsHxeh_.js +0 -1
- package/dist/assets/index-PmiCO3k8.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as d,I as H,ad as He,N as Je,O as Xe,bT as Ze,r as A,s as ee,bU as be,W as qe,a7 as fe,u as Ce}from"./main-BlnQCHb9.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function q(t){return Array.isArray?Array.isArray(t):Pe(t)==="[object Array]"}function et(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function tt(t){return t==null?"":et(t)}function X(t){return typeof t=="string"}function $e(t){return typeof t=="number"}function st(t){return t===!0||t===!1||nt(t)&&Pe(t)=="[object Boolean]"}function Te(t){return typeof t=="object"}function nt(t){return Te(t)&&t!==null}function O(t){return t!=null}function me(t){return!t.trim().length}function Pe(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const rt="Incorrect 'index' type",it=t=>`Invalid value for key ${t}`,ct=t=>`Pattern length exceeds max of ${t}.`,ot=t=>`Missing ${t} property in key`,at=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class ut{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(n=>{let r=Ke(n);this._keys.push(r),this._keyMap[r.id]=r,s+=r.weight}),this._keys.forEach(n=>{n.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ke(t){let e=null,s=null,n=null,r=1,i=null;if(X(t)||q(t))n=t,e=Se(t),s=pe(t);else{if(!ve.call(t,"name"))throw new Error(ot("name"));const c=t.name;if(n=c,ve.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(at(c));e=Se(c),s=pe(c),i=t.getFn}return{path:e,id:s,weight:r,src:n,getFn:i}}function Se(t){return q(t)?t:t.split(".")}function pe(t){return q(t)?t.join("."):t}function lt(t,e){let s=[],n=!1;const r=(i,c,a)=>{if(O(i))if(!c[a])s.push(i);else{let u=c[a];const l=i[u];if(!O(l))return;if(a===c.length-1&&(X(l)||$e(l)||st(l)))s.push(tt(l));else if(q(l)){n=!0;for(let h=0,f=l.length;h<f;h+=1)r(l[h],c,a+1)}else c.length&&r(l,c,a+1)}};return r(t,X(e)?e.split("."):e,0),n?s:s[0]}const ht={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},dt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},ft={location:0,threshold:.6,distance:100},mt={useExtendedSearch:!1,getFn:lt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...dt,...ht,...ft,...mt};const pt=/[^ ]+/g;function gt(t=1,e=3){const s=new Map,n=Math.pow(10,e);return{get(r){const i=r.match(pt).length;if(s.has(i))return s.get(i);const c=1/Math.pow(i,.5*t),a=parseFloat(Math.round(c*n)/n);return s.set(i,a),a},clear(){s.clear()}}}class we{constructor({getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=gt(s,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,X(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();X(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(e,s){return e[this._keysMap[s]]}size(){return this.records.length}_addString(e,s){if(!O(e)||me(e))return;let n={v:e,i:s,n:this.norm.get(e)};this.records.push(n)}_addObject(e,s){let n={i:s,$:{}};this.keys.forEach((r,i)=>{let c=r.getFn?r.getFn(e):this.getFn(e,r.path);if(O(c)){if(q(c)){let a=[];const u=[{nestedArrIndex:-1,value:c}];for(;u.length;){const{nestedArrIndex:l,value:h}=u.pop();if(O(h))if(X(h)&&!me(h)){let f={v:h,i:l,n:this.norm.get(h)};a.push(f)}else q(h)&&h.forEach((f,m)=>{u.push({nestedArrIndex:m,value:f})})}n.$[i]=a}else if(X(c)&&!me(c)){let a={v:c,n:this.norm.get(c)};n.$[i]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Oe(t,e,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const r=new we({getFn:s,fieldNormWeight:n});return r.setKeys(t.map(Ke)),r.setSources(e),r.create(),r}function At(t,{getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:r}=t,i=new we({getFn:e,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i}function le(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=p.distance,ignoreLocation:i=p.ignoreLocation}={}){const c=e/t.length;if(i)return c;const a=Math.abs(n-s);return r?c+a/r:a?1:c}function yt(t=[],e=p.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=t.length;i<c;i+=1){let a=t[i];a&&n===-1?n=i:!a&&n!==-1&&(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}const ne=32;function xt(t,e,s,{location:n=p.location,distance:r=p.distance,threshold:i=p.threshold,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(e.length>ne)throw new Error(ct(ne));const h=e.length,f=t.length,m=Math.max(0,Math.min(n,f));let g=i,y=m;const b=a>1||u,k=b?Array(f):[];let S;for(;(S=t.indexOf(e,y))>-1;){let x=le(e,{currentLocation:S,expectedLocation:m,distance:r,ignoreLocation:l});if(g=Math.min(x,g),y=S+h,b){let E=0;for(;E<h;)k[S+E]=1,E+=1}}y=-1;let _=[],W=1,z=h+f;const re=1<<h-1;for(let x=0;x<h;x+=1){let E=0,I=z;for(;E<I;)le(e,{errors:x,currentLocation:m+I,expectedLocation:m,distance:r,ignoreLocation:l})<=g?E=I:z=I,I=Math.floor((z-E)/2+E);z=I;let $=Math.max(1,m-I+1),T=c?f:Math.min(m+I,f)+h,V=Array(T+2);V[T+1]=(1<<x)-1;for(let N=T;N>=$;N-=1){let Z=N-1,ae=s[t.charAt(Z)];if(b&&(k[Z]=+!!ae),V[N]=(V[N+1]<<1|1)&ae,x&&(V[N]|=(_[N+1]|_[N])<<1|1|_[N+1]),V[N]&re&&(W=le(e,{errors:x,currentLocation:Z,expectedLocation:m,distance:r,ignoreLocation:l}),W<=g)){if(g=W,y=Z,y<=m)break;$=Math.max(1,2*m-y)}}if(le(e,{errors:x+1,currentLocation:m,expectedLocation:m,distance:r,ignoreLocation:l})>g)break;_=V}const G={isMatch:y>=0,score:Math.max(.001,W)};if(b){const x=yt(k,a);x.length?u&&(G.indices=x):G.isMatch=!1}return G}function Et(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}const he=String.prototype.normalize?(t=>t.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,"")):(t=>t);class ze{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h},e=u?e:e.toLowerCase(),e=l?he(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const f=(g,y)=>{this.chunks.push({pattern:g,alphabet:Et(g),startIndex:y})},m=this.pattern.length;if(m>ne){let g=0;const y=m%ne,b=m-y;for(;g<b;)f(this.pattern.substr(g,ne),g),g+=ne;if(y){const k=m-ne;f(this.pattern.substr(k),k)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=s?e:e.toLowerCase(),e=n?he(e):e,this.pattern===e){let b={isMatch:!0,score:0};return r&&(b.indices=[[0,e.length-1]]),b}const{location:i,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:h}=this.options;let f=[],m=0,g=!1;this.chunks.forEach(({pattern:b,alphabet:k,startIndex:S})=>{const{isMatch:_,score:W,indices:z}=xt(e,b,k,{location:i+S,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:r,ignoreLocation:h});_&&(g=!0),m+=W,_&&z&&(f=[...f,...z])});let y={isMatch:g,score:g?m/this.chunks.length:1};return g&&r&&(y.indices=f),y}}class te{constructor(e){this.pattern=e}static isMultiMatch(e){return ke(e,this.multiRegex)}static isSingleMatch(e){return ke(e,this.singleRegex)}search(){}}function ke(t,e){const s=t.match(e);return s?s[1]:null}class Ct extends te{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const s=e===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class wt extends te{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Ft extends te{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const s=e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Mt extends te{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const s=!e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class It extends te{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const s=e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Dt extends te{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const s=!e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Qe extends te{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){super(e),this._bitapSearch=new ze(e,{location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class We extends te{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let s=0,n;const r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,s))>-1;)s=n+i,r.push([n,s-1]);const c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}}const ge=[Ct,We,Ft,Mt,Dt,It,wt,Qe],Ne=ge.length,Bt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,bt="|";function vt(t,e={}){return t.split(bt).map(s=>{let n=s.trim().split(Bt).filter(i=>i&&!!i.trim()),r=[];for(let i=0,c=n.length;i<c;i+=1){const a=n[i];let u=!1,l=-1;for(;!u&&++l<Ne;){const h=ge[l];let f=h.isMultiMatch(a);f&&(r.push(new h(f,e)),u=!0)}if(!u)for(l=-1;++l<Ne;){const h=ge[l];let f=h.isSingleMatch(a);if(f){r.push(new h(f,e));break}}}return r})}const St=new Set([Qe.type,We.type]);class kt{constructor(e,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:r=p.includeMatches,minMatchCharLength:i=p.minMatchCharLength,ignoreLocation:c=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:h=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:a,ignoreLocation:c,location:u,threshold:l,distance:h},e=s?e:e.toLowerCase(),e=n?he(e):e,this.pattern=e,this.query=vt(this.pattern,this.options)}static condition(e,s){return s.useExtendedSearch}searchIn(e){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?he(e):e;let c=0,a=[],u=0;for(let l=0,h=s.length;l<h;l+=1){const f=s[l];a.length=0,c=0;for(let m=0,g=f.length;m<g;m+=1){const y=f[m],{isMatch:b,indices:k,score:S}=y.search(e);if(b){if(c+=1,u+=S,n){const _=y.constructor.type;St.has(_)?a=[...a,...k]:a.push(k)}}else{u=0,c=0,a.length=0;break}}if(c){let m={isMatch:!0,score:u/c};return n&&(m.indices=a),m}}return{isMatch:!1,score:1}}}const Ae=[];function Nt(...t){Ae.push(...t)}function ye(t,e){for(let s=0,n=Ae.length;s<n;s+=1){let r=Ae[s];if(r.condition(t,e))return new r(t,e)}return new ze(t,e)}const de={AND:"$and",OR:"$or"},xe={PATH:"$path",PATTERN:"$val"},Ee=t=>!!(t[de.AND]||t[de.OR]),jt=t=>!!t[xe.PATH],Rt=t=>!q(t)&&Te(t)&&!Ee(t),je=t=>({[de.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function Ve(t,e,{auto:s=!0}={}){const n=r=>{let i=Object.keys(r);const c=jt(r);if(!c&&i.length>1&&!Ee(r))return n(je(r));if(Rt(r)){const u=c?r[xe.PATH]:i[0],l=c?r[xe.PATTERN]:r[u];if(!X(l))throw new Error(it(u));const h={keyId:pe(u),pattern:l};return s&&(h.searcher=ye(l,e)),h}let a={children:[],operator:i[0]};return i.forEach(u=>{const l=r[u];q(l)&&l.forEach(h=>{a.children.push(n(h))})}),a};return Ee(t)||(t=je(t)),n(t)}function _t(t,{ignoreFieldNorm:e=p.ignoreFieldNorm}){t.forEach(s=>{let n=1;s.matches.forEach(({key:r,norm:i,score:c})=>{const a=r?r.weight:null;n*=Math.pow(c===0&&a?Number.EPSILON:c,(a||1)*(e?1:i))}),s.score=n})}function Lt(t,e){const s=t.matches;e.matches=[],O(s)&&s.forEach(n=>{if(!O(n.indices)||!n.indices.length)return;const{indices:r,value:i}=n;let c={indices:r,value:i};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function $t(t,e){e.score=t.score}function Tt(t,e,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const r=[];return s&&r.push(Lt),n&&r.push($t),t.map(i=>{const{idx:c}=i,a={item:e[c],refIndex:c};return r.length&&r.forEach(u=>{u(i,a)}),a})}class J{constructor(e,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ut(this.options.keys),this.setCollection(e,n)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof we))throw new Error(rt);this._myIndex=s||Oe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){O(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,r-=1,s.push(i))}return s}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:s=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:c,ignoreFieldNorm:a}=this.options;let u=X(e)?X(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return _t(u,{ignoreFieldNorm:a}),i&&u.sort(c),$e(s)&&s>-1&&(u=u.slice(0,s)),Tt(u,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const s=ye(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:i,i:c,n:a})=>{if(!O(i))return;const{isMatch:u,score:l,indices:h}=s.searchIn(i);u&&r.push({item:i,idx:c,matches:[{score:l,value:i,norm:a,indices:h}]})}),r}_searchLogical(e){const s=Ve(e,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:f,searcher:m}=a,g=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(u,f),searcher:m});return g&&g.length?[{idx:l,item:u,matches:g}]:[]}const h=[];for(let f=0,m=a.children.length;f<m;f+=1){const g=a.children[f],y=n(g,u,l);if(y.length)h.push(...y);else if(a.operator===de.AND)return[]}return h},r=this._myIndex.records,i={},c=[];return r.forEach(({$:a,i:u})=>{if(O(a)){let l=n(s,a,u);l.length&&(i[u]||(i[u]={idx:u,item:a,matches:[]},c.push(i[u])),l.forEach(({matches:h})=>{i[u].matches.push(...h)}))}}),c}_searchObjectList(e){const s=ye(e,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:c,i:a})=>{if(!O(c))return;let u=[];n.forEach((l,h)=>{u.push(...this._findMatches({key:l,value:c[h],searcher:s}))}),u.length&&i.push({idx:a,item:c,matches:u})}),i}_findMatches({key:e,value:s,searcher:n}){if(!O(s))return[];let r=[];if(q(s))s.forEach(({v:i,i:c,n:a})=>{if(!O(i))return;const{isMatch:u,score:l,indices:h}=n.searchIn(i);u&&r.push({score:l,key:e,value:i,idx:c,norm:a,indices:h})});else{const{v:i,n:c}=s,{isMatch:a,score:u,indices:l}=n.searchIn(i);a&&r.push({score:u,key:e,value:i,norm:c,indices:l})}return r}}J.version="7.1.0";J.createIndex=Oe;J.parseIndex=At;J.config=p;J.parseQuery=Ve;Nt(kt);const Re={".ts":"file-code",".tsx":"atom",".js":"file-code",".jsx":"atom",".py":"file-code",".rs":"file-code",".go":"file-code",".md":"file-text",".json":"clipboard",".yaml":"gear",".yml":"gear",".css":"palette",".scss":"palette",".html":"globe",".sql":"database",".sh":"terminal",".env":"lock",".toml":"gear",".lock":"lock",default:"file-text"};function Pt(t){switch(t){case"scout":return"class-scout";case"builder":return"class-builder";case"debugger":return"class-debugger";case"architect":return"class-architect";case"warrior":return"class-warrior";case"support":return"class-support";case"boss":return"class-boss";default:return"class-default"}}function Kt(t,e=16){var r;const s="."+(((r=t.split(".").pop())==null?void 0:r.toLowerCase())??""),n=Re[s]||Re.default;return d.jsx(H,{name:n,size:e})}function Jt(t,e=16){return d.jsx(H,{name:Pt(t),size:e,weight:"fill"})}function Ue(t){const e=Math.floor(t/1e3),s=Math.floor(e/60),n=Math.floor(s/60),r=Math.floor(n/24);return r>0?`${r}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Xt(t){const s=Date.now()-t;return Ue(s)}function _e(t){switch(t){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"modified-file":return"Changed";case"building":return"Server";default:return t}}const Le=["command","agent","building","area","modified-file"];function Ot({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=He(),f=Je(),m=Xe(),g=Ze(),y=A.useRef(e);y.current=e;const b=A.useRef(s);b.current=s;const k=A.useRef(n);k.current=n;const S=A.useRef(r);S.current=r;const _=A.useRef(i);_.current=i;const W=A.useRef(c);W.current=c;const z=A.useRef(a);z.current=a;const re=A.useRef(u);re.current=u;const G=A.useRef(l);G.current=l;const[x,E]=A.useState(""),[I,$]=A.useState(0);A.useEffect(()=>{t&&(E(""),$(0))},[t]);const T=ee.getShortcuts(),V=A.useMemo(()=>{if(!t)return[];const o=T.find(F=>F.id==="spawn-agent"),w=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:o?be(o):"Alt+N",icon:d.jsx(H,{name:"plus",size:16}),action:()=>{y.current(),b.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:w?be(w):"Ctrl+K",icon:d.jsx(H,{name:"dashboard",size:16}),action:()=>{y.current(),k.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:d.jsx(H,{name:"gear",size:16}),action:()=>{y.current(),S.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:d.jsx(H,{name:"chart-line",size:16}),action:()=>{var F;y.current(),(F=G.current)==null||F.call(G)}}]},[t,T]),oe=A.useMemo(()=>t?Array.from(h.values()).map(o=>{const w=(g||[]).filter(K=>K.agentId===o.id).map(K=>K.filePath),F=[...new Set(w)],M=F.map(K=>K.split("/").pop()||K),v=[];o.lastAssignedTask&&v.push(o.lastAssignedTask);const j=`${o.class} • ${o.status} • ${o.cwd}`;let D=`${o.name} ${j}`;M.length>0&&(D+=` ${M.join(" ")} ${F.join(" ")}`),v.length>0&&(D+=` ${v.join(" ")}`);const P=Date.now()-o.lastActivity;let Q;return o.lastAssignedTask&&(o.lastAssignedTask.length>150?Q=o.lastAssignedTask.slice(0,150)+"...":Q=o.lastAssignedTask),{id:`agent-${o.id}`,type:"agent",title:o.name,subtitle:j,lastUserInput:Q,timeAway:P,icon:d.jsx(qe,{agent:o,size:20}),_searchText:D,_modifiedFiles:F,_userQueries:v,action:()=>{y.current(),ee.selectAgent(o.id),ee.getState().viewMode!=="flat"&&ee.requestTerminalExpand()}}}):[],[t,h,g]),N=A.useMemo(()=>t?Array.from(f.values()).map(o=>{var w;return{id:`area-${o.id}`,type:"area",title:o.name,subtitle:`${o.assignedAgentIds.length} agents • ${((w=o.directories)==null?void 0:w.length)||0} folders`,icon:d.jsx(H,{name:"map",size:16}),action:()=>{y.current(),ee.selectArea(o.id)}}}):[],[t,f]),Z=A.useMemo(()=>t?Array.from(m.values()).filter(o=>o.type==="server"||o.type==="boss"||o.type==="database").map(o=>{var D,P,Q,K;const w=o.status==="running"?"#4ade80":o.status==="stopped"?"#f87171":"#facc15",F=o.type==="boss"?"crown":o.type==="database"?"database":"desktop";let v=`${o.type==="boss"?"Boss":o.type==="database"?"Database":"Server"} • ${o.status}`;if(o.type==="database"&&((P=(D=o.database)==null?void 0:D.connections)!=null&&P.length)){const L=o.database.connections[0];v+=` • ${L.engine} @ ${L.host}`}else o.cwd&&(v+=` • ${o.cwd}`);let j=`${o.name} ${o.type} ${o.status} ${o.cwd||""} ${((Q=o.pm2)==null?void 0:Q.name)||""}`;if(o.type==="database"&&((K=o.database)!=null&&K.connections))for(const L of o.database.connections)j+=` ${L.name} ${L.engine} ${L.host} ${L.database||""} mysql postgresql sql`;return{id:`building-${o.id}`,type:"building",title:o.name,subtitle:v,icon:d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[d.jsx(H,{name:"status-pending",size:10,weight:"fill",color:w}),d.jsx(H,{name:F,size:16})]}),_searchText:j,action:()=>{var L;y.current(),o.type==="boss"?z.current(o.id):o.type==="database"?re.current(o.id):(L=o.pm2)!=null&&L.enabled&&W.current(o.id)}}}):[],[t,m]),ae=A.useMemo(()=>{if(!t)return[];const o=g||[],w=new Set,F=[];for(const M of o){if(w.has(M.filePath))continue;w.add(M.filePath);const v=M.filePath.split("/").pop()||M.filePath,j=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:v,subtitle:`${j} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?d.jsx(H,{name:"trash",size:16}):Kt(M.filePath),action:()=>{y.current();const D=Array.from(ee.getState().areas.values());for(const P of D)for(const Q of P.directories||[])if(M.filePath.startsWith(Q)){ee.setFileViewerPath(M.filePath),_.current(P.id);return}ee.selectAgent(M.agentId)}}),F.length>=50)break}return F},[t,g]),Fe=A.useMemo(()=>new J(oe,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[oe]),Me=A.useMemo(()=>new J(V,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[V]),Ie=A.useMemo(()=>new J(N,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[N]),De=A.useMemo(()=>new J(ae,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ae]),Be=A.useMemo(()=>new J(Z,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Z]),U=A.useMemo(()=>{if(!x.trim()){const C=[];C.push(...Z);const B=[...oe].sort((R,Y)=>{const ie=R.timeAway??0,ce=Y.timeAway??0;return ie-ce});C.push(...B),C.push(...V.slice(0,2)),C.push(...N.slice(0,2));const se={};return Le.forEach((R,Y)=>{se[R]=Y}),C.sort((R,Y)=>(se[R.type]??999)-(se[Y.type]??999)),C}const o=x.toLowerCase(),w=Fe.search(x).slice(0,8),F=Me.search(x).slice(0,3),M=Ie.search(x).slice(0,2),v=De.search(x).slice(0,3),j=Be.search(x).filter(C=>{const B=C.score??1;return`${C.item.title} ${C.item.subtitle||""} ${C.item._searchText||""}`.toLowerCase().includes(o)||B<=.2}).slice(0,4),D=[],P=[],Q=[];for(const C of w){const B={...C.item};if(B._modifiedFiles&&B._modifiedFiles.length>0){const R=B._modifiedFiles.filter(Y=>{var ue;const ie=((ue=Y.split("/").pop())==null?void 0:ue.toLowerCase())||"",ce=Y.toLowerCase();return ie.includes(o)||ce.includes(o)});R.length>0&&(B.matchedFiles=R)}if(B._userQueries&&B._userQueries.length>0){const R=B._userQueries.find(Y=>Y.toLowerCase().includes(o));if(R)if(R.length>200){const ie=R.toLowerCase().indexOf(o),ce=Math.max(0,ie-60),ue=Math.min(R.length,ie+o.length+100);B.matchedQuery=(ce>0?"...":"")+R.slice(ce,ue)+(ue<R.length?"...":"")}else B.matchedQuery=R}const se=B.title.toLowerCase();se===o||se.startsWith(o)?P.push(B):Q.push(B)}const K=(C,B)=>(C.timeAway??Number.POSITIVE_INFINITY)-(B.timeAway??Number.POSITIVE_INFINITY);P.sort(K),Q.sort(K);for(const C of P)D.push(C);for(const C of j)D.push(C.item);for(const C of Q)D.push(C);for(const C of F)D.push(C.item);for(const C of M)D.push(C.item);for(const C of v)D.push(C.item);const L={};return Le.forEach((C,B)=>{L[C]=B}),D.sort((C,B)=>(L[C.type]??999)-(L[B.type]??999)),D},[x,Fe,Me,Ie,De,Be,V,oe,N,Z]);A.useEffect(()=>{I>=U.length&&$(Math.max(0,U.length-1))},[U.length,I]);const Ye=A.useCallback(o=>{if(o.altKey&&!o.ctrlKey&&!o.metaKey&&(o.key==="p"||o.key==="n"||o.key==="P"||o.key==="N")){o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopImmediatePropagation();const w=o.key.toLowerCase();$(w==="p"?F=>F>0?F-1:U.length-1:F=>F<U.length-1?F+1:0);return}switch(o.key){case"Escape":o.preventDefault(),y.current();break;case"ArrowUp":o.preventDefault(),$(w=>w>0?w-1:U.length-1);break;case"ArrowDown":o.preventDefault(),$(w=>w<U.length-1?w+1:0);break;case"Enter":o.preventDefault(),U[I]&&U[I].action();break}},[U,I]),Ge=A.useCallback((o,w)=>{if(!w||!o)return o;const F=o.toLowerCase(),M=w.toLowerCase(),v=[];let j=0,D=F.indexOf(M),P=0;for(;D!==-1;)D>j&&v.push(o.slice(j,D)),v.push(fe.createElement("mark",{key:P++,className:"spotlight-highlight"},o.slice(D,D+w.length))),j=D+w.length,D=F.indexOf(M,j);return j<o.length&&v.push(o.slice(j)),v.length>0?fe.createElement(fe.Fragment,null,...v):o},[]);return{query:x,setQuery:E,selectedIndex:I,setSelectedIndex:$,results:U,handleKeyDown:Ye,highlightMatch:Ge}}const zt=A.forwardRef(function({query:e,onQueryChange:s,onKeyDown:n,onResetSelection:r},i){const{t:c}=Ce(["common"]);return d.jsxs("div",{className:"spotlight-input-wrapper",children:[d.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),d.jsx("input",{ref:i,type:"text",className:"spotlight-input",placeholder:c("common:search.spotlightPlaceholder"),value:e,onChange:a=>{s(a.target.value),r()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),d.jsxs("div",{className:"spotlight-input-hints",children:[d.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Qt=A.memo(function({result:e,isSelected:s,query:n,highlightMatch:r,onClick:i,onMouseEnter:c}){const a=e.activityText||e.matchedFiles&&e.matchedFiles.length>0||e.matchedQuery;return d.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${e.activityText?"has-activity":""}`,onClick:i,onMouseEnter:c,role:"option","aria-selected":s,children:[d.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:e.icon}),d.jsxs("div",{className:"spotlight-item-content",children:[d.jsxs("div",{className:"spotlight-item-header",children:[d.jsx("span",{className:"spotlight-item-title",children:r(e.title,n)}),d.jsx("span",{className:`spotlight-item-type ${e.type}`,"aria-label":_e(e.type),children:_e(e.type)})]}),e.subtitle&&d.jsx("span",{className:"spotlight-item-subtitle",children:r(e.subtitle,n)}),e.activityText&&d.jsx("span",{className:"spotlight-item-activity",children:r(e.activityText,n)}),a&&d.jsxs("div",{className:"spotlight-item-details",children:[e.matchedFiles&&e.matchedFiles.length>0&&d.jsx("span",{className:"spotlight-item-files",children:e.matchedFiles.map((u,l)=>d.jsxs("span",{className:"file-badge",children:[l>0&&d.jsx("span",{className:"file-separator",children:"•"}),r(u.split("/").pop()||u,n)]},u))}),e.matchedQuery&&d.jsx("span",{className:"spotlight-item-query",children:r(e.matchedQuery,n)})]}),e.timeAway!==void 0&&d.jsx("span",{className:"spotlight-item-time",children:d.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Ue(e.timeAway)]})}),e.lastUserInput&&!e.matchedQuery&&d.jsxs("span",{className:"spotlight-item-last-input",children:['"',r(e.lastUserInput,n),'"']})]})]})}),Wt=A.forwardRef(function({results:e,selectedIndex:s,query:n,highlightMatch:r,onSelectIndex:i},c){const{t:a}=Ce(["terminal"]),u=A.useRef(!1);A.useEffect(()=>{u.current=!1},[e]),A.useEffect(()=>{const f=typeof c=="function"?null:c==null?void 0:c.current;if(!f)return;const m=()=>{u.current=!0};return f.addEventListener("mousemove",m),()=>{f.removeEventListener("mousemove",m)}},[c,e]);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")},h=A.useMemo(()=>{const f=[];let m=null,g=[];return e.forEach((y,b)=>{y.type!==m&&(m!==null&&g.length>0&&f.push([m,g]),m=y.type,g=[]),g.push({result:y,index:b})}),m!==null&&g.length>0&&f.push([m,g]),f},[e]);return A.useEffect(()=>{if(!c||typeof c=="function")return;const f=c.current;if(!f)return;const m=f.querySelector(".spotlight-item.selected");m&&m.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,c]),e.length===0?d.jsx("div",{className:"spotlight-results",ref:c,children:d.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):d.jsx("div",{className:"spotlight-results",ref:c,children:h.map(([f,m])=>d.jsxs("div",{children:[h.length>1&&d.jsx("div",{className:"spotlight-category-header",children:l[f]||f}),m.map(({result:g,index:y})=>d.jsx(Qt,{result:g,isSelected:y===s,query:n,highlightMatch:r,onClick:()=>g.action(),onMouseEnter:()=>{u.current&&i(y)}},g.id))]},f))})}),Vt=A.memo(function(){const{t:e}=Ce(["terminal"]);return d.jsxs("div",{className:"spotlight-footer",children:[d.jsxs("div",{className:"spotlight-footer-left",children:[d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"↑"}),d.jsx("kbd",{children:"↓"})," ",d.jsx("kbd",{children:"Alt+N"}),d.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]})]}),d.jsx("div",{className:"spotlight-footer-right",children:d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})}),Ut=768;function Zt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=A.useRef(null),f=A.useRef(null),m=A.useRef(null),g=A.useRef(0),{query:y,setQuery:b,selectedIndex:k,setSelectedIndex:S,results:_,handleKeyDown:W,highlightMatch:z}=Ot({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l});g.current=_.length,A.useEffect(()=>{t&&setTimeout(()=>{var x;(x=h.current)==null||x.focus()},50)},[t]),A.useEffect(()=>{if(!t)return;const x=window.visualViewport;if(!x||window.innerWidth>Ut)return;const E=()=>{const I=f.current;I&&(I.style.height=`${x.height}px`,I.style.top=`${x.offsetTop}px`)};return E(),x.addEventListener("resize",E),x.addEventListener("scroll",E),()=>{x.removeEventListener("resize",E),x.removeEventListener("scroll",E);const I=f.current;I&&(I.style.height="",I.style.top="")}},[t]),A.useEffect(()=>{if(!t)return;const x=E=>{if(E.key==="Escape"){E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),e();return}if(E.altKey&&!E.ctrlKey&&!E.metaKey&&(E.key==="n"||E.key==="p"||E.key==="N"||E.key==="P")){E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const I=E.key.toLowerCase(),$=g.current;S(I==="p"?T=>T>0?T-1:$-1:T=>T<$-1?T+1:0);return}};return window.addEventListener("keydown",x,{capture:!0}),()=>{window.removeEventListener("keydown",x,{capture:!0})}},[t,e]);const re=A.useCallback(x=>{x.target===x.currentTarget&&e()},[e]),G=A.useCallback(()=>{S(0)},[S]);return t?d.jsx("div",{ref:f,className:"spotlight-overlay",onClick:re,children:d.jsxs("div",{className:"spotlight-modal",children:[d.jsx(zt,{ref:h,query:y,onQueryChange:b,onKeyDown:W,onResetSelection:G}),d.jsx(Wt,{ref:m,results:_,selectedIndex:k,query:y,highlightMatch:z,onSelectIndex:S}),d.jsx(Vt,{})]})}):null}export{Re as FILE_ICON_NAMES,Zt as Spotlight,Vt as SpotlightFooter,zt as SpotlightInput,Qt as SpotlightItem,Wt as SpotlightResults,Ue as formatDuration,Xt as formatRelativeTime,Jt as getAgentIcon,Kt as getFileIconFromPath,_e as getTypeLabel,Ot as useSpotlightSearch};
|
|
1
|
+
import{j as d,I as H,af as He,O as Je,P as Xe,bV as Ze,r as A,s as ee,bW as be,Y as qe,a9 as fe,u as Ce}from"./main-BxStxFko.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function q(t){return Array.isArray?Array.isArray(t):Pe(t)==="[object Array]"}function et(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function tt(t){return t==null?"":et(t)}function X(t){return typeof t=="string"}function $e(t){return typeof t=="number"}function st(t){return t===!0||t===!1||nt(t)&&Pe(t)=="[object Boolean]"}function Te(t){return typeof t=="object"}function nt(t){return Te(t)&&t!==null}function O(t){return t!=null}function me(t){return!t.trim().length}function Pe(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const rt="Incorrect 'index' type",it=t=>`Invalid value for key ${t}`,ct=t=>`Pattern length exceeds max of ${t}.`,ot=t=>`Missing ${t} property in key`,at=t=>`Property 'weight' in key '${t}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class ut{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(n=>{let r=Ke(n);this._keys.push(r),this._keyMap[r.id]=r,s+=r.weight}),this._keys.forEach(n=>{n.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ke(t){let e=null,s=null,n=null,r=1,i=null;if(X(t)||q(t))n=t,e=Se(t),s=pe(t);else{if(!ve.call(t,"name"))throw new Error(ot("name"));const c=t.name;if(n=c,ve.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(at(c));e=Se(c),s=pe(c),i=t.getFn}return{path:e,id:s,weight:r,src:n,getFn:i}}function Se(t){return q(t)?t:t.split(".")}function pe(t){return q(t)?t.join("."):t}function lt(t,e){let s=[],n=!1;const r=(i,c,a)=>{if(O(i))if(!c[a])s.push(i);else{let u=c[a];const l=i[u];if(!O(l))return;if(a===c.length-1&&(X(l)||$e(l)||st(l)))s.push(tt(l));else if(q(l)){n=!0;for(let h=0,f=l.length;h<f;h+=1)r(l[h],c,a+1)}else c.length&&r(l,c,a+1)}};return r(t,X(e)?e.split("."):e,0),n?s:s[0]}const ht={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},dt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},ft={location:0,threshold:.6,distance:100},mt={useExtendedSearch:!1,getFn:lt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var p={...dt,...ht,...ft,...mt};const pt=/[^ ]+/g;function gt(t=1,e=3){const s=new Map,n=Math.pow(10,e);return{get(r){const i=r.match(pt).length;if(s.has(i))return s.get(i);const c=1/Math.pow(i,.5*t),a=parseFloat(Math.round(c*n)/n);return s.set(i,a),a},clear(){s.clear()}}}class we{constructor({getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){this.norm=gt(s,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,X(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){const s=this.size();X(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(e,s){return e[this._keysMap[s]]}size(){return this.records.length}_addString(e,s){if(!O(e)||me(e))return;let n={v:e,i:s,n:this.norm.get(e)};this.records.push(n)}_addObject(e,s){let n={i:s,$:{}};this.keys.forEach((r,i)=>{let c=r.getFn?r.getFn(e):this.getFn(e,r.path);if(O(c)){if(q(c)){let a=[];const u=[{nestedArrIndex:-1,value:c}];for(;u.length;){const{nestedArrIndex:l,value:h}=u.pop();if(O(h))if(X(h)&&!me(h)){let f={v:h,i:l,n:this.norm.get(h)};a.push(f)}else q(h)&&h.forEach((f,m)=>{u.push({nestedArrIndex:m,value:f})})}n.$[i]=a}else if(X(c)&&!me(c)){let a={v:c,n:this.norm.get(c)};n.$[i]=a}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Oe(t,e,{getFn:s=p.getFn,fieldNormWeight:n=p.fieldNormWeight}={}){const r=new we({getFn:s,fieldNormWeight:n});return r.setKeys(t.map(Ke)),r.setSources(e),r.create(),r}function At(t,{getFn:e=p.getFn,fieldNormWeight:s=p.fieldNormWeight}={}){const{keys:n,records:r}=t,i=new we({getFn:e,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i}function le(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=p.distance,ignoreLocation:i=p.ignoreLocation}={}){const c=e/t.length;if(i)return c;const a=Math.abs(n-s);return r?c+a/r:a?1:c}function yt(t=[],e=p.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let c=t.length;i<c;i+=1){let a=t[i];a&&n===-1?n=i:!a&&n!==-1&&(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}const ne=32;function xt(t,e,s,{location:n=p.location,distance:r=p.distance,threshold:i=p.threshold,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,includeMatches:u=p.includeMatches,ignoreLocation:l=p.ignoreLocation}={}){if(e.length>ne)throw new Error(ct(ne));const h=e.length,f=t.length,m=Math.max(0,Math.min(n,f));let g=i,y=m;const b=a>1||u,k=b?Array(f):[];let S;for(;(S=t.indexOf(e,y))>-1;){let x=le(e,{currentLocation:S,expectedLocation:m,distance:r,ignoreLocation:l});if(g=Math.min(x,g),y=S+h,b){let E=0;for(;E<h;)k[S+E]=1,E+=1}}y=-1;let _=[],W=1,z=h+f;const re=1<<h-1;for(let x=0;x<h;x+=1){let E=0,I=z;for(;E<I;)le(e,{errors:x,currentLocation:m+I,expectedLocation:m,distance:r,ignoreLocation:l})<=g?E=I:z=I,I=Math.floor((z-E)/2+E);z=I;let $=Math.max(1,m-I+1),T=c?f:Math.min(m+I,f)+h,V=Array(T+2);V[T+1]=(1<<x)-1;for(let j=T;j>=$;j-=1){let Z=j-1,ae=s[t.charAt(Z)];if(b&&(k[Z]=+!!ae),V[j]=(V[j+1]<<1|1)&ae,x&&(V[j]|=(_[j+1]|_[j])<<1|1|_[j+1]),V[j]&re&&(W=le(e,{errors:x,currentLocation:Z,expectedLocation:m,distance:r,ignoreLocation:l}),W<=g)){if(g=W,y=Z,y<=m)break;$=Math.max(1,2*m-y)}}if(le(e,{errors:x+1,currentLocation:m,expectedLocation:m,distance:r,ignoreLocation:l})>g)break;_=V}const G={isMatch:y>=0,score:Math.max(.001,W)};if(b){const x=yt(k,a);x.length?u&&(G.indices=x):G.isMatch=!1}return G}function Et(t){let e={};for(let s=0,n=t.length;s<n;s+=1){const r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}const he=String.prototype.normalize?(t=>t.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,"")):(t=>t);class ze{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h},e=u?e:e.toLowerCase(),e=l?he(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const f=(g,y)=>{this.chunks.push({pattern:g,alphabet:Et(g),startIndex:y})},m=this.pattern.length;if(m>ne){let g=0;const y=m%ne,b=m-y;for(;g<b;)f(this.pattern.substr(g,ne),g),g+=ne;if(y){const k=m-ne;f(this.pattern.substr(k),k)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=s?e:e.toLowerCase(),e=n?he(e):e,this.pattern===e){let b={isMatch:!0,score:0};return r&&(b.indices=[[0,e.length-1]]),b}const{location:i,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:h}=this.options;let f=[],m=0,g=!1;this.chunks.forEach(({pattern:b,alphabet:k,startIndex:S})=>{const{isMatch:_,score:W,indices:z}=xt(e,b,k,{location:i+S,distance:c,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:r,ignoreLocation:h});_&&(g=!0),m+=W,_&&z&&(f=[...f,...z])});let y={isMatch:g,score:g?m/this.chunks.length:1};return g&&r&&(y.indices=f),y}}class te{constructor(e){this.pattern=e}static isMultiMatch(e){return ke(e,this.multiRegex)}static isSingleMatch(e){return ke(e,this.singleRegex)}search(){}}function ke(t,e){const s=t.match(e);return s?s[1]:null}class Ct extends te{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const s=e===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class wt extends te{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Ft extends te{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const s=e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}}class Mt extends te{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const s=!e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class It extends te{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const s=e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Dt extends te{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const s=!e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Qe extends te{constructor(e,{location:s=p.location,threshold:n=p.threshold,distance:r=p.distance,includeMatches:i=p.includeMatches,findAllMatches:c=p.findAllMatches,minMatchCharLength:a=p.minMatchCharLength,isCaseSensitive:u=p.isCaseSensitive,ignoreDiacritics:l=p.ignoreDiacritics,ignoreLocation:h=p.ignoreLocation}={}){super(e),this._bitapSearch=new ze(e,{location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class We extends te{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let s=0,n;const r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,s))>-1;)s=n+i,r.push([n,s-1]);const c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}}const ge=[Ct,We,Ft,Mt,Dt,It,wt,Qe],je=ge.length,Bt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,bt="|";function vt(t,e={}){return t.split(bt).map(s=>{let n=s.trim().split(Bt).filter(i=>i&&!!i.trim()),r=[];for(let i=0,c=n.length;i<c;i+=1){const a=n[i];let u=!1,l=-1;for(;!u&&++l<je;){const h=ge[l];let f=h.isMultiMatch(a);f&&(r.push(new h(f,e)),u=!0)}if(!u)for(l=-1;++l<je;){const h=ge[l];let f=h.isSingleMatch(a);if(f){r.push(new h(f,e));break}}}return r})}const St=new Set([Qe.type,We.type]);class kt{constructor(e,{isCaseSensitive:s=p.isCaseSensitive,ignoreDiacritics:n=p.ignoreDiacritics,includeMatches:r=p.includeMatches,minMatchCharLength:i=p.minMatchCharLength,ignoreLocation:c=p.ignoreLocation,findAllMatches:a=p.findAllMatches,location:u=p.location,threshold:l=p.threshold,distance:h=p.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:a,ignoreLocation:c,location:u,threshold:l,distance:h},e=s?e:e.toLowerCase(),e=n?he(e):e,this.pattern=e,this.query=vt(this.pattern,this.options)}static condition(e,s){return s.useExtendedSearch}searchIn(e){const s=this.query;if(!s)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?he(e):e;let c=0,a=[],u=0;for(let l=0,h=s.length;l<h;l+=1){const f=s[l];a.length=0,c=0;for(let m=0,g=f.length;m<g;m+=1){const y=f[m],{isMatch:b,indices:k,score:S}=y.search(e);if(b){if(c+=1,u+=S,n){const _=y.constructor.type;St.has(_)?a=[...a,...k]:a.push(k)}}else{u=0,c=0,a.length=0;break}}if(c){let m={isMatch:!0,score:u/c};return n&&(m.indices=a),m}}return{isMatch:!1,score:1}}}const Ae=[];function jt(...t){Ae.push(...t)}function ye(t,e){for(let s=0,n=Ae.length;s<n;s+=1){let r=Ae[s];if(r.condition(t,e))return new r(t,e)}return new ze(t,e)}const de={AND:"$and",OR:"$or"},xe={PATH:"$path",PATTERN:"$val"},Ee=t=>!!(t[de.AND]||t[de.OR]),Nt=t=>!!t[xe.PATH],Rt=t=>!q(t)&&Te(t)&&!Ee(t),Ne=t=>({[de.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function Ve(t,e,{auto:s=!0}={}){const n=r=>{let i=Object.keys(r);const c=Nt(r);if(!c&&i.length>1&&!Ee(r))return n(Ne(r));if(Rt(r)){const u=c?r[xe.PATH]:i[0],l=c?r[xe.PATTERN]:r[u];if(!X(l))throw new Error(it(u));const h={keyId:pe(u),pattern:l};return s&&(h.searcher=ye(l,e)),h}let a={children:[],operator:i[0]};return i.forEach(u=>{const l=r[u];q(l)&&l.forEach(h=>{a.children.push(n(h))})}),a};return Ee(t)||(t=Ne(t)),n(t)}function _t(t,{ignoreFieldNorm:e=p.ignoreFieldNorm}){t.forEach(s=>{let n=1;s.matches.forEach(({key:r,norm:i,score:c})=>{const a=r?r.weight:null;n*=Math.pow(c===0&&a?Number.EPSILON:c,(a||1)*(e?1:i))}),s.score=n})}function Lt(t,e){const s=t.matches;e.matches=[],O(s)&&s.forEach(n=>{if(!O(n.indices)||!n.indices.length)return;const{indices:r,value:i}=n;let c={indices:r,value:i};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function $t(t,e){e.score=t.score}function Tt(t,e,{includeMatches:s=p.includeMatches,includeScore:n=p.includeScore}={}){const r=[];return s&&r.push(Lt),n&&r.push($t),t.map(i=>{const{idx:c}=i,a={item:e[c],refIndex:c};return r.length&&r.forEach(u=>{u(i,a)}),a})}class J{constructor(e,s={},n){this.options={...p,...s},this.options.useExtendedSearch,this._keyStore=new ut(this.options.keys),this.setCollection(e,n)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof we))throw new Error(rt);this._myIndex=s||Oe(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){O(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const s=[];for(let n=0,r=this._docs.length;n<r;n+=1){const i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,r-=1,s.push(i))}return s}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:s=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:i,sortFn:c,ignoreFieldNorm:a}=this.options;let u=X(e)?X(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return _t(u,{ignoreFieldNorm:a}),i&&u.sort(c),$e(s)&&s>-1&&(u=u.slice(0,s)),Tt(u,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const s=ye(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:i,i:c,n:a})=>{if(!O(i))return;const{isMatch:u,score:l,indices:h}=s.searchIn(i);u&&r.push({item:i,idx:c,matches:[{score:l,value:i,norm:a,indices:h}]})}),r}_searchLogical(e){const s=Ve(e,this.options),n=(a,u,l)=>{if(!a.children){const{keyId:f,searcher:m}=a,g=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(u,f),searcher:m});return g&&g.length?[{idx:l,item:u,matches:g}]:[]}const h=[];for(let f=0,m=a.children.length;f<m;f+=1){const g=a.children[f],y=n(g,u,l);if(y.length)h.push(...y);else if(a.operator===de.AND)return[]}return h},r=this._myIndex.records,i={},c=[];return r.forEach(({$:a,i:u})=>{if(O(a)){let l=n(s,a,u);l.length&&(i[u]||(i[u]={idx:u,item:a,matches:[]},c.push(i[u])),l.forEach(({matches:h})=>{i[u].matches.push(...h)}))}}),c}_searchObjectList(e){const s=ye(e,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:c,i:a})=>{if(!O(c))return;let u=[];n.forEach((l,h)=>{u.push(...this._findMatches({key:l,value:c[h],searcher:s}))}),u.length&&i.push({idx:a,item:c,matches:u})}),i}_findMatches({key:e,value:s,searcher:n}){if(!O(s))return[];let r=[];if(q(s))s.forEach(({v:i,i:c,n:a})=>{if(!O(i))return;const{isMatch:u,score:l,indices:h}=n.searchIn(i);u&&r.push({score:l,key:e,value:i,idx:c,norm:a,indices:h})});else{const{v:i,n:c}=s,{isMatch:a,score:u,indices:l}=n.searchIn(i);a&&r.push({score:u,key:e,value:i,norm:c,indices:l})}return r}}J.version="7.1.0";J.createIndex=Oe;J.parseIndex=At;J.config=p;J.parseQuery=Ve;jt(kt);const Re={".ts":"file-code",".tsx":"atom",".js":"file-code",".jsx":"atom",".py":"file-code",".rs":"file-code",".go":"file-code",".md":"file-text",".json":"clipboard",".yaml":"gear",".yml":"gear",".css":"palette",".scss":"palette",".html":"globe",".sql":"database",".sh":"terminal",".env":"lock",".toml":"gear",".lock":"lock",default:"file-text"};function Pt(t){switch(t){case"scout":return"class-scout";case"builder":return"class-builder";case"debugger":return"class-debugger";case"architect":return"class-architect";case"warrior":return"class-warrior";case"support":return"class-support";case"boss":return"class-boss";default:return"class-default"}}function Kt(t,e=16){var r;const s="."+(((r=t.split(".").pop())==null?void 0:r.toLowerCase())??""),n=Re[s]||Re.default;return d.jsx(H,{name:n,size:e})}function Jt(t,e=16){return d.jsx(H,{name:Pt(t),size:e,weight:"fill"})}function Ye(t){const e=Math.floor(t/1e3),s=Math.floor(e/60),n=Math.floor(s/60),r=Math.floor(n/24);return r>0?`${r}d ${n%24}h ago`:n>0?`${n}h ${s%60}m ago`:s>0?`${s}m ago`:"just now"}function Xt(t){const s=Date.now()-t;return Ye(s)}function _e(t){switch(t){case"agent":return"Agent";case"command":return"Command";case"area":return"Area";case"modified-file":return"Changed";case"building":return"Server";default:return t}}const Le=["command","agent","building","area","modified-file"];function Ot({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=He(),f=Je(),m=Xe(),g=Ze(),y=A.useRef(e);y.current=e;const b=A.useRef(s);b.current=s;const k=A.useRef(n);k.current=n;const S=A.useRef(r);S.current=r;const _=A.useRef(i);_.current=i;const W=A.useRef(c);W.current=c;const z=A.useRef(a);z.current=a;const re=A.useRef(u);re.current=u;const G=A.useRef(l);G.current=l;const[x,E]=A.useState(""),[I,$]=A.useState(0);A.useEffect(()=>{t&&(E(""),$(0))},[t]);const T=ee.getShortcuts(),V=A.useMemo(()=>{if(!t)return[];const o=T.find(F=>F.id==="spawn-agent"),w=T.find(F=>F.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:o?be(o):"Alt+N",icon:d.jsx(H,{name:"plus",size:16}),action:()=>{y.current(),b.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:w?be(w):"Ctrl+K",icon:d.jsx(H,{name:"dashboard",size:16}),action:()=>{y.current(),k.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:d.jsx(H,{name:"gear",size:16}),action:()=>{y.current(),S.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:d.jsx(H,{name:"chart-line",size:16}),action:()=>{var F;y.current(),(F=G.current)==null||F.call(G)}}]},[t,T]),oe=A.useMemo(()=>t?Array.from(h.values()).map(o=>{const w=(g||[]).filter(K=>K.agentId===o.id).map(K=>K.filePath),F=[...new Set(w)],M=F.map(K=>K.split("/").pop()||K),v=[];o.lastAssignedTask&&v.push(o.lastAssignedTask);const N=`${o.class} • ${o.status} • ${o.cwd}`;let D=`${o.name} ${N}`;M.length>0&&(D+=` ${M.join(" ")} ${F.join(" ")}`),v.length>0&&(D+=` ${v.join(" ")}`);const P=Date.now()-o.lastActivity;let Q;return o.lastAssignedTask&&(o.lastAssignedTask.length>150?Q=o.lastAssignedTask.slice(0,150)+"...":Q=o.lastAssignedTask),{id:`agent-${o.id}`,type:"agent",title:o.name,subtitle:N,lastUserInput:Q,timeAway:P,icon:d.jsx(qe,{agent:o,size:20}),_searchText:D,_modifiedFiles:F,_userQueries:v,action:()=>{y.current(),ee.selectAgent(o.id),ee.getState().viewMode!=="flat"&&ee.requestTerminalExpand()}}}):[],[t,h,g]),j=A.useMemo(()=>t?Array.from(f.values()).map(o=>{var w;return{id:`area-${o.id}`,type:"area",title:o.name,subtitle:`${o.assignedAgentIds.length} agents • ${((w=o.directories)==null?void 0:w.length)||0} folders`,icon:d.jsx(H,{name:"map",size:16}),action:()=>{y.current(),ee.selectArea(o.id)}}}):[],[t,f]),Z=A.useMemo(()=>t?Array.from(m.values()).filter(o=>o.type==="server"||o.type==="boss"||o.type==="database").map(o=>{var D,P,Q,K;const w=o.status==="running"?"#4ade80":o.status==="stopped"?"#f87171":"#facc15",F=o.type==="boss"?"crown":o.type==="database"?"database":"desktop";let v=`${o.type==="boss"?"Boss":o.type==="database"?"Database":"Server"} • ${o.status}`;if(o.type==="database"&&((P=(D=o.database)==null?void 0:D.connections)!=null&&P.length)){const L=o.database.connections[0];v+=` • ${L.engine} @ ${L.host}`}else o.cwd&&(v+=` • ${o.cwd}`);let N=`${o.name} ${o.type} ${o.status} ${o.cwd||""} ${((Q=o.pm2)==null?void 0:Q.name)||""}`;if(o.type==="database"&&((K=o.database)!=null&&K.connections))for(const L of o.database.connections)N+=` ${L.name} ${L.engine} ${L.host} ${L.database||""} mysql postgresql sql`;return{id:`building-${o.id}`,type:"building",title:o.name,subtitle:v,icon:d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[d.jsx(H,{name:"status-pending",size:10,weight:"fill",color:w}),d.jsx(H,{name:F,size:16})]}),_searchText:N,action:()=>{var L;y.current(),o.type==="boss"?z.current(o.id):o.type==="database"?re.current(o.id):(L=o.pm2)!=null&&L.enabled&&W.current(o.id)}}}):[],[t,m]),ae=A.useMemo(()=>{if(!t)return[];const o=g||[],w=new Set,F=[];for(const M of o){if(w.has(M.filePath))continue;w.add(M.filePath);const v=M.filePath.split("/").pop()||M.filePath,N=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:v,subtitle:`${N} by ${M.agentName} • ${M.filePath}`,matchedText:M.filePath,icon:M.action==="deleted"?d.jsx(H,{name:"trash",size:16}):Kt(M.filePath),action:()=>{y.current();const D=Array.from(ee.getState().areas.values());for(const P of D)for(const Q of P.directories||[])if(M.filePath.startsWith(Q)){ee.setFileViewerPath(M.filePath),_.current(P.id);return}ee.selectAgent(M.agentId)}}),F.length>=50)break}return F},[t,g]),Fe=A.useMemo(()=>new J(oe,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[oe]),Me=A.useMemo(()=>new J(V,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[V]),Ie=A.useMemo(()=>new J(j,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[j]),De=A.useMemo(()=>new J(ae,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ae]),Be=A.useMemo(()=>new J(Z,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Z]),Y=A.useMemo(()=>{if(!x.trim()){const C=[];C.push(...Z);const B=[...oe].sort((R,U)=>{const ie=R.timeAway??0,ce=U.timeAway??0;return ie-ce});C.push(...B),C.push(...V.slice(0,2)),C.push(...j.slice(0,2));const se={};return Le.forEach((R,U)=>{se[R]=U}),C.sort((R,U)=>(se[R.type]??999)-(se[U.type]??999)),C}const o=x.toLowerCase(),w=Fe.search(x).slice(0,8),F=Me.search(x).slice(0,3),M=Ie.search(x).slice(0,2),v=De.search(x).slice(0,3),N=Be.search(x).filter(C=>{const B=C.score??1;return`${C.item.title} ${C.item.subtitle||""} ${C.item._searchText||""}`.toLowerCase().includes(o)||B<=.2}).slice(0,4),D=[],P=[],Q=[];for(const C of w){const B={...C.item};if(B._modifiedFiles&&B._modifiedFiles.length>0){const R=B._modifiedFiles.filter(U=>{var ue;const ie=((ue=U.split("/").pop())==null?void 0:ue.toLowerCase())||"",ce=U.toLowerCase();return ie.includes(o)||ce.includes(o)});R.length>0&&(B.matchedFiles=R)}if(B._userQueries&&B._userQueries.length>0){const R=B._userQueries.find(U=>U.toLowerCase().includes(o));if(R)if(R.length>200){const ie=R.toLowerCase().indexOf(o),ce=Math.max(0,ie-60),ue=Math.min(R.length,ie+o.length+100);B.matchedQuery=(ce>0?"...":"")+R.slice(ce,ue)+(ue<R.length?"...":"")}else B.matchedQuery=R}const se=B.title.toLowerCase();se===o||se.startsWith(o)?P.push(B):Q.push(B)}const K=(C,B)=>(C.timeAway??Number.POSITIVE_INFINITY)-(B.timeAway??Number.POSITIVE_INFINITY);P.sort(K),Q.sort(K);for(const C of P)D.push(C);for(const C of N)D.push(C.item);for(const C of Q)D.push(C);for(const C of F)D.push(C.item);for(const C of M)D.push(C.item);for(const C of v)D.push(C.item);const L={};return Le.forEach((C,B)=>{L[C]=B}),D.sort((C,B)=>(L[C.type]??999)-(L[B.type]??999)),D},[x,Fe,Me,Ie,De,Be,V,oe,j,Z]);A.useEffect(()=>{I>=Y.length&&$(Math.max(0,Y.length-1))},[Y.length,I]);const Ue=A.useCallback(o=>{if(o.altKey&&!o.ctrlKey&&!o.metaKey&&(o.key==="p"||o.key==="n"||o.key==="P"||o.key==="N")){o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopImmediatePropagation();const w=o.key.toLowerCase();$(w==="p"?F=>F>0?F-1:Y.length-1:F=>F<Y.length-1?F+1:0);return}switch(o.key){case"Escape":o.preventDefault(),y.current();break;case"ArrowUp":o.preventDefault(),$(w=>w>0?w-1:Y.length-1);break;case"ArrowDown":o.preventDefault(),$(w=>w<Y.length-1?w+1:0);break;case"Enter":o.preventDefault(),Y[I]&&Y[I].action();break}},[Y,I]),Ge=A.useCallback((o,w)=>{if(!w||!o)return o;const F=o.toLowerCase(),M=w.toLowerCase(),v=[];let N=0,D=F.indexOf(M),P=0;for(;D!==-1;)D>N&&v.push(o.slice(N,D)),v.push(fe.createElement("mark",{key:P++,className:"spotlight-highlight"},o.slice(D,D+w.length))),N=D+w.length,D=F.indexOf(M,N);return N<o.length&&v.push(o.slice(N)),v.length>0?fe.createElement(fe.Fragment,null,...v):o},[]);return{query:x,setQuery:E,selectedIndex:I,setSelectedIndex:$,results:Y,handleKeyDown:Ue,highlightMatch:Ge}}const zt=A.forwardRef(function({query:e,onQueryChange:s,onKeyDown:n,onResetSelection:r},i){const{t:c}=Ce(["common"]);return d.jsxs("div",{className:"spotlight-input-wrapper",children:[d.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),d.jsx("input",{ref:i,type:"text",className:"spotlight-input",placeholder:c("common:search.spotlightPlaceholder"),value:e,onChange:a=>{s(a.target.value),r()},onKeyDown:n,autoFocus:!0,spellCheck:!1}),d.jsxs("div",{className:"spotlight-input-hints",children:[d.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Qt=A.memo(function({result:e,isSelected:s,query:n,highlightMatch:r,onClick:i,onMouseEnter:c}){const a=e.activityText||e.matchedFiles&&e.matchedFiles.length>0||e.matchedQuery;return d.jsxs("div",{className:`spotlight-item ${s?"selected":""} ${e.activityText?"has-activity":""}`,onClick:i,onMouseEnter:c,role:"option","aria-selected":s,children:[d.jsx("span",{className:"spotlight-item-icon","aria-hidden":"true",children:e.icon}),d.jsxs("div",{className:"spotlight-item-content",children:[d.jsxs("div",{className:"spotlight-item-header",children:[d.jsx("span",{className:"spotlight-item-title",children:r(e.title,n)}),d.jsx("span",{className:`spotlight-item-type ${e.type}`,"aria-label":_e(e.type),children:_e(e.type)})]}),e.subtitle&&d.jsx("span",{className:"spotlight-item-subtitle",children:r(e.subtitle,n)}),e.activityText&&d.jsx("span",{className:"spotlight-item-activity",children:r(e.activityText,n)}),a&&d.jsxs("div",{className:"spotlight-item-details",children:[e.matchedFiles&&e.matchedFiles.length>0&&d.jsx("span",{className:"spotlight-item-files",children:e.matchedFiles.map((u,l)=>d.jsxs("span",{className:"file-badge",children:[l>0&&d.jsx("span",{className:"file-separator",children:"•"}),r(u.split("/").pop()||u,n)]},u))}),e.matchedQuery&&d.jsx("span",{className:"spotlight-item-query",children:r(e.matchedQuery,n)})]}),e.timeAway!==void 0&&d.jsx("span",{className:"spotlight-item-time",children:d.jsxs("span",{className:"spotlight-time-away",children:["Idle: ",Ye(e.timeAway)]})}),e.lastUserInput&&!e.matchedQuery&&d.jsxs("span",{className:"spotlight-item-last-input",children:['"',r(e.lastUserInput,n),'"']})]})]})}),Wt=A.forwardRef(function({results:e,selectedIndex:s,query:n,highlightMatch:r,onSelectIndex:i},c){const{t:a}=Ce(["terminal"]),u=A.useRef(!1);A.useEffect(()=>{u.current=!1},[e]),A.useEffect(()=>{const f=typeof c=="function"?null:c==null?void 0:c.current;if(!f)return;const m=()=>{u.current=!0};return f.addEventListener("mousemove",m),()=>{f.removeEventListener("mousemove",m)}},[c,e]);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")},h=A.useMemo(()=>{const f=[];let m=null,g=[];return e.forEach((y,b)=>{y.type!==m&&(m!==null&&g.length>0&&f.push([m,g]),m=y.type,g=[]),g.push({result:y,index:b})}),m!==null&&g.length>0&&f.push([m,g]),f},[e]);return A.useEffect(()=>{if(!c||typeof c=="function")return;const f=c.current;if(!f)return;const m=f.querySelector(".spotlight-item.selected");m&&m.scrollIntoView({block:"nearest",behavior:"smooth"})},[s,c]),e.length===0?d.jsx("div",{className:"spotlight-results",ref:c,children:d.jsx("div",{className:"spotlight-empty",children:a("terminal:spotlight.noResults")})}):d.jsx("div",{className:"spotlight-results",ref:c,children:h.map(([f,m])=>d.jsxs("div",{children:[h.length>1&&d.jsx("div",{className:"spotlight-category-header",children:l[f]||f}),m.map(({result:g,index:y})=>d.jsx(Qt,{result:g,isSelected:y===s,query:n,highlightMatch:r,onClick:()=>g.action(),onMouseEnter:()=>{u.current&&i(y)}},g.id))]},f))})}),Vt=A.memo(function(){const{t:e}=Ce(["terminal"]);return d.jsxs("div",{className:"spotlight-footer",children:[d.jsxs("div",{className:"spotlight-footer-left",children:[d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"↑"}),d.jsx("kbd",{children:"↓"})," ",d.jsx("kbd",{children:"Alt+N"}),d.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]})]}),d.jsx("div",{className:"spotlight-footer-right",children:d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})}),Yt=768;function Zt({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=A.useRef(null),f=A.useRef(null),m=A.useRef(null),g=A.useRef(0),{query:y,setQuery:b,selectedIndex:k,setSelectedIndex:S,results:_,handleKeyDown:W,highlightMatch:z}=Ot({isOpen:t,onClose:e,onOpenSpawnModal:s,onOpenCommanderView:n,onOpenToolbox:r,onOpenFileExplorer:i,onOpenPM2LogsModal:c,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l});g.current=_.length,A.useEffect(()=>{t&&setTimeout(()=>{var x;(x=h.current)==null||x.focus()},50)},[t]),A.useEffect(()=>{if(!t)return;const x=window.visualViewport;if(!x||window.innerWidth>Yt)return;const E=()=>{const I=f.current;I&&(I.style.height=`${x.height}px`,I.style.top=`${x.offsetTop}px`)};return E(),x.addEventListener("resize",E),x.addEventListener("scroll",E),()=>{x.removeEventListener("resize",E),x.removeEventListener("scroll",E);const I=f.current;I&&(I.style.height="",I.style.top="")}},[t]),A.useEffect(()=>{if(!t)return;const x=E=>{if(E.key==="Escape"){E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),e();return}if(E.altKey&&!E.ctrlKey&&!E.metaKey&&(E.key==="n"||E.key==="p"||E.key==="N"||E.key==="P")){E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const I=E.key.toLowerCase(),$=g.current;S(I==="p"?T=>T>0?T-1:$-1:T=>T<$-1?T+1:0);return}};return window.addEventListener("keydown",x,{capture:!0}),()=>{window.removeEventListener("keydown",x,{capture:!0})}},[t,e]);const re=A.useCallback(x=>{x.target===x.currentTarget&&e()},[e]),G=A.useCallback(()=>{S(0)},[S]);return t?d.jsx("div",{ref:f,className:"spotlight-overlay",onClick:re,children:d.jsxs("div",{className:"spotlight-modal",children:[d.jsx(zt,{ref:h,query:y,onQueryChange:b,onKeyDown:W,onResetSelection:G}),d.jsx(Wt,{ref:m,results:_,selectedIndex:k,query:y,highlightMatch:z,onSelectIndex:S}),d.jsx(Vt,{})]})}):null}export{Re as FILE_ICON_NAMES,Zt as Spotlight,Vt as SpotlightFooter,zt as SpotlightInput,Qt as SpotlightItem,Wt as SpotlightResults,Ye as formatDuration,Xt as formatRelativeTime,Jt as getAgentIcon,Kt as getFileIconFromPath,_e as getTypeLabel,Ot as useSpotlightSearch};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--bg-primary: #0d0d14;--bg-secondary: #14141e;--bg-tertiary: #1c1c28;--border-color: #2a2a3a;--text-primary: #d0d0d8;--text-secondary: #8a8a98;--text-muted: #606070;--accent-blue: #5a8fd4;--accent-green: #5cb88a;--accent-orange: #d4a05a;--accent-red: #d45a5a;--accent-purple: #8a6fbf;--accent-cyan: #5ab8c8;--accent-claude: #a06848;--accent-claude-light: #c8896a;--accent-pink: #5a8fd4;--accent-yellow: #d0d0d8;--font-size-base: 14px;--line-height-base: 1.5;--msg-user-bg: color-mix(in srgb, #5ab8c8 8%, transparent);--msg-user-border: #5ab8c8;--msg-user-text: #d0d0d8;--msg-assistant-bg: color-mix(in srgb, #5cb88a 8%, transparent);--msg-assistant-border: #5cb88a;--msg-assistant-text: #d0d0d8;--tool-use-bg: color-mix(in srgb, #d4a05a 8%, transparent);--tool-use-border: #d4a05a;--tool-use-text: #d4a05a;--tool-use-name: #d4a05a;--tool-result-bg: color-mix(in srgb, #8a6fbf 6%, transparent);--tool-result-border: #8a6fbf;--tool-result-text: #5cb88a;--context-bar-bg: #1c1c28;--context-bar-fill: #8a6fbf;--output-line-bg: transparent;--task-label-color: #5ab8c8}.view-mode-toggle{display:flex;gap:2px;position:relative;background:#0009;border-radius:6px;padding:3px;border:1px solid #2a2a3a}.view-mode-toggle__indicator{position:absolute;top:3px;bottom:3px;background:#d4a05a2e;border-radius:4px;transition:left .2s cubic-bezier(.4,0,.2,1),width .2s cubic-bezier(.4,0,.2,1);pointer-events:none;z-index:0}.view-mode-toggle__btn{display:flex;align-items:center;gap:5px;padding:5px 10px;border:none;border-radius:4px;background:transparent;color:#8a8a98;font-size:11px;font-weight:600;font-family:JetBrains Mono,SF Mono,Fira Code,Consolas,monospace;cursor:pointer;transition:color .15s ease,background .15s ease;white-space:nowrap;position:relative;z-index:1}.view-mode-toggle__btn:hover:not(.view-mode-toggle__btn--active){background:#ffffff14;color:#d0d0d8}.view-mode-toggle__btn--active{color:#d4a05a}.view-mode-toggle__btn--active svg{stroke:#d4a05a}.view-mode-toggle__icon{display:flex;align-items:center;justify-content:center;flex-shrink:0}.view-mode-toggle__label{line-height:1}.view-mode-toggle--floating{position:fixed;bottom:70px;left:60px;z-index:150;box-shadow:0 2px 8px #0000004d}@media(max-width:768px){.view-mode-toggle__btn{padding:10px 14px;min-height:44px;min-width:44px;font-size:12px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.view-mode-toggle__btn:active{opacity:.7;transform:scale(.95)}.view-mode-toggle__icon svg{width:16px;height:16px}.view-mode-toggle__label{font-size:11px}}@media(max-width:480px){.view-mode-toggle--floating{padding:3px}.view-mode-toggle__btn{padding:8px 10px;min-height:44px}.view-mode-toggle__label{display:none}}.app.view-mode-flat .guake-terminal{display:none}.flat-view{--flat-middle-width: 1fr;--flat-inspector-width: 320px;display:grid;grid-template-columns:var(--flat-middle-width) 3px 1fr;height:100%;width:100%;background:#282a36;overflow:hidden;padding-left:64px;box-sizing:border-box;transition:grid-template-columns .25s ease}.flat-view--with-inspector{grid-template-columns:var(--flat-middle-width) 3px 1fr 3px var(--flat-inspector-width)}.flat-splitter{position:relative;cursor:col-resize;background:#ffffff0a;touch-action:none;-webkit-user-select:none;user-select:none;transition:background .15s ease;z-index:2}.flat-splitter:before{content:"";position:absolute;top:0;bottom:0;left:-5px;right:-5px}.flat-splitter:hover{background:#8be9fd73}body.flat-splitter-dragging{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}body.flat-splitter-dragging .flat-splitter{background:#8be9fd99}body.flat-splitter-dragging .flat-view{transition:none!important}.flat-middle{display:flex;flex-direction:column;background:#282a36;border-right:1px solid rgba(255,255,255,.06);overflow:hidden;min-width:280px}.flat-middle__header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;gap:12px}.flat-middle__title{font-size:14px;font-weight:600;color:#f8f8f2;margin:0}.flat-middle__actions{display:flex;gap:6px;flex-shrink:0}.flat-middle__content{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px}.flat-middle__content::-webkit-scrollbar{width:6px}.flat-middle__content::-webkit-scrollbar-track{background:transparent}.flat-middle__content::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-middle__content::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-cta-btn{padding:4px 10px;font-size:11px;font-weight:500;border:none;border-radius:4px;cursor:pointer;transition:all .15s ease;white-space:nowrap}.flat-cta-btn--agent{background:#50fa7b26;color:#50fa7b}.flat-cta-btn--agent:hover{background:#50fa7b40}.flat-cta-btn--boss{background:#ffd70026;color:gold}.flat-cta-btn--boss:hover{background:#ffd70040}.flat-cta-btn--building{background:#8be9fd26;color:#8be9fd}.flat-cta-btn--building:hover{background:#8be9fd40}.flat-cta-btn--area{background:#bd93f926;color:#bd93f9}.flat-cta-btn--area:hover{background:#bd93f940}.flat-middle .agent-overview-panel{position:relative;inset:auto;width:100%;height:100%;border-right:none;flex:1;min-height:0;z-index:auto}.flat-middle .agent-overview-panel .aop-row-controls .close-btn{display:none}.flat-middle__content:has(>.agent-overview-panel){padding:0;overflow:hidden}.flat-right{display:flex;flex-direction:column;background:#21222c;overflow:hidden}.flat-chat{display:flex;flex-direction:column;height:100%}.flat-chat--empty{align-items:center;justify-content:center}.flat-chat__placeholder{display:flex;flex-direction:column;align-items:center;gap:12px;color:#6272a4}.flat-chat__placeholder-icon{font-size:48px;opacity:.5}.flat-chat__placeholder-text{font-size:14px}.flat-map{display:flex;flex-direction:column;height:100%;padding:12px 16px;gap:10px;overflow-y:auto;position:relative}.flat-map::-webkit-scrollbar{width:6px}.flat-map::-webkit-scrollbar-track{background:transparent}.flat-map::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-map::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-map__header{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-shrink:0;padding-right:130px}.flat-map__title{font-size:13px;font-weight:600;color:#f8f8f2}.flat-map__hint{font-size:11px;color:#6272a4}.flat-map__view-mode{position:absolute;top:10px;right:12px;z-index:5;background:color-mix(in srgb,#1e1f29 92%,transparent);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);border-radius:999px;box-shadow:0 2px 8px #0000004d}.flat-map__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;align-content:start}.flat-map__empty{grid-column:1/-1;display:flex;align-items:center;justify-content:center;padding:40px;color:#6272a4;font-size:13px}.flat-map-area-card{display:flex;flex-direction:column;background:#363848;border:1px solid rgba(255,255,255,.06);border-radius:8px;overflow:hidden;transition:border-color .15s ease,box-shadow .15s ease}.flat-map-area-card:hover{border-color:#ffffff1a;box-shadow:0 2px 8px #00000040}.flat-map-area-card__header{display:flex;align-items:center;gap:6px;padding:6px 8px;background:transparent;border:none;cursor:pointer;width:100%;text-align:left;color:#f8f8f2;font-size:12px;font-weight:600;transition:background .15s ease}.flat-map-area-card__header:hover{background:#ffffff0a}.flat-map-area-card__color{width:8px;height:8px;border-radius:50%;flex-shrink:0}.flat-map-area-card__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.flat-map-area-card__count{font-size:10px;font-weight:500;color:#6272a4;background:#ffffff0f;padding:1px 5px;border-radius:8px;flex-shrink:0}.flat-map-area-card__caret{font-size:10px;color:#6272a4;flex-shrink:0;width:12px;text-align:center}.flat-map-area-card__agents{display:flex;flex-wrap:wrap;gap:4px;padding:0 8px 8px}.flat-map-agent-chip{position:relative;display:inline-flex;align-items:center;gap:5px;padding:3px 7px 6px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;color:#9a9caa;font-size:11px;text-align:left;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap;min-width:0;overflow:hidden}.flat-map-agent-chip:hover{background:#ffffff14;border-color:#ffffff1f;color:#f8f8f2}.flat-map-agent-chip.working{overflow:visible;isolation:isolate;background-color:#4a9eff1f;background-image:linear-gradient(100deg,transparent 30%,rgba(180,230,255,.45) 49%,rgba(139,220,240,.3) 51%,transparent 70%),linear-gradient(100deg,transparent 32%,rgba(139,233,253,.3) 50%,transparent 68%);background-size:220% 100%,260% 100%;background-repeat:no-repeat,no-repeat;background-position:150% 0,150% 0;border-color:#8be9fdb3;color:#f8f8f2;box-shadow:0 0 8px #4a9eff59,inset 0 0 0 1px #8be9fd00;transform-origin:center;will-change:transform,background-position,box-shadow,border-color;animation:flat-map-agent-working-shimmer .75s linear infinite,flat-map-agent-working-shimmer-2 1.15s linear infinite,flat-map-agent-working-pulse 1.1s ease-in-out infinite,flat-map-agent-working-beat .85s ease-in-out infinite,flat-map-agent-working-iris 3.2s linear infinite}.flat-map-agent-chip.working:before{content:"";position:absolute;top:-2px;right:-2px;bottom:-2px;left:-2px;border-radius:inherit;pointer-events:none;z-index:-1;background:conic-gradient(from 0deg,#8be9fd00,#8bc8fd8c,#a082e680,#dc82c873,#dcb48266,#8bc8fd8c,#8be9fd00);filter:blur(8px);transform-origin:center;will-change:transform,opacity;animation:flat-map-agent-working-spin 3.8s linear infinite,flat-map-agent-working-breath 2.6s ease-in-out infinite}.flat-map-agent-chip.working:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;pointer-events:none;z-index:1;background-image:radial-gradient(1px 1px at 18% 32%,rgba(255,255,255,.7) 0%,transparent 60%),radial-gradient(1px 1px at 72% 58%,rgba(200,240,255,.65) 0%,transparent 60%),radial-gradient(1.5px 1.5px at 42% 80%,rgba(220,200,255,.55) 0%,transparent 60%),radial-gradient(1px 1px at 88% 22%,rgba(255,255,255,.6) 0%,transparent 60%),radial-gradient(1px 1px at 12% 70%,rgba(210,190,255,.55) 0%,transparent 60%),radial-gradient(1px 1px at 58% 18%,rgba(255,255,255,.55) 0%,transparent 60%);mix-blend-mode:screen;opacity:.5;animation:flat-map-agent-working-twinkle 1.9s ease-in-out infinite}.flat-map-agent-chip.working .flat-map-agent-chip__dot{position:relative;z-index:2;box-shadow:0 0 6px #4a9effb3;animation:flat-map-agent-working-dot .65s ease-in-out infinite}.flat-map-agent-chip.working .flat-map-agent-chip__name,.flat-map-agent-chip.working .flat-map-agent-chip__provider-icon,.flat-map-agent-chip.working .flat-map-agent-chip__crown{position:relative;z-index:2}@keyframes flat-map-agent-working-shimmer{0%{background-position:150% 0,150% 0}to{background-position:-70% 0,150% 0}}@keyframes flat-map-agent-working-shimmer-2{0%{background-position:150% 0,150% 0}to{background-position:150% 0,-70% 0}}@keyframes flat-map-agent-working-pulse{0%,to{border-color:#4a9eff8c;box-shadow:0 0 6px #4a9eff59,inset 0 0 0 1px #8be9fd00}50%{border-color:#b4faff;box-shadow:0 0 18px #4a9effcc,0 0 30px #8be9fd59,inset 0 0 0 1px #b4faff8c}}@keyframes flat-map-agent-working-beat{0%,to{transform:scale(1)}35%{transform:scale(1.035)}55%{transform:scale(.99)}75%{transform:scale(1.015)}}@keyframes flat-map-agent-working-dot{0%,to{transform:scale(1);box-shadow:0 0 6px #4a9effb3}50%{transform:scale(1.7);box-shadow:0 0 12px #b4faff,0 0 22px #4a9effb3}}@keyframes flat-map-agent-working-iris{0%{border-color:#8be9fdb3}25%{border-color:#b482ffd9}50%{border-color:#ff78dccc}75%{border-color:#ffc878bf}to{border-color:#8be9fdb3}}@keyframes flat-map-agent-working-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes flat-map-agent-working-breath{0%,to{opacity:.3;filter:blur(7px)}40%{opacity:.7;filter:blur(11px)}70%{opacity:.45;filter:blur(8px)}}@keyframes flat-map-agent-working-twinkle{0%,to{opacity:.25;transform:translate(0) scale(.9)}25%{opacity:1;transform:translate(1px,-1px) scale(1.1)}50%{opacity:.55;transform:translate(-1px,1px) scale(.95)}75%{opacity:1;transform:translate(1px,1px) scale(1.15)}}@media(prefers-reduced-motion:reduce){.flat-map-agent-chip.working{animation:flat-map-agent-working-shimmer 5s linear infinite;background-image:linear-gradient(110deg,transparent 40%,rgba(139,233,253,.3) 50%,transparent 60%),linear-gradient(110deg,transparent 40%,rgba(139,233,253,0) 50%,transparent 60%);transform:none}.flat-map-agent-chip.working:before,.flat-map-agent-chip.working:after{animation:none;opacity:.3}.flat-map-agent-chip.working .flat-map-agent-chip__dot{animation:none}}.flat-map-agent-chip__name{min-width:0;overflow:hidden;text-overflow:ellipsis}.flat-map-agent-chip__dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.flat-map-agent-chip__provider-icon{width:12px;height:12px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.flat-map-agent-chip__crown{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.flat-map-agent-chip__context-bar{position:absolute;left:0;right:0;bottom:0;height:2px;background:#ffffff0f;pointer-events:none}.flat-map-agent-chip__context-bar-fill{display:block;height:100%;transition:width .2s ease,background-color .2s ease}.flat-map-area-card__buildings{display:flex;flex-wrap:wrap;gap:4px;padding:6px 8px 8px;border-top:1px dashed rgba(255,255,255,.05);margin-top:2px}.flat-map-building-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;background:#ffffff06;border:1px dashed rgba(255,255,255,.08);border-radius:8px;cursor:pointer;color:#9a9caa;font-size:11px;text-align:left;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap;min-width:0;overflow:hidden}.flat-map-building-chip:hover{background:#ffffff12;border-color:#ffffff2e;color:#f8f8f2}.flat-map-building-chip__name{min-width:0;overflow:hidden;text-overflow:ellipsis}.flat-map-building-chip__dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.flat-map-building-chip--error{border-color:#ff4a4a66}.flat-map-building-chip--running{border-style:solid;border-color:#4aff9e40}.flat-terminal-wrapper{display:flex;flex-direction:column;height:100%;min-height:0;position:relative;background:#21222c;overflow:hidden;--guake-side-panel-width: 380px}.flat-terminal-wrapper--with-side-panel>*:not(.guake-git-panel):not(.guake-buildings-panel):not(.guake-workflow-panel):not(.agent-debug-panel){margin-right:var(--guake-side-panel-width);transition:margin-right .2s ease}.flat-terminal-wrapper__header{display:flex;flex-direction:row;align-items:center;gap:12px;padding:6px 12px;border-bottom:1px solid rgba(255,255,255,.06);background:#1e1f29;flex-shrink:0;min-height:40px}.flat-terminal-wrapper__header-main{display:flex;align-items:center;gap:10px;min-width:0;flex:1 1 auto;overflow:hidden;padding:4px 6px;margin:0;background:transparent;border:1px solid transparent;border-radius:8px;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__header-main:hover{background:#ffffff0a;border-color:#ffffff0f}.flat-terminal-wrapper__header-main--active{background:#bd93f92e;border-color:#bd93f973}.flat-terminal-wrapper__header-main--active:hover{background:#bd93f942}.flat-terminal-wrapper__header-meta{display:flex;align-items:center;justify-content:flex-end;gap:6px;flex:0 0 auto;flex-wrap:nowrap}.flat-terminal-wrapper__statusbar{display:flex;align-items:center;gap:10px;padding:6px 12px;flex-shrink:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.06);min-height:32px;box-sizing:border-box}.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__cwd,.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__context{background:transparent;border-color:#ffffff0a}.flat-terminal-wrapper__statusbar-spacer{flex:1 1 auto}.flat-terminal-wrapper__buildings{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__building-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__building-btn:hover{color:#f8f8f2;background:#ffffff14}.flat-terminal-wrapper__building-btn--offline{color:#ffb86cbf}.flat-terminal-wrapper__building-btn--offline:hover{color:#ffb86c}.flat-terminal-wrapper__building-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__building-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__detached{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;font-size:11px;font-weight:500;color:#ffb86c;background:#ffb86c1f;border:1px solid rgba(255,184,108,.35);border-radius:10px;animation:blink 1.6s ease-in-out infinite}.flat-terminal-wrapper__area-dir{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;font-size:11px;font-family:SF Mono,Menlo,Consolas,monospace;color:#9a9caa;background:#ffffff08;border:1px solid rgba(255,255,255,.05);border-radius:10px;cursor:pointer;max-width:240px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__area-dir:hover{background:#ffffff14;color:#f8f8f2;border-color:#ffffff24}.flat-terminal-wrapper__area-dir-name{overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__area-dir-branch{display:inline-flex;align-items:center;gap:3px;color:#8be9fd;opacity:.85}.flat-terminal-wrapper__branch-ahead{display:inline-flex;align-items:center;color:#50fa7b}.flat-terminal-wrapper__branch-behind{display:inline-flex;align-items:center;color:#ffb86c}.flat-terminal-wrapper__area-fetch{display:inline-flex;align-items:center;padding:1px 3px;border-radius:4px;color:#6272a4;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__area-fetch:hover{background:#ffffff14;color:#f8f8f2}.flat-terminal-wrapper__area-fetch--fetching{animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__context-label{color:#6272a4;margin-right:2px}.flat-terminal-wrapper__context-free{color:#6272a4;font-size:10px}.flat-terminal-wrapper__actions{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__action-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:24px;padding:0;font-size:12px;line-height:1;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__action-btn:hover:not(:disabled){color:#f8f8f2;background:#ffffff0f}.flat-terminal-wrapper__action-btn:disabled{opacity:.35;cursor:not-allowed}.flat-terminal-wrapper__action-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__action-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__action-btn--danger{color:#ff5555d9}.flat-terminal-wrapper__action-btn--danger:hover{color:#f55;background:#ff55551f}.flat-terminal-wrapper__action-btn--confirm{color:#f55;background:#ff55552e;box-shadow:0 0 0 1px #ff555580;animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__more{position:relative;display:inline-flex}.flat-terminal-wrapper__more-menu{position:absolute;top:calc(100% + 4px);right:0;min-width:220px;padding:4px;background:#363848;border:1px solid rgba(255,255,255,.08);border-radius:8px;box-shadow:0 8px 28px #00000073;z-index:100}.flat-terminal-wrapper__more-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 10px;font-size:12px;color:#f8f8f2;background:transparent;border:none;border-radius:6px;cursor:pointer;text-align:left;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__more-item:hover:not(:disabled){background:#ffffff0f}.flat-terminal-wrapper__more-item:disabled{opacity:.45;cursor:not-allowed}.flat-terminal-wrapper__more-item--danger{color:#ff5555e6}.flat-terminal-wrapper__more-item--danger:hover:not(:disabled){color:#f55;background:#ff55551f}.flat-terminal-wrapper__more-divider{height:1px;margin:4px 2px;background:#ffffff0f}.flat-terminal-wrapper__header-info{display:flex;flex-direction:row;align-items:baseline;gap:8px;min-width:0;overflow:hidden}.flat-terminal-wrapper__header-name{font-size:13px;font-weight:600;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-status{font-size:10px;text-transform:capitalize;flex-shrink:0}.flat-terminal-wrapper__header-task{font-size:11px;color:#6272a4;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:2px 8px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);flex-shrink:1}.flat-terminal-wrapper__header-model{display:inline-flex;align-items:center;gap:6px;flex-shrink:0;min-width:0}.flat-terminal-wrapper__header-provider-icon{width:16px;height:16px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.flat-terminal-wrapper__header-model-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:10px;font-family:SF Mono,Menlo,Consolas,monospace;font-weight:600;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:999px;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis;line-height:1.4}.flat-terminal-wrapper__header-model-name{color:#f8f8f2;text-transform:lowercase;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-model-sep{opacity:.6}.flat-terminal-wrapper__header-model-effort{color:#bd93f9;text-transform:lowercase}.flat-terminal-wrapper__cwd{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;max-width:240px;transition:background .15s ease,border-color .15s ease,color .15s ease}.flat-terminal-wrapper__cwd:hover{background:#ffffff14;border-color:#ffffff24;color:#f8f8f2}.flat-terminal-wrapper__cwd-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__cwd-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:SF Mono,Menlo,Consolas,monospace}.flat-terminal-wrapper__context{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__context:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__context-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__context-bar{position:relative;width:56px;height:5px;border-radius:3px;background:#ffffff14;overflow:hidden}.flat-terminal-wrapper__context-bar-fill{position:absolute;left:0;top:0;height:100%;border-radius:3px;transition:width .2s ease,background-color .2s ease}.flat-terminal-wrapper__context-tokens{font-family:SF Mono,Menlo,Consolas,monospace;font-size:11px;font-weight:600;font-variant-numeric:tabular-nums}.flat-terminal-wrapper__context-warning{font-size:11px;opacity:.8}.flat-terminal-wrapper__view-mode{display:inline-flex;align-items:center;padding:2px;gap:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__view-mode-btn{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:8px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__view-mode-btn:hover{color:#f8f8f2;background:#ffffff0a}.flat-terminal-wrapper__view-mode-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f980,0 1px 3px #00000040}.flat-terminal-wrapper__view-mode-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__view-mode-icon{font-size:13px;line-height:1}.flat-terminal-wrapper__view-mode-label{line-height:1}.flat-terminal-wrapper__theme{display:inline-flex;align-items:center}.flat-terminal-wrapper__theme .theme-selector-trigger{padding:4px 9px;font-size:11px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06)}.flat-terminal-wrapper__theme .theme-selector-trigger:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__inspector-toggle:hover{color:#f8f8f2;background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle--active{color:#f8f8f2;background:#bd93f938;border-color:#bd93f98c;box-shadow:0 0 0 1px #bd93f959,0 1px 3px #00000040}.flat-terminal-wrapper__inspector-toggle--active:hover{background:#bd93f952}.flat-terminal-wrapper__inspector-icon{display:inline-flex;align-items:center;justify-content:center;line-height:1}.flat-terminal-wrapper__inspector-label{line-height:1}.flat-terminal-wrapper__close{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;color:#6272a4;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__close:hover{color:#f55;background:#ff55551f;border-color:#f556}@media(max-width:1100px){.flat-terminal-wrapper__view-mode-label,.flat-terminal-wrapper__inspector-label{display:none}.flat-terminal-wrapper__cwd{max-width:160px}}.flat-terminal-wrapper .guake-output{flex:1 1 auto;min-height:0;overflow-y:auto;padding:14px 18px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar{width:6px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-track{background:transparent}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-terminal-wrapper .guake-input-container{position:relative;flex-shrink:0;border-top:1px solid rgba(255,255,255,.06);background:#1e1f29}.flat-terminal-wrapper .guake-search-bar,.flat-terminal-wrapper .atp-search-bar{position:sticky;top:0;z-index:10;background:#1e1f29}.flat-terminal-wrapper .guake-handle,.flat-terminal-wrapper .guake-side-panel-resize,.flat-terminal-wrapper .atp-resize-handle{display:none}.flat-terminal-wrapper .compacting-indicator{padding:12px;margin:8px}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}.flat-inspector{display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;background:#1e1f29;border-left:1px solid rgba(255,255,255,.06);overflow:hidden;animation:flat-inspector-slide-in .22s ease}.flat-inspector__header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid rgba(255,255,255,.06);background:#21222c;flex-shrink:0}.flat-inspector__tabs{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#00000040;border:1px solid rgba(255,255,255,.06);border-radius:6px}.flat-inspector__tab{padding:4px 10px;font-size:12px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:4px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-inspector__tab:hover{color:#f8f8f2}.flat-inspector__tab--active{color:#f8f8f2;background:#ffffff14}.flat-inspector__close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:13px;color:#6272a4;background:transparent;border:1px solid transparent;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-inspector__close:hover{color:#f8f8f2;background:#ffffff0f;border-color:#ffffff1a}.flat-inspector__body{flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column}.flat-inspector__body .unit-panel{flex:1 1 auto;min-height:0;min-width:0;padding:10px}.flat-inspector__empty{display:flex;align-items:center;justify-content:center;flex:1;color:#6272a4;font-size:13px}@keyframes flat-inspector-slide-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}.flat-mobile-sidebar-toggle,.flat-mobile-sidebar-backdrop{display:none}@media(max-width:1024px){.flat-view,.flat-view--with-inspector{grid-template-columns:1fr}.flat-splitter{display:none}.flat-right{grid-column:1/-1}.flat-right>.flat-terminal-wrapper,.flat-right>.flat-chat{flex:1 1 auto;min-height:0;height:auto}.flat-middle{position:fixed;top:0;left:0;bottom:0;width:min(380px,92vw);z-index:185;transform:translate(-110%);transition:transform .22s ease;border-right:1px solid rgba(255,255,255,.08);box-shadow:6px 0 32px #0009}.flat-view--mobile-sidebar-open .flat-middle{transform:translate(0)}.flat-mobile-sidebar-toggle{display:inline-flex;align-items:center;gap:8px;align-self:flex-start;margin:10px 12px 0;padding:8px 12px;font-size:12px;font-weight:500;color:#f8f8f2;background:#363848f2;border:1px solid rgba(255,255,255,.08);border-radius:10px;cursor:pointer;min-height:36px;flex-shrink:0;transition:background .15s ease,border-color .15s ease}.flat-mobile-sidebar-toggle:hover,.flat-mobile-sidebar-toggle:active{background:#bd93f947;border-color:#bd93f980}.flat-mobile-sidebar-toggle__label{line-height:1}.flat-mobile-sidebar-backdrop{display:block;position:fixed;top:0;right:0;bottom:0;left:0;z-index:184;background:#000000ad;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);animation:flat-inspector-fade-in .18s ease}.flat-inspector{position:fixed;top:0;right:0;bottom:0;left:0;z-index:186;border-left:none;animation:none;transform:translate(100%);transition:transform .22s ease}.flat-inspector--open{transform:translate(0)}.flat-inspector--closing{transform:translate(100%)}}@media(max-width:768px){.app.view-mode-flat .mobile-fab-toggle,.app.view-mode-flat .mobile-fab-menu,.app.view-mode-flat .voice-assistant-btn.mobile-voice-assistant{display:none!important}.app.view-mode-flat .flat-view{padding-left:0}.app.view-mode-flat .main-content{height:calc(100% - var(--mobile-bottom-stack-height, 72px))!important;max-height:calc(100% - var(--mobile-bottom-stack-height, 72px))!important;overflow:hidden}.app.view-mode-flat .flat-terminal-wrapper__header,.app.view-mode-flat .flat-inspector__header,.app.view-mode-flat .flat-middle__header,.app.view-mode-flat .flat-map__header{padding-top:calc(6px + env(safe-area-inset-top,0px))}.app.view-mode-flat .flat-inspector__body,.app.view-mode-flat .flat-middle__content{padding-bottom:var(--mobile-bottom-stack-height, 72px)}.flat-view{padding-left:56px}.flat-middle__header{flex-wrap:wrap;padding:10px 12px;gap:8px}.flat-middle__content{padding:8px}.flat-cta-btn{padding:8px 10px;font-size:11px;min-height:34px}.flat-chat--empty{align-items:stretch;justify-content:flex-start}.flat-map{width:100%;padding:10px 12px;gap:8px;overflow-x:auto;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;touch-action:pan-x pan-y}.flat-map__grid{grid-template-columns:unset!important;grid-auto-columns:220px;width:max-content;min-width:100%}.flat-map-area-card__agents{gap:6px}.flat-map-agent-chip{padding:7px 10px 9px;font-size:12px;min-height:34px}.flat-terminal-wrapper__header{flex-wrap:nowrap;padding:6px 10px;gap:8px;min-height:40px}.flat-terminal-wrapper__header-main{flex:1 1 auto;min-width:0}.flat-terminal-wrapper__header-meta{flex:0 0 auto;justify-content:flex-end;flex-wrap:nowrap;gap:4px}.flat-terminal-wrapper__header-task{display:none}.flat-terminal-wrapper__statusbar{flex-wrap:wrap;padding:6px 10px;gap:6px;row-gap:6px}.flat-terminal-wrapper__action-btn,.flat-terminal-wrapper__building-btn,.flat-terminal-wrapper__close{width:28px;height:28px}.flat-terminal-wrapper__inspector-toggle{padding:4px 6px}.flat-terminal-wrapper__inspector-label{display:none}.flat-terminal-wrapper__actions{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}.flat-terminal-wrapper__actions::-webkit-scrollbar{display:none}.flat-terminal-wrapper{--guake-side-panel-width: 100%}.flat-terminal-wrapper--with-side-panel>*:not(.guake-git-panel):not(.guake-buildings-panel):not(.guake-workflow-panel):not(.agent-debug-panel){margin-right:0}.flat-terminal-wrapper .guake-git-panel,.flat-terminal-wrapper .guake-buildings-panel,.flat-terminal-wrapper .guake-workflow-panel,.flat-terminal-wrapper .agent-debug-panel{width:100%}.flat-bottom-panel{height:180px}.flat-terminal-wrapper__view-mode{display:none}.flat-terminal-wrapper__actions .flat-terminal-wrapper__action-btn:nth-child(1),.flat-terminal-wrapper__actions .flat-terminal-wrapper__action-btn:nth-child(2){display:none}.flat-terminal-wrapper__close,.flat-terminal-wrapper__statusbar,.app.view-mode-flat .flat-mobile-sidebar-toggle,.app.view-mode-flat .flat-terminal-wrapper__inspector-toggle{display:none}}@media(max-width:480px){.flat-view{padding-left:52px}.flat-middle{width:100vw;max-width:100vw;box-shadow:none}.flat-middle__header{padding:8px 10px}.flat-middle__actions{gap:4px}.flat-cta-btn{padding:6px 8px;font-size:10px;min-height:32px}.flat-map-area-card__header{padding:8px 10px;font-size:13px}.flat-map-agent-chip{font-size:12px;padding:6px 8px 8px}.flat-terminal-wrapper__header-name{font-size:12px}.flat-terminal-wrapper__header-model-chip{font-size:9px;max-width:130px}.flat-inspector__body{padding-bottom:env(safe-area-inset-bottom,0)}}@media(min-width:1400px){.flat-view{--flat-middle-width: minmax(280px, 400px);--flat-inspector-width: 360px}}@keyframes flat-inspector-fade-in{0%{opacity:0}to{opacity:1}}.flat-bottom-panel{display:flex;flex-direction:column;flex-shrink:0;height:250px;min-height:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.08);overflow:hidden}.flat-bottom-panel__header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 10px;background:#21222c;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;min-height:28px}.flat-bottom-panel__title{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:500;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flat-bottom-panel__muted{color:#6272a4;font-weight:400;font-size:10px}.flat-bottom-panel__close{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-bottom-panel__close:hover{color:#f8f8f2;background:#ffffff14}.flat-bottom-panel__body{flex:1 1 auto;min-height:0;display:flex;background:#282a36}.flat-bottom-panel__body>*{flex:1 1 auto;min-height:0}.flat-bottom-panel__placeholder{flex:1 1 auto;display:flex;align-items:center;justify-content:center;color:#6272a4;font-size:12px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,aR as Fe,aS as Ve,j as e,I as L,u as ee,aT as Je,a0 as Ze,f as Re,s as A,aU as es,k as ss,l as ce,aV as H,aW as as,aK as ts,aX as ns,C as re,aY as Y,aH as je,aZ as is,a_ as os,a$ as ls,b0 as cs,b1 as ze,b2 as rs,b3 as ds,b4 as Me,b5 as ms,b6 as ps,b7 as us,b8 as hs,b9 as gs,ba as fs,bb as xs,aD as bs,G as js,S as be,bc as vs,bd as Ns,aF as ws,be as Oe,H as Se,aO as ys,bf as De,bg as ks}from"./main-BxStxFko.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const _e="deivid11/tide-commander",Ss=`https://api.github.com/repos/${_e}/releases/latest`,Cs=`https://api.github.com/repos/${_e}/releases?per_page=3`,As=3600*1e3,qe="app_update_dismissed_version",We="1.84.3";function Ts(){var b,k;const[s,o]=l.useState({isChecking:!1,updateAvailable:!1,updateInfo:null,recentReleases:[],error:null,currentVersion:We}),a=((k=(b=Fe)==null?void 0:b.getPlatform)==null?void 0:k.call(b))==="android"||!1,i=d=>d.replace(/^v/,"").split(".").map(u=>parseInt(u,10)||0),m=(d,g)=>{const u=i(d),y=i(g),x=Math.max(u.length,y.length);for(let c=0;c<x;c++){const F=u[c]||0,z=y[c]||0;if(F>z)return 1;if(F<z)return-1}return 0},f=async d=>{var u,y;if(Fe&&Ve&&((y=(u=Fe).isNativePlatform)==null?void 0:y.call(u))===!0){const x=await Ve.get({url:d,headers:{Accept:"application/vnd.github.v3+json"}});return{data:x.data,status:x.status}}else{const x=await fetch(d,{headers:{Accept:"application/vnd.github.v3+json"}});return x.ok?{data:await x.json(),status:x.status}:{data:null,status:x.status}}},r=l.useCallback(async(d=!1)=>{o(g=>({...g,isChecking:!0,error:null}));try{const[g,u]=await Promise.all([f(Ss),f(Cs)]);if(g.status!==200)throw new Error(`GitHub API error: ${g.status}`);const y=g.data,x=y.tag_name;let c=[];u.status===200&&u.data&&(c=u.data.map(E=>({version:E.tag_name,name:E.name,publishedAt:E.published_at,releaseUrl:E.html_url})));const F=localStorage.getItem(qe);if(!d&&F===x)return o(E=>({...E,isChecking:!1,updateAvailable:!1,recentReleases:c})),null;if(!(m(x,We)>0))return o(E=>({...E,isChecking:!1,updateAvailable:!1,recentReleases:c})),null;const R=y.assets.find(E=>E.name.endsWith(".apk")&&E.content_type==="application/vnd.android.package-archive"),w={version:x,name:y.name,changelog:y.body,releaseUrl:y.html_url,apkUrl:(R==null?void 0:R.browser_download_url)||null,apkSize:(R==null?void 0:R.size)||null,publishedAt:y.published_at};return o(E=>({...E,isChecking:!1,updateAvailable:!0,updateInfo:w,recentReleases:c})),w}catch(g){const u=g instanceof Error?g.message:"Failed to check for updates";return o(y=>({...y,isChecking:!1,error:u})),null}},[]),n=l.useCallback(async()=>{var d,g,u;if(!((d=s.updateInfo)!=null&&d.apkUrl)){(g=s.updateInfo)!=null&&g.releaseUrl&&window.open(s.updateInfo.releaseUrl,"_blank");return}if(!a){(u=s.updateInfo)!=null&&u.releaseUrl&&window.open(s.updateInfo.releaseUrl,"_blank");return}try{window.open(s.updateInfo.apkUrl,"_system"),o(y=>({...y,error:null}))}catch(y){const x=y instanceof Error?y.message:"Failed to open download";o(c=>({...c,error:x}))}},[s.updateInfo,a]),h=l.useCallback(()=>{s.updateInfo&&localStorage.setItem(qe,s.updateInfo.version),o(d=>({...d,updateAvailable:!1,updateInfo:null}))},[s.updateInfo]),I=l.useCallback(()=>{var d;(d=s.updateInfo)!=null&&d.releaseUrl?window.open(s.updateInfo.releaseUrl,"_blank"):window.open(`https://github.com/${_e}/releases`,"_blank")},[s.updateInfo]);return l.useEffect(()=>{if(!a)return;const d=setTimeout(()=>{r()},5e3),g=setInterval(()=>{r()},As);return()=>{clearTimeout(d),clearInterval(g)}},[a,r]),{...s,isAndroid:a,checkForUpdate:r,downloadAndInstall:n,dismissUpdate:h,openReleasePage:I}}const Xe="tide-toolbox-collapse";function Es(s,o){try{const a=localStorage.getItem(`${Xe}-${s}`);if(a!==null)return a==="true"}catch{}return o}function Is(s,o){try{localStorage.setItem(`${Xe}-${s}`,String(o))}catch{}}function U({title:s,storageKey:o,defaultOpen:a=!1,forceOpen:i=!1,children:m,headerExtra:f}){const[r,n]=l.useState(()=>o?Es(o,a):a),h=()=>{const b=!r;n(b),o&&Is(o,b)},I=i||r;return e.jsxs("div",{className:`collapsible-section ${I?"open":"collapsed"}`,children:[e.jsxs("button",{className:"collapsible-header",onClick:h,children:[e.jsx("span",{className:"collapsible-title",children:s}),e.jsxs("span",{className:"collapsible-header-right",children:[f,e.jsx("span",{className:"collapsible-arrow",children:e.jsx(L,{name:I?"caret-down":"caret-right",size:10})})]})]}),I&&e.jsx("div",{className:"collapsible-content",children:m})]})}function Ps({area:s,isSelected:o,onClick:a,onDelete:i}){const{t:m}=ee(["config","common"]),f=s.assignedAgentIds.length,r=s.type==="rectangle"?m("config:areas.rect"):m("config:areas.circle");return e.jsxs("div",{className:`area-item ${o?"selected":""}`,onClick:a,children:[e.jsx("div",{className:"area-color-dot",style:{backgroundColor:s.color}}),e.jsxs("div",{className:"area-info",children:[e.jsx("div",{className:"area-name",children:s.name}),e.jsxs("div",{className:"area-meta",children:[r," ",f>0&&`• ${f} ${f>1?m("common:labels.agents").toLowerCase():m("common:labels.agent").toLowerCase()}`]})]}),e.jsx("button",{className:"area-delete-btn",onClick:i,title:m("config:areas.deleteArea"),children:"×"})]})}function Ls({building:s,isSelected:o,onClick:a,onEdit:i}){var n;const{t:m}=ee(["config"]),f=((n=s.pm2Status)==null?void 0:n.ports)||[],r=(h,I)=>{h.stopPropagation(),window.open(`http://${window.location.hostname}:${I}`,"_blank")};return e.jsxs("div",{className:`building-item ${o?"selected":""}`,onClick:a,children:[e.jsx("div",{className:"building-status-dot",style:{backgroundColor:Je[s.status]},title:s.status}),e.jsx("div",{className:"building-icon",children:e.jsx(L,{name:Ze(s.type),size:16})}),e.jsxs("div",{className:"building-info",children:[e.jsx("div",{className:"building-name",children:s.name}),e.jsxs("div",{className:"building-meta",children:[s.type,f.length>0&&e.jsx("span",{className:"building-ports",children:f.map(h=>e.jsxs("a",{href:`http://${window.location.hostname}:${h}`,className:"building-port-link",onClick:I=>r(I,h),title:`Open :${h}`,children:[":",h]},h))})]})]}),e.jsx("button",{className:"building-edit-btn",onClick:h=>{h.stopPropagation(),i()},title:m("config:buildings.editBuilding"),children:e.jsx(L,{name:"gear",size:14})})]})}function Fs({building:s,onClose:o,onOpenModal:a}){var I,b,k,d,g,u,y,x;const{t:i}=ee(["config","common"]),{buildingLogs:m}=Re(),f=A.getBuildingLogs(s.id),r=es[s.style||"server-rack"],n=c=>{A.sendBuildingCommand(s.id,c)},h=c=>{window.open(c,"_blank")};return e.jsxs("div",{className:"building-editor",children:[e.jsxs("div",{className:"building-editor-header",children:[e.jsxs("div",{className:"building-editor-title-row",children:[e.jsx("span",{className:"building-editor-icon",children:e.jsx(L,{name:Ze(s.type),size:18})}),e.jsx("span",{className:"building-editor-title",children:s.name}),e.jsx("span",{className:"building-editor-status",style:{backgroundColor:Je[s.status]},children:s.status})]}),e.jsx("button",{className:"building-editor-close",onClick:o,children:"×"})]}),e.jsx("div",{className:"building-editor-section",children:e.jsxs("div",{className:"building-editor-info-grid",children:[e.jsxs("div",{className:"building-editor-info-item",children:[e.jsx("span",{className:"building-editor-info-label",children:i("common:labels.type")}),e.jsx("span",{className:"building-editor-info-value",children:s.type})]}),e.jsxs("div",{className:"building-editor-info-item",children:[e.jsx("span",{className:"building-editor-info-label",children:i("config:buildings.style")}),e.jsx("span",{className:"building-editor-info-value",children:r.label})]}),s.cwd&&e.jsxs("div",{className:"building-editor-info-item building-editor-info-wide",children:[e.jsx("span",{className:"building-editor-info-label",children:i("config:buildings.directory")}),e.jsx("span",{className:"building-editor-info-value building-editor-cwd",title:s.cwd,children:s.cwd.split("/").pop()||s.cwd})]})]})}),s.type==="server"&&e.jsxs("div",{className:"building-editor-section",children:[e.jsx("div",{className:"building-editor-section-title",children:i("config:buildings.actions")}),e.jsxs("div",{className:"building-editor-actions",children:[e.jsxs("button",{className:"building-editor-action-btn start",onClick:()=>n("start"),disabled:!((I=s.commands)!=null&&I.start)||s.status==="running",title:((b=s.commands)==null?void 0:b.start)||i("config:buildings.noStartCommand"),children:[e.jsx(L,{name:"play",size:12})," ",i("common:buttons.start")]}),e.jsxs("button",{className:"building-editor-action-btn stop",onClick:()=>n("stop"),disabled:!((k=s.commands)!=null&&k.stop)||s.status==="stopped",title:((d=s.commands)==null?void 0:d.stop)||i("config:buildings.noStopCommand"),children:[e.jsx(L,{name:"stop",size:12,weight:"fill"})," ",i("common:buttons.stop")]}),e.jsxs("button",{className:"building-editor-action-btn restart",onClick:()=>n("restart"),disabled:!((g=s.commands)!=null&&g.restart),title:((u=s.commands)==null?void 0:u.restart)||i("config:buildings.noRestartCommand"),children:[e.jsx(L,{name:"refresh",size:12})," ",i("common:buttons.retry")]}),e.jsxs("button",{className:"building-editor-action-btn health",onClick:()=>n("healthCheck"),disabled:!((y=s.commands)!=null&&y.healthCheck),title:((x=s.commands)==null?void 0:x.healthCheck)||i("config:buildings.noHealthCheck"),children:[e.jsx(L,{name:"heart",size:12})," Health"]})]})]}),s.urls&&s.urls.length>0&&e.jsxs("div",{className:"building-editor-section",children:[e.jsx("div",{className:"building-editor-section-title",children:i("config:buildings.links")}),e.jsx("div",{className:"building-editor-links",children:s.urls.map((c,F)=>e.jsxs("button",{className:"building-editor-link",onClick:()=>h(c.url),title:c.url,children:[e.jsx(L,{name:"link",size:12})," ",c.label||c.url]},F))})]}),f.length>0&&e.jsxs("div",{className:"building-editor-section",children:[e.jsxs("div",{className:"building-editor-section-title",children:[i("config:buildings.recentLogs"),e.jsx("button",{className:"building-editor-clear-logs",onClick:()=>A.clearBuildingLogs(s.id),title:i("common:buttons.clear"),children:i("common:buttons.clear")})]}),e.jsx("div",{className:"building-editor-logs",children:f.slice(-5).map((c,F)=>e.jsx("div",{className:"building-editor-log-entry",children:c},F))})]}),e.jsx("div",{className:"building-editor-footer",children:e.jsxs("button",{className:"building-editor-edit-btn",onClick:a,children:[e.jsx(L,{name:"gear",size:12})," ",i("config:buildings.fullSettings")]})})]})}async function Os(s,o){const a=H(),i=await fetch(ce(`/api/areas/${s}/logo`),{method:"POST",headers:{"Content-Type":o.type||"image/png","X-Filename":encodeURIComponent(o.name),...a?{Authorization:`Bearer ${a}`}:{}},body:o});if(!i.ok){const m=await i.json().catch(()=>({error:i.statusText}));throw new Error(m.error||`Upload failed: ${i.statusText}`)}return i.json()}async function Ds(s){const o=H(),a=await fetch(ce(`/api/areas/${s}/logo`),{method:"DELETE",headers:{...o?{Authorization:`Bearer ${o}`}:{}}});if(!a.ok)throw new Error(`Failed to delete logo: ${a.statusText}`)}function $s(s){return ss(ce(`/api/areas/logos/${s}`))}const Rs=[{key:"center",labelKey:"posCenter"},{key:"top-left",labelKey:"posTopLeft"},{key:"top-right",labelKey:"posTopRight"},{key:"bottom-left",labelKey:"posBottomLeft"},{key:"bottom-right",labelKey:"posBottomRight"}];function zs({area:s,onClose:o,onOpenFolder:a}){var oe;const{t:i}=ee(["config","common"]),[m,f]=l.useState(s.name),[r,n]=l.useState(s.prompt||""),[h,I]=l.useState(!1),[b,k]=l.useState(""),[d,g]=l.useState(!1),u=l.useRef(null);l.useEffect(()=>{f(s.name)},[s.id,s.name]),l.useEffect(()=>{n(s.prompt||"")},[s.id,s.prompt]);const y=j=>{const O=j.target.value;f(O),A.updateArea(s.id,{name:O})},x=j=>{A.updateArea(s.id,{color:j})},c=j=>{const O=j.target.value;n(O),A.updateArea(s.id,{prompt:O})},F=()=>{b.trim()&&(A.addDirectoryToArea(s.id,b.trim()),k(""),I(!1))},z=(j,O)=>{O.stopPropagation(),A.removeDirectoryFromArea(s.id,j)},R=()=>{A.bringAreaToFront(s.id)},w=()=>{A.sendAreaToBack(s.id)},E=l.useCallback(()=>{let j=2,O=2;s.type==="rectangle"&&s.width&&s.height?(j=s.width,O=s.height):s.type==="circle"&&s.radius&&(j=s.radius*1.414,O=s.radius*1.414);const K=Math.min(j,O)*.4;return{width:Math.round(K*10)/10,height:Math.round(K*10)/10}},[s.type,s.width,s.height,s.radius]),V=async j=>{var K;const O=(K=j.target.files)==null?void 0:K[0];if(O){g(!0);try{const v=await Os(s.id,O),D=E();A.updateArea(s.id,{logo:{filename:v.filename,position:"center",width:D.width,height:D.height,keepAspectRatio:!0,opacity:.8}})}catch(v){console.error("Failed to upload logo:",v)}finally{g(!1),u.current&&(u.current.value="")}}},B=async()=>{try{await Ds(s.id),A.updateArea(s.id,{logo:void 0})}catch(j){console.error("Failed to remove logo:",j)}},W=j=>{s.logo&&A.updateArea(s.id,{logo:{...s.logo,position:j}})},N=j=>{if(!s.logo)return;const O=parseFloat(j.target.value)||.1;if(s.logo.keepAspectRatio&&s.logo.width>0){const K=s.logo.height/s.logo.width;A.updateArea(s.id,{logo:{...s.logo,width:O,height:Math.round(O*K*10)/10}})}else A.updateArea(s.id,{logo:{...s.logo,width:O}})},T=j=>{if(!s.logo)return;const O=parseFloat(j.target.value)||.1;if(s.logo.keepAspectRatio&&s.logo.height>0){const K=s.logo.width/s.logo.height;A.updateArea(s.id,{logo:{...s.logo,height:O,width:Math.round(O*K*10)/10}})}else A.updateArea(s.id,{logo:{...s.logo,height:O}})},M=()=>{s.logo&&A.updateArea(s.id,{logo:{...s.logo,keepAspectRatio:!s.logo.keepAspectRatio}})},se=j=>{s.logo&&A.updateArea(s.id,{logo:{...s.logo,opacity:parseFloat(j.target.value)}})};return e.jsxs("div",{className:"area-editor",children:[e.jsxs("div",{className:"area-editor-header",children:[e.jsx("span",{className:"area-editor-title",children:i("config:areas.editArea")}),e.jsx("button",{className:"area-editor-close",onClick:o,children:"×"})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:i("common:labels.name")}),e.jsx("input",{type:"text",className:"area-editor-input",value:m,onChange:y,placeholder:i("config:areas.areaName")})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:i("config:areas.color")}),e.jsx("div",{className:"color-picker-row",children:as.map(j=>e.jsx("div",{className:`color-swatch ${s.color===j?"selected":""}`,style:{backgroundColor:j},onClick:()=>x(j)},j))})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:i("config:areas.layer")}),e.jsxs("div",{className:"area-layer-buttons",children:[e.jsxs("button",{className:"area-layer-btn",onClick:R,title:i("config:areas.bringToFront"),children:[e.jsx(L,{name:"arrow-up",size:12})," ",i("config:areas.front")]}),e.jsxs("button",{className:"area-layer-btn",onClick:w,title:i("config:areas.sendToBack"),children:[e.jsx(L,{name:"arrow-down",size:12})," ",i("config:areas.back")]})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:i("config:areas.logo")}),e.jsxs("div",{className:"area-logo-section",children:[(oe=s.logo)!=null&&oe.filename?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"area-logo-preview",children:[e.jsx("img",{src:$s(s.logo.filename),alt:"Logo",className:"area-logo-thumbnail"}),e.jsx("button",{className:"area-logo-remove-btn",onClick:B,children:i("config:areas.removeLogo")}),e.jsx("button",{className:"area-logo-replace-btn",onClick:()=>{var j;return(j=u.current)==null?void 0:j.click()},disabled:d,children:d?"...":e.jsx(L,{name:"refresh",size:12})})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:i("config:areas.logoPosition")}),e.jsx("div",{className:"area-logo-position-row",children:Rs.map(({key:j,labelKey:O})=>{var K;return e.jsx("button",{className:`area-logo-pos-btn ${((K=s.logo)==null?void 0:K.position)===j?"active":""}`,onClick:()=>W(j),children:i(`config:areas.${O}`)},j)})})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:i("config:areas.logoSize")}),e.jsxs("div",{className:"area-logo-size-row",children:[e.jsxs("label",{className:"area-logo-size-field",children:[e.jsx("span",{children:i("config:areas.logoWidth")}),e.jsx("input",{type:"number",className:"area-logo-size-input",value:s.logo.width,onChange:N,min:.1,step:.1})]}),e.jsxs("label",{className:"area-logo-size-field",children:[e.jsx("span",{children:i("config:areas.logoHeight")}),e.jsx("input",{type:"number",className:"area-logo-size-input",value:s.logo.height,onChange:T,min:.1,step:.1})]}),e.jsxs("label",{className:"area-logo-aspect-label",title:i("config:areas.keepAspectRatio"),children:[e.jsx("input",{type:"checkbox",checked:s.logo.keepAspectRatio,onChange:M}),i("config:areas.keepAspectRatio")]})]})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:i("config:areas.logoOpacity")}),e.jsxs("div",{className:"area-logo-opacity-row",children:[e.jsx("input",{type:"range",min:0,max:1,step:.05,value:s.logo.opacity??.8,onChange:se,className:"area-logo-opacity-slider"}),e.jsxs("span",{className:"area-logo-opacity-value",children:[Math.round((s.logo.opacity??.8)*100),"%"]})]})]})]}):e.jsx("button",{className:"area-logo-upload-btn",onClick:()=>{var j;return(j=u.current)==null?void 0:j.click()},disabled:d,children:d?"...":i("config:areas.uploadLogo")}),e.jsx("input",{ref:u,type:"file",accept:"image/*",style:{display:"none"},onChange:V})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:i("config:areas.folders",{count:s.directories.length})}),e.jsxs("div",{className:"area-folders-list",children:[s.directories.map(j=>e.jsxs("div",{className:"area-folder-item",title:j,children:[e.jsx("span",{className:"area-folder-icon clickable",onClick:()=>a==null?void 0:a(s.id),title:i("config:areas.openFolder"),children:e.jsx(L,{name:"folder",size:14})}),e.jsx("span",{className:"area-folder-path",children:j.split("/").pop()||j}),e.jsx("button",{className:"area-folder-remove",onClick:O=>z(j,O),title:i("config:areas.removeFolder"),children:"×"})]},j)),h?e.jsxs("div",{className:"area-add-folder-inline",children:[e.jsx(ts,{value:b,onChange:k,onSubmit:F,placeholder:i("config:areas.folderPlaceholder"),className:"area-add-folder-input",directoriesOnly:!0,autoFocus:!0}),e.jsx("button",{className:"area-add-folder-confirm",onClick:F,children:"+"})]}):e.jsx("button",{className:"area-add-folder-btn",onClick:()=>I(!0),children:i("config:areas.addFolder")})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:i("config:areas.prompt","Prompt")}),e.jsx("textarea",{className:"area-editor-input",value:r,onChange:c,placeholder:i("config:areas.promptPlaceholder","System prompt for agents in this area..."),rows:4,style:{resize:"vertical",fontFamily:"monospace",fontSize:12}}),e.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4},children:i("config:areas.promptHint","This prompt is injected into agents assigned to this area. Takes effect on next context refresh.")})]}),s.assignedAgentIds.length>0&&e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:i("config:areas.assignedAgents",{count:s.assignedAgentIds.length})}),e.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:i("config:areas.rightClickUnassign")})]})]})}function _s(){const{t:s}=ee(["config","common"]),o=ns(),[a,i]=l.useState(!1),[m,f]=l.useState(null),[r,n]=l.useState({name:"",key:"",value:"",description:""}),[h,I]=l.useState(null),b=()=>{i(!0),f(null),n({name:"",key:"",value:"",description:""})},k=c=>{f(c.id),i(!1),n({name:c.name,key:c.key,value:c.value,description:c.description||""})},d=()=>{i(!1),f(null),n({name:"",key:"",value:"",description:""})},g=()=>{!r.name.trim()||!r.key.trim()||(m?A.updateSecret(m,{name:r.name.trim(),key:r.key.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_"),value:r.value,description:r.description.trim()||void 0}):A.createSecret({name:r.name.trim(),key:r.key.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_"),value:r.value,description:r.description.trim()||void 0}),d())},u=c=>{I(c)},y=()=>{h&&(A.deleteSecret(h),m===h&&d())},x=c=>{navigator.clipboard.writeText(`{{${c}}}`)};return e.jsxs("div",{className:"secrets-section",children:[e.jsx("div",{className:"secrets-description",children:s("config:secrets.description",{placeholder:"{{KEY}}"})}),e.jsx("div",{className:"secrets-list",children:o.length===0&&!a?e.jsx("div",{className:"secrets-empty",children:s("config:secrets.noSecrets")}):o.map(c=>e.jsxs("div",{className:`secret-item ${m===c.id?"editing":""}`,children:[e.jsxs("div",{className:"secret-item-header",children:[e.jsxs("div",{className:"secret-item-info",children:[e.jsx("span",{className:"secret-item-name",children:c.name}),e.jsx("code",{className:"secret-item-key",onClick:()=>x(c.key),title:s("config:secrets.copyPlaceholder"),children:`{{${c.key}}}`})]}),e.jsxs("div",{className:"secret-item-actions",children:[e.jsx("button",{className:"secret-item-btn edit",onClick:()=>k(c),title:s("common:buttons.edit"),children:e.jsx(L,{name:"edit",size:12})}),e.jsx("button",{className:"secret-item-btn delete",onClick:()=>u(c.id),title:s("common:buttons.delete"),children:"×"})]})]}),c.description&&e.jsx("div",{className:"secret-item-description",children:c.description})]},c.id))}),(a||m)&&e.jsxs("div",{className:"secret-form",children:[e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("common:labels.name")}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.namePlaceholder"),value:r.name,onChange:c=>n({...r,name:c.target.value}),autoFocus:!0})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:"Key"}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.keyPlaceholder"),value:r.key,onChange:c=>n({...r,key:c.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"")})}),e.jsx("span",{className:"secret-form-hint",children:s("config:secrets.usedAs",{placeholder:`{{${r.key||"KEY"}}}`})})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("config:secrets.secretValue")}),e.jsx("input",{type:"password",className:"secret-form-input",placeholder:s("config:secrets.valuePlaceholder"),value:r.value,onChange:c=>n({...r,value:c.target.value})})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("common:labels.description")}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.descriptionPlaceholder"),value:r.description,onChange:c=>n({...r,description:c.target.value})})]}),e.jsxs("div",{className:"secret-form-actions",children:[e.jsx("button",{className:"secret-form-btn cancel",onClick:d,children:s("common:buttons.cancel")}),e.jsx("button",{className:"secret-form-btn save",onClick:g,disabled:!r.name.trim()||!r.key.trim(),children:s(m?"config:secrets.update":"common:buttons.add")})]})]}),!a&&!m&&e.jsx("button",{className:"secrets-add-btn",onClick:b,children:s("config:secrets.addSecret")}),e.jsx(re,{isOpen:h!==null,title:s("common:buttons.delete"),message:s("config:secrets.deleteConfirm"),confirmLabel:s("common:buttons.delete"),cancelLabel:s("common:buttons.cancel"),variant:"danger",onConfirm:y,onClose:()=>I(null)})]})}async function Us(){const s=H(),o=await fetch(`${Y()}/api/agents/system-settings/prompt`,{headers:{Authorization:`Bearer ${s}`}});if(!o.ok)throw new Error(`Failed to fetch system prompt: ${o.statusText}`);return(await o.json()).prompt||""}async function Bs(s){const o=H(),a=await fetch(`${Y()}/api/agents/system-settings/prompt`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({prompt:s})});if(!a.ok)throw new Error(`Failed to update system prompt: ${a.statusText}`)}async function Ks(){const s=H(),o=await fetch(`${Y()}/api/agents/system-settings/prompt`,{method:"DELETE",headers:{Authorization:`Bearer ${s}`}});if(!o.ok)throw new Error(`Failed to clear system prompt: ${o.statusText}`)}async function Vs(){const s=H(),o=await fetch(`${Y()}/api/agents/system-settings/echo-prompt`,{headers:{Authorization:`Bearer ${s}`}});if(!o.ok)throw new Error(`Failed to fetch echo prompt setting: ${o.statusText}`);return(await o.json()).enabled||!1}async function Ms(s){const o=H(),a=await fetch(`${Y()}/api/agents/system-settings/echo-prompt`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({enabled:s})});if(!a.ok)throw new Error(`Failed to update echo prompt setting: ${a.statusText}`)}async function qs(){const s=H(),o=await fetch(`${Y()}/api/agents/system-settings/codex-binary`,{headers:{Authorization:`Bearer ${s}`}});if(!o.ok)throw new Error(`Failed to fetch codex binary path: ${o.statusText}`);return(await o.json()).path||""}async function Ws(s){const o=H(),a=await fetch(`${Y()}/api/agents/system-settings/codex-binary`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({path:s})});if(!a.ok)throw new Error(`Failed to update codex binary path: ${a.statusText}`)}async function Hs(){const s=H(),o=await fetch(`${Y()}/api/agents/system-settings/tmux-mode`,{headers:{Authorization:`Bearer ${s}`}});if(!o.ok)throw new Error(`Failed to fetch tmux mode setting: ${o.statusText}`);return(await o.json()).enabled||!1}async function Gs(s){const o=H(),a=await fetch(`${Y()}/api/agents/system-settings/tmux-mode`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({enabled:s})});if(!a.ok)throw new Error(`Failed to update tmux mode setting: ${a.statusText}`)}async function Ys(){const s=H(),o=await fetch(`${Y()}/api/agents/system-settings/backup`,{headers:{Authorization:`Bearer ${s}`}});if(!o.ok)throw new Error(`Failed to fetch backup status: ${o.statusText}`);return o.json()}async function Js(s){const o=H(),a=await fetch(`${Y()}/api/agents/system-settings/backup`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({enabled:s})});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||`Failed to update backup setting: ${a.statusText}`)}return a.json()}function Zs({checked:s,onChange:o,disabled:a}){return e.jsxs("label",{className:"config-toggle",children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:s,disabled:a,onChange:i=>o(i.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})}function Xs(){const{t:s}=ee(["config","common"]),[o,a]=l.useState([]),[i,m]=l.useState(new Set),[f,r]=l.useState(new Set),[n,h]=l.useState(!1),[I,b]=l.useState(!1),[k,d]=l.useState(null),[g,u]=l.useState(null),[y,x]=l.useState(null),[c,F]=l.useState(null),[z,R]=l.useState(!1),[w,E]=l.useState(null);l.useEffect(()=>{je(ce("/api/config/categories")).then(v=>v.json()).then(v=>{const D=Array.isArray(v)?v:[];a(D),m(new Set(D.map($=>$.id)))}).catch(v=>console.error("Failed to fetch config categories:",v))},[]),l.useEffect(()=>{Ys().then(F).catch(v=>{console.error("Failed to fetch backup status:",v),E(v.message||"Failed to fetch backup status")})},[]);const V=async v=>{if(!z){R(!0),E(null);try{const D=await Js(v);F(D)}catch(D){E(D.message||"Failed to update backup setting")}finally{R(!1)}}},B=v=>{m(D=>{const $=new Set(D);return $.has(v)?$.delete(v):$.add(v),$})},W=v=>{r(D=>{const $=new Set(D);return $.has(v)?$.delete(v):$.add(v),$})},N=()=>m(new Set(o.map(v=>v.id))),T=()=>m(new Set),M=()=>{g&&r(new Set(g.categories.map(v=>v.id)))},se=()=>r(new Set),oe=async()=>{var v;if(i.size!==0){h(!0),x(null);try{const D=Array.from(i).join(","),$=await je(ce(`/api/config/export?categories=${D}`));if(!$.ok)throw new Error("Export failed");const J=await $.blob(),ae=window.URL.createObjectURL(J),X=document.createElement("a");X.href=ae;const G=$.headers.get("Content-Disposition"),ge=((v=G==null?void 0:G.match(/filename="(.+)"/))==null?void 0:v[1])||"tide-commander-config.zip";X.download=ge,document.body.appendChild(X),X.click(),document.body.removeChild(X),window.URL.revokeObjectURL(ae),x({type:"success",text:s("config:data.exportSuccess")})}catch(D){x({type:"error",text:D.message||"Export failed"})}finally{h(!1)}}},j=async v=>{var $;const D=($=v.target.files)==null?void 0:$[0];if(D){d(D),x(null),u(null),r(new Set);try{const J=await je(ce("/api/config/preview"),{method:"POST",headers:{"Content-Type":"application/zip"},body:await D.arrayBuffer()});if(!J.ok){const G=await J.json();throw new Error(G.error||"Failed to preview config file")}const ae=await J.json(),X=Array.isArray(ae.categories)?ae.categories:[];u({...ae,categories:X}),r(new Set(X.map(G=>G.id)))}catch(J){x({type:"error",text:J.message||"Failed to read config file"}),d(null)}}},O=async()=>{if(!(!k||f.size===0)){b(!0),x(null);try{const v=Array.from(f).join(","),D=await je(ce(`/api/config/import?categories=${v}`),{method:"POST",headers:{"Content-Type":"application/zip"},body:await k.arrayBuffer()}),$=await D.json();if(!D.ok)throw new Error($.error||"Import failed");x({type:"success",text:$.message||s("config:data.importSuccess")}),d(null),u(null),r(new Set)}catch(v){x({type:"error",text:v.message||"Import failed"})}finally{b(!1)}}},K=()=>{d(null),u(null),r(new Set),x(null)};return e.jsxs("div",{className:"data-section",children:[y&&e.jsx("div",{className:`data-message data-message-${y.type}`,children:y.text}),e.jsxs("div",{className:"data-subsection",children:[e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-title",children:"Hourly Backups"}),e.jsx(Zs,{checked:!!(c!=null&&c.enabled),disabled:z||!c,onChange:V})]}),e.jsxs("div",{className:"data-backup-info",children:[c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:["Saves a compressed snapshot of your data every hour to"," ",e.jsx("code",{children:c.backupDir}),". Identical snapshots are skipped. Keeps the 8 newest plus one from each of the 2 most recent prior days."]}),!c.scriptExists&&e.jsxs("div",{style:{marginTop:6,color:"var(--dracula-red, #ff5555)"},children:["Backup script not found at ",e.jsx("code",{children:c.scriptPath})]}),c.lastRunAt&&e.jsxs("div",{style:{marginTop:6},children:["Last run: ",new Date(c.lastRunAt).toLocaleString(),c.lastRunOk===!0&&" — ok",c.lastRunOk===!1&&c.lastRunError&&e.jsxs("span",{style:{color:"var(--dracula-red, #ff5555)"},children:[" — ",c.lastRunError]})]})]}):e.jsx("div",{children:"Loading backup status…"}),w&&e.jsx("div",{className:"data-message data-message-error",style:{marginTop:6},children:w})]})]}),e.jsxs("div",{className:"data-subsection",children:[e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-title",children:s("config:data.exportData")}),e.jsxs("div",{className:"data-select-controls",children:[e.jsx("button",{className:"data-select-btn",onClick:N,children:s("common:labels.all")}),e.jsx("button",{className:"data-select-btn",onClick:T,children:s("common:labels.none")})]})]}),e.jsx("div",{className:"data-category-list",children:o.map(v=>e.jsxs("label",{className:"data-category-item",children:[e.jsx("input",{type:"checkbox",checked:i.has(v.id),onChange:()=>B(v.id)}),e.jsx("span",{className:"data-category-name",children:v.name})]},v.id))}),e.jsx("button",{className:"data-action-btn export",onClick:oe,disabled:n||i.size===0,children:n?s("config:data.exporting"):s("config:data.exportCount",{count:i.size})})]}),e.jsxs("div",{className:"data-subsection",children:[e.jsx("div",{className:"data-subsection-header",children:e.jsx("span",{className:"data-subsection-title",children:s("config:data.importData")})}),k?g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"data-import-info",children:[e.jsx("div",{className:"data-import-file",children:k.name}),e.jsxs("div",{className:"data-import-date",children:[s("config:data.exported"),": ",new Date(g.exportedAt).toLocaleDateString()]})]}),e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-subtitle",children:s("config:data.selectToImport")}),e.jsxs("div",{className:"data-select-controls",children:[e.jsx("button",{className:"data-select-btn",onClick:M,children:s("common:labels.all")}),e.jsx("button",{className:"data-select-btn",onClick:se,children:s("common:labels.none")})]})]}),e.jsx("div",{className:"data-category-list",children:g.categories.map(v=>e.jsxs("label",{className:"data-category-item",children:[e.jsx("input",{type:"checkbox",checked:f.has(v.id),onChange:()=>W(v.id)}),e.jsx("span",{className:"data-category-name",children:v.name}),v.fileCount&&e.jsxs("span",{className:"data-category-count",children:["(",v.fileCount," ",s("config:data.files"),")"]})]},v.id))}),e.jsxs("div",{className:"data-import-actions",children:[e.jsx("button",{className:"data-action-btn cancel",onClick:K,children:s("common:buttons.cancel")}),e.jsx("button",{className:"data-action-btn import",onClick:O,disabled:I||f.size===0,children:I?s("config:data.importing"):s("config:data.importCount",{count:f.size})})]})]}):e.jsx("div",{className:"data-loading",children:s("config:data.readingFile")}):e.jsxs("label",{className:"data-file-input",children:[e.jsx("input",{type:"file",accept:".zip",onChange:j,style:{display:"none"}}),e.jsx("span",{className:"data-file-input-label",children:s("config:data.selectFile")})]})]})]})}function Qs(){const[s,o]=l.useState(()=>is()),a=i=>{o(i);const m=ls(i);cs(m)};return e.jsx("div",{className:"theme-selector",children:e.jsx("div",{className:"theme-selector-grid",children:os.map(i=>e.jsxs("button",{className:`theme-option ${s===i.id?"active":""}`,onClick:()=>a(i.id),title:i.description,children:[e.jsx("div",{className:"theme-preview",children:e.jsxs("div",{className:"theme-preview-bg",style:{backgroundColor:i.colors.bgPrimary},children:[e.jsx("div",{className:"theme-preview-accent",style:{backgroundColor:i.colors.accentBlue}}),e.jsx("div",{className:"theme-preview-claude",style:{backgroundColor:i.colors.accentClaude}})]})}),e.jsx("span",{className:"theme-name",children:i.name})]},i.id))})})}function ea(){const{t:s}=ee(["config"]),{updateAvailable:o,updateInfo:a,recentReleases:i,isChecking:m,error:f,currentVersion:r,isAndroid:n,checkForUpdate:h,downloadAndInstall:I,openReleasePage:b}=Ts(),k=g=>g?`${(g/(1024*1024)).toFixed(1)} MB`:"",d=g=>new Date(g).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return e.jsxs("div",{className:"about-section",children:[e.jsxs("div",{className:"about-logo",children:[e.jsx("span",{className:"about-logo-icon",children:e.jsx(L,{name:"waves",size:24})}),e.jsx("span",{className:"about-logo-text",children:"Tide Commander"})]}),e.jsxs("div",{className:"about-version",children:[e.jsx("span",{className:"about-version-label",children:s("config:about.version")}),e.jsxs("div",{className:"about-version-info",children:[e.jsx("span",{className:"about-version-value",children:r}),o&&a?e.jsx("span",{className:"about-version-update-badge",onClick:b,title:`Update available: ${a.version}`,children:a.version}):e.jsxs("a",{href:"https://github.com/deivid11/tide-commander/releases",target:"_blank",rel:"noopener noreferrer",className:"about-version-status",children:["(",s("config:about.updated"),")"]})]})]}),e.jsxs("div",{className:"about-update",children:[o&&a?e.jsxs("div",{className:"about-update-available",children:[e.jsxs("div",{className:"about-update-header",children:[e.jsx("span",{className:"about-update-badge",children:s("config:about.updateAvailable")}),e.jsx("span",{className:"about-update-version",children:a.version})]}),a.apkSize&&e.jsxs("div",{className:"about-update-size",children:[s("config:about.sizeLabel"),": ",k(a.apkSize)]}),f&&e.jsx("div",{className:"about-update-error",children:f}),e.jsxs("div",{className:"about-update-actions",children:[e.jsx("button",{className:"about-update-btn changelog",onClick:b,children:s("config:about.changelog")}),n&&a.apkUrl?e.jsx("button",{className:"about-update-btn download",onClick:I,children:s("config:about.downloadAPK")}):e.jsx("button",{className:"about-update-btn download",onClick:b,children:s("config:about.viewRelease")})]})]}):e.jsxs("div",{className:"about-update-check",children:[e.jsx("span",{className:"about-update-status",children:s(m?"config:about.checkingUpdates":"config:about.upToDate")}),e.jsx("button",{className:"about-update-btn check",onClick:()=>h(!0),disabled:m,children:m?"...":s("config:about.check")})]}),i.length>0&&e.jsxs("div",{className:"about-releases",children:[e.jsx("div",{className:"about-releases-title",children:s("config:about.recentReleases")}),e.jsx("div",{className:"about-releases-list",children:i.map(g=>e.jsxs("a",{href:g.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:`about-release-item ${g.version===`v${r}`||g.version===r?"current":""}`,children:[e.jsx("span",{className:"about-release-version",children:g.version}),e.jsx("span",{className:"about-release-date",children:d(g.publishedAt)})]},g.version))})]})]}),e.jsx("div",{className:"about-description",children:s("config:about.tagline")}),e.jsxs("div",{className:"about-principles",children:[e.jsx("div",{className:"about-principles-title",children:s("config:about.corePrinciples")}),e.jsxs("ul",{className:"about-principles-list",children:[e.jsx("li",{children:s("config:about.principle1")}),e.jsx("li",{children:s("config:about.principle2")}),e.jsx("li",{children:s("config:about.principle3")}),e.jsx("li",{children:s("config:about.principle4")})]})]}),e.jsx("div",{className:"about-links",children:e.jsxs("a",{href:"https://github.com/deivid11/tide-commander",target:"_blank",rel:"noopener noreferrer",className:"about-link",children:[e.jsx("span",{className:"about-link-icon",children:e.jsx(L,{name:"package",size:14})}),e.jsx("span",{children:s("config:about.repository")})]})}),e.jsxs("div",{className:"about-credits",children:[e.jsx("div",{className:"about-credits-title",children:s("config:about.specialThanks")}),e.jsxs("div",{className:"about-credit-item",children:[e.jsx("a",{href:"https://kenney.nl",target:"_blank",rel:"noopener noreferrer",className:"about-credit-link",children:"Kenney.nl"}),e.jsx("span",{className:"about-credit-desc",children:s("config:about.kenneyCredit")})]}),e.jsxs("div",{className:"about-credit-item",children:[e.jsx("a",{href:"https://claude.ai/code",target:"_blank",rel:"noopener noreferrer",className:"about-credit-link",children:"Claude Code"}),e.jsx("span",{className:"about-credit-desc",children:s("config:about.claudeCodeCredit")})]})]})]})}const sa={gmail:"✉️",slack:"💬",jira:"📋","google-calendar":"📅",docx:"📄"};function aa({onOpenModal:s}){const[o,a]=l.useState([]),[i,m]=l.useState(!0),f=l.useCallback(async()=>{try{const r=await je(ce("/api/integrations"));if(!r.ok)return;const n=await r.json();a(n)}catch{}finally{m(!1)}},[]);return l.useEffect(()=>{f()},[f]),i?e.jsx("div",{style:{color:"var(--text-secondary, #a6adc8)",fontSize:12,padding:"4px 0"},children:"Loading..."}):o.length===0?e.jsx("div",{style:{color:"var(--text-secondary, #a6adc8)",fontSize:12,padding:"4px 0"},children:"No integrations available."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[o.map(r=>{const n=sa[r.id]||"🔌",h=!!r.status.error,I=r.status.connected,b=h?"#f38ba8":I?"#a6e3a1":"#fab387",k=h?"Error":I?"Connected":"Setup Required",d=h?"✗":I?"✓":"⚠";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)",fontSize:13},children:[e.jsx("span",{style:{fontSize:15,flexShrink:0},children:n}),e.jsx("span",{style:{flex:1,color:"var(--text-primary, #cdd6f4)",fontWeight:500},children:r.name}),e.jsxs("span",{style:{color:b,fontSize:11,fontWeight:500,whiteSpace:"nowrap"},children:[d," ",k]}),e.jsx("button",{onClick:()=>s(r.id),title:`Configure ${r.name}`,style:{background:"none",border:"none",cursor:"pointer",padding:"2px 4px",fontSize:14,color:"var(--text-secondary, #a6adc8)",borderRadius:4,flexShrink:0},onMouseEnter:g=>{g.target.style.color="var(--text-primary, #cdd6f4)"},onMouseLeave:g=>{g.target.style.color="var(--text-secondary, #a6adc8)"},children:"⚙️"})]},r.id)}),e.jsx("button",{onClick:()=>s(),style:{background:"none",border:"1px dashed var(--border, #313244)",borderRadius:6,padding:"6px 8px",cursor:"pointer",color:"var(--text-secondary, #a6adc8)",fontSize:12,textAlign:"center",marginTop:2},onMouseEnter:r=>{r.target.style.borderColor="var(--accent, #89b4fa)",r.target.style.color="var(--accent, #89b4fa)"},onMouseLeave:r=>{r.target.style.borderColor="var(--border, #313244)",r.target.style.color="var(--text-secondary, #a6adc8)"},children:"Manage All Integrations"})]})}function ta({isOpen:s,onClose:o}){const{t:a}=ee(["config"]),[i,m]=l.useState(""),[f,r]=l.useState(""),[n,h]=l.useState(!0),[I,b]=l.useState(null),[k,d]=l.useState(null),[g,u]=l.useState(!1),[y,x]=l.useState(!1),[c,F]=l.useState(!1);l.useEffect(()=>{s&&z()},[s]);const z=async()=>{try{h(!0),b(null),d(null);const T=await Us();m(T),r(T),u(!1)}catch(T){b(T instanceof Error?T.message:"Failed to load system prompt")}finally{h(!1)}},R=T=>{const M=T.target.value;m(M),u(M!==f),b(null),d(null)},w=async()=>{try{b(null),d(null),await Bs(i),r(i),u(!1),d(a("config:systemPrompt.saved"))}catch(T){b(T instanceof Error?T.message:"Failed to save system prompt")}},E=()=>{x(!0)},V=async()=>{try{b(null),d(null),await Ks(),m(""),r(""),u(!1),d(a("config:systemPrompt.cleared"))}catch(T){b(T instanceof Error?T.message:"Failed to clear system prompt")}},B=()=>{m(f),u(!1),b(null),d(null)},W=()=>{if(g){F(!0);return}o()},N=T=>{T.key==="Escape"&&(T.preventDefault(),W())};return s?e.jsxs(ze,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:W,children:e.jsxs("div",{className:"system-prompt-modal",onClick:T=>T.stopPropagation(),onKeyDown:N,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:a("config:systemPrompt.title")}),e.jsx("button",{className:"modal-close",onClick:W,"aria-label":"Close",children:e.jsx(L,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:n?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:"Loading system prompt..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:a("config:systemPrompt.description")}),I&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(L,{name:"warn",size:14})}),I]}),k&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(L,{name:"check",size:14})}),k]}),e.jsxs("div",{className:"editor-wrapper",children:[e.jsxs("div",{className:"editor-header",children:[e.jsx("label",{htmlFor:"prompt-input",className:"editor-label",children:a("config:systemPrompt.editPrompt")}),e.jsxs("span",{className:"char-count",children:[i.length," ",a("config:systemPrompt.characters")]})]}),e.jsx("textarea",{id:"prompt-input",className:"prompt-editor",value:i,onChange:R,placeholder:a("config:systemPrompt.placeholder"),rows:18,autoFocus:!0}),e.jsx("div",{className:"editor-hint",children:a("config:systemPrompt.hint")})]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left",children:e.jsx("button",{className:"btn btn-danger",onClick:E,disabled:!i||n,children:a("config:systemPrompt.clear")})}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:W,children:"Close"}),e.jsx("button",{className:"btn btn-secondary",onClick:B,disabled:!g||n,children:a("config:systemPrompt.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:w,disabled:!g||n,children:a("config:systemPrompt.save")})]})]})]})}),e.jsx(re,{isOpen:y,title:a("config:systemPrompt.clear"),message:a("config:systemPrompt.confirmClear"),confirmLabel:a("config:systemPrompt.clear"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{V()},onClose:()=>x(!1)}),e.jsx(re,{isOpen:c,title:"Unsaved Changes",message:"You have unsaved changes. Close anyway?",confirmLabel:"Close anyway",cancelLabel:"Keep editing",variant:"danger",onConfirm:o,onClose:()=>F(!1)})]}):null}const He={enabled:!1,baseUrl:"",defaultSessionId:"",webhookVerifyToken:"",showIncomingToasts:!0},na=2500,ia=12e4;function Ge(s){return{enabled:s.enabled??!1,baseUrl:s.baseUrl??"",defaultSessionId:s.defaultSessionId??"",webhookVerifyToken:s.webhookVerifyToken??"",showIncomingToasts:s.showIncomingToasts??!0}}function oa(s,o){return s.enabled===o.enabled&&s.baseUrl===o.baseUrl&&s.defaultSessionId===o.defaultSessionId&&s.webhookVerifyToken===o.webhookVerifyToken&&s.showIncomingToasts===o.showIncomingToasts}function la({isOpen:s,onClose:o}){const{t:a}=ee(["config"]),[i,m]=l.useState(He),[f,r]=l.useState(He),[n,h]=l.useState(!1),[I,b]=l.useState([]),[k,d]=l.useState(!0),[g,u]=l.useState(null),[y,x]=l.useState(null),[c,F]=l.useState(""),[z,R]=l.useState(!1),[w,E]=l.useState(""),[V,B]=l.useState(null),[W,N]=l.useState(null),[T,M]=l.useState(null),se=l.useRef(null),oe=l.useRef(0),[j,O]=l.useState(""),[K,v]=l.useState(""),[D,$]=l.useState(null),[J,ae]=l.useState(!1),[X,G]=l.useState(!1),[ge,ve]=l.useState(!1),[Ae,de]=l.useState(!1),[S,Z]=l.useState(null),fe=!oa(i,f),te=l.useCallback(()=>{se.current&&(clearTimeout(se.current),se.current=null)},[]),Ne=l.useCallback(async()=>{try{d(!0),u(null),x(null);const[p,t]=await Promise.all([rs(),ds()]),P=Ge(p);if(m(P),r(P),h(!!t.configured),t.configured)try{const q=await Me();b(Array.isArray(q)?q:[])}catch{b([])}else b([])}catch(p){u(p instanceof Error?p.message:a("config:whatsapp.errors.loadFailed"))}finally{d(!1)}},[a]),me=l.useCallback(async()=>{try{const p=await Me();b(Array.isArray(p)?p:[])}catch{}},[]);l.useEffect(()=>(s?Ne():(te(),B(null),N(null),M(null),F(""),R(!1),$(null)),()=>{te()}),[s,Ne,te]);const le=(p,t)=>{m(P=>({...P,[p]:t})),u(null),x(null)},Te=async()=>{try{u(null),x(null);const p=await gs({enabled:i.enabled,baseUrl:i.baseUrl.trim(),defaultSessionId:i.defaultSessionId.trim(),webhookVerifyToken:i.webhookVerifyToken,showIncomingToasts:i.showIncomingToasts});window.dispatchEvent(new CustomEvent("tide:whatsapp-config-updated"));const t=Ge(p);m(t),r(t),x(a("config:whatsapp.saved"))}catch(p){u(p instanceof Error?p.message:a("config:whatsapp.errors.saveFailed"))}},we=()=>{m(f),u(null),x(null)},ue=()=>{if(fe){G(!0);return}o()},Ee=p=>{p.key==="Escape"&&(p.preventDefault(),ue())},ye=async()=>{const p=c.trim();if(p)try{u(null),x(null),await ps(p),F(""),R(!1),h(!0),x(a("config:whatsapp.apiKeySaved"))}catch(t){u(t instanceof Error?t.message:a("config:whatsapp.errors.apiKeySaveFailed"))}},Ie=()=>{ve(!0)},ke=async()=>{try{u(null),x(null),await fs(),h(!1),x(a("config:whatsapp.apiKeyCleared"))}catch(p){u(p instanceof Error?p.message:a("config:whatsapp.errors.apiKeyClearFailed"))}},ne=l.useCallback(async p=>{if(Date.now()>oe.current){M(a("config:whatsapp.pairingTimeout")),B(null),N(null),te(),me();return}try{const t=await ms(p);if(t.status&&["connected","paired","open","ready"].includes(t.status.toLowerCase())){M(a("config:whatsapp.pairingSuccess")),B(null),N(null),te(),me();return}const q=t.qrUrl??t.qr??null;q&&N(q)}catch(t){M(t instanceof Error?t.message:a("config:whatsapp.errors.qrFetchFailed"))}se.current=setTimeout(()=>{ne(p)},na)},[me,te,a]),ie=async()=>{const p=w.trim();if(p)try{u(null),x(null),M(null),N(null),te(),await us(p),E(""),B(p),oe.current=Date.now()+ia,ne(p),me()}catch(t){u(t instanceof Error?t.message:a("config:whatsapp.errors.sessionCreateFailed"))}},xe=()=>{te(),B(null),N(null),M(null)},Pe=p=>{Z(p),de(!0)},Le=async()=>{if(S)try{u(null),x(null),await xs(S),V===S&&xe(),me(),x(a("config:whatsapp.sessionDeleted"))}catch(p){u(p instanceof Error?p.message:a("config:whatsapp.errors.sessionDeleteFailed"))}finally{Z(null)}},_=async()=>{const p=j.trim(),t=K.trim();if(!(!p||!t))try{ae(!0),$(null);const P=i.defaultSessionId.trim()||void 0;await hs(p,t,P),$({kind:"success",text:a("config:whatsapp.testSent")})}catch(P){$({kind:"error",text:P instanceof Error?P.message:a("config:whatsapp.errors.testSendFailed")})}finally{ae(!1)}};return s?e.jsxs(ze,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:ue,children:e.jsxs("div",{className:"whatsapp-config-modal",onClick:p=>p.stopPropagation(),onKeyDown:Ee,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:a("config:whatsapp.title")}),e.jsx("button",{className:"modal-close",onClick:ue,"aria-label":"Close",children:e.jsx(L,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:k?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:a("config:whatsapp.loading")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:a("config:whatsapp.description")}),g&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(L,{name:"warn",size:14})}),g]}),y&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(L,{name:"check",size:14})}),y]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.general")}),e.jsxs("div",{className:"wa-field wa-field-row",children:[e.jsx("label",{htmlFor:"wa-enabled",className:"wa-label",children:a("config:whatsapp.enabled")}),e.jsxs("label",{className:"wa-toggle",children:[e.jsx("input",{id:"wa-enabled",type:"checkbox",checked:i.enabled,onChange:p=>le("enabled",p.target.checked)}),e.jsx("span",{className:"wa-toggle-track",children:e.jsx("span",{className:"wa-toggle-thumb"})})]})]}),e.jsxs("div",{className:"wa-field wa-field-row",children:[e.jsx("label",{htmlFor:"wa-show-toasts",className:"wa-label",children:a("config:whatsapp.showIncomingToasts")}),e.jsxs("label",{className:"wa-toggle",children:[e.jsx("input",{id:"wa-show-toasts",type:"checkbox",checked:i.showIncomingToasts,onChange:p=>le("showIncomingToasts",p.target.checked)}),e.jsx("span",{className:"wa-toggle-track",children:e.jsx("span",{className:"wa-toggle-thumb"})})]})]}),e.jsx("span",{className:"wa-hint",children:a("config:whatsapp.showIncomingToastsHelp")}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-base-url",className:"wa-label",children:a("config:whatsapp.baseUrl")}),e.jsx("input",{id:"wa-base-url",type:"text",className:"wa-input",placeholder:"http://localhost:3007",value:i.baseUrl,onChange:p=>le("baseUrl",p.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-default-session",className:"wa-label",children:a("config:whatsapp.defaultSessionId")}),e.jsx("input",{id:"wa-default-session",type:"text",className:"wa-input",placeholder:a("config:whatsapp.defaultSessionIdPlaceholder"),value:i.defaultSessionId,onChange:p=>le("defaultSessionId",p.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-webhook-token",className:"wa-label",children:a("config:whatsapp.webhookVerifyToken")}),e.jsx("input",{id:"wa-webhook-token",type:"text",className:"wa-input",placeholder:a("config:whatsapp.webhookVerifyTokenPlaceholder"),value:i.webhookVerifyToken,onChange:p=>le("webhookVerifyToken",p.target.value)})]})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.apiKey")}),e.jsx("div",{className:"wa-key-status",children:n?e.jsxs("span",{className:"wa-status wa-status-ok",children:[e.jsx(L,{name:"check",size:12})," ",a("config:whatsapp.configured")]}):e.jsxs("span",{className:"wa-status wa-status-warn",children:[e.jsx(L,{name:"warn",size:12})," ",a("config:whatsapp.notConfigured")]})}),e.jsxs("div",{className:"wa-field wa-field-inline",children:[e.jsx("input",{type:z?"text":"password",className:"wa-input",placeholder:a("config:whatsapp.apiKeyPlaceholder"),value:c,onChange:p=>F(p.target.value)}),e.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>R(p=>!p),title:a(z?"config:whatsapp.hideKey":"config:whatsapp.showKey"),children:e.jsx(L,{name:z?"eye-closed":"eye",size:14})}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:ye,disabled:!c.trim(),children:a("config:whatsapp.saveKey")}),e.jsx("button",{type:"button",className:"btn btn-danger",onClick:Ie,disabled:!n,children:a("config:whatsapp.clearKey")})]}),e.jsx("span",{className:"wa-hint",children:a("config:whatsapp.apiKeyHint")})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.sessions")}),e.jsx("div",{className:"wa-sessions-list",children:!Array.isArray(I)||I.length===0?e.jsx("div",{className:"wa-empty",children:a("config:whatsapp.noSessions")}):I.map(p=>e.jsxs("div",{className:"wa-session-row",children:[e.jsxs("div",{className:"wa-session-info",children:[e.jsx("span",{className:"wa-session-id",children:p.id}),e.jsx("span",{className:`wa-session-status status-${(p.status??"unknown").toLowerCase()}`,children:p.status||"—"}),p.pairedNumber&&e.jsx("span",{className:"wa-session-paired",children:p.pairedNumber})]}),e.jsx("button",{type:"button",className:"btn btn-danger btn-sm",onClick:()=>Pe(p.id),children:a("config:whatsapp.deleteSession")})]},p.id))}),e.jsxs("div",{className:"wa-field wa-field-inline",children:[e.jsx("input",{type:"text",className:"wa-input",placeholder:a("config:whatsapp.addSessionPlaceholder"),value:w,onChange:p=>E(p.target.value),onKeyDown:p=>{p.key==="Enter"&&ie()}}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:ie,disabled:!w.trim()||V!==null,children:a("config:whatsapp.addSession")})]}),V&&e.jsxs("div",{className:"wa-qr-panel",children:[e.jsxs("div",{className:"wa-qr-header",children:[e.jsx("span",{children:a("config:whatsapp.qrPrompt",{id:V})}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:xe,children:a("config:whatsapp.cancelPairing")})]}),W?e.jsx("div",{className:"wa-qr-image",children:e.jsx("img",{src:W,alt:"WhatsApp pairing QR code"})}):e.jsxs("div",{className:"wa-qr-loading",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:a("config:whatsapp.waitingForQr")})]})]}),T&&!V&&e.jsx("div",{className:"wa-pairing-message",children:T})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.testMessage")}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-test-to",className:"wa-label",children:a("config:whatsapp.testTo")}),e.jsx("input",{id:"wa-test-to",type:"text",className:"wa-input",placeholder:a("config:whatsapp.testToPlaceholder"),value:j,onChange:p=>O(p.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-test-message",className:"wa-label",children:a("config:whatsapp.testMessageBody")}),e.jsx("textarea",{id:"wa-test-message",className:"wa-textarea",rows:4,placeholder:a("config:whatsapp.testMessageBodyPlaceholder"),value:K,onChange:p=>v(p.target.value)})]}),e.jsx("div",{className:"wa-field-inline wa-field-end",children:e.jsx("button",{type:"button",className:"btn btn-primary",onClick:_,disabled:!j.trim()||!K.trim()||J,children:a(J?"config:whatsapp.sending":"config:whatsapp.sendTest")})}),D&&e.jsxs("div",{className:`alert ${D.kind==="success"?"alert-success":"alert-error"}`,children:[e.jsx("span",{className:"alert-icon",children:e.jsx(L,{name:D.kind==="success"?"check":"warn",size:14})}),D.text]})]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left"}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:ue,children:a("config:whatsapp.close")}),e.jsx("button",{className:"btn btn-secondary",onClick:we,disabled:!fe||k,children:a("config:whatsapp.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:Te,disabled:!fe||k,children:a("config:whatsapp.save")})]})]})]})}),e.jsx(re,{isOpen:X,title:a("config:whatsapp.unsavedTitle"),message:a("config:whatsapp.unsavedMessage"),confirmLabel:a("config:whatsapp.closeAnyway"),cancelLabel:a("config:whatsapp.keepEditing"),variant:"danger",onConfirm:()=>{G(!1),o()},onClose:()=>G(!1)}),e.jsx(re,{isOpen:ge,title:a("config:whatsapp.clearKey"),message:a("config:whatsapp.confirmClearKey"),confirmLabel:a("config:whatsapp.clearKey"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{ke()},onClose:()=>ve(!1)}),e.jsx(re,{isOpen:Ae,title:a("config:whatsapp.deleteSession"),message:a("config:whatsapp.confirmDeleteSession",{id:S??""}),confirmLabel:a("config:whatsapp.deleteSession"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{Le()},onClose:()=>{de(!1),Z(null)}})]}):null}const Qe=["messages","statusChanges","taskComplete","errors","planReady","agentSpawned","agentStopped"];function Ue(s=!1){const o=H(),a={};return o&&(a.Authorization=`Bearer ${o}`),s&&(a["Content-Type"]="application/json"),a}async function Be(s,o){try{const a=await s.json();if(a&&typeof a.error=="string")return a.error;if(a&&typeof a.message=="string")return a.message}catch{}return`${o}: ${s.statusText}`}async function ca(){const s=await fetch(`${Y()}/api/whatsapp/notification-config`,{headers:Ue()});if(!s.ok)throw new Error(await Be(s,"Failed to fetch WhatsApp notification config"));return s.json()}async function ra(s){const o=await fetch(`${Y()}/api/whatsapp/notification-config`,{method:"PATCH",headers:Ue(!0),body:JSON.stringify(s)});if(!o.ok)throw new Error(await Be(o,"Failed to update WhatsApp notification config"));return o.json()}async function da(){const s=await fetch(`${Y()}/api/whatsapp/notification-config`,{method:"DELETE",headers:Ue()});if(!s.ok)throw new Error(await Be(s,"Failed to reset WhatsApp notification config"));return s.json()}const Ce={messages:!0,statusChanges:!0,taskComplete:!0,errors:!0,planReady:!0,agentSpawned:!0,agentStopped:!0},Ye={filter:{...Ce},recipient:""};function ma(s,o){if(s.recipient!==o.recipient)return!1;for(const a of Qe)if(s.filter[a]!==o.filter[a])return!1;return!0}function pa({isOpen:s,onClose:o}){const{t:a}=ee(["config"]),[i,m]=l.useState(Ye),[f,r]=l.useState(Ye),[n,h]=l.useState(!0),[I,b]=l.useState(null),[k,d]=l.useState(null),[g,u]=l.useState(!1),[y,x]=l.useState(!1),c=!ma(i,f),F=l.useCallback(async()=>{try{h(!0),b(null),d(null);const N=await ca(),T={filter:{...Ce,...N.filter},recipient:N.recipient??""};m(T),r(T)}catch(N){b(N instanceof Error?N.message:a("config:whatsappNotifications.errors.loadFailed"))}finally{h(!1)}},[a]);l.useEffect(()=>{s&&F()},[s,F]);const z=(N,T)=>{m(M=>({...M,filter:{...M.filter,[N]:T}})),b(null),d(null)},R=N=>{m(T=>({...T,recipient:N})),b(null),d(null)},w=async()=>{try{b(null),d(null);const N=await ra({filter:i.filter,recipient:i.recipient.trim()}),T={filter:{...Ce,...N.filter},recipient:N.recipient??""};m(T),r(T),d(a("config:whatsappNotifications.saved"))}catch(N){b(N instanceof Error?N.message:a("config:whatsappNotifications.errors.saveFailed"))}},E=()=>{m(f),b(null),d(null)},V=async()=>{try{b(null),d(null);const N=await da(),T={filter:{...Ce,...N.filter},recipient:N.recipient??""};m(T),r(T),d(a("config:whatsappNotifications.resetDone"))}catch(N){b(N instanceof Error?N.message:a("config:whatsappNotifications.errors.resetFailed"))}},B=()=>{if(c){u(!0);return}o()},W=N=>{N.key==="Escape"&&(N.preventDefault(),B())};return s?e.jsxs(ze,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:B,children:e.jsxs("div",{className:"whatsapp-notifications-modal",onClick:N=>N.stopPropagation(),onKeyDown:W,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:a("config:whatsappNotifications.title")}),e.jsx("button",{className:"modal-close",onClick:B,"aria-label":"Close",children:e.jsx(L,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:n?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:a("config:whatsappNotifications.loading")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:a("config:whatsappNotifications.description")}),I&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(L,{name:"warn",size:14})}),I]}),k&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(L,{name:"check",size:14})}),k]}),e.jsxs("section",{className:"wan-section",children:[e.jsx("h3",{className:"wan-section-title",children:a("config:whatsappNotifications.sections.recipient")}),e.jsxs("div",{className:"wan-field",children:[e.jsx("label",{htmlFor:"wan-recipient",className:"wan-label",children:a("config:whatsappNotifications.recipientLabel")}),e.jsx("input",{id:"wan-recipient",type:"text",className:"wan-input",placeholder:a("config:whatsappNotifications.recipientPlaceholder"),value:i.recipient,onChange:N=>R(N.target.value)}),e.jsx("span",{className:"wan-hint",children:a("config:whatsappNotifications.recipientHint")})]})]}),e.jsxs("section",{className:"wan-section",children:[e.jsx("h3",{className:"wan-section-title",children:a("config:whatsappNotifications.sections.events")}),e.jsx("p",{className:"wan-section-hint",children:a("config:whatsappNotifications.eventsHint")}),Qe.map(N=>e.jsxs("div",{className:"wan-toggle-row",children:[e.jsxs("div",{className:"wan-toggle-info",children:[e.jsx("span",{className:"wan-toggle-title",children:a(`config:whatsappNotifications.events.${N}.title`)}),e.jsx("span",{className:"wan-toggle-help",children:a(`config:whatsappNotifications.events.${N}.help`)})]}),e.jsxs("label",{className:"wan-toggle",children:[e.jsx("input",{type:"checkbox",checked:i.filter[N],onChange:T=>z(N,T.target.checked)}),e.jsx("span",{className:"wan-toggle-track",children:e.jsx("span",{className:"wan-toggle-thumb"})})]})]},N))]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left",children:e.jsx("button",{className:"btn btn-danger",onClick:()=>x(!0),disabled:n,children:a("config:whatsappNotifications.resetToDefaults")})}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:B,children:a("config:whatsappNotifications.close")}),e.jsx("button",{className:"btn btn-secondary",onClick:E,disabled:!c||n,children:a("config:whatsappNotifications.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:w,disabled:!c||n,children:a("config:whatsappNotifications.save")})]})]})]})}),e.jsx(re,{isOpen:g,title:a("config:whatsappNotifications.unsavedTitle"),message:a("config:whatsappNotifications.unsavedMessage"),confirmLabel:a("config:whatsappNotifications.closeAnyway"),cancelLabel:a("config:whatsappNotifications.keepEditing"),variant:"danger",onConfirm:()=>{u(!1),o()},onClose:()=>u(!1)}),e.jsx(re,{isOpen:y,title:a("config:whatsappNotifications.resetToDefaults"),message:a("config:whatsappNotifications.confirmReset"),confirmLabel:a("config:whatsappNotifications.resetToDefaults"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{V(),x(!1)},onClose:()=>x(!1)})]}):null}const ua=[{value:"auto",label:"Auto",icon:"🕐"},{value:"dawn",label:"Dawn",icon:"🌅"},{value:"day",label:"Day",icon:"☀️"},{value:"dusk",label:"Dusk",icon:"🌇"},{value:"night",label:"Night",icon:"🌙"}],ha=[{value:"none",label:"Grass",icon:"🌱"},{value:"concrete",label:"Concrete",icon:"🏗️"},{value:"galactic",label:"Galactic",icon:"🌌"},{value:"metal",label:"Metal",icon:"⚙️"},{value:"hex",label:"Hex",icon:"⬡"},{value:"circuit",label:"Circuit",icon:"🔌"},{value:"pokemon-stadium",label:"Pokemon",icon:"🔴"}],ga=[{value:"static",label:"Static",icon:"🧍"},{value:"idle",label:"Idle",icon:"🚶"},{value:"walk",label:"Walk",icon:"🚶♂️"},{value:"sprint",label:"Sprint",icon:"🏃"},{value:"jump",label:"Jump",icon:"⬆️"},{value:"fall",label:"Fall",icon:"⬇️"},{value:"crouch",label:"Crouch",icon:"🧎"},{value:"sit",label:"Sit",icon:"🪑"},{value:"die",label:"Die",icon:"💀"},{value:"emote-yes",label:"Yes",icon:"👍"},{value:"emote-no",label:"No",icon:"👎"}],fa=[{value:"normal",label:"Normal",icon:"🎨"},{value:"bw",label:"B&W",icon:"⬛"},{value:"sepia",label:"Sepia",icon:"🟤"},{value:"cool",label:"Cool",icon:"❄️"},{value:"warm",label:"Warm",icon:"🔥"},{value:"neon",label:"Neon",icon:"💜"}],xa=[{key:"showTrees",icon:"🌳",label:"Trees"},{key:"showBushes",icon:"🌿",label:"Bushes"},{key:"showHouse",icon:"🏠",label:"House"},{key:"showLamps",icon:"💡",label:"Lamps"},{key:"showGrass",icon:"🟩",label:"Grass"},{key:"showClouds",icon:"☁️",label:"Clouds"}],ba=[{value:null,label:"Auto",color:"linear-gradient(135deg, #4a90d9 0%, #0a1a2a 100%)"},{value:"#4a90d9",label:"Day Blue",color:"#4a90d9"},{value:"#0a1a2a",label:"Night",color:"#0a1a2a"},{value:"#ff6b35",label:"Sunset",color:"#ff6b35"},{value:"#1a0a2e",label:"Purple",color:"#1a0a2e"},{value:"#2d5a27",label:"Matrix",color:"#2d5a27"},{value:"#8b0000",label:"Blood",color:"#8b0000"},{value:"#000000",label:"Void",color:"#000000"}],ja={showTrees:"trees",showBushes:"bushes",showHouse:"house",showLamps:"lamps",showGrass:"grass",showClouds:"clouds"},va={none:"grass","pokemon-stadium":"pokemon"},Na={"emote-yes":"yes","emote-no":"no"},wa={"":"auto","#4a90d9":"dayBlue","#0a1a2a":"night","#ff6b35":"sunset","#1a0a2e":"purple","#2d5a27":"matrix","#8b0000":"blood","#000000":"void"};function Q({checked:s,onChange:o}){return e.jsxs("label",{className:"config-toggle",children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:s,onChange:a=>o(a.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})}function he({options:s,value:o,onChange:a,iconOnly:i=!1}){return e.jsx("div",{className:"chip-selector",children:s.map(m=>e.jsxs("button",{className:`chip ${o===m.value?"active":""}`,onClick:()=>a(m.value),title:m.label,children:[e.jsx("span",{className:"chip-icon",children:m.icon}),!i&&e.jsx("span",{className:"chip-label",children:m.label})]},m.value))})}function C({text:s,query:o}){if(!o.trim())return e.jsx(e.Fragment,{children:s});const a=s.toLowerCase(),i=o.toLowerCase(),m=a.indexOf(i);if(m===-1)return e.jsx(e.Fragment,{children:s});const f=s.slice(0,m),r=s.slice(m,m+o.length),n=s.slice(m+o.length);return e.jsxs(e.Fragment,{children:[f,e.jsx("mark",{className:"search-highlight",children:r}),n]})}const ya=[{id:"general",title:"General",keywords:["history","hide costs","grid","fps","power saving","performance","limit","editor","external editor","language","idioma","语言","vibration","haptic","intensity","tab title","tmux","process persistence"]},{id:"agentNames",title:"Agent Names",keywords:["agent","names","custom","characters","rename"]},{id:"defaultClass",title:"Default Spawn Class",keywords:["default","class","spawn","agent","scout","builder","random"]},{id:"appearance",title:"Appearance",keywords:["theme","appearance","color","dark","light","style","look"]},{id:"connection",title:"Connection",keywords:["backend","url","auth","token","reconnect","server","api","connect","codex","opencode","binary","path"]},{id:"scene",title:"Scene",keywords:["character","size","indicator","scale","time","dawn","day","dusk","night","auto"]},{id:"terrain",title:"Terrain",keywords:["trees","bushes","house","lamps","grass","clouds","fog","brightness","floor","sky","color","environment","battlefield","size","grid","simple","minimal","dark","clean"]},{id:"modelStyle",title:"Agent Model Style",keywords:["saturation","roughness","metalness","glow","emissive","reflections","wireframe","color mode","material","shader"]},{id:"animations",title:"Animations",keywords:["idle","working","animation","walk","run","sprint","jump","sit","crouch"]},{id:"secrets",title:"Secrets",keywords:["secrets","api","key","password","credentials","env","environment"]},{id:"systemPrompt",title:"System Prompt",keywords:["system","prompt","global","instructions","ai","agent","rules","guidelines"]},{id:"whatsapp",title:"WhatsApp Integration",keywords:["whatsapp","message","sms","integration","notification","baileys"]},{id:"whatsappNotifications",title:"WhatsApp Notifications",keywords:["whatsapp","notification","notifications","messages","status","toggle","filter","event","subscribe","plan","error","spawned","stopped"]},{id:"data",title:"Data",keywords:["export","import","backup","restore","save","load","json"]},{id:"integrations",title:"Integrations",keywords:["integrations","plugins","gmail","slack","jira","calendar","docx","email","config","setup"]},{id:"workflows",title:"Workflows",keywords:["workflow","automation","state machine","editor","actions","transitions","pipeline"]},{id:"triggers",title:"Triggers",keywords:["trigger","event","webhook","cron","slack","email","jira","matching","fire"]},{id:"monitoring",title:"Monitoring",keywords:["monitoring","logs","triggers","events","history","workflow","traces","audit","timeline"]},{id:"experimental",title:"Experimental",keywords:["experimental","2d","view","voice","assistant","speech","tts","text to speech","echo","prompt","duplicate"]},{id:"about",title:"About",keywords:["about","version","update","credits","github","releases"]}],$e=[{value:"auto",label:"Auto",icon:"🌐"},{value:"en",label:"English",icon:"🇺🇸"},{value:"zh-CN",label:"中文",icon:"🇨🇳"},{value:"es",label:"Español",icon:"🇪🇸"},{value:"hi",label:"हिन्दी",icon:"🇮🇳"},{value:"pt",label:"Português",icon:"🇧🇷"},{value:"ru",label:"Русский",icon:"🇷🇺"},{value:"ja",label:"日本語",icon:"🇯🇵"},{value:"de",label:"Deutsch",icon:"🇩🇪"},{value:"fr",label:"Français",icon:"🇫🇷"},{value:"it",label:"Italiano",icon:"🇮🇹"}];function ka({config:s,onChange:o,searchQuery:a="",onOpenIntegrationsModal:i,onOpenMonitoringModal:m,onOpenWorkflowEditor:f,onOpenTriggerManager:r}){var p;const{t:n}=ee(["config","common"]),h=Re(),I=bs(),[b,k]=l.useState(()=>js(be.DEFAULT_AGENT_CLASS)||"scout"),[d,g]=l.useState(h.settings.historyLimit),[u,y]=l.useState(()=>vs()),[x,c]=l.useState(!1),[F,z]=l.useState(""),[R,w]=l.useState(()=>H()),[E,V]=l.useState(!1),[B,W]=l.useState(!1),[N,T]=l.useState(""),[M,se]=l.useState(!1),[oe,j]=l.useState(!1),[O,K]=l.useState(!1),[v,D]=l.useState(""),[$,J]=l.useState(!1);l.useEffect(()=>{qs().then(D).catch(()=>{})},[]),l.useEffect(()=>{Vs().then(t=>{t!==h.settings.experimentalEchoPrompt&&A.updateSettings({experimentalEchoPrompt:t})}).catch(()=>{})},[]),l.useEffect(()=>{Hs().then(t=>{t!==h.settings.tmuxMode&&A.updateSettings({tmuxMode:t})}).catch(()=>{})},[]),l.useEffect(()=>Ns(t=>{y(t),c(!1)}),[]);const ae=ua.map(t=>({...t,label:n(`config:time.${t.value}`)})),X=ha.map(t=>({...t,label:n(`config:floor.${va[t.value]||t.value}`)})),G=ga.map(t=>({...t,label:n(`config:animation.${Na[t.value]||t.value}`)})),ge=fa.map(t=>({...t,label:n(`config:colorMode.${t.value}`)})),ve=xa.map(t=>({...t,label:n(`config:terrain.${ja[t.key]}`)})),Ae=ba.map(t=>({...t,label:n(`config:sky.${wa[t.value??""]}`)})),de=a.trim()?ya.filter(t=>{const P=a.toLowerCase();return t.title.toLowerCase().includes(P)||t.keywords.some(q=>q.toLowerCase().includes(P))}).map(t=>t.id):null,S=t=>de?de.includes(t):!0,Z=h.settings.customAgentNames||[],fe=Z.length>0?Z:ws,te=()=>{const t=N.trim();t&&!Z.includes(t)&&(A.updateSettings({customAgentNames:[...Z,t]}),T(""))},Ne=t=>{A.updateSettings({customAgentNames:Z.filter(P=>P!==t)})},me=()=>{A.updateSettings({customAgentNames:[]})},le=()=>{const t=F.trim();if(t){if(u.includes(t)){z("");return}y([...u,t]),c(!0),z("")}},Te=t=>{y(u.filter((P,q)=>q!==t)),c(!0)},we=(t,P)=>{const q=t+P;if(q<0||q>=u.length)return;const pe=u.slice();[pe[t],pe[q]]=[pe[q],pe[t]],y(pe),c(!0)},ue=()=>{ks(u),c(!1),De()},Ee=t=>{w(t),V(!0)},ye=()=>{Se(be.AUTH_TOKEN,R),V(!1),De()},Ie=t=>{D(t),J(!0)},ke=()=>{Ws(v).catch(()=>{}),J(!1)},ne=t=>{o({...s,terrain:{...s.terrain,...t}})},ie=t=>{o({...s,modelStyle:{...s.modelStyle,...t}})},xe=t=>{o({...s,animations:{...s.animations,...t}})},Pe=t=>{g(t),A.updateSettings({historyLimit:t})},Le=t=>{const P=s.terrain[t];typeof P=="boolean"&&ne({[t]:!P})},_=a.trim().length>0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"config-section",children:[de&&de.length===0&&e.jsx("div",{className:"config-no-results",children:n("config:noResults",{query:a})}),S("general")&&e.jsxs(U,{title:n("config:sections.general"),storageKey:"general",defaultOpen:!0,forceOpen:_&&S("general"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.history"),query:a})}),e.jsx("input",{type:"number",className:"config-input config-input-sm",value:d,onChange:t=>Pe(parseInt(t.target.value)||100),min:50,max:2e3,step:50})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.hideCosts"),query:a})}),e.jsx(Q,{checked:h.settings.hideCost,onChange:t=>A.updateSettings({hideCost:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.grid"),query:a})}),e.jsx(Q,{checked:s.gridVisible,onChange:t=>o({...s,gridVisible:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.showFPS"),query:a})}),e.jsx(Q,{checked:h.settings.showFPS,onChange:t=>A.updateSettings({showFPS:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.fpsLimit"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"120",step:"10",value:s.fpsLimit,onChange:t=>o({...s,fpsLimit:parseInt(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.fpsLimit===0?"∞":s.fpsLimit})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Experimental: Reduce FPS when idle to save power",children:[e.jsx(C,{text:n("config:general.powerSaving"),query:a})," ",e.jsx(L,{name:"bolt",size:12})]}),e.jsx(Q,{checked:h.settings.powerSaving,onChange:t=>A.updateSettings({powerSaving:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",title:"Wrap agent processes in tmux sessions so they survive server restarts (requires tmux installed)",children:e.jsx(C,{text:n("config:general.tmuxMode"),query:a})}),e.jsx(Q,{checked:h.settings.tmuxMode,onChange:async t=>{A.updateSettings({tmuxMode:t});try{await Gs(t)}catch(P){console.error("Failed to sync tmux mode setting to server:",P)}}})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.vibrationIntensity"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"5",step:"1",value:h.settings.vibrationIntensity,onChange:t=>A.updateSettings({vibrationIntensity:parseInt(t.target.value)})}),e.jsx("span",{className:"config-value",children:h.settings.vibrationIntensity===0?n("config:vibrationValues.off"):h.settings.vibrationIntensity===1?n("config:vibrationValues.ultraLight"):h.settings.vibrationIntensity===2?n("config:vibrationValues.veryLight"):h.settings.vibrationIntensity===3?n("config:vibrationValues.light"):h.settings.vibrationIntensity===4?n("config:vibrationValues.medium"):n("config:vibrationValues.heavy")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.externalEditor"),query:a})}),e.jsx("input",{type:"text",className:"config-input",placeholder:n("config:general.externalEditorPlaceholder"),value:h.settings.externalEditorCommand||"",onChange:t=>A.updateSettings({externalEditorCommand:t.target.value})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.tabTitle"),query:a})}),e.jsx("input",{type:"text",className:"config-input",placeholder:n("config:general.tabTitlePlaceholder"),value:h.settings.tabTitle||"",onChange:t=>A.updateSettings({tabTitle:t.target.value})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:general.language"),query:a})}),e.jsx(he,{options:$e,value:localStorage.getItem("tide-commander-language-mode")==="manual"?((p=$e.find(t=>t.value!=="auto"&&Oe.language.startsWith(t.value.split("-")[0])))==null?void 0:p.value)||"en":"auto",onChange:t=>{var P;if(t==="auto"){localStorage.setItem("tide-commander-language-mode","auto");const q=navigator.language,pe=((P=$e.find(Ke=>Ke.value!=="auto"&&q.startsWith(Ke.value.split("-")[0])))==null?void 0:P.value)||"en";Oe.changeLanguage(pe)}else localStorage.setItem("tide-commander-language-mode","manual"),Oe.changeLanguage(t)}})]})]}),S("agentNames")&&e.jsx(U,{title:n("config:sections.agentNames"),storageKey:"agentNames",defaultOpen:!1,forceOpen:_&&S("agentNames"),children:e.jsxs("div",{className:"agent-names-section",children:[e.jsx("span",{className:"config-hint",children:Z.length>0?n("config:agentNames.customConfigured",{count:Z.length}):n("config:agentNames.usingDefaults")}),e.jsxs("div",{className:"agent-names-input-row",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",placeholder:n("config:agentNames.addPlaceholder"),value:N,onChange:t=>T(t.target.value),onKeyDown:t=>{t.key==="Enter"&&te()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:te,disabled:!N.trim(),title:n("config:agentNames.addName"),children:"+"})]}),e.jsx("div",{className:"agent-names-list",children:fe.map((t,P)=>e.jsxs("div",{className:"agent-name-chip",children:[e.jsx("span",{className:"agent-name-text",children:t}),Z.length>0&&e.jsx("button",{className:"agent-name-remove",onClick:()=>Ne(t),title:n("common:buttons.remove"),children:"x"})]},`${t}-${P}`))}),Z.length>0&&e.jsx("button",{className:"config-btn config-btn-link",onClick:me,children:n("common:buttons.resetToDefaults")})]})}),S("defaultClass")&&e.jsx(U,{title:"Default Spawn Class",storageKey:"defaultClass",defaultOpen:!1,forceOpen:_&&S("defaultClass"),children:e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-hint",children:'Class pre-selected when the spawn modal opens. "Random" picks a different class each time.'}),e.jsxs("div",{className:"agent-names-list",style:{flexWrap:"wrap",gap:"6px",marginTop:"8px"},children:[e.jsx("div",{className:`agent-name-chip${b==="random"?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{k("random"),Se(be.DEFAULT_AGENT_CLASS,"random")},children:e.jsx("span",{className:"agent-name-text",children:"🎲 Random"})}),Object.entries(ys).map(([t,P])=>e.jsx("div",{className:`agent-name-chip${b===t?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{k(t),Se(be.DEFAULT_AGENT_CLASS,t)},children:e.jsxs("span",{className:"agent-name-text",children:[P.icon," ",t.charAt(0).toUpperCase()+t.slice(1)]})},t)),I.map(t=>e.jsx("div",{className:`agent-name-chip${b===t.id?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{k(t.id),Se(be.DEFAULT_AGENT_CLASS,t.id)},children:e.jsxs("span",{className:"agent-name-text",children:[t.icon," ",t.name]})},t.id))]})]})}),S("appearance")&&e.jsx(U,{title:n("config:sections.appearance"),storageKey:"appearance",defaultOpen:!1,forceOpen:_&&S("appearance"),children:e.jsx(Qs,{})}),S("connection")&&e.jsxs(U,{title:n("config:sections.connection"),storageKey:"connection",defaultOpen:!1,forceOpen:_&&S("connection"),children:[e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:connection.backendUrl"),query:a})}),e.jsx("div",{className:"backend-urls-list",children:u.map((t,P)=>e.jsxs("div",{className:"backend-url-row",children:[e.jsx("span",{className:"backend-url-priority",title:n("config:connection.priorityLabel",{defaultValue:"Priority"}),children:P+1}),e.jsx("span",{className:"backend-url-text",title:t,children:t}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>we(P,-1),disabled:P===0,title:n("config:connection.moveUp",{defaultValue:"Move up"}),children:"↑"}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>we(P,1),disabled:P===u.length-1,title:n("config:connection.moveDown",{defaultValue:"Move down"}),children:"↓"}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>Te(P),title:n("common:buttons.remove"),children:"x"})]},`${t}-${P}`))}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",value:F,onChange:t=>z(t.target.value),placeholder:n("config:connection.addUrlPlaceholder",{defaultValue:"http://host:port"}),onKeyDown:t=>{t.key==="Enter"&&le()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:le,disabled:!F.trim(),title:n("config:connection.addUrl",{defaultValue:"Add URL"}),children:"+"}),x&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:ue,title:n("config:connection.saveAndReconnect"),children:n("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:n("config:connection.urlsHint",{defaultValue:"Tried in order on connect; the first reachable host wins. Leave empty for auto-detect."})})]}),e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:connection.authToken"),query:a})}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:B?"text":"password",className:"config-input config-input-full",value:R,onChange:t=>Ee(t.target.value),placeholder:n("config:connection.tokenPlaceholder"),onKeyDown:t=>{t.key==="Enter"&&E&&ye()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>W(!B),title:n(B?"config:connection.hideToken":"config:connection.showToken"),children:e.jsx(L,{name:B?"eye-closed":"eye",size:14})}),E&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:ye,title:n("config:connection.saveAndReconnect"),children:n("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:n("config:connection.tokenRequired")})]}),e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:connection.codexBinaryPath"),query:a})}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",value:v,onChange:t=>Ie(t.target.value),placeholder:n("config:connection.codexBinaryPathPlaceholder"),onKeyDown:t=>{t.key==="Enter"&&$&&ke()}}),$&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:ke,children:n("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:n("config:connection.codexBinaryPathHint")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("common:buttons.reconnect"),query:a})}),e.jsx("button",{className:"config-btn",onClick:()=>De(),title:"Force reconnect to server",children:n("common:buttons.reconnect")})]})]}),S("scene")&&e.jsxs(U,{title:n("config:sections.scene"),storageKey:"scene",defaultOpen:!1,forceOpen:_&&S("scene"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:scene.characterSize"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"3.0",step:"0.1",value:s.characterScale,onChange:t=>o({...s,characterScale:parseFloat(t.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.characterScale.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:scene.scale2d",{defaultValue:"2D Scale"}),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"2.0",step:"0.1",value:s.scale2d,onChange:t=>o({...s,scale2d:parseFloat(t.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.scale2d.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:scene.scale3d",{defaultValue:"3D Scale"}),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"2.0",step:"0.1",value:s.scale3d,onChange:t=>o({...s,scale3d:parseFloat(t.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.scale3d.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:scene.show2DTaskLabels",{defaultValue:"Show 2D task labels"}),query:a})}),e.jsx(Q,{checked:s.show2DTaskLabels,onChange:t=>o({...s,show2DTaskLabels:t})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:scene.time"),query:a})}),e.jsx(he,{options:ae,value:s.timeMode,onChange:t=>o({...s,timeMode:t}),iconOnly:!0})]})]}),S("terrain")&&e.jsxs(U,{title:n("config:sections.terrain"),storageKey:"terrain",defaultOpen:!1,forceOpen:_&&S("terrain"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:terrainSettings.simpleMode",{defaultValue:"Simple Mode"}),query:a})}),e.jsx(Q,{checked:s.terrain.simpleMode??!1,onChange:t=>ne({simpleMode:t})})]}),e.jsx("div",{className:"terrain-icons",style:{opacity:s.terrain.simpleMode?.4:1,pointerEvents:s.terrain.simpleMode?"none":"auto"},children:ve.map(t=>e.jsx("button",{className:`terrain-icon-btn ${s.terrain[t.key]?"active":""}`,onClick:()=>Le(t.key),title:t.label,children:t.icon},t.key))}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:terrainSettings.fog"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"2",step:"0.1",value:s.terrain.fogDensity,onChange:t=>ne({fogDensity:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.fogDensity===0?n("config:fogValues.off"):s.terrain.fogDensity<=1?n("config:fogValues.low"):n("config:fogValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:terrainSettings.brightness"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.2",max:"2",step:"0.1",value:s.terrain.brightness,onChange:t=>ne({brightness:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.brightness<=.5?n("config:brightnessValues.dark"):s.terrain.brightness<=1.2?n("config:brightnessValues.normal"):n("config:brightnessValues.bright")})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:terrainSettings.floor"),query:a})}),e.jsx(he,{options:X,value:s.terrain.floorStyle,onChange:t=>ne({floorStyle:t}),iconOnly:!0})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:terrainSettings.sky"),query:a})}),e.jsx("div",{className:"sky-color-selector",children:Ae.map(t=>e.jsx("button",{className:`sky-color-btn ${s.terrain.skyColor===t.value?"active":""}`,onClick:()=>ne({skyColor:t.value}),title:t.label,style:{background:t.color}},t.value??"auto"))})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:terrainSettings.battlefieldSize"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"30",max:"200",step:"10",value:s.terrain.battlefieldSize,onChange:t=>ne({battlefieldSize:parseInt(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.battlefieldSize})]})]}),S("modelStyle")&&e.jsxs(U,{title:n("config:sections.modelStyle"),storageKey:"modelStyle",defaultOpen:!1,forceOpen:_&&S("modelStyle"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:modelStyleSettings.saturation"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"2",step:"0.1",value:s.modelStyle.saturation,onChange:t=>ie({saturation:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.saturation<=.3?n("config:saturationValues.gray"):s.modelStyle.saturation<=1.2?n("config:saturationValues.normal"):n("config:saturationValues.vivid")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:modelStyleSettings.roughness"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"1",step:"0.1",value:s.modelStyle.roughness,onChange:t=>ie({roughness:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.roughness<0?n("config:roughnessValues.auto"):s.modelStyle.roughness<=.3?n("config:roughnessValues.glossy"):s.modelStyle.roughness<=.7?n("config:roughnessValues.normal"):n("config:roughnessValues.matte")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:modelStyleSettings.metalness"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"1",step:"0.1",value:s.modelStyle.metalness,onChange:t=>ie({metalness:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.metalness<0?n("config:metalnessValues.auto"):s.modelStyle.metalness<=.3?n("config:metalnessValues.plastic"):s.modelStyle.metalness<=.7?n("config:metalnessValues.mixed"):n("config:metalnessValues.metal")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:modelStyleSettings.glow"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"1",step:"0.05",value:s.modelStyle.emissiveBoost,onChange:t=>ie({emissiveBoost:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.emissiveBoost<=.1?n("config:glowValues.off"):s.modelStyle.emissiveBoost<=.4?n("config:glowValues.low"):s.modelStyle.emissiveBoost<=.7?n("config:glowValues.med"):n("config:glowValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:modelStyleSettings.reflections"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"2",step:"0.1",value:s.modelStyle.envMapIntensity,onChange:t=>ie({envMapIntensity:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.envMapIntensity<0?n("config:reflectionValues.auto"):s.modelStyle.envMapIntensity<=.3?n("config:reflectionValues.low"):s.modelStyle.envMapIntensity<=1?n("config:reflectionValues.normal"):n("config:reflectionValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:modelStyleSettings.wireframe"),query:a})}),e.jsx(Q,{checked:s.modelStyle.wireframe,onChange:t=>ie({wireframe:t})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:modelStyleSettings.colorMode"),query:a})}),e.jsx(he,{options:ge,value:s.modelStyle.colorMode,onChange:t=>ie({colorMode:t}),iconOnly:!0})]})]}),S("animations")&&e.jsxs(U,{title:n("config:sections.animations"),storageKey:"animations",defaultOpen:!1,forceOpen:_&&S("animations"),children:[e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:animationSettings.idle"),query:a})}),e.jsx(he,{options:G,value:s.animations.idleAnimation,onChange:t=>xe({idleAnimation:t}),iconOnly:!0})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:animationSettings.working"),query:a})}),e.jsx(he,{options:G,value:s.animations.workingAnimation,onChange:t=>xe({workingAnimation:t}),iconOnly:!0})]})]}),S("secrets")&&e.jsx(U,{title:n("config:sections.secrets"),storageKey:"secrets",defaultOpen:!1,forceOpen:_&&S("secrets"),children:e.jsx(_s,{})}),S("systemPrompt")&&e.jsx(U,{title:n("config:sections.systemPrompt"),storageKey:"systemPrompt",defaultOpen:!1,forceOpen:_&&S("systemPrompt"),children:e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:systemPrompt.title"),query:a})}),e.jsx("button",{className:"config-button",onClick:()=>se(!0),children:n("config:systemPrompt.editPrompt")})]})}),S("whatsapp")&&e.jsx(U,{title:n("config:sections.whatsapp"),storageKey:"whatsapp",defaultOpen:!1,forceOpen:_&&S("whatsapp"),children:e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:whatsapp.title"),query:a})}),e.jsx("button",{className:"config-button",onClick:()=>j(!0),children:n("config:whatsapp.editConfig")})]})}),S("whatsappNotifications")&&e.jsx(U,{title:n("config:sections.whatsappNotifications"),storageKey:"whatsappNotifications",defaultOpen:!1,forceOpen:_&&S("whatsappNotifications"),children:e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(C,{text:n("config:whatsappNotifications.title"),query:a})}),e.jsx("button",{className:"config-button",onClick:()=>K(!0),children:n("config:whatsappNotifications.editButton")})]})}),S("data")&&e.jsx(U,{title:n("config:sections.data"),storageKey:"data",defaultOpen:!1,forceOpen:_&&S("data"),children:e.jsx(Xs,{})}),S("integrations")&&e.jsx(U,{title:"Integrations",storageKey:"integrations",defaultOpen:!1,forceOpen:_&&S("integrations"),children:e.jsx(aa,{onOpenModal:t=>i==null?void 0:i(t)})}),S("workflows")&&e.jsxs(U,{title:"Workflows",storageKey:"workflows",defaultOpen:!1,forceOpen:_&&S("workflows"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(C,{text:"Create and manage automated workflow pipelines with visual state machine editor",query:a})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>f==null?void 0:f(),children:"Open Workflow Editor"})})]}),S("triggers")&&e.jsxs(U,{title:"Triggers",storageKey:"triggers",defaultOpen:!1,forceOpen:_&&S("triggers"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(C,{text:"Create and manage event-driven triggers that fire agents with templates",query:a})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>r==null?void 0:r(),children:"Open Trigger Manager"})})]}),S("monitoring")&&e.jsxs(U,{title:"Monitoring",storageKey:"monitoring",defaultOpen:!1,forceOpen:_&&S("monitoring"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(C,{text:"View event logs, trigger history, workflow traces, and system stats",query:a})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>m==null?void 0:m(),children:"Open Monitoring & Logs"})})]}),S("experimental")&&e.jsxs(U,{title:n("config:sections.experimental"),storageKey:"experimental",defaultOpen:!1,forceOpen:_&&S("experimental"),children:[e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Lightweight 2D top-down view for better performance",children:[e.jsx(C,{text:n("config:experimental.2dView"),query:a})," ",e.jsx(L,{name:"map",size:12})]}),e.jsx(Q,{checked:h.settings.experimental2DView,onChange:t=>A.updateSettings({experimental2DView:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Voice assistant for hands-free agent control",children:[e.jsx(C,{text:n("config:experimental.voiceAssistant"),query:a})," ",e.jsx(L,{name:"microphone",size:12})]}),e.jsx(Q,{checked:h.settings.experimentalVoiceAssistant,onChange:t=>A.updateSettings({experimentalVoiceAssistant:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Text-to-speech for reading agent responses",children:[e.jsx(C,{text:n("config:experimental.tts"),query:a})," ",e.jsx(L,{name:"speaker-on",size:12})]}),e.jsx(Q,{checked:h.settings.experimentalTTS,onChange:t=>A.updateSettings({experimentalTTS:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",title:"Duplicate system prompt for improved LLM attention coverage. Increases input token usage.",children:e.jsx(C,{text:n("config:experimental.echoPrompt"),query:a})}),e.jsx(Q,{checked:h.settings.experimentalEchoPrompt,onChange:async t=>{A.updateSettings({experimentalEchoPrompt:t});try{await Ms(t)}catch(P){console.error("Failed to sync echo prompt setting to server:",P)}}})]}),e.jsx("span",{className:"config-hint",children:n("config:experimental.hint")})]}),S("about")&&e.jsx(U,{title:n("config:sections.about"),storageKey:"about",defaultOpen:!1,forceOpen:_&&S("about"),children:e.jsx(ea,{})})]}),e.jsx(ta,{isOpen:M,onClose:()=>se(!1)}),e.jsx(la,{isOpen:oe,onClose:()=>j(!1)}),e.jsx(pa,{isOpen:O,onClose:()=>K(!1)})]})}function Ta({onConfigChange:s,onToolChange:o,config:a,isOpen:i,onClose:m,onOpenBuildingModal:f,onOpenAreaExplorer:r,onOpenIntegrationsModal:n,onOpenMonitoringModal:h,onOpenWorkflowEditor:I,onOpenTriggerManager:b}){const{t:k}=ee(["config","common"]),d=Re(),g=Array.from(d.areas.values()),u=Array.from(d.buildings.values()),[y,x]=l.useState(""),c=l.useRef(null);if(l.useEffect(()=>{const w=E=>{E.key==="Escape"&&i&&m()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i,m]),l.useEffect(()=>{if(i&&c.current){if(typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches)return;const E=setTimeout(()=>{var V;(V=c.current)==null||V.focus()},50);return()=>clearTimeout(E)}},[i]),!i)return null;const F=w=>{const E=d.activeTool===w?null:w;o(E)},z=w=>{A.selectArea(d.selectedAreaId===w?null:w),o("select")},R=(w,E)=>{w.stopPropagation(),A.deleteArea(E)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbox-backdrop",onClick:m}),e.jsxs("aside",{className:"toolbox",children:[e.jsxs("div",{className:"toolbox-header",children:[e.jsx("span",{children:k("config:title")}),e.jsx("button",{className:"toolbox-close-btn",onClick:m,title:k("common:buttons.close"),children:"×"})]}),e.jsxs("div",{className:"toolbox-search",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:c,type:"text",placeholder:k("config:searchPlaceholder"),value:y,onChange:w=>x(w.target.value),className:"toolbox-search-input"}),y&&e.jsx("button",{className:"toolbox-search-clear",onClick:()=>x(""),children:"×"})]}),e.jsxs("div",{className:"toolbox-content",children:[e.jsx("div",{className:"toolbox-section toolbox-section-collapsible",children:e.jsxs(U,{title:k("config:areas.title",{count:g.length}),storageKey:"areas",children:[e.jsxs("div",{className:"tool-buttons",children:[e.jsx("button",{className:`tool-btn ${d.activeTool==="select"?"active":""}`,onClick:()=>F("select"),title:k("config:tools.select"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"})})})}),e.jsx("button",{className:`tool-btn ${d.activeTool==="rectangle"?"active":""}`,onClick:()=>F("rectangle"),title:k("config:tools.rectangle"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"})})})}),e.jsx("button",{className:`tool-btn ${d.activeTool==="circle"?"active":""}`,onClick:()=>F("circle"),title:k("config:tools.circle"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("circle",{cx:"12",cy:"12",r:"9"})})})})]}),e.jsx("div",{className:"areas-list",children:g.length===0?e.jsx("div",{className:"areas-empty",children:k("config:areas.drawToCreate")}):g.map(w=>e.jsx(Ps,{area:w,isSelected:d.selectedAreaId===w.id,onClick:()=>z(w.id),onDelete:E=>R(E,w.id)},w.id))})]})}),d.selectedAreaId&&e.jsx(zs,{area:d.areas.get(d.selectedAreaId),onClose:()=>A.selectArea(null),onOpenFolder:r}),e.jsx("div",{className:"toolbox-section toolbox-section-collapsible",children:e.jsx(U,{title:k("config:buildings.title",{count:u.length}),storageKey:"buildings",headerExtra:e.jsx("button",{className:"add-building-btn",onClick:w=>{w.stopPropagation(),f==null||f()},title:k("config:buildings.addBuilding"),children:"+"}),children:e.jsx("div",{className:"buildings-list",children:u.length===0?e.jsx("div",{className:"buildings-empty",children:k("config:buildings.clickToAdd")}):u.map(w=>e.jsx(Ls,{building:w,isSelected:d.selectedBuildingIds.has(w.id),onClick:()=>{A.selectBuilding(d.selectedBuildingIds.has(w.id)?null:w.id)},onEdit:()=>f==null?void 0:f(w.id)},w.id))})})}),d.selectedBuildingIds.size===1&&(()=>{const w=Array.from(d.selectedBuildingIds)[0],E=d.buildings.get(w);return E?e.jsx(Fs,{building:E,onClose:()=>A.selectBuilding(null),onOpenModal:()=>f==null?void 0:f(w)}):null})(),e.jsx(ka,{config:a,onChange:s,searchQuery:y,onOpenIntegrationsModal:n,onOpenMonitoringModal:h,onOpenWorkflowEditor:I,onOpenTriggerManager:b})]})]})]})}export{Ta as Toolbox};
|