@intent-hq/web 2.387.0 → 2.387.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{B3ziY5oo.js → -lHTHpP1.js} +2 -2
  3. package/web/app/immutable/chunks/{C4t02ICg.js → 008oakff.js} +2 -2
  4. package/web/app/immutable/chunks/{D-aEx3GL.js → 0x2uouHf.js} +1 -1
  5. package/web/app/immutable/chunks/{BK0IkwFP.js → 50A7Z_-B.js} +2 -2
  6. package/web/app/immutable/chunks/{9fNNDfgo.js → 5PJaIC3r.js} +1 -1
  7. package/web/app/immutable/chunks/{cc1gQUub.js → 9-uroABC.js} +1 -1
  8. package/web/app/immutable/chunks/{CY4ZK6xA.js → AOZzp8ty.js} +3 -3
  9. package/web/app/immutable/chunks/{C6rcni5e.js → AYY4LgeX.js} +1 -1
  10. package/web/app/immutable/chunks/{DXI99C-u.js → B-zoUUuH.js} +1 -1
  11. package/web/app/immutable/chunks/{BPscmH6M.js → B00JHs7f.js} +1 -1
  12. package/web/app/immutable/chunks/{BuiwW61u.js → B0ezV3l2.js} +1 -1
  13. package/web/app/immutable/chunks/{-2rOENSl.js → B3MH86Vn.js} +1 -1
  14. package/web/app/immutable/chunks/{cpPIph2M.js → B3TMsgS_.js} +1 -1
  15. package/web/app/immutable/chunks/{CNl453qs.js → B43V2T0m.js} +1 -1
  16. package/web/app/immutable/chunks/{BXlN4FOb.js → B8xvO_6_.js} +1 -1
  17. package/web/app/immutable/chunks/{DaMlaKH_.js → B9y0cZhw.js} +1 -1
  18. package/web/app/immutable/chunks/{6uD0LviT.js → BCXPUO8b.js} +1 -1
  19. package/web/app/immutable/chunks/{CSlvwZw1.js → BCvggkji.js} +1 -1
  20. package/web/app/immutable/chunks/{ClQE9kQf.js → BDNdgg66.js} +1 -1
  21. package/web/app/immutable/chunks/{BFMlH_mp.js → BDWHrJG-.js} +2 -2
  22. package/web/app/immutable/chunks/{DtVrXGBM.js → BDlra3t9.js} +1 -1
  23. package/web/app/immutable/chunks/{T-5C1GqS.js → BDt9E5uz.js} +1 -1
  24. package/web/app/immutable/chunks/{CQA1q0F9.js → BIRGsT3P.js} +1 -1
  25. package/web/app/immutable/chunks/{CoAfXTHr.js → BI_DusvG.js} +1 -1
  26. package/web/app/immutable/chunks/{XK8g38bo.js → BJexyObh.js} +1 -1
  27. package/web/app/immutable/chunks/{qm1BBGRe.js → BL-MsXUm.js} +7 -7
  28. package/web/app/immutable/chunks/{gHZWxIPZ.js → BLkSfPBb.js} +1 -1
  29. package/web/app/immutable/chunks/{CY2g-8Xo.js → BPQAdw1o.js} +1 -1
  30. package/web/app/immutable/chunks/{C07_BcWL.js → BRKRniXi.js} +1 -1
  31. package/web/app/immutable/chunks/{ygDvZWWC.js → BRjGoMQ9.js} +1 -1
  32. package/web/app/immutable/chunks/{DhVLJG6D.js → BSE7V9gR.js} +1 -1
  33. package/web/app/immutable/chunks/{CoCy46Yy.js → BUV-totk.js} +1 -1
  34. package/web/app/immutable/chunks/{Chg0KuUy.js → BUuO1cTh.js} +2 -2
  35. package/web/app/immutable/chunks/{rlNXEIUc.js → BWPNcv11.js} +1 -1
  36. package/web/app/immutable/chunks/{DGj-492Z.js → BXLAqQEF.js} +2 -2
  37. package/web/app/immutable/chunks/{Cyr0PKv3.js → Be8Ashad.js} +1 -1
  38. package/web/app/immutable/chunks/{CqGq5PHb.js → Beo-CJDg.js} +1 -1
  39. package/web/app/immutable/chunks/{DqEoTQds.js → BgLEGr1h.js} +1 -1
  40. package/web/app/immutable/chunks/{CoOgBJzu.js → BherRhQp.js} +1 -1
  41. package/web/app/immutable/chunks/{B79iAtSu.js → Bjf7hugP.js} +2 -2
  42. package/web/app/immutable/chunks/{w-7j2Qtq.js → BkMXle2_.js} +1 -1
  43. package/web/app/immutable/chunks/{BkcO6l5G.js → Bksce3O_.js} +1 -1
  44. package/web/app/immutable/chunks/{BlAMrm5X.js → BsTFmNb9.js} +1 -1
  45. package/web/app/immutable/chunks/{DQ8CqY9L.js → BxLkg7uH.js} +2 -2
  46. package/web/app/immutable/chunks/{DuoQQplG.js → Bxy-dKiU.js} +1 -1
  47. package/web/app/immutable/chunks/{CrvtnK13.js → C2bGK2Dk.js} +6 -6
  48. package/web/app/immutable/chunks/{ewL2yuZ8.js → C4iGtRjS.js} +1 -1
  49. package/web/app/immutable/chunks/{pJyYpzre.js → C8xlptKa.js} +1 -1
  50. package/web/app/immutable/chunks/{DNnmVx8j.js → CAaPJl7G.js} +1 -1
  51. package/web/app/immutable/chunks/{DP2r4UWt.js → CAgbd5Ti.js} +1 -1
  52. package/web/app/immutable/chunks/{Bt11uxE8.js → CBkBKkDd.js} +4 -4
  53. package/web/app/immutable/chunks/{ExR0UceK.js → CElnCtuM.js} +1 -1
  54. package/web/app/immutable/chunks/{D2ch709U.js → CI8Lw58b.js} +1 -1
  55. package/web/app/immutable/chunks/{CW4vzFn_.js → CJ1JqFmW.js} +1 -1
  56. package/web/app/immutable/chunks/{ClSbVEed.js → CQLtSEV2.js} +1 -1
  57. package/web/app/immutable/chunks/{CVd7xnlx.js → CQjRAr0U.js} +1 -1
  58. package/web/app/immutable/chunks/{DQpDIYyw.js → CR20hpZS.js} +1 -1
  59. package/web/app/immutable/chunks/{GTsIF2uA.js → CS6vI0me.js} +1 -1
  60. package/web/app/immutable/chunks/{Dn_aCJkC.js → CSvryKTi.js} +1 -1
  61. package/web/app/immutable/chunks/{DoY7_Wfd.js → CV2tYqJV.js} +1 -1
  62. package/web/app/immutable/chunks/{BJEUIKTL.js → CVhzAujT.js} +1 -1
  63. package/web/app/immutable/chunks/{DcRqMoeH.js → CWsF2_VC.js} +1 -1
  64. package/web/app/immutable/chunks/{DRXgE6SQ.js → CcT7kKD0.js} +1 -1
  65. package/web/app/immutable/chunks/{Cuqu6DgP.js → Ccr5qYxN.js} +1 -1
  66. package/web/app/immutable/chunks/{CAiDxi6i.js → CdaZbV8l.js} +3 -3
  67. package/web/app/immutable/chunks/{r2R1I-D0.js → Ce0BIIDa.js} +1 -1
  68. package/web/app/immutable/chunks/{DCL7QtVR.js → CfbxOJat.js} +1 -1
  69. package/web/app/immutable/chunks/{CD9WEaPg.js → CfhdjjBQ.js} +1 -1
  70. package/web/app/immutable/chunks/{CCzan1r_.js → CkSfh61f.js} +1 -1
  71. package/web/app/immutable/chunks/{BSu_WKe5.js → CmbDm8yU.js} +1 -1
  72. package/web/app/immutable/chunks/{D_AhXAPc.js → CnskB1XE.js} +1 -1
  73. package/web/app/immutable/chunks/{aR8LYT4O.js → Cof8gmNK.js} +1 -1
  74. package/web/app/immutable/chunks/{Byr10Y9u.js → Cp82YYua.js} +1 -1
  75. package/web/app/immutable/chunks/{DNZCPKpq.js → CsxKvalJ.js} +1 -1
  76. package/web/app/immutable/chunks/{DzTn7KcX.js → CuNu9amm.js} +1 -1
  77. package/web/app/immutable/chunks/{BVmCM-pH.js → CvHiGYhL.js} +1 -1
  78. package/web/app/immutable/chunks/{oHUzFHtp.js → Cw2Jpa3G.js} +2 -2
  79. package/web/app/immutable/chunks/{C-y1uW-U.js → CyTx9--U.js} +1 -1
  80. package/web/app/immutable/chunks/{BAAQt1ZW.js → D1O8c-XE.js} +1 -1
  81. package/web/app/immutable/chunks/{D24Of5Kd.js → D2F02ltW.js} +1 -1
  82. package/web/app/immutable/chunks/{Ck8ZqpbB.js → D353gQK9.js} +1 -1
  83. package/web/app/immutable/chunks/{gJJMUdOI.js → D4HnBWIz.js} +1 -1
  84. package/web/app/immutable/chunks/{Cs-DtA5c.js → D6kOheez.js} +1 -1
  85. package/web/app/immutable/chunks/{CJ7hw6mW.js → D8nUBH9m.js} +1 -1
  86. package/web/app/immutable/chunks/{Bl72eYFn.js → DABB0YKb.js} +1 -1
  87. package/web/app/immutable/chunks/{BuTcdZo7.js → DKUSDh19.js} +1 -1
  88. package/web/app/immutable/chunks/{B9GWGWit.js → DMEYEHEJ.js} +1 -1
  89. package/web/app/immutable/chunks/{DmWvRjk6.js → DQdW3cIp.js} +1 -1
  90. package/web/app/immutable/chunks/{DUFN_Pzm.js → DTp2ogAW.js} +1 -1
  91. package/web/app/immutable/chunks/{CMsGHYhn.js → DVdxemX2.js} +1 -1
  92. package/web/app/immutable/chunks/{DlfbUU6o.js → DXAvNH3m.js} +1 -1
  93. package/web/app/immutable/chunks/{CcgSaDDB.js → DYtAW_JF.js} +1 -1
  94. package/web/app/immutable/chunks/{CTVz-pXS.js → DZ5jcXxx.js} +3 -3
  95. package/web/app/immutable/chunks/{Bbae4OrB.js → DgXUCDp0.js} +2 -2
  96. package/web/app/immutable/chunks/{CUxtJz1o.js → DiGF1QZI.js} +1 -1
  97. package/web/app/immutable/chunks/{B6-aVrNf.js → DjWdAsv4.js} +4 -4
  98. package/web/app/immutable/chunks/{CS6HVyHp.js → DkM6pApv.js} +1 -1
  99. package/web/app/immutable/chunks/{Bsru2omj.js → DmBIaaw1.js} +1 -1
  100. package/web/app/immutable/chunks/{BFi0zRRv.js → DoOGebPl.js} +1 -1
  101. package/web/app/immutable/chunks/{I9b9apiN.js → DsP8kMCe.js} +1 -1
  102. package/web/app/immutable/chunks/{Blt813S0.js → DwHRyZvZ.js} +1 -1
  103. package/web/app/immutable/chunks/{CbQ8NVeY.js → DzEQS47t.js} +1 -1
  104. package/web/app/immutable/chunks/{BcrN1yjB.js → DzX7N4dl.js} +1 -1
  105. package/web/app/immutable/chunks/{C53ouDFl.js → E-oQnJBy.js} +1 -1
  106. package/web/app/immutable/chunks/{Db1BGAZN.js → E0h7d-uJ.js} +1 -1
  107. package/web/app/immutable/chunks/{CACH34FC.js → E4QyIuMc.js} +1 -1
  108. package/web/app/immutable/chunks/{CbQYR4R2.js → N6CYAKjU.js} +3 -3
  109. package/web/app/immutable/chunks/{BlJAndP6.js → Q--Jdcqq.js} +1 -1
  110. package/web/app/immutable/chunks/{_duPkHC1.js → Q2Fhc9xf.js} +1 -1
  111. package/web/app/immutable/chunks/{DlwTP-AJ.js → SUc3hjvu.js} +1 -1
  112. package/web/app/immutable/chunks/{Bmm_g7di.js → WIpix-jK.js} +4 -4
  113. package/web/app/immutable/chunks/{-hTxjwFO.js → a8KDQTjI.js} +1 -1
  114. package/web/app/immutable/chunks/{C_4qh07f.js → c-b7vp56.js} +1 -1
  115. package/web/app/immutable/chunks/{BC5HDfRR.js → cLiNexV2.js} +1 -1
  116. package/web/app/immutable/chunks/{B3QTKmHy.js → ddYZXH0s.js} +1 -1
  117. package/web/app/immutable/chunks/{DGK5CsQK.js → gs8EHWKj.js} +1 -1
  118. package/web/app/immutable/chunks/{ByBw1QkA.js → iYBWUn-Y.js} +1 -1
  119. package/web/app/immutable/chunks/{CHApvLbz.js → jrJ2dWK7.js} +3 -3
  120. package/web/app/immutable/chunks/{C8Wy-uTf.js → kPePSbed.js} +1 -1
  121. package/web/app/immutable/chunks/{CtDIyzmZ.js → lthgBKpc.js} +1 -1
  122. package/web/app/immutable/chunks/{D1R1FWjP.js → q1hD1wA_.js} +1 -1
  123. package/web/app/immutable/chunks/{CrZlcn4Y.js → sRkVH83r.js} +1 -1
  124. package/web/app/immutable/chunks/{Dm98YBgx.js → t7OX0H3A.js} +1 -1
  125. package/web/app/immutable/chunks/{DKeBnsgS.js → tdkdPDHZ.js} +1 -1
  126. package/web/app/immutable/chunks/{CxMr7p-O.js → ujrHKn1R.js} +3 -3
  127. package/web/app/immutable/chunks/{CULu7FSf.js → yvEwd65w.js} +1 -1
  128. package/web/app/immutable/chunks/{Bm3beBRj.js → zec4sHtD.js} +1 -1
  129. package/web/app/immutable/entry/{app.DOLk01Bm.js → app.CiEe3jVw.js} +2 -2
  130. package/web/app/immutable/entry/start.lgb00fUy.js +1 -0
  131. package/web/app/immutable/nodes/{0.qPBEcapg.js → 0.Rx4EZM26.js} +1 -1
  132. package/web/app/immutable/nodes/{1.Bi3sNEdL.js → 1.CTGLcOWT.js} +1 -1
  133. package/web/app/immutable/nodes/{10.DHyl6QAs.js → 10.B1s4o90R.js} +1 -1
  134. package/web/app/immutable/nodes/{11.pqpLvrmB.js → 11.BwS8WTYv.js} +1 -1
  135. package/web/app/immutable/nodes/{15.CKbUOFrf.js → 15.aeOKe3S4.js} +1 -1
  136. package/web/app/immutable/nodes/{19.3QLuvvWY.js → 19.p0y9h6Bd.js} +2 -2
  137. package/web/app/immutable/nodes/{2.CSj73FLT.js → 2.DmLTCsKI.js} +1 -1
  138. package/web/app/immutable/nodes/{3.BUbQ5Tes.js → 3.CIGlwKH6.js} +1 -1
  139. package/web/app/immutable/nodes/{4.Byn29Mul.js → 4.xsZADnG7.js} +1 -1
  140. package/web/app/immutable/nodes/{5.CMHzkmR-.js → 5.DISXcTBo.js} +1 -1
  141. package/web/app/immutable/nodes/{6.N0CPg2uE.js → 6.BBw6C3qe.js} +1 -1
  142. package/web/app/immutable/nodes/{7.4Szvqobl.js → 7.D_jGH1JW.js} +1 -1
  143. package/web/app/immutable/nodes/{8.BKw9KMbS.js → 8.C9qcwGHA.js} +1 -1
  144. package/web/app/immutable/nodes/{9.BBJWosck.js → 9.CKMXXqjg.js} +2 -2
  145. package/web/app/version.json +1 -1
  146. package/web/index.html +9 -9
  147. package/web/app/immutable/entry/start.CIQw0TYU.js +0 -1
@@ -1,4 +1,4 @@
1
- import{g as fe}from"./CQA1q0F9.js";import{b as o,ay as te,X as U,aX as ye,ad as be,ah as me,aL as ke,b3 as Ee,O as K,aV as F,ax as _e,J as Se,an as Ne,au as ce,H as le}from"./B6-aVrNf.js";var $=(function(){var e=o(function(O,s,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=s);return n},"o"),h=[1,4],p=[1,13],i=[1,12],d=[1,15],k=[1,16],m=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],E=[6,7,11],G=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],f=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],H=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(s,n,r,a,u,t,M){var c=t.length-1;switch(u){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:p,7:[1,10],9:9,12:11,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},{6:p,9:22,12:11,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},{6:I,7:g,10:23,11:w},e(E,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:m,23:l}),e(E,[2,19]),e(E,[2,21],{15:30,24:G}),e(E,[2,22]),e(E,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},e(V,[2,14],{7:f,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(E,[2,16],{15:37,24:G}),e(E,[2,17]),e(E,[2,18]),e(E,[2,20],{24:H}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:f,11:A}),e(L,[2,11]),e(L,[2,12]),e(E,[2,15],{24:H}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(s,n){if(n.recoverable)this.trace(s);else{var r=new Error(s);throw r.hash=n,r}},"parseError"),parse:o(function(s){var n=this,r=[0],a=[],u=[null],t=[],M=this.table,c="",W=0,ie=0,ue=2,re=1,ge=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);b.setInput(s,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var q=b.yylloc;t.push(q);var de=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,u.length=u.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var _,P,x,Q,j={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=ae()),x=M[P]&&M[P][_]),typeof x>"u"||!x.length||!x[0]){var Z="";X=[];for(z in M[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");b.showPosition?Z="Parse error on line "+(W+1)+`:
1
+ import{g as fe}from"./BIRGsT3P.js";import{b as o,ay as te,X as U,aX as ye,ad as be,ah as me,aL as ke,b3 as Ee,O as K,aV as F,ax as _e,J as Se,an as Ne,au as ce,H as le}from"./DjWdAsv4.js";var $=(function(){var e=o(function(O,s,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=s);return n},"o"),h=[1,4],p=[1,13],i=[1,12],d=[1,15],k=[1,16],m=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],E=[6,7,11],G=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],f=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],H=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(s,n,r,a,u,t,M){var c=t.length-1;switch(u){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:p,7:[1,10],9:9,12:11,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},{6:p,9:22,12:11,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},{6:I,7:g,10:23,11:w},e(E,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:m,23:l}),e(E,[2,19]),e(E,[2,21],{15:30,24:G}),e(E,[2,22]),e(E,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:i,14:14,16:d,17:k,18:17,19:18,20:m,23:l},e(V,[2,14],{7:f,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(E,[2,16],{15:37,24:G}),e(E,[2,17]),e(E,[2,18]),e(E,[2,20],{24:H}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:f,11:A}),e(L,[2,11]),e(L,[2,12]),e(E,[2,15],{24:H}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(s,n){if(n.recoverable)this.trace(s);else{var r=new Error(s);throw r.hash=n,r}},"parseError"),parse:o(function(s){var n=this,r=[0],a=[],u=[null],t=[],M=this.table,c="",W=0,ie=0,ue=2,re=1,ge=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);b.setInput(s,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var q=b.yylloc;t.push(q);var de=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,u.length=u.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var _,P,x,Q,j={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=ae()),x=M[P]&&M[P][_]),typeof x>"u"||!x.length||!x[0]){var Z="";X=[];for(z in M[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");b.showPosition?Z="Parse error on line "+(W+1)+`:
2
2
  `+b.showPosition()+`
3
3
  Expecting `+X.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Z="Parse error on line "+(W+1)+": Unexpected "+(_==re?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Z,{text:b.match,token:this.terminals_[_]||_,line:b.yylineno,loc:q,expected:X})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+_);switch(x[0]){case 1:r.push(_),u.push(b.yytext),t.push(b.yylloc),r.push(x[1]),_=null,ie=b.yyleng,c=b.yytext,W=b.yylineno,q=b.yylloc;break;case 2:if(C=this.productions_[x[1]][1],j.$=u[u.length-C],j._$={first_line:t[t.length-(C||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(C||1)].first_column,last_column:t[t.length-1].last_column},de&&(j._$.range=[t[t.length-(C||1)].range[0],t[t.length-1].range[1]]),Q=this.performAction.apply(j,[c,ie,W,R.yy,x[1],u,t].concat(ge)),typeof Q<"u")return Q;C&&(r=r.slice(0,-1*C*2),u=u.slice(0,-1*C),t=t.slice(0,-1*C)),r.push(this.productions_[x[1]][0]),u.push(j.$),t.push(j._$),oe=M[r[r.length-2]][r[r.length-1]],r.push(oe);break;case 3:return!0}}return!0},"parse")},Y=(function(){var O={EOF:1,parseError:o(function(n,r){if(this.yy.parser)this.yy.parser.parseError(n,r);else throw new Error(n)},"parseError"),setInput:o(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:o(function(s){var n=s.length,r=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===a.length?this.yylloc.first_column:0)+a[a.length-r.length].length-r[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(s){this.unput(this.match.slice(s))},"less"),pastInput:o(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1 +1 @@
1
- var De=Object.defineProperty;var Ce=(i,s,e)=>s in i?De(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var E=(i,s,e)=>Ce(i,typeof s!="symbol"?s+"":s,e);import{K as Le,P as ce,a6 as le,as as z,aC as ve}from"./Bmm_g7di.js";import{b_ as we,c_ as ue,cq as de,cp as be}from"./ByBw1QkA.js";import{Jx as p,C6 as Fe,bJ as ke,i as Ge,LC as me,ir as Ee,bV as Pe,E2 as H,Cv as xe,fl as Ve,AB as Ue,e3 as fe,fh as _e,e2 as he,B4 as Be,Lg as $e,wx as Xe}from"./D5wnbxHp.js";import{aO as Se,dW as ge,A as K,P as Re,aK as Q}from"./BJbm_MWC.js";import{h as We}from"./DJivXy66.js";import{c as q}from"./ChTqQfQN.js";import{a as qe}from"./BdWqymET.js";import{m as j}from"./CZB2ndi9.js";import"./3SdAC2_C.js";import{bm as n}from"./YLhFQnIu.js";import"./BQhBnAuP.js";import"./CrpUtGFn.js";import"./D48_y-cl.js";import{R as pe}from"./B5aYN90J.js";import{L as Ye}from"./CSiaiLHL.js";function ze(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Te="confirmUnslothModelSwitch";function He(i){if(!i||typeof i!="object")return!1;const{agentId:s,agentName:e,workspaceId:t,workspaceTitle:r}=i;return typeof s=="string"&&typeof e=="string"&&typeof t=="string"&&(r===null||typeof r=="string")}function Ke(i){for(let s=i,e=0;s&&e<4;e++){const t=s.data;if(t&&typeof t=="object"){const{code:r,currentModel:a,requestedModel:l,agents:o}=t;if(r==="unsloth-model-switch-confirmation-required"&&typeof a=="string"&&typeof l=="string"&&Array.isArray(o)&&o.every(He))return{currentModel:a,requestedModel:l,agents:o}}s=s.cause}}function bt(i){if(!i||!(Te in i))return i;const{[Te]:s,...e}=i;return Object.keys(e).length>0?e:void 0}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new qe("PerformanceOptimizer"),w=class w{constructor(){E(this,"metricsBuffer");E(this,"metricsIndex",0);E(this,"metricsCount",0);E(this,"MAX_METRICS",500);E(this,"TARGET_RESPONSE_TIME",100);E(this,"memoCache",new Map);E(this,"MEMO_TTL",6e4);E(this,"MAX_CACHE_SIZE",100);E(this,"cacheHits",0);E(this,"cacheMisses",0);E(this,"pendingRequests",new Map);E(this,"requestQueue",[]);E(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let o=0;o<s.length;o+=r){const _=s.slice(o,o+r).map((c,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(c);d(k)},g)})}),u=await Promise.all(_);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const _=this.getMemoized(a);if(_!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),_;this.cacheMisses++}if(t.coalesce){const _=this.pendingRequests.get(s);if(_)return V.debug("Request coalesced",{operation:s}),_}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const o=await l;t.memoize&&this.memoize(a,o);const f=Z.now()-r;return this.recordMetric(s,f,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),f>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(f),target:this.TARGET_RESPONSE_TIME}),o}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const c=this.metricsBuffer[(e+u)%this.MAX_METRICS];c&&s.push(c)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,c)=>u.duration-c.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const o=a/s.length,f=Math.floor(t.length*.95),_=Math.floor(t.length*.99);return{avgResponseTime:Math.round(o),p95ResponseTime:Math.round(t[f]?.duration||0),p99ResponseTime:Math.round(t[_]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};E(w,"instance");let te=w;const Qe=te.getInstance(),Ae={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},J={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},je={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function Ze(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Je(i,s){return Ze(i).every(t=>t in s)}function Oe(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function ee(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function et(i,s){return s&&J[i]&&Je(J[i],s)?Oe(J[i],s):je[i]||n.errors_userFriendly_fallback_error()}function tt(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?Ae[e]:Ae.GENERAL}const st={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function it(i){return st[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var N=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(N||{});class W extends Error{constructor(e,t,r={},a){super(e);E(this,"code");E(this,"context");E(this,"recoverySuggestions");E(this,"userMessage");E(this,"isRecoverable");E(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return et(e,this.context)}getDefaultRecoverySuggestions(e){return it(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return tt(this.code)}formatMessage(e){return Oe(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const rt={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function re(i){const s=i.toLowerCase();for(const e of rt.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const at="Agent already has an in-flight prompt. Message was not delivered.",v=q("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=pe.DEFAULT_ATTEMPTS,retryDelay:a=pe.BASE_DELAY,exponentialBackoff:l=!0,notify:o=!1,notifyOnRetry:f=!1,context:_={},onError:u,onRetry:c,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const C=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),C}catch(C){if(g=C,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:_}),u?.(g,d),d<=r&&R(g)){const h=l?a*Math.pow(2,d-1):a;f&&j.warning(n.agent_errorBoundary_retrying_message({seconds:h/1e3})),c?.(d),v.info(`[${e}] Retrying in ${h}ms`),await this.sleep(h)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=ee(g?.message||n.agent_errorBoundary_generic_error()),D=g?.message?.toLowerCase()||"",$=D.includes("no available models")||D.includes("all models exhausted")||D.includes("all models unavailable");throw o&&!$&&j.error(P),new W(P,N.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:_})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&j.error(ee(a.message)),new W(ee(a.message),N.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return re(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof W?[N.NETWORK_ERROR,N.STREAM_TIMEOUT,N.STREAM_CONNECTION_FAILED,N.PROVIDER_CONNECTION_FAILED,N.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new W(`${t} timed out after ${e}ms`,N.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,o=[],f=[];for(let _=0;_<s.length;_+=r){const u=s.slice(_,_+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")o.push(R.value);else{const d=R.reason;if(f.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return f.length>0&&v.warn(`[${l}] Completed with ${f.length} errors`),{results:o,errors:f}}};E(b,"instance");let se=b;const nt=se.getInstance(),ie=q("browser/index"),F=new Map,B=new Map;let U;function ot(i,s,e){for(const t of s)try{t(e)}catch(r){ie.error("Error in agent subscriber callback",{agentId:i,error:r})}}function ct(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Se.select(e,t);B.get(t)!==a&&(B.set(t,a),ot(t,r,a))}})}function lt(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ft(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),ct();const a=p.state,l=Se.select(a,i);return r&&B.set(i,l),l?ie.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):ie.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const o=F.get(i);o&&(o.delete(s),o.size===0&&(F.delete(i),B.delete(i))),lt()}}const y=q("ErrorRecovery"),ye={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||re(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class ut{constructor(){E(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class dt extends ut{constructor(){super(...arguments);E(this,"activeRecoveries",new Map);E(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=ye.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let o,f=t.initialBackoffMs,_=0;for(let u=1;u<=t.maxRetries;u++){if(_=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const c=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:c,attempts:u,totalTime:Date.now()-a}}catch(c){o=c,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:o.message});const R=o.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:o.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:o.message});break}if(re(o.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:o.message});break}if(!t.shouldRetry(o,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:o.message});break}if(u<t.maxRetries){const g=Math.random()*.2*f,d=Math.min(f+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:o.message}),await this.delay(d,l.signal),f=Math.min(f*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(o,_),this.emit("recovery:failure",{operationId:r,attempts:_,duration:Date.now()-a,error:o?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:o,attempts:_,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const o=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",o);const f=r;r=()=>{t.removeEventListener("abort",o),f()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const mt=new dt,O=new Ye({category:"WorkspaceMetrics"}),Et=100;class ft{constructor(){E(this,"metrics",new Map);E(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>Et;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const _t=new ft,M=q("AgentSend");function A(i){p.dispatch(i)}function Ie(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ht(i){const s=Ie(i)&&i.success===!0&&"data"in i?i.data:i;return!Ie(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(at)}async function kt(i,s,e,t={}){const r=ge.select(p.state,e.id);if(!r)return;const a=Le(i,e.id),l=t.submission,o=!!l&&we.select(p.state,l.scope)?.supported===!0,f=(c,R,g=!1)=>{l&&A(Xe(l.scope,l.id,c,Date.now(),R,g))};let _=!1;const u=()=>(!l||_||be.select(p.state,l))&&r===ge.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return Qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let c=await p.dispatch(Fe(e.id,i));if(u()){if(!c)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));c={...c,isStreaming:c.isStreaming??!1};{if(c&&(c.status==="pending"||!c.id)&&!c.backendSessionId&&c.activationState!==K.ACTIVE&&c.activationState!==K.ACTIVATING){const h=e.id.startsWith("optimistic-"),Y=e.worktreePath||e.repositoryPath||e.path;if(!h&&Y){M.info("Activating pending session in sendMessage",{agentId:i,status:c.status,activationState:c.activationState,hasBackendSessionId:!!c.backendSessionId});const x=await p.dispatch(ke(e.id,i));if(!u())return;x&&(c=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else c&&c.status==="pending"&&c.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:c.backendSessionId,activationState:c.activationState}),c={...c,status:Ge.Active,activationState:K.ACTIVE},A(me({...c,workspaceId:e.id})));if(!c)throw new Error(`Failed to get or create session for agent ${i}`);A(me({...c,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??ce(),k=t.messageMetadata?.[Re],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[Re]:k}:{}},D={id:Ee(ue()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};o||(l&&(f("rejected"),_=!0),A(Pe(c.id,D))),A(H(c.id,!0));let $=!1,C;try{o||await p.dispatch(xe(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=Ee(`msg_${ue()}`),Y=ce(),x=async()=>nt.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:c.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(m=>({type:m.type,mimeType:m.mimeType,dataLength:m.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(m=>({type:m.type,fileName:m.fileName,mimeType:m.mimeType,attachmentId:m.attachmentId,size:m.size}))||[]});const Me=t.model??t.modelId??c.model??void 0;A(Ve(i));const Ne=le(i,e.id),ne=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await We("agent.sendMessage",{agentId:i,...o&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Me,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:Y,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(m=>{if(u())throw Ke(m)&&(C=m),m});if(u()){if(ht(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:c.id}),f("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const m=T.error,I=typeof m=="string"?m:m?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:c.id,queuedMessageId:T.queuedMessage?.id}),(!o||!l||!de.select(p.state,l))&&A(H(c.id,!1)),o||A(Ue(c.id,D.id)),o){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=fe(s,t),X=Q.select(p.state,i,e.id).find(oe=>oe.id===I.id||oe.turnId===L);A(_e(i,I.id,S,L,he(X??I,S),!X&&!!l&&de.select(p.state,l),ne))}f("accepted",I,!0),z(i,e.id);return}const m=T.queuedMessage;if(m){const I=T.turnId,G=typeof I=="string"?I:m.turnId;let L=m;if(u()&&le(i,e.id)===Ne){const S=Q.select(p.state,i,e.id),X=ze(S,m);A(Be(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:m.id}),await z(i,e.id).catch(()=>{}),L=Q.select(p.state,i,e.id).find(S=>S.id===m.id||S.turnId===G));if(u()&&typeof G=="string"){const S=fe(s,t);A(_e(i,m.id,S,G,he(L??m,S),!L,ne))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:m.id})}return}}o&&(f("accepted"),z(i,e.id),ve(i,e.id)),_t.incrementMessageSent(e.id)}},"send message",{retries:o?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),ae=o?await x().then(()=>({success:!0,error:void 0})):await mt.executeWithRecovery(x,ye.streaming,`send-message-${i}`);if(!ae.success)throw ae.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(H(c.id,!1)),!o&&t.messageMetadata&&A($e(c.id,D.id,{metadata:P})),o&&f($||C?"rejected":"uncertain"),C??h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Te as U,Ft as a,ee as c,ze as r,kt as s,Ke as u,bt as w};
1
+ var De=Object.defineProperty;var Ce=(i,s,e)=>s in i?De(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var E=(i,s,e)=>Ce(i,typeof s!="symbol"?s+"":s,e);import{K as Le,P as ce,a6 as le,as as z,aC as ve}from"./WIpix-jK.js";import{b_ as we,c_ as ue,cq as de,cp as be}from"./iYBWUn-Y.js";import{Jx as p,C6 as Fe,bJ as ke,i as Ge,LC as me,ir as Ee,bV as Pe,E2 as H,Cv as xe,fl as Ve,AB as Ue,e3 as fe,fh as _e,e2 as he,B4 as Be,Lg as $e,wx as Xe}from"./D5wnbxHp.js";import{aO as Se,dW as ge,A as K,P as Re,aK as Q}from"./BJbm_MWC.js";import{h as We}from"./DJivXy66.js";import{c as q}from"./ChTqQfQN.js";import{a as qe}from"./BdWqymET.js";import{m as j}from"./CZB2ndi9.js";import"./3SdAC2_C.js";import{bm as n}from"./YLhFQnIu.js";import"./BQhBnAuP.js";import"./CrpUtGFn.js";import"./D48_y-cl.js";import{R as pe}from"./B5aYN90J.js";import{L as Ye}from"./CSiaiLHL.js";function ze(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Te="confirmUnslothModelSwitch";function He(i){if(!i||typeof i!="object")return!1;const{agentId:s,agentName:e,workspaceId:t,workspaceTitle:r}=i;return typeof s=="string"&&typeof e=="string"&&typeof t=="string"&&(r===null||typeof r=="string")}function Ke(i){for(let s=i,e=0;s&&e<4;e++){const t=s.data;if(t&&typeof t=="object"){const{code:r,currentModel:a,requestedModel:l,agents:o}=t;if(r==="unsloth-model-switch-confirmation-required"&&typeof a=="string"&&typeof l=="string"&&Array.isArray(o)&&o.every(He))return{currentModel:a,requestedModel:l,agents:o}}s=s.cause}}function bt(i){if(!i||!(Te in i))return i;const{[Te]:s,...e}=i;return Object.keys(e).length>0?e:void 0}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new qe("PerformanceOptimizer"),w=class w{constructor(){E(this,"metricsBuffer");E(this,"metricsIndex",0);E(this,"metricsCount",0);E(this,"MAX_METRICS",500);E(this,"TARGET_RESPONSE_TIME",100);E(this,"memoCache",new Map);E(this,"MEMO_TTL",6e4);E(this,"MAX_CACHE_SIZE",100);E(this,"cacheHits",0);E(this,"cacheMisses",0);E(this,"pendingRequests",new Map);E(this,"requestQueue",[]);E(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let o=0;o<s.length;o+=r){const _=s.slice(o,o+r).map((c,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(c);d(k)},g)})}),u=await Promise.all(_);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const _=this.getMemoized(a);if(_!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),_;this.cacheMisses++}if(t.coalesce){const _=this.pendingRequests.get(s);if(_)return V.debug("Request coalesced",{operation:s}),_}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const o=await l;t.memoize&&this.memoize(a,o);const f=Z.now()-r;return this.recordMetric(s,f,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),f>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(f),target:this.TARGET_RESPONSE_TIME}),o}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const c=this.metricsBuffer[(e+u)%this.MAX_METRICS];c&&s.push(c)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,c)=>u.duration-c.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const o=a/s.length,f=Math.floor(t.length*.95),_=Math.floor(t.length*.99);return{avgResponseTime:Math.round(o),p95ResponseTime:Math.round(t[f]?.duration||0),p99ResponseTime:Math.round(t[_]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};E(w,"instance");let te=w;const Qe=te.getInstance(),Ae={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},J={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},je={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function Ze(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Je(i,s){return Ze(i).every(t=>t in s)}function Oe(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function ee(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function et(i,s){return s&&J[i]&&Je(J[i],s)?Oe(J[i],s):je[i]||n.errors_userFriendly_fallback_error()}function tt(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?Ae[e]:Ae.GENERAL}const st={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function it(i){return st[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var N=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(N||{});class W extends Error{constructor(e,t,r={},a){super(e);E(this,"code");E(this,"context");E(this,"recoverySuggestions");E(this,"userMessage");E(this,"isRecoverable");E(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return et(e,this.context)}getDefaultRecoverySuggestions(e){return it(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return tt(this.code)}formatMessage(e){return Oe(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const rt={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function re(i){const s=i.toLowerCase();for(const e of rt.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const at="Agent already has an in-flight prompt. Message was not delivered.",v=q("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=pe.DEFAULT_ATTEMPTS,retryDelay:a=pe.BASE_DELAY,exponentialBackoff:l=!0,notify:o=!1,notifyOnRetry:f=!1,context:_={},onError:u,onRetry:c,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const C=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),C}catch(C){if(g=C,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:_}),u?.(g,d),d<=r&&R(g)){const h=l?a*Math.pow(2,d-1):a;f&&j.warning(n.agent_errorBoundary_retrying_message({seconds:h/1e3})),c?.(d),v.info(`[${e}] Retrying in ${h}ms`),await this.sleep(h)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=ee(g?.message||n.agent_errorBoundary_generic_error()),D=g?.message?.toLowerCase()||"",$=D.includes("no available models")||D.includes("all models exhausted")||D.includes("all models unavailable");throw o&&!$&&j.error(P),new W(P,N.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:_})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&j.error(ee(a.message)),new W(ee(a.message),N.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return re(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof W?[N.NETWORK_ERROR,N.STREAM_TIMEOUT,N.STREAM_CONNECTION_FAILED,N.PROVIDER_CONNECTION_FAILED,N.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new W(`${t} timed out after ${e}ms`,N.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,o=[],f=[];for(let _=0;_<s.length;_+=r){const u=s.slice(_,_+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")o.push(R.value);else{const d=R.reason;if(f.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return f.length>0&&v.warn(`[${l}] Completed with ${f.length} errors`),{results:o,errors:f}}};E(b,"instance");let se=b;const nt=se.getInstance(),ie=q("browser/index"),F=new Map,B=new Map;let U;function ot(i,s,e){for(const t of s)try{t(e)}catch(r){ie.error("Error in agent subscriber callback",{agentId:i,error:r})}}function ct(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Se.select(e,t);B.get(t)!==a&&(B.set(t,a),ot(t,r,a))}})}function lt(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ft(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),ct();const a=p.state,l=Se.select(a,i);return r&&B.set(i,l),l?ie.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):ie.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const o=F.get(i);o&&(o.delete(s),o.size===0&&(F.delete(i),B.delete(i))),lt()}}const y=q("ErrorRecovery"),ye={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||re(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class ut{constructor(){E(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class dt extends ut{constructor(){super(...arguments);E(this,"activeRecoveries",new Map);E(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=ye.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let o,f=t.initialBackoffMs,_=0;for(let u=1;u<=t.maxRetries;u++){if(_=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const c=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:c,attempts:u,totalTime:Date.now()-a}}catch(c){o=c,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:o.message});const R=o.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:o.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:o.message});break}if(re(o.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:o.message});break}if(!t.shouldRetry(o,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:o.message});break}if(u<t.maxRetries){const g=Math.random()*.2*f,d=Math.min(f+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:o.message}),await this.delay(d,l.signal),f=Math.min(f*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(o,_),this.emit("recovery:failure",{operationId:r,attempts:_,duration:Date.now()-a,error:o?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:o,attempts:_,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const o=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",o);const f=r;r=()=>{t.removeEventListener("abort",o),f()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const mt=new dt,O=new Ye({category:"WorkspaceMetrics"}),Et=100;class ft{constructor(){E(this,"metrics",new Map);E(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>Et;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const _t=new ft,M=q("AgentSend");function A(i){p.dispatch(i)}function Ie(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ht(i){const s=Ie(i)&&i.success===!0&&"data"in i?i.data:i;return!Ie(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(at)}async function kt(i,s,e,t={}){const r=ge.select(p.state,e.id);if(!r)return;const a=Le(i,e.id),l=t.submission,o=!!l&&we.select(p.state,l.scope)?.supported===!0,f=(c,R,g=!1)=>{l&&A(Xe(l.scope,l.id,c,Date.now(),R,g))};let _=!1;const u=()=>(!l||_||be.select(p.state,l))&&r===ge.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return Qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let c=await p.dispatch(Fe(e.id,i));if(u()){if(!c)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));c={...c,isStreaming:c.isStreaming??!1};{if(c&&(c.status==="pending"||!c.id)&&!c.backendSessionId&&c.activationState!==K.ACTIVE&&c.activationState!==K.ACTIVATING){const h=e.id.startsWith("optimistic-"),Y=e.worktreePath||e.repositoryPath||e.path;if(!h&&Y){M.info("Activating pending session in sendMessage",{agentId:i,status:c.status,activationState:c.activationState,hasBackendSessionId:!!c.backendSessionId});const x=await p.dispatch(ke(e.id,i));if(!u())return;x&&(c=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else c&&c.status==="pending"&&c.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:c.backendSessionId,activationState:c.activationState}),c={...c,status:Ge.Active,activationState:K.ACTIVE},A(me({...c,workspaceId:e.id})));if(!c)throw new Error(`Failed to get or create session for agent ${i}`);A(me({...c,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??ce(),k=t.messageMetadata?.[Re],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[Re]:k}:{}},D={id:Ee(ue()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};o||(l&&(f("rejected"),_=!0),A(Pe(c.id,D))),A(H(c.id,!0));let $=!1,C;try{o||await p.dispatch(xe(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=Ee(`msg_${ue()}`),Y=ce(),x=async()=>nt.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:c.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(m=>({type:m.type,mimeType:m.mimeType,dataLength:m.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(m=>({type:m.type,fileName:m.fileName,mimeType:m.mimeType,attachmentId:m.attachmentId,size:m.size}))||[]});const Me=t.model??t.modelId??c.model??void 0;A(Ve(i));const Ne=le(i,e.id),ne=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await We("agent.sendMessage",{agentId:i,...o&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Me,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:Y,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(m=>{if(u())throw Ke(m)&&(C=m),m});if(u()){if(ht(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:c.id}),f("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const m=T.error,I=typeof m=="string"?m:m?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:c.id,queuedMessageId:T.queuedMessage?.id}),(!o||!l||!de.select(p.state,l))&&A(H(c.id,!1)),o||A(Ue(c.id,D.id)),o){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=fe(s,t),X=Q.select(p.state,i,e.id).find(oe=>oe.id===I.id||oe.turnId===L);A(_e(i,I.id,S,L,he(X??I,S),!X&&!!l&&de.select(p.state,l),ne))}f("accepted",I,!0),z(i,e.id);return}const m=T.queuedMessage;if(m){const I=T.turnId,G=typeof I=="string"?I:m.turnId;let L=m;if(u()&&le(i,e.id)===Ne){const S=Q.select(p.state,i,e.id),X=ze(S,m);A(Be(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:m.id}),await z(i,e.id).catch(()=>{}),L=Q.select(p.state,i,e.id).find(S=>S.id===m.id||S.turnId===G));if(u()&&typeof G=="string"){const S=fe(s,t);A(_e(i,m.id,S,G,he(L??m,S),!L,ne))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:m.id})}return}}o&&(f("accepted"),z(i,e.id),ve(i,e.id)),_t.incrementMessageSent(e.id)}},"send message",{retries:o?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),ae=o?await x().then(()=>({success:!0,error:void 0})):await mt.executeWithRecovery(x,ye.streaming,`send-message-${i}`);if(!ae.success)throw ae.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(H(c.id,!1)),!o&&t.messageMetadata&&A($e(c.id,D.id,{metadata:P})),o&&f($||C?"rejected":"uncertain"),C??h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Te as U,Ft as a,ee as c,ze as r,kt as s,Ke as u,bt as w};
@@ -1 +1 @@
1
- import{t as lt,bo as f,bw as dt,b as ct,bm as e,br as ft,bs as we,bq as Et}from"./YLhFQnIu.js";import{bs as pt,ay as We,be as A,b$ as T,b_ as n,bO as i,W as a,bS as o,bl as D,bn as _t,aA as g,a7 as Lt,aD as t,c9 as $,aB as k,a5 as x,bA as y,bf as gt,bo as It,bV as tt,br as Gt,ca as bt,bH as $e,bk as zt}from"./3SdAC2_C.js";import{g as Ut,i as Ot,I as mt}from"./oBIu7LTI.js";import{c as Ft}from"./DwGyIIXK.js";import{s as ot,f as Bt,c as Nt}from"./BQhBnAuP.js";import{f as z}from"./Cw2fqKk9.js";import"./DJivXy66.js";import"./WvHbj6rB.js";import{b as Rt}from"./DRLJuUwT.js";import"./kvtKUeBe.js";import"./KtEuoG00.js";import{b as Ht}from"./DPG1HUgG.js";import{i as S}from"./YeOAvjnW.js";import{b as Mt}from"./D3yXvqwY.js";import{F as Wt,ay as Jt,c_ as qt,cn as Yt,aN as Vt,bn as jt,d0 as Qt,cK as Xt}from"./gwv5JQYH.js";import"./CrpUtGFn.js";import{F as ht,G as Zt}from"./DNZCPKpq.js";import"./CIWQMI37.js";/* empty css */import{C as er}from"./CZB2ndi9.js";import{L as kt}from"./DwiE5WsI.js";import{I as rt}from"./DkERMj5B.js";import"./DtkIwON_.js";import"./BNDTLRE1.js";import{h as tr}from"./BK0IkwFP.js";import{Jx as Ke,fC as xt,J as rr,ep as yt,r6 as sr,uB as ar,Jo as ir,oE as nr,hS as or}from"./D5wnbxHp.js";import{aB as St,aC as $t,aD as lr,aw as dr,ax as Kt,ay as cr,az as pr,aH as _r}from"./D-aEx3GL.js";import{R as ur}from"./BP-cDE7g.js";var vr=k('<!> <p class="type-body"> </p>',1);function fr(l,r){if(new.target)return lt({component:fr,...l});pt(r,!0);let _=f(r,"open",15,!1),E=f(r,"static",7,!1),B=f(r,"title",7),u=f(r,"message",7),b=f(r,"buttons",7),m=f(r,"cancelIndex",7,0),ae=f(r,"onSelect",7);function Y(d){_(!1),ae()?.(d)}var he={get open(){return _()},set open(d=!1){_(d),g()},get static(){return E()},set static(d=!1){E(d),g()},get title(){return B()},set title(d){B(d),g()},get message(){return u()},set message(d){u(d),g()},get buttons(){return b()},set buttons(d){b(d),g()},get cancelIndex(){return m()},set cancelIndex(d=0){m(d),g()},get onSelect(){return ae()},set onSelect(d){ae(d),g()},$set:dt,$on:(d,V)=>ct(r,d,V)};return Ht(l,{get static(){return E()},role:"alertdialog",get title(){return B()},dismissOnInteractOutside:!1,focusContent:!0,onSubmit:()=>Y(b().length-1),onCancel:()=>Y(m()),get open(){return _()},set open(V){_(V)},footer:V=>{var K=Lt(),N=We(K);Ut(N,17,b,Ot,(ie,ne,te)=>{{let ke=$(()=>te===m()?"ghost":te===b().length-1?"primary":"outline");z(ie,{get variant(){return t(ke)},onclick:()=>Y(te),children:(Ae,R)=>{A();var Te=T();n(()=>i(Te,t(ne))),a(Ae,Te)},$$slots:{default:!0}})}}),a(V,K)},children:(V,K)=>{var N=vr(),ie=We(N);Ft(ie,()=>Rt,(ke,Ae)=>{Ae(ke,{class:"sr-only",children:(R,Te)=>{A();var Fe=T();n(()=>i(Fe,u())),a(R,Fe)},$$slots:{default:!0}})});var ne=o(ie,2),te=D(ne,!0);n(()=>i(te,u())),a(V,N)},$$slots:{footer:!0,default:!0}}),_t(he)}const Oe={anthropicKeys:"https://console.anthropic.com/settings/keys",openAiKeys:"https://platform.openai.com/api-keys",openAiTokens:"https://developers.openai.com/codex/enterprise/access-tokens",xaiConsole:"https://console.x.ai",factoryKeys:"https://app.factory.ai/settings/api-keys",cursorDashboard:"https://cursor.com/dashboard?tab=integrations",auggieAuth:"https://docs.augmentcode.com/cli/setup-auggie/authentication"},gr="claude setup-token",br="auggie token print";function mr(l,r){if(r==="differentLogin")return e.settings_providerProfileKinds_differentLogin_description();if(r==="token")return l==="codex"?e.settings_providerProfileKinds_tokenCodex_description():l==="auggie"?e.settings_providerProfileKinds_tokenAuggie_description():e.settings_providerProfileKinds_tokenClaude_description();switch(l){case"codex":return e.settings_providerProfileKinds_apiKeyCodex_description();case"grok":return e.settings_providerProfileKinds_apiKeyGrok_description();case"droid":return e.settings_providerProfileKinds_apiKeyDroid_description();case"cursor":return e.settings_providerProfileKinds_apiKeyCursor_description();default:return e.settings_providerProfileKinds_apiKeyClaude_description()}}function hr(l,r){return r==="apiKey"?e.settings_providerProfileKinds_apiKey_label():l==="auggie"?e.settings_providerProfileKinds_tokenAuggie_label():e.settings_providerProfileKinds_token_label()}function Ss(l,r){return l!=="claude"&&l!=="codex"?mr(l,r):r==="token"?l==="codex"?e.settings_providerProfileKinds_tokenCodexDialog_description():e.settings_providerProfileKinds_tokenClaudeDialog_description():l==="codex"?e.settings_providerProfileKinds_apiKeyCodexDialog_description():e.settings_providerProfileKinds_apiKeyClaudeDialog_description()}function kr(l,r){if(r==="token")return l==="codex"?{steps:[e.settings_providerProfileKinds_tokenCodexStep1_label()],link:{href:Oe.openAiTokens,label:e.settings_providerProfileKinds_openAiAccessTokens_link()},eligibility:e.settings_providerProfileKinds_tokenCodexEligibility_description()}:l==="auggie"?{steps:[e.settings_providerProfileKinds_tokenAuggieStep1_label(),e.settings_providerProfileKinds_tokenAuggieStep2_label()],command:br,link:{href:Oe.auggieAuth,label:e.settings_providerProfileKinds_auggieAuthDocs_link()}}:{steps:[e.settings_providerProfileKinds_tokenClaudeStep1_label(),e.settings_providerProfileKinds_tokenClaudeStep2_label()],command:gr};switch(l){case"codex":return{steps:[e.settings_providerProfileKinds_apiKeyCodexStep1_label(),e.settings_providerProfileKinds_apiKeyCodexStep2_label()],link:{href:Oe.openAiKeys,label:e.settings_providerProfileKinds_openAiApiKeys_link()}};case"grok":return{steps:[e.settings_providerProfileKinds_apiKeyGrokStep1_label(),e.settings_providerProfileKinds_apiKeyGrokStep2_label()],link:{href:Oe.xaiConsole,label:e.settings_providerProfileKinds_xaiConsole_link()}};case"droid":return{steps:[e.settings_providerProfileKinds_apiKeyDroidStep1_label(),e.settings_providerProfileKinds_apiKeyDroidStep2_label()],link:{href:Oe.factoryKeys,label:e.settings_providerProfileKinds_factoryApiKeys_link()}};case"cursor":return{steps:[e.settings_providerProfileKinds_apiKeyCursorStep1_label(),e.settings_providerProfileKinds_apiKeyCursorStep2_label()],link:{href:Oe.cursorDashboard,label:e.settings_providerProfileKinds_cursorDashboard_link()}};default:return{steps:[e.settings_providerProfileKinds_apiKeyClaudeStep1_label(),e.settings_providerProfileKinds_apiKeyClaudeStep2_label()],link:{href:Oe.anthropicKeys,label:e.settings_providerProfileKinds_anthropicConsole_link()}}}}function xr(l,r){return r?l==="apiKey"?e.settings_providerProfileKinds_apiKeyClaudeStep3_label():e.settings_providerProfileKinds_tokenClaudeStep3_label():e.settings_providerProfileKinds_pasteNoCheck_label()}function $s(l,r){if(r==="token")return l==="codex"?e.settings_providerProfileKinds_tokenNotJwt_error():l==="auggie"?e.settings_providerProfileKinds_tokenShapeAuggie_error():e.settings_providerProfileKinds_tokenShapeClaude_error();switch(l){case"codex":return e.settings_providerProfileKinds_keyShapeCodex_error();case"grok":return e.settings_providerProfileKinds_keyShapeGrok_error();case"droid":return e.settings_providerProfileKinds_keyShapeDroid_error();case"cursor":return e.settings_providerProfileKinds_keyShapeCursor_error();default:return e.settings_providerProfileKinds_keyShapeClaude_error()}}var yr=k('<p class="type-body text-muted-foreground" data-testid="provider-profile-token-eligibility"> </p>'),Sr=k('<span class="mt-1 flex items-center gap-2" data-testid="provider-profile-setup-token"><code class="rounded border border-border bg-muted px-1.5 py-0.5 font-mono type-caption text-foreground"> </code> <!></span>'),Pt=k("<li> </li>"),$r=k('<section class="space-y-2" data-testid="provider-profile-secret-steps"><h3 class="type-body font-medium! text-foreground"> </h3> <ol class="type-body list-decimal space-y-1 pl-5 text-muted-foreground"><li> <!></li> <!> <!></ol> <!></section>'),Ct=k('<div class="flex items-center gap-2"><!> <!></div>'),Kr=k('<div class="space-y-2" data-testid="provider-profile-secret-saved"><p class="type-body text-foreground"> </p> <div class="flex items-center gap-3"><span class="type-body font-mono text-muted-foreground"> </span> <!></div></div>'),Pr=k('<span class="type-body text-muted-foreground"> </span> <!>',1),Cr=k('<span class="type-body font-mono text-muted-foreground"> </span> <!> <!>',1),wr=k('<div class="flex flex-wrap items-center gap-3" data-testid="provider-profile-base-url-saved"><span class="type-body text-foreground"> </span> <!></div>'),Ar=k('<details class="group rounded-md border border-border" data-testid="provider-profile-custom-endpoint"><summary class="flex cursor-pointer list-none items-center gap-2 px-3 py-2 type-body text-foreground [&amp;::-webkit-details-marker]:hidden"><!> </summary> <div class="space-y-2 border-t border-border px-3 py-3"><p class="type-caption text-muted-foreground"> </p> <!></div></details>'),Tr=k('<div class="space-y-5" data-testid="provider-profile-secret"><!> <!> <!> <!></div>');function Dr(l,r){if(new.target)return lt({component:Dr,...l});pt(r,!0);let _=f(r,"provider",7),E=f(r,"kind",7),B=f(r,"mode",7),u=f(r,"secret",15,""),b=f(r,"secretSaved",7,!1),m=f(r,"replacing",15,!1),ae=f(r,"secretError",7),Y=f(r,"baseUrl",15,""),he=f(r,"baseUrlSaved",7,!1),d=f(r,"baseUrlAction",15,"keep"),V=f(r,"customEndpointOpen",15,!1),K=f(r,"disabled",7,!1),N=f(r,"secretDisabled",23,K),ie=f(r,"keyCheck",7,!0),ne=f(r,"pasteStep",7,!0),te=f(r,"customEndpoint",7,!0);const ke="https://",Ae=$(()=>_()==="claude"&&E()==="apiKey"),R=$(()=>kr(_(),E())),Te=$(()=>xr(E(),ie())),Fe=$(()=>B()==="add"||!b()||m()),Ye=$(()=>hr(_(),E()));function st(){m(!1),u("")}var at={get provider(){return _()},set provider(s){_(s),g()},get kind(){return E()},set kind(s){E(s),g()},get mode(){return B()},set mode(s){B(s),g()},get secret(){return u()},set secret(s=""){u(s),g()},get secretSaved(){return b()},set secretSaved(s=!1){b(s),g()},get replacing(){return m()},set replacing(s=!1){m(s),g()},get secretError(){return ae()},set secretError(s){ae(s),g()},get baseUrl(){return Y()},set baseUrl(s=""){Y(s),g()},get baseUrlSaved(){return he()},set baseUrlSaved(s=!1){he(s),g()},get baseUrlAction(){return d()},set baseUrlAction(s="keep"){d(s),g()},get customEndpointOpen(){return V()},set customEndpointOpen(s=!1){V(s),g()},get disabled(){return K()},set disabled(s=!1){K(s),g()},get secretDisabled(){return N()},set secretDisabled(s=K){N(s),g()},get keyCheck(){return ie()},set keyCheck(s=!0){ie(s),g()},get pasteStep(){return ne()},set pasteStep(s=!0){ne(s),g()},get customEndpoint(){return te()},set customEndpoint(s=!0){te(s),g()},$set:dt,$on:(s,C)=>ct(r,s,C)},Be=Tr(),De=x(Be);{var Ve=s=>{var C=yr(),H=D(C,!0);n(()=>i(H,t(R).eligibility)),a(s,C)};S(De,s=>{t(R).eligibility&&s(Ve)})}var ue=o(De,2);{var Ne=s=>{var C=$r(),H=x(C),oe=D(H,!0),j=o(H,2),Q=x(j),le=x(Q),xe=o(le);{var W=h=>{var L=Sr(),J=x(L),O=D(J,!0),de=o(J,2);er(de,{get text(){return t(R).command},size:"sm"}),y(L),n(()=>i(O,t(R).command)),a(h,L)};S(xe,h=>{t(R).command&&h(W)})}y(Q);var ve=o(Q,2);{var re=h=>{var L=Pt(),J=D(L,!0);n(()=>i(J,t(R).steps[1])),a(h,L)};S(ve,h=>{t(R).steps[1]&&h(re)})}var U=o(ve,2);{var M=h=>{var L=Pt(),J=D(L,!0);n(()=>i(J,t(Te))),a(h,L)};S(U,h=>{ne()&&h(M)})}y(j);var ye=o(j,2);{var Ee=h=>{z(h,{variant:"link",size:"sm",get href(){return t(R).link.href},target:"_blank",rel:"noopener noreferrer",class:"h-auto px-0",children:(L,J)=>{A();var O=T();n(()=>i(O,t(R).link.label)),a(L,O)},$$slots:{default:!0}})};S(ye,h=>{t(R).link&&h(Ee)})}y(C),n(h=>{i(oe,h),i(le,`${t(R).steps[0]??""} `)},[()=>E()==="apiKey"?e.settings_providerProfileKinds_apiKeyClaudeSteps_label():e.settings_providerProfileKinds_tokenSteps_label()]),a(s,C)};S(ue,s=>{(B()==="add"||m())&&s(Ne)})}var P=o(ue,2);{var je=s=>{ht(s,{get label(){return t(Ye)},get error(){return ae()},control:(H,oe=gt)=>{var j=Ct(),Q=x(j);rt(Q,ft(oe,{type:"password",autocomplete:"off",spellcheck:!1,class:"font-mono",get disabled(){return N()},"data-testid":"provider-profile-secret-input",get value(){return u()},set value(W){u(W)}}));var le=o(Q,2);{var xe=W=>{z(W,{variant:"ghost-light",size:"sm",get disabled(){return N()},onclick:st,children:(ve,re)=>{A();var U=T();n(M=>i(U,M),[()=>e.settings_providerProfileKinds_keepSaved_label()]),a(ve,U)},$$slots:{default:!0}})};S(le,W=>{B()==="edit"&&b()&&W(xe)})}y(j),a(H,j)},$$slots:{control:!0}})},Je=s=>{var C=Kr(),H=x(C),oe=D(H,!0),j=o(H,2),Q=x(j),le=D(Q,!0),xe=o(Q,2);z(xe,{variant:"outline",size:"sm",get disabled(){return K()},onclick:()=>m(!0),children:(W,ve)=>{A();var re=T();n(U=>i(re,U),[()=>e.settings_providerProfileKinds_replace_label()]),a(W,re)},$$slots:{default:!0}}),y(j),y(C),n(W=>{i(oe,t(Ye)),i(le,W)},[()=>e.settings_providerProfileKinds_saved_label()]),a(s,C)};S(P,s=>{t(Fe)?s(je):s(Je,-1)})}var it=o(P,2);{var Qe=s=>{var C=Ar(),H=x(C),oe=x(H);Wt(oe,{get icon(){return Jt},class:"size-3 transition-transform group-open:rotate-90"});var j=o(oe);y(H);var Q=o(H,2),le=x(Q),xe=D(le,!0),W=o(le,2);{var ve=U=>{var M=wr(),ye=x(M),Ee=D(ye,!0),h=o(ye,2);{var L=O=>{var de=Pr(),X=We(de),Pe=D(X,!0),Le=o(X,2);z(Le,{variant:"ghost-light",size:"sm",get disabled(){return K()},onclick:()=>d("keep"),children:(fe,ge)=>{A();var Re=T();n(Se=>i(Re,Se),[()=>e.settings_providerProfileKinds_keepSaved_label()]),a(fe,Re)},$$slots:{default:!0}}),n(fe=>i(Pe,fe),[()=>e.settings_providerProfileKinds_baseUrlRemoved_label()]),a(O,de)},J=O=>{var de=Cr(),X=We(de),Pe=D(X,!0),Le=o(X,2);z(Le,{variant:"outline",size:"sm",get disabled(){return K()},onclick:()=>d("replace"),children:(ge,Re)=>{A();var Se=T();n(v=>i(Se,v),[()=>e.settings_providerProfileKinds_replace_label()]),a(ge,Se)},$$slots:{default:!0}});var fe=o(Le,2);z(fe,{variant:"ghost-light",size:"sm",get disabled(){return K()},onclick:()=>d("remove"),children:(ge,Re)=>{A();var Se=T();n(v=>i(Se,v),[()=>e.settings_providerProfiles_remove_label()]),a(ge,Se)},$$slots:{default:!0}}),n(ge=>i(Pe,ge),[()=>e.settings_providerProfileKinds_saved_label()]),a(O,de)};S(h,O=>{d()==="remove"?O(L):O(J,-1)})}y(M),n(O=>i(Ee,O),[()=>e.settings_providerProfileKinds_baseUrl_label()]),a(U,M)},re=U=>{{const M=(Ee,h=gt)=>{var L=Ct(),J=x(L);rt(J,ft(h,{type:"url",placeholder:ke,autocomplete:"off",spellcheck:!1,class:"font-mono",get disabled(){return K()},"data-testid":"provider-profile-base-url-input",get value(){return Y()},set value(X){Y(X)}}));var O=o(J,2);{var de=X=>{z(X,{variant:"ghost-light",size:"sm",get disabled(){return K()},onclick:()=>{d("keep"),Y("")},children:(Pe,Le)=>{A();var fe=T();n(ge=>i(fe,ge),[()=>e.settings_providerProfileKinds_keepSaved_label()]),a(Pe,fe)},$$slots:{default:!0}})};S(O,X=>{B()==="edit"&&he()&&X(de)})}y(L),a(Ee,L)};let ye=$(()=>e.settings_providerProfileKinds_baseUrl_label());ht(U,{get label(){return t(ye)},control:M,$$slots:{control:!0}})}};S(W,U=>{B()==="edit"&&he()&&d()!=="replace"?U(ve):U(re,-1)})}y(Q),y(C),n((U,M)=>{i(j,` ${U??""}`),i(xe,M)},[()=>e.settings_providerProfileKinds_customEndpoint_label(),()=>e.settings_providerProfileKinds_customEndpoint_description()]),Mt("open","toggle",C,V,V),a(s,C)};S(it,s=>{t(Ae)&&te()&&s(Qe)})}return y(Be),n(()=>ot(Be,"data-kind",E())),a(l,Be),_t(at)}var Er=k('<p class="text-sm text-subtle" role="status" data-testid="gitlab-instance-update-required"> </p>'),Lr=k('<p class="break-all type-caption text-subtle" data-testid="gitlab-connect-instance"> </p>'),Ir=k('<div class="max-w-sm space-y-3" data-testid="gitlab-connect-device-flow"><!> <div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!> <!></div></div>'),Gr=k('<div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!></div>'),zr=k('<p class="text-xs text-danger" role="alert"> </p>'),Ur=k('<div class="max-w-sm space-y-1" data-testid="gitlab-connect-token"><!> <!> <p class="text-xs text-subtle"> <!></p></div> <div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>',1),Or=k('<div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>'),Fr=k('<div class="max-w-sm space-y-1"><!> <!> <p class="text-xs text-subtle"> </p> <!></div> <!>',1),Br=k('<p class="text-sm text-subtle" role="status"> </p>'),Nr=k('<div class="space-y-1"><p class="text-sm text-subtle" role="status"> </p> <!></div>'),Rr=k('<p class="text-sm text-danger" role="alert"> </p>'),Hr=k('<div data-testid="gitlab-connect-form"><!> <!> <!> <!> <!></div>');function Mr(l,r){const _=It();if(new.target)return lt({component:Mr,...l});pt(r,!0);const E=()=>we(Ae,"$storedInstance$",d),B=()=>we(st,"$deviceGrantSupported$",d),u=()=>we(Be,"$instanceSetupSupported$",d),b=()=>we(R,"$isAuthenticating$",d),m=()=>we(Te,"$isCancelling$",d),ae=()=>we(Ye,"$deviceFlow$",d),Y=()=>we(Fe,"$cancelOutcome$",d),he=()=>we(at,"$error$",d),[d,V]=Et();let K=f(r,"compact",7,!1),N=f(r,"onCancel",7);const ie=`${_}-host`,ne=`${_}-host-help`,te=`${_}-host-error`,ke=`${_}-token`,Ae=St(),R=$t(),Te=lr(),Fe=dr(),Ye=Kt(),st=cr(),at=pr(),Be=_r();let De=tt(Gt(St.select(Ke.state))),Ve=tt(!1),ue=tt(""),Ne=tt(!1);const P=$(()=>ar(t(De))),je=$(()=>t(Ne)||t(P)===E()&&B()===!1),Je=$(()=>t(P)?nr(t(P)):null),it=$(()=>u()&&t(P)!==null&&t(ue).trim().length>0);bt(()=>{const v=E();t(Ve)||$e(De,v,!0)}),bt(()=>{u()||$e(ue,"")}),zt(()=>{const v=()=>{const c=Ke.state;$t.select(c)&&Kt.select(c)&&Ke.dispatch(xt())};return window.addEventListener("focus",v),()=>window.removeEventListener("focus",v)});function Qe(){!u()||!t(P)||t(P)===E()||b()||m()||Ke.dispatch(sr(t(P)))}function s(){$e(Ve,!0),$e(ue,"")}function C(){!u()||!t(P)||b()||m()||Ke.dispatch(ir(t(P)))}function H(){const v=t(ue).trim();!u()||!v||!t(P)||b()||m()||(Ke.dispatch(or(t(P),v)),$e(ue,""))}function oe(){!u()||m()||(b()&&Ke.dispatch(yt()),$e(Ne,!0))}function j(){$e(Ne,!1)}function Q(){m()||Ke.dispatch(yt())}function le(){t(Je)&&tr(t(Je),{})}function xe(v){v.key==="Enter"&&(v.preventDefault(),Qe(),t(je)?document.getElementById(ke)?.focus():C())}function W(v){v.key==="Enter"&&(v.preventDefault(),H())}const ve=$(()=>K()?"sm":"xl"),re=$(()=>K()?"sm":"default");var U={get compact(){return K()},set compact(v=!1){K(v),g()},get onCancel(){return N()},set onCancel(v){N(v),g()},$set:dt,$on:(v,c)=>ct(r,v,c)},M=Hr();{const v=c=>{z(c,{variant:"ghost",size:"sm",type:"button",class:"text-muted-foreground hover:text-foreground",get disabled(){return m()},onclick:Q,children:(p,w)=>{A();var F=T();n(ce=>i(F,ce),[()=>m()?e.lib_gitlabConnect_cancelling_label():e.lib_gitlabConnect_cancel_label()]),a(p,F)},$$slots:{default:!0}})};var ye=x(M);{var Ee=c=>{var p=Er(),w=D(p,!0);n(F=>i(w,F),[()=>e.lib_gitlabConnect_updateRequired_description()]),a(c,p)};S(ye,c=>{u()||c(Ee)})}var h=o(ye,2);{var L=c=>{var p=Lr(),w=D(p,!0);n(()=>i(w,E())),a(c,p)};S(h,c=>{(b()||m())&&c(L)})}var J=o(h,2);{var O=c=>{var p=Ir(),w=x(p);{let Ge=$(()=>e.lib_gitlabConnect_openGitlab_label());Zt(w,{get userCode(){return ae().userCode},get verificationUri(){return ae().verificationUri},get openLabel(){return t(Ge)},get compact(){return K()}})}var F=o(w,2),ce=x(F);mt(ce,{size:16,class:"shrink-0"});var se=o(ce,2),He=D(se,!0),Ie=o(se,2);{let Ge=$(()=>m()||!u());z(Ie,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return t(Ge)},onclick:oe,children:(nt,ut)=>{A();var I=T();n(q=>i(I,q),[()=>e.lib_gitlabConnect_useToken_label()]),a(nt,I)},$$slots:{default:!0}})}var qe=o(Ie,2);v(qe),y(F),y(p),n(Ge=>i(He,Ge),[()=>e.lib_gitlabConnect_waitingForAuthorization_label()]),a(c,p)},de=c=>{var p=Gr(),w=x(p);mt(w,{size:16,class:"shrink-0"});var F=o(w,2),ce=D(F,!0),se=o(F,2);v(se),y(p),n(He=>i(ce,He),[()=>e.lib_gitlabConnect_connecting_label()]),a(c,p)},X=c=>{var p=Fr(),w=We(p),F=x(w);kt(F,{get for(){return ie},children:(I,q)=>{A();var Z=T();n(pe=>i(Z,pe),[()=>e.lib_gitlabConnect_host_label()]),a(I,Z)},$$slots:{default:!0}});var ce=o(F,2);{let I=$(()=>!u()),q=$(()=>!t(P)||void 0),Z=$(()=>t(P)?ne:`${ne} ${te}`);rt(ce,{get id(){return ie},type:"text",autocomplete:"url",spellcheck:!1,get disabled(){return t(I)},get"aria-invalid"(){return t(q)},get"aria-describedby"(){return t(Z)},get placeholder(){return rr},oninput:s,onchange:Qe,onkeydown:xe,get value(){return t(De)},set value(pe){$e(De,pe,!0)}})}var se=o(ce,2),He=D(se,!0),Ie=o(se,2);{var qe=I=>{var q=zr(),Z=D(q,!0);n(pe=>{ot(q,"id",te),i(Z,pe)},[()=>e.lib_gitlabConnect_invalidInstance_error()]),a(I,q)};S(Ie,I=>{t(P)||I(qe)})}y(w);var Ge=o(w,2);{var nt=I=>{var q=Ur(),Z=We(q),pe=x(Z);kt(pe,{get for(){return ke},children:(G,me)=>{A();var Me=T();n(ee=>i(Me,ee),[()=>e.lib_gitlabConnect_token_label()]),a(G,Me)},$$slots:{default:!0}});var Xe=o(pe,2);{let G=$(()=>!u());rt(Xe,{get id(){return ke},type:"password",autocomplete:"off",get disabled(){return t(G)},placeholder:"glpat-...",onkeydown:W,get value(){return t(ue)},set value(me){$e(ue,me,!0)}})}var Ze=o(Xe,2),be=x(Ze),ze=o(be);{var et=G=>{z(G,{variant:"link",size:"sm",type:"button",class:"h-auto px-0 text-xs",onclick:le,children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_createToken_label({host:t(P)})]),a(me,ee)},$$slots:{default:!0}})};S(ze,G=>{t(Je)&&t(P)&&G(et)})}y(Ze),y(Z);var _e=o(Z,2),Ce=x(_e);{let G=$(()=>!t(it));z(Ce,{variant:"primary",get size(){return t(ve)},type:"button",onclick:H,get disabled(){return t(G)},children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_connect_label()]),a(me,ee)},$$slots:{default:!0}})}var vt=o(Ce,2);{var At=G=>{z(G,{variant:"ghost",get size(){return t(re)},type:"button",onclick:j,children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_useDevice_label()]),a(me,ee)},$$slots:{default:!0}})};S(vt,G=>{t(Ne)&&!(t(P)===E()&&B()===!1)&&G(At)})}var Tt=o(vt,2);{var Dt=G=>{z(G,{variant:"ghost",get size(){return t(re)},type:"button",get onclick(){return N()},children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_cancel_label()]),a(me,ee)},$$slots:{default:!0}})};S(Tt,G=>{N()&&G(Dt)})}y(_e),n(G=>i(be,`${G??""} `),[()=>e.lib_gitlabConnect_token_description()]),a(I,q)},ut=I=>{var q=Or(),Z=x(q);{let be=$(()=>!t(P)||!u());z(Z,{variant:"primary",get size(){return t(ve)},type:"button",onclick:C,get disabled(){return t(be)},children:(ze,et)=>{A();var _e=T();n(Ce=>i(_e,Ce),[()=>e.lib_gitlabConnect_connect_label()]),a(ze,_e)},$$slots:{default:!0}})}var pe=o(Z,2);{let be=$(()=>!u());z(pe,{variant:"ghost",get size(){return t(re)},type:"button",get disabled(){return t(be)},onclick:oe,children:(ze,et)=>{A();var _e=T();n(Ce=>i(_e,Ce),[()=>e.lib_gitlabConnect_useToken_label()]),a(ze,_e)},$$slots:{default:!0}})}var Xe=o(pe,2);{var Ze=be=>{z(be,{variant:"ghost",get size(){return t(re)},type:"button",get onclick(){return N()},children:(ze,et)=>{A();var _e=T();n(Ce=>i(_e,Ce),[()=>e.lib_gitlabConnect_cancel_label()]),a(ze,_e)},$$slots:{default:!0}})};S(Xe,be=>{N()&&be(Ze)})}y(q),a(I,q)};S(Ge,I=>{t(je)?I(nt):I(ut,-1)})}n(I=>{ot(se,"id",ne),i(He,I)},[()=>e.lib_gitlabConnect_host_description()]),a(c,p)};S(J,c=>{(b()||m())&&ae()?c(O):b()||m()?c(de,1):c(X,-1)})}var Pe=o(J,2);{var Le=c=>{var p=Br(),w=D(p,!0);n(F=>i(w,F),[()=>e.lib_gitlabConnect_cancelled_label()]),a(c,p)},fe=c=>{var p=Nr(),w=x(p),F=D(w,!0),ce=o(w,2);z(ce,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return m()},onclick:()=>Ke.dispatch(xt()),children:(se,He)=>{A();var Ie=T();n(qe=>i(Ie,qe),[()=>e.lib_gitlabConnect_checkStatus_label()]),a(se,Ie)},$$slots:{default:!0}}),y(p),n(se=>i(F,se),[()=>Y()==="already-started"?e.lib_gitlabConnect_alreadyStarted_description():e.lib_gitlabConnect_cancelFailed_description()]),a(c,p)};S(Pe,c=>{Y()==="cancelled"?c(Le):(Y()==="already-started"||Y()==="failed")&&c(fe,1)})}var ge=o(Pe,2);{var Re=c=>{var p=Rr(),w=D(p,!0);n(()=>i(w,he())),a(c,p)};S(ge,c=>{he()&&c(Re)})}y(M)}n(()=>Bt(M,1,Nt(K()?"space-y-2":"space-y-4"))),a(l,M);var Se=_t(U);return V(),Se}const wt=[{id:"people",get label(){return e.workspace_peopleTile_title()},icon:qt,description:""},{id:"agents",get label(){return e.workspace_multiSelectSidebar_agentsTab_label()},icon:Yt,get description(){return e.workspace_multiSelectSidebar_agentsTab_description()}},{id:"context",get label(){return e.workspace_multiSelectSidebar_contextTab_label()},icon:ur.note,get description(){return e.workspace_multiSelectSidebar_contextTab_description()}},{id:"changes",get label(){return e.workspace_multiSelectSidebar_changesTab_label()},icon:Vt,get description(){return e.workspace_multiSelectSidebar_changesTab_description()}},{id:"files",get label(){return e.workspace_multiSelectSidebar_filesTab_label()},icon:jt,get description(){return e.workspace_multiSelectSidebar_filesTab_description()}},{id:"browser",get label(){return e.workspace_multiSelectSidebar_browserTab_label()},icon:Qt,get description(){return e.workspace_multiSelectSidebar_browserTab_description()}},{id:"shell",get label(){return e.workspace_multiSelectSidebar_shellTab_label()},icon:Xt,get description(){return e.workspace_multiSelectSidebar_shellTab_description()}}];function Wr(l){return wt.some(r=>r.id===l)}const Jr=new Set(["browser","shell"]),Ks=new Set(["context","changes","files","browser","shell"]),qr=new Set(["changes"]);function Ps(l,r=!1,_=!0,E=!1,B=!1){const u=l.filter(b=>Wr(b)&&(b!=="people"||_)&&!(B&&qr.has(b))&&!(r&&Jr.has(b)&&!(b==="shell"&&E)));return new Set(u.length>0?u:["agents"])}function Yr(l){const r=new Set(l);return wt.flatMap(({id:_})=>r.has(_)?[_]:[])}function Cs(l,r){const _=new Set(l);return _.has(r)?_.size>1&&_.delete(r):_.add(r),Yr(_)}export{qr as G,Ks as H,fr as M,Jr as O,Dr as P,wt as T,Mr as a,hr as b,$s as c,mr as k,Ps as n,Yr as o,Ss as s,Cs as t};
1
+ import{t as lt,bo as f,bw as dt,b as ct,bm as e,br as ft,bs as we,bq as Et}from"./YLhFQnIu.js";import{bs as pt,ay as We,be as A,b$ as T,b_ as n,bO as i,W as a,bS as o,bl as D,bn as _t,aA as g,a7 as Lt,aD as t,c9 as $,aB as k,a5 as x,bA as y,bf as gt,bo as It,bV as tt,br as Gt,ca as bt,bH as $e,bk as zt}from"./3SdAC2_C.js";import{g as Ut,i as Ot,I as mt}from"./oBIu7LTI.js";import{c as Ft}from"./DwGyIIXK.js";import{s as ot,f as Bt,c as Nt}from"./BQhBnAuP.js";import{f as z}from"./Cw2fqKk9.js";import"./DJivXy66.js";import"./WvHbj6rB.js";import{b as Rt}from"./DRLJuUwT.js";import"./kvtKUeBe.js";import"./KtEuoG00.js";import{b as Ht}from"./DPG1HUgG.js";import{i as S}from"./YeOAvjnW.js";import{b as Mt}from"./D3yXvqwY.js";import{F as Wt,ay as Jt,c_ as qt,cn as Yt,aN as Vt,bn as jt,d0 as Qt,cK as Xt}from"./gwv5JQYH.js";import"./CrpUtGFn.js";import{F as ht,G as Zt}from"./CsxKvalJ.js";import"./CIWQMI37.js";/* empty css */import{C as er}from"./CZB2ndi9.js";import{L as kt}from"./DwiE5WsI.js";import{I as rt}from"./DkERMj5B.js";import"./DtkIwON_.js";import"./BNDTLRE1.js";import{h as tr}from"./50A7Z_-B.js";import{Jx as Ke,fC as xt,J as rr,ep as yt,r6 as sr,uB as ar,Jo as ir,oE as nr,hS as or}from"./D5wnbxHp.js";import{aB as St,aC as $t,aD as lr,aw as dr,ax as Kt,ay as cr,az as pr,aH as _r}from"./0x2uouHf.js";import{R as ur}from"./BP-cDE7g.js";var vr=k('<!> <p class="type-body"> </p>',1);function fr(l,r){if(new.target)return lt({component:fr,...l});pt(r,!0);let _=f(r,"open",15,!1),E=f(r,"static",7,!1),B=f(r,"title",7),u=f(r,"message",7),b=f(r,"buttons",7),m=f(r,"cancelIndex",7,0),ae=f(r,"onSelect",7);function Y(d){_(!1),ae()?.(d)}var he={get open(){return _()},set open(d=!1){_(d),g()},get static(){return E()},set static(d=!1){E(d),g()},get title(){return B()},set title(d){B(d),g()},get message(){return u()},set message(d){u(d),g()},get buttons(){return b()},set buttons(d){b(d),g()},get cancelIndex(){return m()},set cancelIndex(d=0){m(d),g()},get onSelect(){return ae()},set onSelect(d){ae(d),g()},$set:dt,$on:(d,V)=>ct(r,d,V)};return Ht(l,{get static(){return E()},role:"alertdialog",get title(){return B()},dismissOnInteractOutside:!1,focusContent:!0,onSubmit:()=>Y(b().length-1),onCancel:()=>Y(m()),get open(){return _()},set open(V){_(V)},footer:V=>{var K=Lt(),N=We(K);Ut(N,17,b,Ot,(ie,ne,te)=>{{let ke=$(()=>te===m()?"ghost":te===b().length-1?"primary":"outline");z(ie,{get variant(){return t(ke)},onclick:()=>Y(te),children:(Ae,R)=>{A();var Te=T();n(()=>i(Te,t(ne))),a(Ae,Te)},$$slots:{default:!0}})}}),a(V,K)},children:(V,K)=>{var N=vr(),ie=We(N);Ft(ie,()=>Rt,(ke,Ae)=>{Ae(ke,{class:"sr-only",children:(R,Te)=>{A();var Fe=T();n(()=>i(Fe,u())),a(R,Fe)},$$slots:{default:!0}})});var ne=o(ie,2),te=D(ne,!0);n(()=>i(te,u())),a(V,N)},$$slots:{footer:!0,default:!0}}),_t(he)}const Oe={anthropicKeys:"https://console.anthropic.com/settings/keys",openAiKeys:"https://platform.openai.com/api-keys",openAiTokens:"https://developers.openai.com/codex/enterprise/access-tokens",xaiConsole:"https://console.x.ai",factoryKeys:"https://app.factory.ai/settings/api-keys",cursorDashboard:"https://cursor.com/dashboard?tab=integrations",auggieAuth:"https://docs.augmentcode.com/cli/setup-auggie/authentication"},gr="claude setup-token",br="auggie token print";function mr(l,r){if(r==="differentLogin")return e.settings_providerProfileKinds_differentLogin_description();if(r==="token")return l==="codex"?e.settings_providerProfileKinds_tokenCodex_description():l==="auggie"?e.settings_providerProfileKinds_tokenAuggie_description():e.settings_providerProfileKinds_tokenClaude_description();switch(l){case"codex":return e.settings_providerProfileKinds_apiKeyCodex_description();case"grok":return e.settings_providerProfileKinds_apiKeyGrok_description();case"droid":return e.settings_providerProfileKinds_apiKeyDroid_description();case"cursor":return e.settings_providerProfileKinds_apiKeyCursor_description();default:return e.settings_providerProfileKinds_apiKeyClaude_description()}}function hr(l,r){return r==="apiKey"?e.settings_providerProfileKinds_apiKey_label():l==="auggie"?e.settings_providerProfileKinds_tokenAuggie_label():e.settings_providerProfileKinds_token_label()}function Ss(l,r){return l!=="claude"&&l!=="codex"?mr(l,r):r==="token"?l==="codex"?e.settings_providerProfileKinds_tokenCodexDialog_description():e.settings_providerProfileKinds_tokenClaudeDialog_description():l==="codex"?e.settings_providerProfileKinds_apiKeyCodexDialog_description():e.settings_providerProfileKinds_apiKeyClaudeDialog_description()}function kr(l,r){if(r==="token")return l==="codex"?{steps:[e.settings_providerProfileKinds_tokenCodexStep1_label()],link:{href:Oe.openAiTokens,label:e.settings_providerProfileKinds_openAiAccessTokens_link()},eligibility:e.settings_providerProfileKinds_tokenCodexEligibility_description()}:l==="auggie"?{steps:[e.settings_providerProfileKinds_tokenAuggieStep1_label(),e.settings_providerProfileKinds_tokenAuggieStep2_label()],command:br,link:{href:Oe.auggieAuth,label:e.settings_providerProfileKinds_auggieAuthDocs_link()}}:{steps:[e.settings_providerProfileKinds_tokenClaudeStep1_label(),e.settings_providerProfileKinds_tokenClaudeStep2_label()],command:gr};switch(l){case"codex":return{steps:[e.settings_providerProfileKinds_apiKeyCodexStep1_label(),e.settings_providerProfileKinds_apiKeyCodexStep2_label()],link:{href:Oe.openAiKeys,label:e.settings_providerProfileKinds_openAiApiKeys_link()}};case"grok":return{steps:[e.settings_providerProfileKinds_apiKeyGrokStep1_label(),e.settings_providerProfileKinds_apiKeyGrokStep2_label()],link:{href:Oe.xaiConsole,label:e.settings_providerProfileKinds_xaiConsole_link()}};case"droid":return{steps:[e.settings_providerProfileKinds_apiKeyDroidStep1_label(),e.settings_providerProfileKinds_apiKeyDroidStep2_label()],link:{href:Oe.factoryKeys,label:e.settings_providerProfileKinds_factoryApiKeys_link()}};case"cursor":return{steps:[e.settings_providerProfileKinds_apiKeyCursorStep1_label(),e.settings_providerProfileKinds_apiKeyCursorStep2_label()],link:{href:Oe.cursorDashboard,label:e.settings_providerProfileKinds_cursorDashboard_link()}};default:return{steps:[e.settings_providerProfileKinds_apiKeyClaudeStep1_label(),e.settings_providerProfileKinds_apiKeyClaudeStep2_label()],link:{href:Oe.anthropicKeys,label:e.settings_providerProfileKinds_anthropicConsole_link()}}}}function xr(l,r){return r?l==="apiKey"?e.settings_providerProfileKinds_apiKeyClaudeStep3_label():e.settings_providerProfileKinds_tokenClaudeStep3_label():e.settings_providerProfileKinds_pasteNoCheck_label()}function $s(l,r){if(r==="token")return l==="codex"?e.settings_providerProfileKinds_tokenNotJwt_error():l==="auggie"?e.settings_providerProfileKinds_tokenShapeAuggie_error():e.settings_providerProfileKinds_tokenShapeClaude_error();switch(l){case"codex":return e.settings_providerProfileKinds_keyShapeCodex_error();case"grok":return e.settings_providerProfileKinds_keyShapeGrok_error();case"droid":return e.settings_providerProfileKinds_keyShapeDroid_error();case"cursor":return e.settings_providerProfileKinds_keyShapeCursor_error();default:return e.settings_providerProfileKinds_keyShapeClaude_error()}}var yr=k('<p class="type-body text-muted-foreground" data-testid="provider-profile-token-eligibility"> </p>'),Sr=k('<span class="mt-1 flex items-center gap-2" data-testid="provider-profile-setup-token"><code class="rounded border border-border bg-muted px-1.5 py-0.5 font-mono type-caption text-foreground"> </code> <!></span>'),Pt=k("<li> </li>"),$r=k('<section class="space-y-2" data-testid="provider-profile-secret-steps"><h3 class="type-body font-medium! text-foreground"> </h3> <ol class="type-body list-decimal space-y-1 pl-5 text-muted-foreground"><li> <!></li> <!> <!></ol> <!></section>'),Ct=k('<div class="flex items-center gap-2"><!> <!></div>'),Kr=k('<div class="space-y-2" data-testid="provider-profile-secret-saved"><p class="type-body text-foreground"> </p> <div class="flex items-center gap-3"><span class="type-body font-mono text-muted-foreground"> </span> <!></div></div>'),Pr=k('<span class="type-body text-muted-foreground"> </span> <!>',1),Cr=k('<span class="type-body font-mono text-muted-foreground"> </span> <!> <!>',1),wr=k('<div class="flex flex-wrap items-center gap-3" data-testid="provider-profile-base-url-saved"><span class="type-body text-foreground"> </span> <!></div>'),Ar=k('<details class="group rounded-md border border-border" data-testid="provider-profile-custom-endpoint"><summary class="flex cursor-pointer list-none items-center gap-2 px-3 py-2 type-body text-foreground [&amp;::-webkit-details-marker]:hidden"><!> </summary> <div class="space-y-2 border-t border-border px-3 py-3"><p class="type-caption text-muted-foreground"> </p> <!></div></details>'),Tr=k('<div class="space-y-5" data-testid="provider-profile-secret"><!> <!> <!> <!></div>');function Dr(l,r){if(new.target)return lt({component:Dr,...l});pt(r,!0);let _=f(r,"provider",7),E=f(r,"kind",7),B=f(r,"mode",7),u=f(r,"secret",15,""),b=f(r,"secretSaved",7,!1),m=f(r,"replacing",15,!1),ae=f(r,"secretError",7),Y=f(r,"baseUrl",15,""),he=f(r,"baseUrlSaved",7,!1),d=f(r,"baseUrlAction",15,"keep"),V=f(r,"customEndpointOpen",15,!1),K=f(r,"disabled",7,!1),N=f(r,"secretDisabled",23,K),ie=f(r,"keyCheck",7,!0),ne=f(r,"pasteStep",7,!0),te=f(r,"customEndpoint",7,!0);const ke="https://",Ae=$(()=>_()==="claude"&&E()==="apiKey"),R=$(()=>kr(_(),E())),Te=$(()=>xr(E(),ie())),Fe=$(()=>B()==="add"||!b()||m()),Ye=$(()=>hr(_(),E()));function st(){m(!1),u("")}var at={get provider(){return _()},set provider(s){_(s),g()},get kind(){return E()},set kind(s){E(s),g()},get mode(){return B()},set mode(s){B(s),g()},get secret(){return u()},set secret(s=""){u(s),g()},get secretSaved(){return b()},set secretSaved(s=!1){b(s),g()},get replacing(){return m()},set replacing(s=!1){m(s),g()},get secretError(){return ae()},set secretError(s){ae(s),g()},get baseUrl(){return Y()},set baseUrl(s=""){Y(s),g()},get baseUrlSaved(){return he()},set baseUrlSaved(s=!1){he(s),g()},get baseUrlAction(){return d()},set baseUrlAction(s="keep"){d(s),g()},get customEndpointOpen(){return V()},set customEndpointOpen(s=!1){V(s),g()},get disabled(){return K()},set disabled(s=!1){K(s),g()},get secretDisabled(){return N()},set secretDisabled(s=K){N(s),g()},get keyCheck(){return ie()},set keyCheck(s=!0){ie(s),g()},get pasteStep(){return ne()},set pasteStep(s=!0){ne(s),g()},get customEndpoint(){return te()},set customEndpoint(s=!0){te(s),g()},$set:dt,$on:(s,C)=>ct(r,s,C)},Be=Tr(),De=x(Be);{var Ve=s=>{var C=yr(),H=D(C,!0);n(()=>i(H,t(R).eligibility)),a(s,C)};S(De,s=>{t(R).eligibility&&s(Ve)})}var ue=o(De,2);{var Ne=s=>{var C=$r(),H=x(C),oe=D(H,!0),j=o(H,2),Q=x(j),le=x(Q),xe=o(le);{var W=h=>{var L=Sr(),J=x(L),O=D(J,!0),de=o(J,2);er(de,{get text(){return t(R).command},size:"sm"}),y(L),n(()=>i(O,t(R).command)),a(h,L)};S(xe,h=>{t(R).command&&h(W)})}y(Q);var ve=o(Q,2);{var re=h=>{var L=Pt(),J=D(L,!0);n(()=>i(J,t(R).steps[1])),a(h,L)};S(ve,h=>{t(R).steps[1]&&h(re)})}var U=o(ve,2);{var M=h=>{var L=Pt(),J=D(L,!0);n(()=>i(J,t(Te))),a(h,L)};S(U,h=>{ne()&&h(M)})}y(j);var ye=o(j,2);{var Ee=h=>{z(h,{variant:"link",size:"sm",get href(){return t(R).link.href},target:"_blank",rel:"noopener noreferrer",class:"h-auto px-0",children:(L,J)=>{A();var O=T();n(()=>i(O,t(R).link.label)),a(L,O)},$$slots:{default:!0}})};S(ye,h=>{t(R).link&&h(Ee)})}y(C),n(h=>{i(oe,h),i(le,`${t(R).steps[0]??""} `)},[()=>E()==="apiKey"?e.settings_providerProfileKinds_apiKeyClaudeSteps_label():e.settings_providerProfileKinds_tokenSteps_label()]),a(s,C)};S(ue,s=>{(B()==="add"||m())&&s(Ne)})}var P=o(ue,2);{var je=s=>{ht(s,{get label(){return t(Ye)},get error(){return ae()},control:(H,oe=gt)=>{var j=Ct(),Q=x(j);rt(Q,ft(oe,{type:"password",autocomplete:"off",spellcheck:!1,class:"font-mono",get disabled(){return N()},"data-testid":"provider-profile-secret-input",get value(){return u()},set value(W){u(W)}}));var le=o(Q,2);{var xe=W=>{z(W,{variant:"ghost-light",size:"sm",get disabled(){return N()},onclick:st,children:(ve,re)=>{A();var U=T();n(M=>i(U,M),[()=>e.settings_providerProfileKinds_keepSaved_label()]),a(ve,U)},$$slots:{default:!0}})};S(le,W=>{B()==="edit"&&b()&&W(xe)})}y(j),a(H,j)},$$slots:{control:!0}})},Je=s=>{var C=Kr(),H=x(C),oe=D(H,!0),j=o(H,2),Q=x(j),le=D(Q,!0),xe=o(Q,2);z(xe,{variant:"outline",size:"sm",get disabled(){return K()},onclick:()=>m(!0),children:(W,ve)=>{A();var re=T();n(U=>i(re,U),[()=>e.settings_providerProfileKinds_replace_label()]),a(W,re)},$$slots:{default:!0}}),y(j),y(C),n(W=>{i(oe,t(Ye)),i(le,W)},[()=>e.settings_providerProfileKinds_saved_label()]),a(s,C)};S(P,s=>{t(Fe)?s(je):s(Je,-1)})}var it=o(P,2);{var Qe=s=>{var C=Ar(),H=x(C),oe=x(H);Wt(oe,{get icon(){return Jt},class:"size-3 transition-transform group-open:rotate-90"});var j=o(oe);y(H);var Q=o(H,2),le=x(Q),xe=D(le,!0),W=o(le,2);{var ve=U=>{var M=wr(),ye=x(M),Ee=D(ye,!0),h=o(ye,2);{var L=O=>{var de=Pr(),X=We(de),Pe=D(X,!0),Le=o(X,2);z(Le,{variant:"ghost-light",size:"sm",get disabled(){return K()},onclick:()=>d("keep"),children:(fe,ge)=>{A();var Re=T();n(Se=>i(Re,Se),[()=>e.settings_providerProfileKinds_keepSaved_label()]),a(fe,Re)},$$slots:{default:!0}}),n(fe=>i(Pe,fe),[()=>e.settings_providerProfileKinds_baseUrlRemoved_label()]),a(O,de)},J=O=>{var de=Cr(),X=We(de),Pe=D(X,!0),Le=o(X,2);z(Le,{variant:"outline",size:"sm",get disabled(){return K()},onclick:()=>d("replace"),children:(ge,Re)=>{A();var Se=T();n(v=>i(Se,v),[()=>e.settings_providerProfileKinds_replace_label()]),a(ge,Se)},$$slots:{default:!0}});var fe=o(Le,2);z(fe,{variant:"ghost-light",size:"sm",get disabled(){return K()},onclick:()=>d("remove"),children:(ge,Re)=>{A();var Se=T();n(v=>i(Se,v),[()=>e.settings_providerProfiles_remove_label()]),a(ge,Se)},$$slots:{default:!0}}),n(ge=>i(Pe,ge),[()=>e.settings_providerProfileKinds_saved_label()]),a(O,de)};S(h,O=>{d()==="remove"?O(L):O(J,-1)})}y(M),n(O=>i(Ee,O),[()=>e.settings_providerProfileKinds_baseUrl_label()]),a(U,M)},re=U=>{{const M=(Ee,h=gt)=>{var L=Ct(),J=x(L);rt(J,ft(h,{type:"url",placeholder:ke,autocomplete:"off",spellcheck:!1,class:"font-mono",get disabled(){return K()},"data-testid":"provider-profile-base-url-input",get value(){return Y()},set value(X){Y(X)}}));var O=o(J,2);{var de=X=>{z(X,{variant:"ghost-light",size:"sm",get disabled(){return K()},onclick:()=>{d("keep"),Y("")},children:(Pe,Le)=>{A();var fe=T();n(ge=>i(fe,ge),[()=>e.settings_providerProfileKinds_keepSaved_label()]),a(Pe,fe)},$$slots:{default:!0}})};S(O,X=>{B()==="edit"&&he()&&X(de)})}y(L),a(Ee,L)};let ye=$(()=>e.settings_providerProfileKinds_baseUrl_label());ht(U,{get label(){return t(ye)},control:M,$$slots:{control:!0}})}};S(W,U=>{B()==="edit"&&he()&&d()!=="replace"?U(ve):U(re,-1)})}y(Q),y(C),n((U,M)=>{i(j,` ${U??""}`),i(xe,M)},[()=>e.settings_providerProfileKinds_customEndpoint_label(),()=>e.settings_providerProfileKinds_customEndpoint_description()]),Mt("open","toggle",C,V,V),a(s,C)};S(it,s=>{t(Ae)&&te()&&s(Qe)})}return y(Be),n(()=>ot(Be,"data-kind",E())),a(l,Be),_t(at)}var Er=k('<p class="text-sm text-subtle" role="status" data-testid="gitlab-instance-update-required"> </p>'),Lr=k('<p class="break-all type-caption text-subtle" data-testid="gitlab-connect-instance"> </p>'),Ir=k('<div class="max-w-sm space-y-3" data-testid="gitlab-connect-device-flow"><!> <div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!> <!></div></div>'),Gr=k('<div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!></div>'),zr=k('<p class="text-xs text-danger" role="alert"> </p>'),Ur=k('<div class="max-w-sm space-y-1" data-testid="gitlab-connect-token"><!> <!> <p class="text-xs text-subtle"> <!></p></div> <div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>',1),Or=k('<div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>'),Fr=k('<div class="max-w-sm space-y-1"><!> <!> <p class="text-xs text-subtle"> </p> <!></div> <!>',1),Br=k('<p class="text-sm text-subtle" role="status"> </p>'),Nr=k('<div class="space-y-1"><p class="text-sm text-subtle" role="status"> </p> <!></div>'),Rr=k('<p class="text-sm text-danger" role="alert"> </p>'),Hr=k('<div data-testid="gitlab-connect-form"><!> <!> <!> <!> <!></div>');function Mr(l,r){const _=It();if(new.target)return lt({component:Mr,...l});pt(r,!0);const E=()=>we(Ae,"$storedInstance$",d),B=()=>we(st,"$deviceGrantSupported$",d),u=()=>we(Be,"$instanceSetupSupported$",d),b=()=>we(R,"$isAuthenticating$",d),m=()=>we(Te,"$isCancelling$",d),ae=()=>we(Ye,"$deviceFlow$",d),Y=()=>we(Fe,"$cancelOutcome$",d),he=()=>we(at,"$error$",d),[d,V]=Et();let K=f(r,"compact",7,!1),N=f(r,"onCancel",7);const ie=`${_}-host`,ne=`${_}-host-help`,te=`${_}-host-error`,ke=`${_}-token`,Ae=St(),R=$t(),Te=lr(),Fe=dr(),Ye=Kt(),st=cr(),at=pr(),Be=_r();let De=tt(Gt(St.select(Ke.state))),Ve=tt(!1),ue=tt(""),Ne=tt(!1);const P=$(()=>ar(t(De))),je=$(()=>t(Ne)||t(P)===E()&&B()===!1),Je=$(()=>t(P)?nr(t(P)):null),it=$(()=>u()&&t(P)!==null&&t(ue).trim().length>0);bt(()=>{const v=E();t(Ve)||$e(De,v,!0)}),bt(()=>{u()||$e(ue,"")}),zt(()=>{const v=()=>{const c=Ke.state;$t.select(c)&&Kt.select(c)&&Ke.dispatch(xt())};return window.addEventListener("focus",v),()=>window.removeEventListener("focus",v)});function Qe(){!u()||!t(P)||t(P)===E()||b()||m()||Ke.dispatch(sr(t(P)))}function s(){$e(Ve,!0),$e(ue,"")}function C(){!u()||!t(P)||b()||m()||Ke.dispatch(ir(t(P)))}function H(){const v=t(ue).trim();!u()||!v||!t(P)||b()||m()||(Ke.dispatch(or(t(P),v)),$e(ue,""))}function oe(){!u()||m()||(b()&&Ke.dispatch(yt()),$e(Ne,!0))}function j(){$e(Ne,!1)}function Q(){m()||Ke.dispatch(yt())}function le(){t(Je)&&tr(t(Je),{})}function xe(v){v.key==="Enter"&&(v.preventDefault(),Qe(),t(je)?document.getElementById(ke)?.focus():C())}function W(v){v.key==="Enter"&&(v.preventDefault(),H())}const ve=$(()=>K()?"sm":"xl"),re=$(()=>K()?"sm":"default");var U={get compact(){return K()},set compact(v=!1){K(v),g()},get onCancel(){return N()},set onCancel(v){N(v),g()},$set:dt,$on:(v,c)=>ct(r,v,c)},M=Hr();{const v=c=>{z(c,{variant:"ghost",size:"sm",type:"button",class:"text-muted-foreground hover:text-foreground",get disabled(){return m()},onclick:Q,children:(p,w)=>{A();var F=T();n(ce=>i(F,ce),[()=>m()?e.lib_gitlabConnect_cancelling_label():e.lib_gitlabConnect_cancel_label()]),a(p,F)},$$slots:{default:!0}})};var ye=x(M);{var Ee=c=>{var p=Er(),w=D(p,!0);n(F=>i(w,F),[()=>e.lib_gitlabConnect_updateRequired_description()]),a(c,p)};S(ye,c=>{u()||c(Ee)})}var h=o(ye,2);{var L=c=>{var p=Lr(),w=D(p,!0);n(()=>i(w,E())),a(c,p)};S(h,c=>{(b()||m())&&c(L)})}var J=o(h,2);{var O=c=>{var p=Ir(),w=x(p);{let Ge=$(()=>e.lib_gitlabConnect_openGitlab_label());Zt(w,{get userCode(){return ae().userCode},get verificationUri(){return ae().verificationUri},get openLabel(){return t(Ge)},get compact(){return K()}})}var F=o(w,2),ce=x(F);mt(ce,{size:16,class:"shrink-0"});var se=o(ce,2),He=D(se,!0),Ie=o(se,2);{let Ge=$(()=>m()||!u());z(Ie,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return t(Ge)},onclick:oe,children:(nt,ut)=>{A();var I=T();n(q=>i(I,q),[()=>e.lib_gitlabConnect_useToken_label()]),a(nt,I)},$$slots:{default:!0}})}var qe=o(Ie,2);v(qe),y(F),y(p),n(Ge=>i(He,Ge),[()=>e.lib_gitlabConnect_waitingForAuthorization_label()]),a(c,p)},de=c=>{var p=Gr(),w=x(p);mt(w,{size:16,class:"shrink-0"});var F=o(w,2),ce=D(F,!0),se=o(F,2);v(se),y(p),n(He=>i(ce,He),[()=>e.lib_gitlabConnect_connecting_label()]),a(c,p)},X=c=>{var p=Fr(),w=We(p),F=x(w);kt(F,{get for(){return ie},children:(I,q)=>{A();var Z=T();n(pe=>i(Z,pe),[()=>e.lib_gitlabConnect_host_label()]),a(I,Z)},$$slots:{default:!0}});var ce=o(F,2);{let I=$(()=>!u()),q=$(()=>!t(P)||void 0),Z=$(()=>t(P)?ne:`${ne} ${te}`);rt(ce,{get id(){return ie},type:"text",autocomplete:"url",spellcheck:!1,get disabled(){return t(I)},get"aria-invalid"(){return t(q)},get"aria-describedby"(){return t(Z)},get placeholder(){return rr},oninput:s,onchange:Qe,onkeydown:xe,get value(){return t(De)},set value(pe){$e(De,pe,!0)}})}var se=o(ce,2),He=D(se,!0),Ie=o(se,2);{var qe=I=>{var q=zr(),Z=D(q,!0);n(pe=>{ot(q,"id",te),i(Z,pe)},[()=>e.lib_gitlabConnect_invalidInstance_error()]),a(I,q)};S(Ie,I=>{t(P)||I(qe)})}y(w);var Ge=o(w,2);{var nt=I=>{var q=Ur(),Z=We(q),pe=x(Z);kt(pe,{get for(){return ke},children:(G,me)=>{A();var Me=T();n(ee=>i(Me,ee),[()=>e.lib_gitlabConnect_token_label()]),a(G,Me)},$$slots:{default:!0}});var Xe=o(pe,2);{let G=$(()=>!u());rt(Xe,{get id(){return ke},type:"password",autocomplete:"off",get disabled(){return t(G)},placeholder:"glpat-...",onkeydown:W,get value(){return t(ue)},set value(me){$e(ue,me,!0)}})}var Ze=o(Xe,2),be=x(Ze),ze=o(be);{var et=G=>{z(G,{variant:"link",size:"sm",type:"button",class:"h-auto px-0 text-xs",onclick:le,children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_createToken_label({host:t(P)})]),a(me,ee)},$$slots:{default:!0}})};S(ze,G=>{t(Je)&&t(P)&&G(et)})}y(Ze),y(Z);var _e=o(Z,2),Ce=x(_e);{let G=$(()=>!t(it));z(Ce,{variant:"primary",get size(){return t(ve)},type:"button",onclick:H,get disabled(){return t(G)},children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_connect_label()]),a(me,ee)},$$slots:{default:!0}})}var vt=o(Ce,2);{var At=G=>{z(G,{variant:"ghost",get size(){return t(re)},type:"button",onclick:j,children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_useDevice_label()]),a(me,ee)},$$slots:{default:!0}})};S(vt,G=>{t(Ne)&&!(t(P)===E()&&B()===!1)&&G(At)})}var Tt=o(vt,2);{var Dt=G=>{z(G,{variant:"ghost",get size(){return t(re)},type:"button",get onclick(){return N()},children:(me,Me)=>{A();var ee=T();n(Ue=>i(ee,Ue),[()=>e.lib_gitlabConnect_cancel_label()]),a(me,ee)},$$slots:{default:!0}})};S(Tt,G=>{N()&&G(Dt)})}y(_e),n(G=>i(be,`${G??""} `),[()=>e.lib_gitlabConnect_token_description()]),a(I,q)},ut=I=>{var q=Or(),Z=x(q);{let be=$(()=>!t(P)||!u());z(Z,{variant:"primary",get size(){return t(ve)},type:"button",onclick:C,get disabled(){return t(be)},children:(ze,et)=>{A();var _e=T();n(Ce=>i(_e,Ce),[()=>e.lib_gitlabConnect_connect_label()]),a(ze,_e)},$$slots:{default:!0}})}var pe=o(Z,2);{let be=$(()=>!u());z(pe,{variant:"ghost",get size(){return t(re)},type:"button",get disabled(){return t(be)},onclick:oe,children:(ze,et)=>{A();var _e=T();n(Ce=>i(_e,Ce),[()=>e.lib_gitlabConnect_useToken_label()]),a(ze,_e)},$$slots:{default:!0}})}var Xe=o(pe,2);{var Ze=be=>{z(be,{variant:"ghost",get size(){return t(re)},type:"button",get onclick(){return N()},children:(ze,et)=>{A();var _e=T();n(Ce=>i(_e,Ce),[()=>e.lib_gitlabConnect_cancel_label()]),a(ze,_e)},$$slots:{default:!0}})};S(Xe,be=>{N()&&be(Ze)})}y(q),a(I,q)};S(Ge,I=>{t(je)?I(nt):I(ut,-1)})}n(I=>{ot(se,"id",ne),i(He,I)},[()=>e.lib_gitlabConnect_host_description()]),a(c,p)};S(J,c=>{(b()||m())&&ae()?c(O):b()||m()?c(de,1):c(X,-1)})}var Pe=o(J,2);{var Le=c=>{var p=Br(),w=D(p,!0);n(F=>i(w,F),[()=>e.lib_gitlabConnect_cancelled_label()]),a(c,p)},fe=c=>{var p=Nr(),w=x(p),F=D(w,!0),ce=o(w,2);z(ce,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return m()},onclick:()=>Ke.dispatch(xt()),children:(se,He)=>{A();var Ie=T();n(qe=>i(Ie,qe),[()=>e.lib_gitlabConnect_checkStatus_label()]),a(se,Ie)},$$slots:{default:!0}}),y(p),n(se=>i(F,se),[()=>Y()==="already-started"?e.lib_gitlabConnect_alreadyStarted_description():e.lib_gitlabConnect_cancelFailed_description()]),a(c,p)};S(Pe,c=>{Y()==="cancelled"?c(Le):(Y()==="already-started"||Y()==="failed")&&c(fe,1)})}var ge=o(Pe,2);{var Re=c=>{var p=Rr(),w=D(p,!0);n(()=>i(w,he())),a(c,p)};S(ge,c=>{he()&&c(Re)})}y(M)}n(()=>Bt(M,1,Nt(K()?"space-y-2":"space-y-4"))),a(l,M);var Se=_t(U);return V(),Se}const wt=[{id:"people",get label(){return e.workspace_peopleTile_title()},icon:qt,description:""},{id:"agents",get label(){return e.workspace_multiSelectSidebar_agentsTab_label()},icon:Yt,get description(){return e.workspace_multiSelectSidebar_agentsTab_description()}},{id:"context",get label(){return e.workspace_multiSelectSidebar_contextTab_label()},icon:ur.note,get description(){return e.workspace_multiSelectSidebar_contextTab_description()}},{id:"changes",get label(){return e.workspace_multiSelectSidebar_changesTab_label()},icon:Vt,get description(){return e.workspace_multiSelectSidebar_changesTab_description()}},{id:"files",get label(){return e.workspace_multiSelectSidebar_filesTab_label()},icon:jt,get description(){return e.workspace_multiSelectSidebar_filesTab_description()}},{id:"browser",get label(){return e.workspace_multiSelectSidebar_browserTab_label()},icon:Qt,get description(){return e.workspace_multiSelectSidebar_browserTab_description()}},{id:"shell",get label(){return e.workspace_multiSelectSidebar_shellTab_label()},icon:Xt,get description(){return e.workspace_multiSelectSidebar_shellTab_description()}}];function Wr(l){return wt.some(r=>r.id===l)}const Jr=new Set(["browser","shell"]),Ks=new Set(["context","changes","files","browser","shell"]),qr=new Set(["changes"]);function Ps(l,r=!1,_=!0,E=!1,B=!1){const u=l.filter(b=>Wr(b)&&(b!=="people"||_)&&!(B&&qr.has(b))&&!(r&&Jr.has(b)&&!(b==="shell"&&E)));return new Set(u.length>0?u:["agents"])}function Yr(l){const r=new Set(l);return wt.flatMap(({id:_})=>r.has(_)?[_]:[])}function Cs(l,r){const _=new Set(l);return _.has(r)?_.size>1&&_.delete(r):_.add(r),Yr(_)}export{qr as G,Ks as H,fr as M,Jr as O,Dr as P,wt as T,Mr as a,hr as b,$s as c,mr as k,Ps as n,Yr as o,Ss as s,Cs as t};